triggers.v1.TriggersService
CreateTrigger
Create a standalone trigger (stop order, TWAP, ladder).
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/triggers.v1.TriggersService/CreateTrigger' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"subaccountId": "6789012345678",
"trigger": {
"clientTriggerId": "9155001234567",
"feeAsset": "QUOTE",
"qtyScaled": "100000",
"selfTradePreventionMode": "EXPIRE_MAKER",
"stopLoss": {
"child": {
"marketIoc": {
"maxSlippageTicks": "1"
}
},
"side": "BUY",
"triggerPriceSource": "LAST_PRICE",
"triggerPriceTicks": "61000250000000"
},
"symbolId": 1
}
}'Responses
{
"acceptedAt": "2025-01-01T00:00:00Z",
"acceptedAtTsNs": "1735689600000000000",
"clientTriggerId": "9155001234567",
"triggerId": "9155001234567"
}triggers.v1.CreateTriggerRequesttriggers.v1.CreateTriggerResponseOptional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Stable numeric pair ID from GetSpotConfig.
Total quantity scaled by the pair's base_quantity_scale.
Fee asset for BUY children. SELL children must use QUOTE.
Child self-trade prevention mode against orders of the same root account, including all its subaccounts. Defaults to EXPIRE_MAKER.
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.
Trigger threshold in quote units scaled by 1e9.
Child order side.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
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.
Limit price in quote units scaled by 1e9.
Reject instead of taking liquidity.
Limit price in quote units scaled by 1e9.
Limit price in quote units scaled by 1e9.
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.
Trigger threshold in quote units scaled by 1e9.
Child order side.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
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.
Limit price in quote units scaled by 1e9.
Reject instead of taking liquidity.
Limit price in quote units scaled by 1e9.
Limit price in quote units scaled by 1e9.
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.
Distance as a price delta in 1e-9 quote-unit ticks.
Distance in basis points (1 bp = 0.01%).
Optional activation price in quote units scaled by 1e9.
Positive maximum absolute price delta in Q9 execution-price ticks (1 tick = 1e-9 quote units).
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.
Child order side.
Maximum price of a trailing stop that buys, in quote units scaled by 1e9: 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 (trigger_price_source) 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.
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.
Child side.
Total execution duration in milliseconds, at least 1000.
Interval between slices in milliseconds, at least 100 and at most duration_ms.
Positive maximum absolute price delta per slice in Q9 execution-price ticks (1 tick = 1e-9 quote units).
Maximum adverse price movement per slice in basis points (1 bp = 0.01%).
Slice limit price in quote units scaled by 1e9.
Child side.
Minimum generated level price in quote units scaled by 1e9.
Maximum generated level price in quote units scaled by 1e9.
Number of linearly distributed levels.
Reject each level instead of taking liquidity.
Assigned trigger ID.
Echoed client trigger ID.
Time creation admission completed.
Admission completion time in nanoseconds since epoch (UTC).
| 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. |