Skip to main content
POST
/
v1
/
perps
/
twap
/
order
Create TWAP Order
curl --request POST \
  --url https://api.ondoperps.xyz/v1/perps/twap/order \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "market": "AAPL-USD.P",
  "side": "buy",
  "size": "20.30",
  "runningTime": 3600,
  "frequency": 60,
  "reduceOnly": false,
  "maxPrice": "160.00",
  "minPrice": "140.00"
}
'
{
  "success": true,
  "result": {
    "twapId": "twap_70a37d8f972f2494837f9dba8364cbb4",
    "market": "AAPL-USD.P",
    "side": "buy",
    "startTime": "2025-03-05T14:00:00Z",
    "runningTime": 3600,
    "frequency": 60,
    "avgFilledPrice": "0.00",
    "filledSize": "0.00",
    "totalSize": "20.00",
    "totalFees": "0.00",
    "orderStatus": "running",
    "reduceOnly": false
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
market
string
required

Perps trading market

Example:

"AAPL-USD.P"

side
enum<string>
required

Order side

Available options:
buy,
sell
Example:

"buy"

size
string
required

Total order size in base currency to execute over the TWAP duration

Example:

"20.30"

runningTime
integer
required

Total duration of the TWAP order in seconds. Must be between 300 (5 minutes) and 86400 (24 hours) and a multiple of frequency.

Example:

3600

frequency
integer
required

Interval between child orders in seconds. runningTime / frequency gives the number of child orders, which must be between 2 and 200.

Example:

60

reduceOnly
boolean

If true, child orders are reduce-only

Example:

false

maxPrice
string

Maximum allowed price for child orders. Child orders will not be placed above this price.

Example:

"160.00"

minPrice
string

Minimum allowed price for child orders. Child orders will not be placed below this price.

Example:

"140.00"

Response

Created TWAP order

success
boolean
required

Whether the request was successful

Example:

true

error
string

Error message, present only on failure

Example:

""

error_code
string

Semantic error code. See each endpoint's error responses for the specific codes it can return.

deprecated
string

Deprecation notice, if applicable

Example:

""

result
object