Skip to main content
Dollar-cost averaging (DCA) spreads a purchase over time. A DCA strategy spends a total amount of one token in equal orders, one every frequency seconds, buying another token on the same chain. You create the strategy once with POST /dca-order/strategies. Olympex creates the strategy’s orders as it runs and executes each one from the maker’s wallet, under the maker’s pair signature and token allowance.

Strategies and orders

A strategy is the plan; its orders are the executions.

Units

accountTo is the maker: the EOA that sells tokenAddressFrom, receives tokenAddressTo and signs the pair. Send it in EIP-55 checksummed form. accountTo, tokenAddressFrom and tokenAddressTo must be valid EVM addresses: 0x and 40 hexadecimal digits, in lowercase or EIP-55 checksummed form. A mixed-case address with a wrong checksum returns 400 VALIDATION_ERROR with "Must be a valid EVM address". status is optional. Omit it and the strategy starts active. Send "cancelled" to create a stopped strategy, for example to test your integration without scheduling orders. Other fields in the schema are set by Olympex; don’t send them.
Unlike the rest of the API, DCA strategies take amounts, prices and slippage as JSON numbers, not strings. A string such as "100" fails validation with 400.

The amount of each order

Each order spends totalAmount / iterations of tokenAddressFrom. A strategy with a totalAmount of 100 USDC, 10 iterations and a frequency of 86400 places 10 orders of 10 USDC each. Olympex places the orders one frequency apart. A new strategy starts as active immediately, unless you create it with "status": "cancelled", and has no orders until its first order is scheduled. A strategy whose orders have all run has the status finished.

Price bounds

minPrice and maxPrice are optional, in units of tokenAddressTo per 1 tokenAddressFrom. Olympex executes an order only while the price is within the bounds you set. You can set both, one or neither. For a strategy that buys WETH with USDC, the bounds are in WETH per 1 USDC: a WETH price of 4,200 USDC is 1/4200, about 0.000238. You can change the bounds of a running strategy with PATCH /dca-order/strategies/{id}. You can’t remove them: to run without bounds, cancel the strategy and create a new one.
The bounds and an order’s executionPrice use opposite orientations. The bounds are in the token bought per 1 token sold; executionPrice is in the token sold per 1 token bought. An order that spent 10 USDC and received 0.00238 WETH reports an executionPrice of 4201.68, in USDC per WETH.

Lifecycle

Strategy statuses: Order statuses: Treat any status not in these tables as not final.

Follow a strategy

The lists are unpaginated. They return only strategies created with your API key, and an ID from another API key returns 404 NOT_FOUND. accountTo is stored as you sent it, and ?accountTo= matches case-sensitively, so send the EIP-55 checksummed form everywhere.

Cancel a strategy

To stop a strategy and everything it has scheduled:
1

Cancel the strategy

Send PATCH /dca-order/strategies/{id} with {"status":"cancelled"}. It stops new orders, and it can’t be undone.
2

Lower the allowance

Cancelling doesn’t reduce the maker’s token allowance, and the orders Olympex already created are read-only: you can’t cancel them through the API. Set the allowance to what the maker’s other orders still need, or to 0: see Stop everything.
PATCH changes only a strategy’s status and price bounds. To change anything else, such as the amount, the frequency or the tokens, cancel the strategy and create a new one.

Creating a strategy is not safe to repeat

Each successful POST /dca-order/strategies creates a new strategy, and Olympex ignores any id you send. If a create call times out, the strategy may still exist. Don’t retry it blindly: list your strategies for the maker and look for one that matches your tokens, amounts and creation time before you send the call again. Handle errors and retries covers the pattern.

Funds and fees

  • Nothing moves at creation. The tokens stay in the maker’s wallet, and nothing is reserved. The wallet must hold each order’s amount, and the allowance must cover it, when the order runs.
  • Each order pulls its amount of tokenAddressFrom from accountTo through the Olympex order contract and swaps it for tokenAddressTo, which goes to accountTo.
  • Gas is reimbursed out of the token bought. Olympex pays the gas of each execution and takes it out of the token bought, so the maker needs no native token for the executions.
  • So the allowance must cover totalAmount of tokenAddressFrom, with no extra amount for gas. If the maker has other open orders or strategies that sell the same token on the same chain, approve the sum: see One allowance per token and chain.
Gas and fees compares the costs of swaps, limit orders and DCA.

What can’t be sold

Strategies run only on chains that have an order contract and that GET /chains returns. When you create a strategy, Olympex checks the types, the required fields and that each address is a valid EVM address. It doesn’t check the rules on this page or the pair signature: a strategy that breaks one is created, and its orders can’t execute. Check them before you send the request.

What this means for your integration

  • Send totalAmount, slippage and the price bounds as JSON numbers, and expect each order to spend totalAmount / iterations.
  • Sign the pair once, and keep the allowance at what the maker’s strategies and orders still need to spend.
  • To stop a strategy, cancel it, then lower the allowance.
  • Never retry a create call blindly: list your strategies and match first.

Order signatures and allowances

The pair signature, the allowance and the order contract.

Run a DCA strategy

The step-by-step guide.

Create a DCA strategy reference

Every field of POST /dca-order/strategies.

Limit orders

Sell at a target price instead.