BTCUSDT Perpetual Trade Execution and Position Reconciliation
Summary
This document describes an execution tool for BTCUSDT perpetual futures that receives trade instructions and submits them through an exchange API. Its Python logic reads account balance, leverage, price, and current long and short positions, then scales the requested size relative to available balance and leverage. Before placing an order, it checks whether the signal is recent, whether it has already been processed, and whether the exchange position is consistent with the requested target; it opens or closes positions according to side and position direction.
The material is chiefly an operational example, not a tested trading strategy: it gives no signal-generation method or performance results. It is limited to one exchange API and cross-margin positions, and the accompanying guidance discusses API permissions, simulated versus live credentials, and avoiding high leverage. The code relies on external modules and local state, and includes forceful process termination instructions. Position reconciliation, stale-signal handling, exchange errors, and sizing assumptions would need careful review before live use.
Key ideas
- The execution process reads exchange account data and current positions before acting on a signal.
- Requested trade sizes are scaled using account balance, leverage, and current price.
- Signal identifiers and timestamps help prevent duplicate or stale orders.
- The logic distinguishes opening and closing long or short positions and checks target consistency.
- The document gives operational guidance but no strategy performance evidence.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.