Original Format
{
"id": "{{strategy.order.id}}",
"symbol": "{{ticker}}",
"action": "{{strategy.order.action}}",
"qty": "{{strategy.order.contracts}}",
"price": "{{strategy.order.price}}",
"type": "Limit",
"marketPosition": "{{strategy.market_position}}",
"prevMarketPosition": "{{strategy.prev_market_position}}",
"marketPositionSize": "{{strategy.market_position_size}}",
"prevMarketPositionSize": "{{strategy.prev_market_position_size}}",
"signalToken": "POdKsisSLkUxWXXIcjlx-eh_4UDuqfgYXL2KKX5wbOgazrhgKhdNhLoUb8OQK_xv0RnLdIclDFOOfqL6sfXwzkBJTN6n9v-U4qgwWK5YCtMP38IG1UJ91dsn2cw=",
"timestamp": "{{timenow}}"
}
Parameter Detailed Description
Alert Example
Example 1: Long Position Opening → Long Position Closing (Close All Positions)
// Open a long position in BTCUSDT, opening price: 40,000, opening quantity: 0.001.
{
"id": "id_9b4b19b3d112",
"symbol": "BTCUSDT",
"action": "buy",
"qty": 0.001,
"price": 40000,
"type": "Limit",
"marketPosition": "long",
"prevMarketPosition": "flat",
"marketPositionSize": 0.001,
"prevMarketPositionSize": 0,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T10:51:58Z"
}
// Close a long position in BTCUSDT, closing price: 41,000, closing quantity: 0.001.
{
"id": "id_9b4b19b3d113",
"symbol": "BTCUSDT",
"action": "sell",
"qty": 0.001,
"price": 41000,
"type": "Limit",
"marketPosition": "flat",
"prevMarketPosition": "long",
"marketPositionSize": 0,
"prevMarketPositionSize": 0.001,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T11:51:58Z"
}
Example 2: Long to Short without an Existing Position → Short (One-Step Reversal)
// Open a long position in BTCUSDT, opening price: 40,000, opening quantity: 0.001.
{
"id": "id_9b4b19b3d112",
"symbol": "BTCUSDT",
"action": "buy",
"qty": 0.001,
"price": 40000,
"type": "Limit",
"marketPosition": "long",
"prevMarketPosition": "flat",
"marketPositionSize": 0.001,
"prevMarketPositionSize": 0,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T10:51:58Z"
}
// Open a short position in BTCUSDT, closing price: 41,000, closing quantity: 0.002. If qty > posQty, reversal will occur, fully closing the 0.001 long position and then opening a 0.001 short position in the opposite direction.
{
"id": "id_9b4b19b3d113",
"symbol": "BTCUSDT",
"action": "sell",
"qty": 0.002,
"price": 41000,
"type": "Limit",
"marketPosition": "short",
"prevMarketPosition": "long",
"marketPositionSize": 0.001,
"prevMarketPositionSize": 0.001,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T11:51:58Z"
}
Example 3: Long Position Opening → Partial Long Position Closing → Full Long Position Closing
// Open a long position in BTCUSDT, opening price: 40,000, opening quantity: 0.002.
{
"id": "id_9b4b19b3d112",
"symbol": "BTCUSDT",
"action": "buy",
"qty": 0.002,
"price": 40000,
"type": "Limit",
"marketPosition": "long",
"prevMarketPosition": "flat",
"marketPositionSize": 0.002,
"prevMarketPositionSize": 0,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T10:51:58Z"
}
// Partially close the long position in BTCUSDT, closing price: 41,000, closing quantity: 0.001.
{
"id": "id_9b4b19b3d113",
"symbol": "BTCUSDT",
"action": "sell",
"qty": 0.001,
"price": 41000,
"type": "Limit",
"marketPosition": "long",
"prevMarketPosition": "long",
"marketPositionSize": 0.001,
"prevMarketPositionSize": 0.002,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T11:51:58Z"
}
// Close the long position in BTCUSDT, closing price: 42,000, closing quantity: 0.001.
{
"id": "id_9b4b19b3d114",
"symbol": "BTCUSDT",
"action": "sell",
"qty": 0.001,
"price": 42000,
"type": "Limit",
"marketPosition": "flat",
"prevMarketPosition": "long",
"marketPositionSize": 0,
"prevMarketPositionSize": 0.001,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T12:51:58Z"
}
Example 4: Long position market order entry → Long position market order exit (close all positions)
// Open a long position in BTCUSDT, entry price: 40,000, position size: 0.001
{
"id": "id_9b4b19b3d112",
"symbol": "BTCUSDT",
"action": "buy",
"qty": 0.001,
"price": 40000,
"type": "Market",
"marketPosition": "long",
"prevMarketPosition": "flat",
"marketPositionSize": 0.001,
"prevMarketPositionSize": 0,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T10:51:58Z"
}
// Close the long position in BTCUSDT, exit price: 41,000, position size: 0.001
{
"id": "id_9b4b19b3d113",
"symbol": "BTCUSDT",
"action": "sell",
"qty": 0.001,
"price": 41000,
"type": "Market",
"marketPosition": "flat",
"prevMarketPosition": "long",
"marketPositionSize": 0,
"prevMarketPositionSize": 0.001,
"signalToken": "kGAOBKheClXD7bVZHe-hEYHxF1rfTwlPPyko3DSWT1Q==",
"timestamp": "2024-01-17T11:51:58Z"
}