TriggersService
Create Trigger
Create a standalone trigger order. Supports stop, trailing, TWAP, and ladder trigger configurations.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/triggers' \
--header 'Accept: */*' \
--header 'X-API-KEY-ID: YOUR_API_KEY_ID' \
--header 'X-API-TIMESTAMP: YOUR_API_TIMESTAMP' \
--header 'X-API-SIGNATURE: YOUR_API_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"subaccountId": "45LUmqjT",
"trigger": {
"clientTriggerId": "9155001234567",
"feeAsset": "QUOTE",
"qty": "0.001",
"selfTradePreventionMode": "EXPIRE_MAKER",
"stopLoss": {
"child": {
"marketIoc": {
"maxSlippageTicks": 1
}
},
"side": "BUY",
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"symbol": "BTC-USDT"
}
}'Responses
{
"acceptedAt": "2025-01-01T00:00:00Z",
"acceptedAtTsNs": "1735689600000000000",
"clientTriggerId": "9155001234567",
"triggerId": "59VD7Lar"
}Optional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Client-provided trigger ID for idempotency, unique per sub-account, pair and trigger type. While the trigger is active and for 60 seconds after it reaches a terminal status, retrying the create with the identical intent returns the same trigger, and a different intent with the same ID returns CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID. After those 60 seconds the ID is free: a create that uses it is a new intent and creates a new trigger. To learn the outcome of an earlier create after that window, read the triggers with ListTriggers, which return each trigger's client_trigger_id, instead of retrying the create. After a create fails with INTERNAL_ERROR, the ID may already be used: a retry then returns CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID and needs a new client trigger ID. At most 36 bytes in UTF-8 (36 ASCII characters); longer IDs are rejected with INVALID_ARGUMENT.
Fee asset for BUY children. SELL children must use QUOTE.
Number of linearly distributed levels.
Reject each level instead of taking liquidity. Defaults to false when omitted.
Maximum generated level price as a decimal string in quote asset units per base asset unit, for example '63000'.
Minimum generated level price as a decimal string in quote asset units per base asset unit, for example '59000'.
Child side.
Total quantity as a decimal string in base asset units, for example '0.01'.
Child self-trade prevention mode against orders of the same root account, including all its subaccounts. Defaults to EXPIRE_MAKER.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Reject the child order instead of taking liquidity. Defaults to false when omitted.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Maximum allowed slippage in basis points (1 bp = 0.01%). A sell child accepts values below 10000; a 100% cap would leave it no positive price to sell at.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Child order side.
Trigger threshold as a decimal string in quote asset units per base asset unit, for example '60000'.
Price the trigger watches. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; a market without an index price fails the trigger with TRIGGER_FAILURE_REASON_INDEX_PRICE_UNAVAILABLE. MARK_PRICE is not supported. Fixed at create: to change it, cancel the trigger and create a new one.
Trading pair symbol, e.g. BTC-USDT.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Reject the child order instead of taking liquidity. Defaults to false when omitted.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Maximum allowed slippage in basis points (1 bp = 0.01%). A sell child accepts values below 10000; a 100% cap would leave it no positive price to sell at.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Child order side.
Trigger threshold as a decimal string in quote asset units per base asset unit, for example '60000'.
Price the trigger watches. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; a market without an index price fails the trigger with TRIGGER_FAILURE_REASON_INDEX_PRICE_UNAVAILABLE. MARK_PRICE is not supported. Fixed at create: to change it, cancel the trigger and create a new one.
Optional activation price as a decimal string in quote asset units per base asset unit, for example '62000'.
Maximum price of a trailing stop that buys, as a decimal string in quote asset units per base asset unit, for example '63000': the most its child pays per unit. Required when `side` is BUY and set aside for it with the child's fee; at least the activation price, or at least the price it watches (triggerPriceSource) when no activation price is set. A rise that fires above it still fires, and the child fills only at or below it. Must be unset when `side` is SELL. Fixed at create.
Maximum slippage in basis points (1 bp = 0.01%). Values below 10000 are accepted; a 100% cap would leave a trailing stop that sells no positive price to sell at.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Child order side.
Trailing distance as a decimal price delta in quote asset units, for example '0.5'.
Distance in basis points (1 bp = 0.01%).
Price the trailing stop watches: its activation, its peak or trough and its fire all follow this price. Unspecified or LAST_PRICE watches the last traded price. INDEX_PRICE watches the market's index price; a market without an index price fails the trigger with TRIGGER_FAILURE_REASON_INDEX_PRICE_UNAVAILABLE. MARK_PRICE is not supported. Fixed at create: to change it, cancel the trigger and create a new one.
Total execution duration in milliseconds, at least 1000.
Slice limit price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
Maximum adverse price movement per slice in basis points (1 bp = 0.01%).
Positive maximum absolute price delta per slice in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Child side.
Interval between slices in milliseconds, at least 100 and at most duration_ms.
Time creation admission completed.
2025-01-01T00:00:00ZAdmission completion time in nanoseconds since epoch (UTC).
1735689600000000000Echoed client trigger ID.
9155001234567Assigned trigger ID.
59VD7Lar| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |