TaUse03FlattenAndReconcile.expected.txt
lib/advantage/trading-actions-on-verb/03-flatten-and-reconcile/TaUse03FlattenAndReconcile.expected.txt · 19 line(s) · txt
== Use case 3: flatten and reconcile ==
buy 100 @ 5000 on day 0, fee 100 : ok
buy 50 @ 5200 on day 30, fee 100 : ok
sell 80 @ 5500 on day 60, fee 100 : ok
flatten @ 5000 on day 100, fee 100 : ok
-- the last sale --
ok cost of the last 70 shares = 360000
ok profit of the last sale (a loss) = -10000
-- reconcile --
ok shares held = 0
ok lots = 0
ok realized gross = 30000
ok fees paid = 400
ok realized net = 29600
ok net = proceeds - cost sold - fees
flatten again on day 101 : refused: nothing is held
ok invariants hold
checks passed=9 failed=0