Below are reference information and calculation formulas associated with Phemex futures grid trading bots.
1) Grid Trading Price Range
Price Lower Limit 
Price Upper Limit 

Minimum Value 
10% of Last Transaction Price 
Lowest Grid Price * 1.005 
Maximum Value 
999,999 
999,999 
2) Price Difference
Equivalent difference – every grid price has an equivalent price gap
The price grid uses the equivalent price gaps to divide the price range from grid price lower limit to the grid price upper limit
*Price Difference = (Grid Price Upper Limit – Grid Price Lower Limit) / Grid Quantity
Grid Price 1 = Grid Price Lower Limit
Grid Price 2 = Grid Price Lower Limit + Price Difference
Grid Price 3 = Grid Price Lower Limit + (Price Difference x 2)
Price n = Grid Price Lower Limit + Price Difference × (n – 1), n = number of grids
Example: 100, 200, 300 (Price Difference is 100)
Equivalent ratio – each grid has an equal proportion of the price gap
The equal ratio grid uses the equal price ratio method to divide the price range from the lower limit of the grid price to the upper limit of the grid price
*Price Ratio = (Grid Price Upper Limit / Grid Price Lower Limit)^(1/Number of Grids)
*Price difference ratio = (Grid Price Upper Limit / Grid Price Lower Limit)^(1/number of grids) – 1
* Grid Price
Price 1 = Grid Price Lower Limit
Price 2 = Grid Price Lower Limit × Price Ratio
Price3 = Grid Price Lower Limit x (Price Ratio ^ 2)
Price n = Grid Price Lower Limit × Price Ratio ^ (n – 1), n = Number of grids
Example: 100,110,121 (Price Gap Ratio = 10%)
3) Expected Single Grid Profit Margin
Price Difference
Lower limit of single grid profit rate = [ (grid price upper limit × (1 – maker rate)) / (grid price limit – price difference) – 1 – maker rate ] × leverage
Single grid profit rate upper limit = [ (1 – maker rate) × price difference / grid price lower limit – 2 × maker rate ] × leverage
Price Ratio
Single grid profit rate = [ (1 – maker rate) × price ratio – 1 – maker rate ] × leverage
4) Amount per Grid
Adjustment factor = 0.9
Regardless of transaction fee, all pending orders are guaranteed to be successful
 Neutral Strategy
Amount per Grid = adjustment factor × investment amount × leverage multiple / sum (pending order price)
Pending order price: the pending order price of the initial buy and sell order according to the neutral strategy
Neutral strategy only supports pending orders initially
 Long / Short Strategy
Amount per Grid = adjustment factor × investment amount × leverage multiple / sum (pending order price)
Pending order price: The initial pending order price of the buy and sell order based on the long/short strategy, also includes the market price of the bottom position
– Long/short strategy initial orders (including pending orders and orders for bottom positions)
5) Estimated liquidation price
Regardless of transaction fee and based on an available margin balance of 0, the estimated liquidation price of the established bottom position after grid trading bot activates
Initial Margin Rate = 1 / Leverage
To get Maintenance Margin Rate, take the MM% of the corresponding risk limit
The entry price is the expected average opening price of the bottom position (if price trigger is set, entry price = trigger price)
Neutral Strategy: Does not calculate estimated liquidation price
Long Strategy:
Estimated Liquidation Price (LP) = [Entry Price × (1 – Initial Margin Rate + Maintenance Margin Rate)]
Short Strategy:
Estimated Liquidation Price (LP) = [Entry Price × (1 + Initial Margin Rate – Maintenance Margin Rate)]
6) Profit and loss calculation
Total P&L = Unrealized P&L + Realized P&L
Rate of return = total profit and loss / investment amount
Realized P&L : PnL from portion of trading bot’s closed positions during operation (DCA method)
Grid Profit
Arithmetic:
Grid Profit = Grid Order Quantity × Price Difference × Grid Completion Pairs – Transaction Fee
Geometric:
Grid Profit = Grid Order Quantity × Price Difference 1 – Transaction Fee
(Price Difference 1 refers to the current price difference of the completed grid pairs. In a geometric grid, each pair has a different price difference, and the profit is calculated for each pair sequentially)
Open Position Unrealized P/L = Floating Profit/Loss for Current Positions
Overall Annualized Return = [(Total P/L / Investment Amount) / Running Days x 365] x 100%
Grid Annualized Return = [(Grid Profit / Investment Amount) / Running Days x 365] x 100%
Note: For running time less than 1 day, the above two formulas uses 1 day to calculate
Comments
0 comments
Please sign in to leave a comment.