Require Market Position
The flag require_market_position
is available to any command with both an account
and instrument
field. It blocks and prevents the signal from going through unless the NT8 market position is flat, short, or long.
Require market position is available to any of the following command types:
PLACE
FLATPLACE
CANCELREPLACE
CANCELORDERS
CLOSEPOSITION
REVERSEPOSITION
FLATTEN
Example Payloads
For example, a PLACE
command with require_market_position=flat;
for account "sim101" and instrument "ES 12-24" will not be processed unless there's no preexisting position in ES 12-24 under account sim101. The position must be flat for the order to proceed:
key=your-secret-key; command=PLACE; account=sim101; instrument=ES 12-24; action=BUY; qty=1; order_type=MARKET; TIF=DAY; require_market_position=flat;
Similarly, let's say you have multiple alert types in play: Long Entry, Long Exit, Short Entry, Short Exit. You don't want to process the "Short Exit" signal to close if there's a long position already in play. In this instance, you could require the alert to be processed if and only if the current market position is short:
key=your-secret-key; command=CLOSEPOSITION; account=sim101; require_market_position=short;
Last updated