Appearance
Place a TWAP order
POST
/v1/twap
Places a TWAP order which splits a large order into smaller sub-orders executed at regular
intervals over a set duration.
| Parameter | Description |
|---|---|
side (required) |
BUY or SELL (should be upper case). |
quantity (required) |
Base amount (the amount submitted will be truncated to baseDecimalPlaces of the currency pair). |
price (required) |
Price in quote currency (should be set to 0 for MARKET orders). |
pair (required) |
Any supported SPOT or FUTURES currency pair, e.g. BTCUSDC, ETHUSDC, BTCUSDT or BTCUSDTPERP. |
orderType (required) |
Any supported order type, e.g. MARKET, LIMIT, LIMIT_REDUCE_ONLY or MARKET_REDUCE_ONLY. |
duration (required) |
Total duration in seconds. Minimum is 60 seconds (1 minute), maximum is 259200 seconds (72 hours). Should be a multiple of cadence. |
cadence (required) |
Interval between sub-orders in seconds. Accepted values are 10, 20, 30 or 60. |
randomQuantity (required) |
true or false (default false). When false, every sub-order is the same size. When true, each sub-order size is randomly varied, making the execution pattern less predictable; the total quantity executed remains the same. |
allowMargin (optional) |
true or false (default false). Set to true for margin/leverage trades. Only sub-accounts can trade on margin, and each must be enabled individually via the account/status API. |
triggerPrice (optional) |
Price level that triggers the order execution. Only after the mark price of the pair reaches this value does the TWAP duration begin. If not included, TWAP starts immediately. |
Please note: When you receive a 202 Accepted response with an order ID, it does not always
mean that the order has been placed. Use the TWAP Order History endpoint to verify the current
state of the order. Sub-orders may fail due to insufficient balance, self-trading (an order
matching against your own order on the other side), or insufficient liquidity.
Authorizations
apiKey
Your API key
Type
API Key (header: X-VALR-API-KEY)
apiSignature
HMAC SHA512 signature of the request (see Authentication section)
Type
API Key (header: X-VALR-SIGNATURE)
apiTimestamp
Request timestamp in milliseconds
Type
API Key (header: X-VALR-TIMESTAMP)
Request Body
application/json
JSON
{
"side": "BUY",
"quantity": "0.0002",
"price": "0",
"pair": "BTCUSDT",
"orderType": "MARKET",
"duration": 300,
"cadence": 30,
"randomQuantity": false,
"allowMargin": false
}
Responses
TWAP order accepted
application/json