Skip to content
All library documents

Synthesizing Futures Indices and Selecting the Main Contract by Open Interest

Article vn.py community

Summary

The document describes a vn.py and CTP gateway modification for creating live commodity futures indices and identifying each product’s dominant contract. It proposes weighting real contracts by their previous day open interest, selecting a main contract only when its open interest exceeds the runner-up by a stated margin, and recalculating the selection once per day.

For an index subscription, the gateway subscribes only to the product’s underlying contracts. It waits until ticks are available, then uses ticks from the selected main contract to trigger calculations. Prices such as last, open, high, low, and best bid and ask are weighted; open interest, volume, turnover, and best quote sizes are summed. The post reports a performance check on a small cloud server across 79 contracts, while noting some interface delay when many products are displayed. It does not provide source code, validation against exchange index data, or evidence on how the weighting and contract selection perform in live trading.

Key ideas

  • Previous day open interest is used to weight constituent futures contracts in the synthetic index.
  • The dominant contract is selected once daily when its open interest clears a threshold relative to the next contract.
  • Subscriptions are limited to contracts belonging to the requested product to reduce unnecessary tick processing.
  • The calculation combines weighted price fields with summed volume and position fields.
  • The reported performance check does not establish tracking accuracy or trading profitability.

Tags

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