Describe program behavior and expected output in README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a2b69504f
commit
d7be65f60f
1 file changed
+31
@@ -2,11 +2,42 @@
|
||||
|
||||
A small service that records trades, tracks positions, and reconciles them at end of day.
|
||||
|
||||
## What it does
|
||||
|
||||
`main.py` sends a list of trades through a live ledger. Each trade is either accepted and applied to its symbol's position, or rejected. The ledger keeps the trades it accepts in its history and logs what happens to each one.
|
||||
|
||||
At end of day, a second ledger is rebuilt from that history and compared against the live one. The program then prints each position and the result of the reconcile.
|
||||
|
||||
```bash
|
||||
python3 main.py
|
||||
python3 -m unittest -v
|
||||
```
|
||||
|
||||
## Expected output
|
||||
|
||||
```
|
||||
[live] 1793451095.875228 INFO applied BUY 100@190.00 -> 100 symbol=AAPL trade_id=T1
|
||||
[live] 1793451095.875238 INFO applied BUY 50@196.00 -> 150 symbol=AAPL trade_id=T2
|
||||
[live] 1793451095.875242 INFO applied BUY 200@410.00 -> 200 symbol=MSFT trade_id=T3
|
||||
[live] 1793451095.875247 INFO applied SELL 120@199.50 -> 30 symbol=AAPL trade_id=T4
|
||||
[live] 1793451095.875250 ERROR rejected: bad qty 0 symbol=MSFT trade_id=T5
|
||||
[live] 1793451095.875256 INFO applied SELL 80@201.00 -> -50 symbol=AAPL trade_id=T6
|
||||
[live] 1793451095.875257 INFO applied SELL 30@225.00 -> -30 symbol=IBM trade_id=T7
|
||||
[eod] 1793451095.875291 INFO applied BUY 100@190.00 -> 100 symbol=AAPL trade_id=T1
|
||||
[eod] 1793451095.875293 INFO applied BUY 50@196.00 -> 150 symbol=AAPL trade_id=T2
|
||||
[eod] 1793451095.875295 INFO applied BUY 200@410.00 -> 200 symbol=MSFT trade_id=T3
|
||||
[eod] 1793451095.875297 INFO applied SELL 120@199.50 -> 30 symbol=AAPL trade_id=T4
|
||||
[eod] 1793451095.875299 INFO applied SELL 80@201.00 -> -50 symbol=AAPL trade_id=T6
|
||||
[eod] 1793451095.875301 INFO applied SELL 30@225.00 -> -30 symbol=IBM trade_id=T7
|
||||
|
||||
AAPL qty= -50 avg= 201.0000 realized= 1170.00
|
||||
IBM qty= -30 avg= 225.0000 realized= 0.00
|
||||
MSFT qty= 200 avg= 410.0000 realized= 0.00
|
||||
reconcile: OK
|
||||
```
|
||||
|
||||
Timestamps will differ between runs.
|
||||
|
||||
## Ticket
|
||||
|
||||
> Ops says the numbers don't look right and the logs aren't helping. Please take a look.
|
||||
|
||||
Reference in new issue
Block a user