Skip to content
All library documents

Manual Multi-Asset Spot and Futures Basis Hedging

Article Strategy library · Author: 发明者量化-小小梦

Summary

This manual hedging tool coordinates positions in a futures instrument and its spot counterpart across configured symbol pairs. It supports opening either a short futures and long spot combination or the reverse, as well as covering those paired positions. For each leg it selects prices from the relevant bid or ask, checks available futures margin and spot balance or inventory, calculates order sizes using exchange-specific rules, and submits both orders. The interface also supports manual hedge and cover commands, while a polling loop refreshes quotes, accounts, and positions.

The source describes operational controls such as leverage configuration, a reserve ratio for futures margin, balance maintenance, and periodic profit tracking. It is explicitly presented as a test version for study and exchange. No backtest settings, performance evidence, or quantified risk analysis are supplied. Because the legs are submitted separately, execution timing or a failed order can leave an unbalanced position; basis moves, fees, funding, liquidity, and exchange behavior can also affect outcomes. The material explains implementation mechanics, but does not provide a complete quantitative rule for when to enter or exit a hedge.

Key ideas

  • The tool pairs futures and spot instruments and supports two opposite hedge directions.
  • Opening orders are sized against available margin, cash, or spot inventory.
  • Prices are selected from bid and ask quotes according to each leg’s direction.
  • Polling updates market, account, and position information, with manual hedge commands available.
  • Separate leg execution can leave exposure if one order fails or fills differently.

Tags

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