Skip to content
All library documents

Routing Trading Commands for Futures Entries and Partial Closes

Article FMZ forum · Author: q631207207

Summary

This example shows a command-driven trading bot that accepts action strings and routes them to spot or futures exchange methods. For futures, it sets the contract type, fetches the ticker, and chooses order direction for opening long or short positions and closing either side. It also describes staged exits by mapping separate close commands to configured quantities, plus reversal commands that close one side and open the other.

The document is implementation guidance rather than a tested trading strategy. It provides no evidence about execution quality, profitability, or whether the configured quantities suit a position. The requested “close all” behavior is not implemented, and the staged close amounts are fixed in the example rather than derived from actual position size. Exchange support, contract settings, precision, and order behavior may vary, so the example alone does not establish safe position management.

Key ideas

  • The bot distinguishes spot from futures exchanges and routes supported actions accordingly.
  • Futures entries and closes use explicit exchange direction settings.
  • Separate commands map to configured quantities for staged position reductions.
  • Reversal commands submit a close order followed by an order opening the opposite side.
  • The example does not implement a command to close the entire open position.

Tags

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