Our broker is using compressed FIFO (First-In, First Out) method in calculating the cost basis. It compresses intraday positions using a weighted average.
Example 1:
Day 1
Buy 100 shares at $10 per share (Cost basis = $1,000)
Buy 50 shares at $12 per share (Cost basis = $600)
Day 2
Buy 30 shares at $15 per share (Cost basis = $450)
Day 3
Sell 120 shares
After the sell transaction:
Cost Basis = ($1000 + $600 + $ 450) - {120*[(100*10)+(50*$12)/150]}
= $770
Average entry price = Cost basis/Qty left = $770/60
= $12.83
Example 2:
Day 1
Buy 100 shares at $10 per share (Cost basis = $1,000)
Buy 50 shares at $9 per share (Cost basis = $450)
Sell 50 shares
Buy 50 shares at $11 per share (Cost basis = $550)
At the end of Day 1
Cost Basis = ($1000 + $450 + $ 550) - {50*[(100*10)+(50*$9)+(50*11)/200]}
= $1500
Average entry price = Cost basis/Qty left
= $1500/150
= $10
It differs because of the intraday position and the end-of-the-day position so it might change the day after the last trade has occurred. This change occurs when our beginning-of-day (BOD) job executes and synchronizes positions from our ledger. For details regarding the timing of the beginning-of-day (BOD) job, please refer to the Daily Processes and Reconciliations. The beginning of day time (sync time) is 02:15 AM-02:30 AM EST