Average Cost

Definition: a method to calculate the price of assets bought or acquired by dividing their price against the number of assets owned.

Formula: Average cost = (average cost before buying * quantity before buying + newly bought price * newly bought quantity) ÷ holding quantity after buying


Currently the average cost method only supports stocks, options, CBBCs & warrants. Futures are not supported by the average cost method.


First In First Out (FIFO)

Definition: First In First Out or "FIFO" is a cost accounting method in which the value of assets purchased or acquired first are deducted first when these are sold.


Diluted Cost

Definition:The Diluted Cost is a cost calculation method that distributes the profit and loss of each transaction during the holding period against the cost of the position. The increase or reduction of the position will affect the diluted cost of the stock. The profits or losses accrued when selling the stock may increase or decrease the Diluted Cost price of the position.


Formula: Diluted cost = (total amount bought during the holding period - total amount sold during the holding period) ÷ number of holdings


Profit & Loss (P&L)

Definition: The total profit and loss of a current position is not affected by the different cost calculation methods mentioned above. The profit and loss of a position can be categorised as realized or unrealized under the Average Cost method & FIFO.


Average Price, Price

Definition: The average price of a position is calculated considering only the transaction price, ignoring any transaction costs.


Under Average Cost method, the realized and unrealized profit and loss are calculated based on the average price of a position. Transaction costs are categorized into the realized profit and loss once they incur.


Holding Cost, Cost

Definition: The holding cost is calculated based on the transacted price, including transaction costs incurred when buying and selling that stock. FIFO & the Diluted Cost method adopt the holding cost to calculate the profit and loss. The position cost may differ depending on the cost calculation method used.



The following examples demonstrate how the profit and loss, the average purchase price and the holding cost are calculated under the three different cost calculation methods.



# of Shares

Closing Price

Transaction Fees

Day 1


100 Shares APPL



Day 2


100 Shares APPL



Day 3


50 Shares APPL



Note: Assuming that all transactions take place at the end of the day (i.e. Orders are executed at closing price)


  • Average Price

Day 1 Ave. Price=$170

Day 2 Ave. Price=(170*100+175*100)/200=$172.5

Day 3 Ave. Price remains unchanged at $172.5 as no buy transaction took place on day 3. The sale transaction does not affect average price under average cost method.


Day 1 Holding Cost= (170*100+1.99)/100=$170.02

Day 2 Holding Cost= (170.02*100+175*100+1.99)/200=$172.52

Day 3 Holding Cost= (172.52*150+1.99)/150=$172.53


Realized P&L= (181-172.5)*50-1.99-1.99-1.99=419.03

Unrealized P&L= (181-172.5)*150=1275

P&L= 419.03+1275=1694.03


  • FIFO

Day 1 Holding Cost= (170*100+1.99)/100=$170.02

Day 2 Holding Cost= (170*100+175*100+1.99+1.99)/200=$172.52

Day 3 Holding Cost=(170*(100-50)+175*100+1.99/2+1.99)/(200-50)=$173.35


Realized P&L= (181-170.02)*50-1.99=547.01

Unrealized P&L= (181-173.35)*150=1147.02

P&L= 547.01+1147.02=1694.03


  • Diluted Cost

Day 1 Holding Cost=(170*100+1.99)/100=$170.02

Day 2 Holding Cost=(170*100+175*100+1.99+1.99)/200=$172.52

Day 3 Holding Cost= ((170*100+175*100-181*50)+(1.99+1.99+1.99))/(200-50)=$169.71


P&L= 181*200-(100*170+100*175)-(1.99+1.99+1.99)=1694.03


The cost is for reference only. It may be calculated inaccurately when corporate action or position transfer takes place, but cost errors have no impact on your account total assets.

Was this helpful?