2.3 KiB
2.3 KiB
Interview Questions
Before coding
- Walk me through the code. What does each file do, and how does a trade move through the system?
- Which assumptions would you check with me before you touch anything?
- CI is green but the ticket says the code is broken. What does that tell you, and where do you look first?
- How would you reproduce the ticket? Can you do it with a smaller input than
main.pyuses?
Logger
- The logs show "no errors". How would you prove whether an error really did not happen or it happened and was not logged?
- The log lines don't match their trades. Why could the context be correct when you log but wrong when the line is written?
- Why might someone buffer log records? What are the risks?
- How does Python's standard
loggingmodule avoid the same problems? Name the specific mechanisms. - Would you replace this logger with
logging? What would that cost, and what would you gain? - How would you test a logger whose output contains a timestamp?
State and data model
- Who owns a
Tradeonce it is passed toLedger.apply? How would you enforce that in the code? - Name two or more ways to stop callers from changing a
Trade. What does each one cost? - The EOD rebuild swallows
ValueError. Is that the right policy? What would you change? - Why did the existing rebuild test still pass?
Positions and P&L
- Work this out by hand: buy 100 @ 100, then sell 150 @ 105. What are
qty,avg_price, andrealized? - Which edge cases of
Position.updatewould you test? Think about zero, flips, shorts, and adding to a short. - Should prices use
float? What would you use in production, and why?
Tests
- Which existing tests could never fail? Explain why each one passes.
- How do you show that a new test really detects a bug?
- Would property-based testing help here? What property would you check?
- What would you add to CI so that weak tests like these get caught?
Wrap-up
- If you could ship only one fix today, which one would you pick, and why?
- What would you add so Ops can answer this kind of ticket without engineering?
- How did you check the AI's suggestions? Where was it wrong, or where did it not help?
- In production, how would you find positions that were already corrupted by these bugs?