How to Calculate the Average Filled Price of a Contract?

·

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.


Calculating the Average Filled Price

For Opening Positions

When an opening order is matched:

  1. The system increases the position for the corresponding contract direction.
  2. 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) + ...]  

For Closing Positions

When a closing order is matched:


Key Definitions

TermExplanation
Contract Face ValueNominal value of one contract (varies by asset).
Original Position SizeExisting number of contracts held.
New Position SizeQuantity of newly opened contracts.
Original Avg. PriceHistorical average price of held contracts.
New Filled Avg. PriceWeighted average price of newly executed contracts.
Execution PriceActual 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:

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.