At Upstox, the average price for overnight (Delivery) positions is calculated using the First In, First Out (FIFO) method. Let's break down the calculation with an example using Nifty Futures.

On 1st July:

Orders Placed: 2

1st Order: Quantity = 225 | Price = Rs. 10,000.00

2nd Order: Quantity = 75 | Price = Rs. 10,200.00

To calculate the average price:

Calculate the value (Quantity x Price) for each trade.

1st Trade: Rs. 22,50,000.00

2nd Trade: Rs. 7,65,000.00

Total Quantity = 300

Total Value = Rs. 30,15,000.00

Average Price = Total Value ÷ Total Quantity

Rs. 30,15,000.00 ÷ 300 = Rs. 10,050.00

On 5th July:

Sell Order Placed: 150 (out of 300)

Price: Rs. 9,950.00

Applying FIFO method:

Deduct 150 from the first trade (buy side), leaving a balance of 75.

After applying FIFO:

Balance: 75 (225 - 150)

Average Price Calculation:

Average Price = Total Price ÷ Total Quantity

Rs. 15,15,000.00 ÷ 150 = Rs. 10,100.00

This FIFO method remains consistent whether you are calculating it for a buy position or a short-sold position.

This breakdown aims to simplify the understanding of the FIFO method in calculating average prices.