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.
Checklist
- Calculate the Average Fill Price
- New Entry Size Amount = Number of contracts at Execution price 1 + Number of futures contracts at Execution price 2 + ......
- Term explanation:
Notes
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 + ... )
Details follow the official OKX help article; this page is a learning checklist, not an official mirror.












