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
  • Limit order API Documentation
  • OpenOcean Limit Order API Integration Guide
  • Limit Order Overview
  • Limit Order Trading in 3 Steps
  1. Developer
  2. APIs
  3. Limit Order API

Guide

PreviousLimit Order APINextAPI

Last updated 5 months ago

Limit order API Documentation

OpenOcean Limit Order API Integration Guide

OpenOcean offers an API interface for limit order trading, allowing developers to place orders at a specific price. This guide will walk you through the steps for utilizing this feature's API.

Limit Order Overview

The Limit Order feature on the OpenOcean platform enables users to set target prices for automated trade execution.

Limit Order Trading in 3 Steps

  1. Create Limit Order

  2. Cancel Order (Optional)

  3. Query Orders

1. Create Limit Order

Set up buy/sell orders at your desired price.

Example request:

const response = await axios({
    url: 'https://open-api.openocean.finance/v1/8453/limit-order',
    method: 'POST',
    data: {
      "makerAmount": "998600",
      "takerAmount": "1000000000000000000",
      "signature": "0xb08a6faf348d4452edb5f382f1a935dbc09d1adee94d10193aeb68a8c5a795aa5141aab439318a992d1045165a584f4b702e87bde781e601fbc9b5e01ec3fcc41b",
      "orderHash": "0x93989d8b660d62c027b2ec8028dbd94056c057f5e60650521e54c9f261344de5",
      "orderMaker": "0xb3cbeff0336baa4863cb51238bd6c35bdaab3d84",
      "remainingMakerAmount": "998600",
      "data": {
          "salt": "609556296383",
          "makerAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
          "takerAsset": "0x59d9356e565ab3a36dd77763fc0d87feaf85508c",
          "maker": "0xb3cbeff0336baa4863cb51238bd6c35bdaab3d84",
          "receiver": "0x0000000000000000000000000000000000000000",
          "allowedSender": "0x0000000000000000000000000000000000000000",
          "makingAmount": "998600",
          "takingAmount": "1000000000000000000",
          "makerAssetData": "0x",
          "takerAssetData": "0x",
          "getMakerAmount": "0xf4a215c300000000000000000000000000000000000000000000000000000000000f3cc80000000000000000000000000000000000000000000000000de0b6b3a7640000",
          "getTakerAmount": "0x296637bf00000000000000000000000000000000000000000000000000000000000f3cc80000000000000000000000000000000000000000000000000de0b6b3a7640000",
          "predicate": "0x961d5b1e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b5486f71c902fe0844bb07221fa8f47834d90b1b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002463592c2b00000000000000000000000000000000000000000000000000000000673a9b6100000000000000000000000000000000000000000000000000000000",
          "permit": "0x",
          "interaction": "0x"
      },
      "isActive": true,
      "chainId": 8453,
      "expireTime": 2592000000,
      "amountRate": "0.998600",
      "interaction": "0x"
  }
});

Example response:

{
    "code": 200,
    "success": true
}

2. Cancel Order

Cancel any pending orders whenever you want.

Example request:

const response = await axios({
    url: 'https://open-api.openocean.finance/v1/8453/limit-order/cancelLimitOrder',
    method: 'POST',
    data: {
      "orderHash": "0x939.."
    }
});

Example response:

{
  "code": 200,
  "data": {
    "status": 3,
    "message": "cancel success"
  }
}

3. Query Orders

Monitor all your orders and trading history in a single view.

Example request:

const response = await axios({
    url: 'https://open-api.openocean.finance/v1/8453/limit-order/address/0xB3cbefF0336BaA4863Cb51238bD6C35BDAaB3D84',
    method: 'GET',
    params: {
      page: 1,
      limit: 10,
      statuses: [1,2,5],
      sortBy: "createDateTime",
    }
});

Example response:

{
  "code": 200,
  "data": [
    {
      "makerAmount": "998600",
      "takerAmount": "1000000000000000000",
      "signature": "0x00..",
      "orderHash": "0xbfbf9e262bedc228854c415eaa84feefbcfe39f5632dbfd774c795d025c80754",
      "createDateTime": "2024-10-19T01:46:57.000Z",
      "orderMaker": "0xB3cbefF0336BaA4863Cb51238bD6C35BDAaB3D84",
      "remainingMakerAmount": "998600",
      "makerBalance": null,
      "makerAllowance": null,
      "expireTime": "2024-11-18T01:46:57.000Z",
      "statuses": 1,
      "data": {},
      "makerRate": null,
      "takerRate": null
    }
  ]
}
⚙️
API