Skip to content
All library documents

Replicating Futures Positions by Monitoring Long and Short Changes

Article FMZ forum · Author: Ninabadass

Summary

This tutorial describes a futures order-following bot that copies changes in a reference account’s long and short positions to additional accounts. It reads the reference account’s positions, tracks long and short quantities separately, and sends corresponding market orders to followers. Separate handling is needed because futures positions have distinct open and close directions; when closing, the bot limits the order to the follower’s available position.

The article demonstrates the method with simulated accounts: a reference account opens three contracts, then closes two, and the follower account mirrors those changes. It also describes a backtest mode that generates simulated position changes. The implementation is intentionally basic and uses polling and market orders. It does not address execution quality, asset checks, synchronization failures, or other operational safeguards, and the author presents it as a learning example that needs further development.

Key ideas

  • The bot detects changes in a reference futures account’s positions and copies them to follower accounts.
  • Long and short positions are tracked separately to handle their different opening and closing directions.
  • For a closing order, the bot caps the quantity at the follower’s existing position.
  • The example uses simulated accounts to show an opening trade and a partial close being copied.
  • The design relies on polling and market orders and leaves asset checks and other safeguards for future work.

Tags

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