How do I calculate the average fill price?
To understand the average fill price, it’s important to know how orders work. By using price-first, time-first matching. Buy (Open Long) and Buy (Close Short) are buy orders, while Sell (Open Short) and Sell(Close Long) are sell orders.
Buy orders with the highest price and earliest timestamp rank first in the buy order book queue ; Sell orders with the lowest price and earliest timestamp rank first in the sell order book queue. When order book buy price ≥ top sell order price, order will be filled.
Calculate the Average Fill Price
If an opening order is filled the system increases the position on the corresponding side and recalculates the average entry price. However, if a closing order is filled the system reduces the position on that side, while the average entry price remains unchanged.
Average Price = Contract size * ( Initial Holding Size Amount + New Entry Size Amount ) / ( Contract size * Initial Holding Size Amount / Initial Holding Average Price + Contract size * New Entry Size Amount / New Entry Average Fill Price )
New Entry Average Fill Price = Contract size * New Entry Size Amount / ( Contract size * Numbers of contracts at Execution price 1 / Execution price 1 + Contract size * Numbers of contracts at Execution price 2 / Execution price 2 + ... )
New Entry Size Amount = Number of contracts at Execution price 1 + Number of futures contracts at Execution price 2 + ......
Term explanation:
Contract size: The contract size refers to the nominal value of the underlying asset represented by one contract. The contract size value varies across different contract types.
Step to search Contract size: Select Trade > Futures, More (upper right three dots button) > Market Info > Trading Rules.
Initial Holding Size Amount: The number of contracts in the original position.
New Entry Size Amount: The number of contracts for a specific futures position that the user created recently.
Initial Holding Average Price: The average price at which the user’s previous futures position was held.
New Entry Average Fill Price : The average price of a specific contract in the user’s most recently opened position.
Execution Price 1: The actual price at which a certain quantity of contracts is executed.
For example: User places a price limit order to buy contracts that worth 10 BTC at $40,000. The system will match orders based on the principles and fill the position at the optimal price when the price approaches $40,000. The final filled price may not be exactly $40,000. For instance, if 3 contracts are filled at $39,999.98, that is Execution price 1; if 2 contracts are filled at $40,000, that is Execution price 2; and so on.