What you will learn
- State machines
- Signal timing
- Sizing
- Exit lifecycle
State machines
A strategy specification defines inputs, decision timing, eligibility, sizing and exits. Convert descriptive ideas into explicit conditions before coding. If two implementers can interpret a rule differently, the ambiguity belongs in the specification review.
Signal timing
Separate signal logic from execution policy. A desired exposure is not the same as an immediately executable order. The adapter must consider current positions, working orders and available account state.
Sizing
Configuration includes parameters and enabled behaviors. Validate ranges and combinations, and record the exact configuration with each experiment. Hidden defaults make it difficult to know what was actually tested.
Exit lifecycle
Define failure behavior for missing data, unavailable dependencies and uncertain state. A system needs a deliberate no-action or recovery path; an exception handler that returns an ordinary zero can disguise a failure as a valid signal.
Worked example
A strategy returns desired exposure of three units while two are already held. Sending a new three-unit buy would create five; the execution policy should reason about the target and current state.
Try it yourself
Write a target-to-order calculation for that case, including the possibility of one additional unit already working.
Show the worked solution
With two held and no working quantity, one additional unit reaches the target. If one is already working, no further buy is needed unless its status changes. Reconcile authoritative state before issuing a new instruction.
Apply this to your course project
Build a demo strategy with unit, replay and failure-path tests.
Keep the calculation inputs, assumptions and decisions with your work. Practical exercises are self-reviewed; the scored knowledge checks assess the questions shown, not an independent certification of practical competence.