Understanding the average filled price of a contract requires knowledge of how the system matches contract trades. The system follows the principles of price priority and time priority for matching orders.
- Buy orders ("Buy to Open Long" or "Buy to Close Short") rank higher at the highest price and earliest time.
- Sell orders ("Sell to Open Short" or "Sell to Close Long") rank higher at the lowest price and earliest time.
- A trade occurs when the highest buy order price matches or exceeds the lowest sell order price.
Calculating the Average Filled Price
For Opening Positions
When an opening order is matched:
- The system increases the position for the corresponding contract direction.
- It recalculates the average opening price using:
Formula:
Average Price = Contract Face Value × (Original Position Size + New Position Size) /
[(Contract Face Value × Original Position Size / Original Avg. Price) +
(Contract Face Value × New Position Size / New Filled Avg. Price)] New Filled Average Price:
New Filled Avg. Price = Contract Face Value × New Position Size /
[(Contract Face Value × Qty at Price 1 / Price 1) +
(Contract Face Value × Qty at Price 2 / Price 2) + ...] - New Position Size = Sum of quantities executed at each price (e.g., Price 1 + Price 2 + ...).
For Closing Positions
When a closing order is matched:
- The system reduces the position size.
- The average opening price remains unchanged.
Key Definitions
| Term | Explanation |
|---|---|
| Contract Face Value | Nominal value of one contract (varies by asset). |
| Original Position Size | Existing number of contracts held. |
| New Position Size | Quantity of newly opened contracts. |
| Original Avg. Price | Historical average price of held contracts. |
| New Filled Avg. Price | Weighted average price of newly executed contracts. |
| Execution Price | Actual trade price per partial fill (e.g., 39,999.98 USD for 3 BTC lots). |
Example Scenario
A user places a limit order for 10 BTC contracts at 40,000 USD:
- 3 contracts fill at 39,999.98 USD (Price 1).
- 2 contracts fill at 40,000 USD (Price 2).
- Remaining fills occur at incremental prices.
The New Filled Average Price is calculated by weighting each execution price by its quantity.
FAQs
1. Why does my filled price differ from my limit order price?
Trades execute at the best available price during matching. Slippage can occur due to market volatility or liquidity gaps.
2. How does the system prioritize order matching?
Orders are matched by price (higher bids and lower asks first) and time (earlier submissions rank higher).
3. Does closing a position affect my average opening price?
No. Closing reduces your position size but retains the original average price for tax/P&L tracking.
👉 Learn more about contract trading strategies
4. Can I manually set my average filled price?
No. The price is algorithmically determined based on execution data to ensure fairness.
5. How is contract face value determined?
It’s set by the exchange based on the underlying asset (e.g., 1 BTC = 1 contract, or fractional shares for indices).
👉 Explore contract specifications
This guide ensures precise calculation of your contract’s average filled price while optimizing for transparency and compliance. For advanced trading insights, leverage platforms like OKX for real-time analytics.