Skip to content
All library documents

Fixing Position-Key Handling in BigQuant HF Backtests

Article BigQuant

Summary

This forum post describes an AttributeError in a BigQuant high-frequency backtest. The copied trade-module code treats each key in the portfolio positions mapping as an object with a symbol attribute. In the HFTrade interface, the key is already a string representing the symbol, so accessing that attribute fails. The response explains that the high-frequency and standard trade modules can expose different interfaces.

The suggested diagnostic is to inspect the mapping entries and their associated position objects. Use the key itself as the instrument identifier; the value is a position object whose available attributes depend on whether it represents a stock or a futures position. The post points readers to platform documentation for those attributes. This resolves the specific key-type misconception, but it does not validate the rest of the sample order logic or address broader backtest behavior.

Key ideas

  • In the described HFTrade interface, portfolio position keys are symbol strings.
  • Code copied from the standard trade module may assume a different positions interface.
  • The position mapping's values hold position objects, with attributes varying by instrument type.
  • Inspect the keys and values to adapt code and diagnose interface mismatches.

Tags

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