Building a Fixed-Quantity Portfolio Manager for Event-Driven Backtests
Summary
This installment in an event-driven backtesting series describes a portfolio component that receives trading signals, creates orders, processes fills, and records positions and holdings over time. Its NaivePortfolio tracks per-symbol quantities alongside cash, commissions, and total account value. At each market-data update, it estimates position value from the latest bar’s closing price and records portfolio state for later analysis.
Signals open long or short positions when the symbol is flat, using a fixed quantity scaled by signal strength, and exit signals close an existing position. The resulting holdings history is converted into returns and a normalized equity curve. The design illustrates how portfolio logic fits into an event queue, but deliberately omits realistic risk controls and capital-aware sizing. Closing prices only approximate liquidation value, particularly for daily strategies, and the article positions this implementation as a basic framework before more sophisticated portfolio and execution handling.
Key ideas
- A portfolio component turns signals into orders and updates positions and holdings when fills arrive.
- The example records historical positions, cash, commissions, and total value for each market-data bar.
- It estimates holdings from the latest closing prices, which may differ from achievable liquidation values.
- The naive order logic uses fixed quantities scaled by signal strength and closes existing positions on exit signals.
- Its equity curve is derived from the recorded total value, but its lack of risk controls and realistic sizing limits performance realism.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.