DCA API

1.Create DCA order

request:

{
  "makerAmount": "20000000", // total amount with decimals
  "takerAmount": "19983700", // optional,  with decimals
  "signature": "0x37e6...", // user sign messagae, get from the frontend sdk
  "orderHash": "0x8e89...", //order hash, get from the frontend sdk
  "orderMaker": "0xB3cb...",// wallet address
  "remainingMakerAmount": "20000000", // remaing amount
  "data": {
    "salt": "", // get from the frontend sdk
    "makerAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", // token address
    "takerAsset": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", // token address
    "maker": "0xB3cb...", // wallet address
    "receiver": "0x0000000000000000000000000000000000000000", // default value
    "allowedSender": "0x0000000000000000000000000000000000000000", // default value
    "makingAmount": "20000000", // with decimals
    "takingAmount": "19983700", // with decimals
    "makerAssetData": "0x", // default value, get from the frontend sdk
    "takerAssetData": "0x", // default value, get from the frontend sdk
    "getMakerAmount": "0x", // default value
    "getTakerAmount": "0x", // default value
    "predicate": "0x", // default value, get from the frontend sdk
    "permit": "0x", // default value, get from the frontend sdk
    "interaction": "0x" // get from the frontend sdk
  },
  "isActive": true,
  "chainId": 8453, // chainId
  "expireTime": 600, // expire time s, time * times
  "amountRate": "1.000816", // makerAmount/takerAmount
  "interaction": "0x", // default value
  "time": 300, // interval time, s
  "times": 2, // frequency
  "minPrice": "0.9", // optional, price range
  "maxPrice": "1.1" // optional, price range
}

response:

{
    code: 200
}

2.Cancel DCA order

request

parameter

type

example

description

chainId

number

8453

chain id (8453)

orderHash

string

0x1e48...

wallet address

request body:

{
  "orderHash":"0x1e48...",
}

response

{
    code: 200,
}

3.Get DCA order by address

parameter

type

example

description

chainId

number

8453

chain id (8453)

address

string

0x6ce8...

wallet address

statuses

array?

[1,3,4]

statuses code: 1-unfill, 3-cancel, 4-filled, 5-pending, 6- hash not exist, 7-expire, default [1,3,4]

limit

number?

10

  • Example:

request:

https://open-api.openocean.finance/v1/8453/dca/address/:address

response:

{
    code: 200,
    data: {
        
    }
}

4.Get all DCA orders

parameter

type

example

description

chainId

number

8453

chain id (8453)

statuses

array?

[1,3,4]

statuses code: 1-unfill 3-cancel or expire 4-filled, default [1,3,4]

limit

number?

10

  • Example:

request:

https://open-api.openocean.finance/v1/8453/dca/all

response:

{
    code: 200,
    data: {
        
    }
}

Last updated