DCA Plans
DCA plans buy or sell a fixed USDC notional per execution on Spot or Perps. Schedules use UTC and support interval, daily, weekly, biweekly and monthly execution. Spot plans require a USDC-quoted symbol.
Each account can have up to five active plans per market. Plans run until cancelled or stopped, without a preset total budget, execution count or end date.
Endpoints
Create a plan
Send the following body to POST /api/v1/{market}/trade/dcas, using spot or perps for {market} and account/symbol IDs from the selected network.
{
"accountID": 42,
"symbolID": 7,
"side": 1,
"amount": "100",
"schedule": {"kind": "daily", "hour": 0},
"minPrice": "50000",
"maxPrice": "120000",
"randomize": false,
"immediate": true
}Account 42 creates a plan for symbol 7 to buy 100 USDC notional per execution. It requests an initial attempt after creation, then an attempt every day at 00:00 UTC. The reference price must be within [50000, 120000] for an attempt to proceed.
A successful response returns the plan ID:
Use data.orderID (123 here) in the cancellation request. See NewDcaOrderRequest for fields and Authentication & Signing for signed requests.
Cancel a plan
Send DELETE /api/v1/{market}/trade/dcas with the plan's account, symbol and parent orderID. For the plan created above:
Cancellation stops future attempts; existing fills and positions are preserved.
Query plans and fills
The following examples use the Mainnet market endpoints. Replace 0xYourAddress with the account owner's wallet address.
Amount and funding
amount is the USDC notional for each execution, for both BUY and SELL. The minimum is 10 USDC; settlement-coin precision and the symbol's amount limits also apply.
Market and side
Meaning of amount="100"
Spot BUY
Use 100 USDC as the purchase funds for each execution.
Spot SELL
Sell the base quantity equivalent to 100 USDC at the order-book midpoint, rounded down to the symbol's quantity precision.
Perps BUY or SELL
Submit an order with 100 USDC notional; required margin depends on the account's leverage, current prices and fees.
Perps plans use the account's leverage setting for the symbol. Executions can reduce, close or open positions, depending on the existing position.
Creation checks funds or margin for the first execution. Future executions use the funds or margin available at that time; funds for the entire plan are not reserved in advance.
Schedules and first execution
All calendar times use UTC. Use these example schedule values in a creation request; see DcaSchedule for all allowed values.
Schedule
schedule example
Execution timing
interval
{"kind":"interval","hour":4}
Created at 03:17 UTC: regular attempts at 07:17, 11:17, and so on.
daily
{"kind":"daily","hour":0}
Every day at 00:00 UTC, or 08:00 in Beijing/Singapore.
weekly
{"kind":"weekly","hour":8,"day":1}
Every Monday at 08:00 UTC.
biweekly
{"kind":"biweekly","hour":8,"day":1}
First at the earliest Monday 08:00 UTC after creation, then every 14 days.
monthly
{"kind":"monthly","hour":8,"day":31}
At 08:00 UTC on the 31st of each month; months without a 31st are skipped.
For calendar schedules, randomize=true selects an execution time within the specified hour. For example, hour=8 means from 08:00 UTC until just before 09:00 UTC. Randomization changes the time, while the execution amount stays fixed. Interval schedules require randomize=false.
immediate=true requests an initial attempt without waiting for the scheduled or randomized time, usually in the block after creation. Price and funding checks still apply. Later attempts follow the regular schedule.
Execution and price bounds
minPrice and maxPrice are optional, inclusive bounds on the reference price: Spot uses the order-book midpoint, while Perps uses the mark price. If the reference price is outside the range, that period is skipped and the plan continues at the next scheduled time. The bounds control the trigger; fill prices can fall outside the configured range.
Each attempt submits a market IOC order with 3% price protection relative to the order-book midpoint. It can fill partially or receive no fills. Missed periods are skipped; later executions do not make up their amounts.
Plan lifecycle and account state
ACTIVE
Waiting for or continuing scheduled executions.
CANCELLED
Cancelled by the user or system.
TERMINATED
Automatically stopped after three consecutive execution failures.
PRUNED
Removed when the account state is pruned.
Insufficient funds or margin, order submission errors and execution errors increase failures, the current consecutive failure count. Price-range skips and an unavailable order book do not count as failures and reset this counter. A successfully processed order with no fills also does not count as a failure.
Account streams include DCA plans in DO. See Account Updates for updates and DcaOrder for plan fields.
DCA fills and account trade fields
Fills use the UserTrade format. orderID identifies the child execution order; clOrdID="dca:<parent plan ID>" links the fill to its DCA plan.
Last updated