Skip to content
All library documents

Reading Strategy Positions in VeighNa Backtests

Article vn.py community

Summary

The discussion explains how to inspect a strategy's logical position during a VeighNa backtest. The strategy's `self.pos` value represents its net position quantity and updates as the strategy processes opening and closing trades. It is scoped to the individual strategy, so strategies running together maintain separate logical position values.

The key limitation is that this value is not the account's actual position. The post distinguishes backtest state from live account state, where separate engine or strategy methods can retrieve account positions. A follow-up asks how to obtain entry price; the only reply suggests caching trade information in the trade callback. The thread does not explain that approach in detail or provide code, so it is a narrow implementation note rather than a complete guide to position or entry-price accounting.

Key ideas

  • In a VeighNa backtest, `self.pos` represents the strategy's net logical position quantity.
  • The value is updated as the strategy opens and closes positions.
  • Each strategy maintains its own position value in a multi-strategy run.
  • Backtest logical positions do not report actual account holdings; the entry-price question receives only a brief suggestion to cache trades in the trade callback.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.