2.0 KiB
2.0 KiB
Interviewer Notes
The candidate's README is vague on purpose. Share the details below only when the candidate asks for them.
Answers to give if asked
- A
Tradehastrade_id,symbol,side("BUY"or"SELL"),qty, andprice. qtyis always entered as a positive whole number. The side gives the direction.- A trade with a qty or price of zero or less, or an unknown side, is invalid. It must be rejected and logged at
ERROR. - Positions use weighted-average cost.
- Realized P&L is booked only when a position is reduced.
Ledger.historyis the record of truth for every accepted trade. The EOD job rebuilds a fresh ledger from it.- The two ledgers reconcile when every symbol has the same
qtyandavg_price. - Every log line must name the trade it is about.
- A logger only writes messages at or above its configured level.
- Single-threaded. You don't need to handle persistence, partial fills, or fees.
- Short selling is allowed, and one trade can move a position from long, through zero, to short.
- After a flip,
avg_priceis the price of the trade that caused the flip. - Treat a
Tradeas immutable once it has been submitted. - Rejected trades do not go into
history. - The EOD rebuild may skip bad trades, but each one it skips must be logged at
ERROR. - Losing records that were never flushed when the process exits is out of scope.
- The
1e-9price tolerance is fine.
Details to share only if the candidate is stuck
- Ops reports that the EOD reconcile shows breaks between the live ledger and the rebuild.
- Some desks say their average prices look wrong after large sells.
- The logs show no errors, and the log lines don't match the trades they're about.
- CI is green.
Signals to watch for
- Does the candidate ask about the assumptions before changing code?
- Does the candidate reproduce the problem before trying a fix?
- Does the candidate question why the tests pass, or trust them?
- Does the candidate check the AI's suggestions, or accept them as they are?