Openocean APIs
  • Developer
    • ⚙️APIs
      • Swap API
        • Guide
        • API V4
        • API V3
        • GMX Exclusive API
        • SDK
      • Limit Order API
        • Guide
        • API
        • SDK
      • Sweep Swap API
        • Guide
        • API
      • DCA API
        • Guide
        • API
        • SDK
      • Meme API
        • Data API
        • Transaction API
        • Websocket API
      • Ticket API
        • API
      • 🤖Swagger
    • 👾Widget
      • Getting Started
      • Customize Theme
      • Other Reference
      • Widget V2
        • Getting Started
    • ℹ️Developer Resources
      • 🔗Supported Chains
      • 📋Contracts of Chains
      • 🚩Common Error Code
      • 📖Developer references & glossary
Powered by GitBook
On this page
  • 1.Create DCA order
  • 2.Cancel DCA order
  • 3.Get DCA order by address
  • 4.Get all DCA orders
  1. Developer
  2. APIs
  3. DCA API

API

1.Create DCA order

POST https://open-api.openocean.finance/v1/:chainId/dca/swap

Path Parameters

Name
Type
Description

chainId*

number

8453, 146, 80094

Example

  • url: https://open-api.openocean.finance/v1/8453/dca/swap

  • body

{
  "makerAmount": "20000000", // total amount with decimals
  "takerAmount": "1", // default amount
  "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", // remaining 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
  "version": "v2", // optional, default is v1. Please use v2 as first time integration.
  "referrer": "0xxxxxxxxxxxxxxxxxxx" // optional. It's the EOA address to set up fees and track data from your end.
  "referrerFee": "1" // optional. "1"=1%. Enter the num to charge the platform fee on your end. The range will be 0-5%
}

If you are willing to set a platform fee on your end, you could include the params of "referrer" &"referrerFee" shown in above example. It only applies to DCA V2 version.

  • referrer is an EOA address to add. It is used for to collect the fee you charged. Meanwhile, it could help us to track data flow from your end.

  • referrerFee is the number set to charge, e.g. "1" is equal to "1%". OpenOcean will take 20% of the platform fee charge as default. If you are not willing to charge, you could either set it as 0 or not include the params.

  • response

{
    code: 200
}

2.Cancel DCA order

POST https://open-api.openocean.finance/v1/:chainId/dca/cancel

Path Parameters

Name
Type
Description

chainId*

number

8453, 146, 80094

Request Body

Name
Type
Description

orderHash*

string

orderHash from sdk

Example

  • url: https://open-api.openocean.finance/v1/8453/dca/cancel

  • body

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

{
    code: 200,
}

3.Get DCA order by address

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

Path Parameters

Name
Type
Description

chainId*

number

8453, 146, 80094

address*

string

wallet address

Query Parameters

Name
Type
Description

statuses

array

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

limit

number

limit count

{
    "code": 200,
    "data": [
        {
            "makerAmount": "100000000",
            "takerAmount": "200000000000000000000",
            "orderHash": "0x......",
            "createDateTime": "2025-04-09T00:19:52.000Z",
            "orderMaker": "0x......",
            "remainingMakerAmount": "100000000",
            "makerBalance": null,
            "makerAllowance": null,
            "expireTime": "2025-04-17T00:19:53.000Z",
            "statuses": 1,
            "time": 86400,
            "times": 8,
            "have_filled": null,
            "minPrice": null,
            "maxPrice": null,
            "data": {
                "makerAsset": "0x.....",
                "makerAssetSymbol": "USDC",
                "makerAssetDecimals": 6,
                "makerAssetIcon": "https://s3.openocean.finance/token_logos/logos/1697507306331_35406629884386076.png",
                "takerAsset": "0x.....",
                "takerAssetSymbol": "ALB",
                "takerAssetDecimals": 18,
                "takerAssetIcon": "https://s3.openocean.finance/token_logos/logos/1693363980475_12272411021892027.png",
                "getMakerAmount": "0x.....",
                "getTakerAmount": "0x.....",
                "makerAssetData": "0x",
                "takerAssetData": "0x",
                "salt": "1033903786203",
                "permit": "0x",
                "predicate": "0x.....",
                "interaction": "0x",
                "makingAmount": "100000000",
                "takingAmount": "200000000000000000000",
                "maker": "0x.....",
                "receiver": "0x0000000000000000000000000000000000000000",
                "allowedSender": "0x0000000000000000000000000000000000000000"
            },
            "makerRate": null,
            "takerRate": null
        }
    ]
}

4.Get all DCA orders

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

Path Parameters

Name
Type
Description

chainId

number

8453, 146, 80094

Query Parameters

Name
Type
Description

statuses

array

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

limit

number

limit count

{
    "code": 200,
    "data": [
        {
            "makerAmount": "100000000",
            "takerAmount": "200000000000000000000",
            "orderHash": "0x......",
            "createDateTime": "2025-04-09T00:19:52.000Z",
            "orderMaker": "0x......",
            "remainingMakerAmount": "100000000",
            "makerBalance": null,
            "makerAllowance": null,
            "expireTime": "2025-04-17T00:19:53.000Z",
            "statuses": 1,
            "time": 86400,
            "times": 8,
            "have_filled": null,
            "minPrice": null,
            "maxPrice": null,
            "data": {
                "makerAsset": "0x.....",
                "makerAssetSymbol": "USDC",
                "makerAssetDecimals": 6,
                "makerAssetIcon": "https://s3.openocean.finance/token_logos/logos/1697507306331_35406629884386076.png",
                "takerAsset": "0x.....",
                "takerAssetSymbol": "ALB",
                "takerAssetDecimals": 18,
                "takerAssetIcon": "https://s3.openocean.finance/token_logos/logos/1693363980475_12272411021892027.png",
                "getMakerAmount": "0x.....",
                "getTakerAmount": "0x.....",
                "makerAssetData": "0x",
                "takerAssetData": "0x",
                "salt": "1033903786203",
                "permit": "0x",
                "predicate": "0x.....",
                "interaction": "0x",
                "makingAmount": "100000000",
                "takingAmount": "200000000000000000000",
                "maker": "0x.....",
                "receiver": "0x0000000000000000000000000000000000000000",
                "allowedSender": "0x0000000000000000000000000000000000000000"
            },
            "makerRate": null,
            "takerRate": null
        }
    ]
}
PreviousGuideNextSDK

Last updated 2 days ago

⚙️