NAV
CURL

Introduction

Welcome to ARBITRAGE-CCXT-API developer API documentation.

Authentication

Every request must include the headers with x-secret-access-key with SECRET_ACCESS_KEY to access the endpoints.

Request Headers

Parameter Type Required Description
x-secret-access-key String Yes Secret key to access the endpoints.

Arbitrage Endpoints

GET Arbitrage Status

This endpoint is to track each arbitrage transaction status.

Response Example: 200

{
  "items": [
    {
      "id": "c2da8af8-642c-426f-be73-fc521ad6c2b3",
      "status": "TRANSFER_TO_SELL_PENDING",
      "symbol": "BTC/USDT",
      "orderType": "MARKET",
      "fromOrderId": "6835443",
      "fromPrice": 22766.92036437,
      "fromAmount": 0.197108,
      "fromCost": 4487.54213918,
      "toOrderId": null,
      "toPrice": null,
      "toAmount": 0.194608,
      "toCost": null,
      "toDepositTag": null,
      "ExchangeFromApiKey": {
        "exchange": "BINANCE"
      },
      "ExchangeToApiKey": {
        "exchange": "OKX"
      },
      "createdAt": "2022-07-24T15:01:05.848Z",
      "updatedAt": "2022-07-24T15:01:11.871Z"
    },
    {
      "id": "81c5ede0-9fa9-4f3a-95d8-eea515d4d85a",
      "status": "FROM_BUY_ORDER_OPEN",
      "symbol": "BTC/USDT",
      "orderType": "LIMIT",
      "fromOrderId": "6835516",
      "fromPrice": 22700,
      "fromAmount": null,
      "fromCost": 0,
      "toOrderId": null,
      "toPrice": 22700,
      "toAmount": null,
      "toCost": null,
      "toDepositTag": null,
      "ExchangeFromApiKey": {
        "exchange": "BINANCE"
      },
      "ExchangeToApiKey": {
        "exchange": "OKX"
      },
      "createdAt": "2022-07-24T15:01:24.607Z",
      "updatedAt": "2022-07-24T15:01:24.607Z"
    }
  ],
  "nextToken": null
}

Status Type

Type Description
FROM_BUY_ORDER_OPEN Buy order is placed and waiting for the trade to be filled.
FROM_SELL_ORDER_OPEN Sell order is placed and waiting for the trade to be filled.
FROM_BUY_ORDER_CLOSED Buy order is completed and ready to transfer to sell.
FROM_SELL_ORDER_CLOSED Buy order is completed and ready to transfer to buy.
TRANSFER_TO_SELL_PENDING Transferring purchased amount to exchange to SELL.
TRANSFER_TO_BUY_PENDING Transferring sold amount to exchange to BUY.
TO_BUY_ORDER_OPEN Buy back order is placed and waiting for the trade to be filled.
TO_SELL_ORDER_OPEN Sell back order is placed and waiting for the trade to be filled.
TO_BUY_ORDER_CLOSED Buy back is completed and ready to transfer back to from exchange.
TO_SELL_ORDER_CLOSED Sell back is completed and ready to transfer back to from exchange.

HTTP Request

GET /v1/arbitrage/status

Request Query

Parameter Type Required Description
status String No Filter by the status type.
limit Integer No Limit total number items per request.
nextToken String No Handle pagination.

HTTP Response

By default, the status type COMPLETED and CANCELLED will not be included.

Content-Type

application/json

POST Arbitrage Trigger

This endpoint creates multiple arbitrage transactions in parallel.

Request Example:

curl -X POST https://BASE_URL/v1/arbitrage/trigger \
  -H 'content-type: text/plain; charset=utf-8' \
  -d 'Buy BTC/USDT BINANCE OKX Market 100 22848.75 passphrase'
Buy BTC/USDT BINANCE OKX Market 100 22848.75 passphrase

Response Example: 200

[
  {
    "status": "fulfilled",
    "value": {
      "id": "3d9029ad-7f45-49e4-abc3-ff85b224c9ef",
      "status": "TRANSFER_TO_SELL_PENDING",
      "symbol": "BTC/USDT",
      "fromPrice": 22838.65686955,
      "fromAmount": 0.442102,
      "fromCost": 10097.01587934,
      "toPrice": null,
      "toAmount": 0.439602,
      "toCost": null,
      "ExchangeFromApiKey": {
        "id": "b8973140-31de-5b1c-8218-3cbdced1c452"
      },
      "ExchangeToApiKey": {
        "id": "068c1dc4-f387-5de1-a206-90aba8fa4ae0"
      },
      "createdAt": "2022-07-24T15:54:28.500Z",
      "updatedAt": "2022-07-24T15:54:33.285Z"
    }
  }
]

HTTP Request

POST /v1/arbitrage/trigger

Request Body

SIDE SYMBOL FROM_EXCHANGE TO_EXCHANGE ORDER_TYPE ORDER_PERCENTAGE PRICE PASSPHRASE

Content-Type

text/plain

Parameter Type Description
SIDE String [BUY, SELL]
SYMBOL String Trade symbol pair. (BASE/QUOTE)
FROM_EXCHANGE String From exchange.
TO_EXCHANGE String To exchange.
ORDER_TYPE String [MARKET, LIMIT, MARKET_LIMIT] MARKET_LIMIT is a LIMIT order at last ticker price.
ORDER_PERCENTAGE Integer Account balance percentage to buy. (Range: 1-100)
PRICE Number ORDER_TYPE buy and sell price. (Must be greater than 0)
PASSPHRASE String password to trigger the order.

HTTP Response

Respond with a proper HTTP status code.

User Endpoints

LIST Users

This endpoint list registered users.

Response Example: 200

{
  "items": [
    {
      "id": "b8973140-31de-5b1c-8218-3cbdced1c452",
      "active": true,
      "ExchangeApiKeys": {
        "items": [
          {
            "exchange": "BINANCE",
            "apiKey": "J5CY9NcR5jQeUIVOCG6VRgS4lwIEevWN9HcT4XaT6Rh92M733dKngldLvaPtSgsk"
          },
          {
            "exchange": "OKX",
            "apiKey": "b541500b-f449-4428-b855-ec79d1574cb8"
          }
        ]
      },
      "createdAt": "2022-07-23T23:24:29.679Z",
      "updatedAt": "2022-07-23T23:24:29.679Z"
    },
    {
      "id": "6414e507-b82d-4c3e-93ed-d4287b74c31a",
      "ExchangeApiKeys": {
        "items": []
      },
      "createdAt": "2022-07-23T20:48:49.319Z",
      "updatedAt": "2022-07-23T20:48:49.319Z"
    }
  ],
  "nextToken": null
}

HTTP Request

GET /v1/user/list

Request Query

Parameter Type Required Description
limit Integer No Limit total number items per request.
nextToken String No Handle pagination.

HTTP Response

Content-Type

application/json

Parameter Type Description
id String User id.
active Boolean Status of the user to be included in the arbitrage transaction or not.
ExchangeApiKeys Object Exchange API keys associated with the user.
createdAt String User created at.
updatedAt String User updated at.

POST User

This endpoint creates a new user.

Response Example: 200

{
  "id": "ea4471f4-6307-4975-8c82-bda2db39514f",
  "active": true,
  "createdAt": "2021-07-11T14:48:00.000Z"
}

HTTP Request

POST /v1/user

Request Body

Content-Type

application/json

Parameter Type Required Default Description
active Boolean No true Status of the user to be included in the arbitrage transaction or not.

HTTP Response

Content-Type

application/json

PATCH User

This endpoint updates an existing user status.

Request Example

{
  "active": true
}

Response Example: 200

{
    "id": "a09c69ad-ae3e-4128-8538-f52ce904f953",
    "active": true,
    "updatedAt": "2022-07-25T00:53:43.313Z",
    "createdAt": "2022-07-25T00:39:12.497Z"
}

HTTP Request

PATCH /v1/user/<ID>

Request URL

Parameter Type Required Description
ID String Yes User Id to update.

Request Body

Content-Type

application/json

Parameter Type Required Description
active Boolean Yes Status of the user to be included in the arbitrage transaction or not.

HTTP Response

Content-Type

application/json

API Key Endpoints

LIST Exchange API Keys

This endpoint list available API key credentials.

Response Example: 200

{
  "items": [
    {
      "id": "b8973140-31de-5b1c-8218-3cbdced1c452",
      "userID": "648d6476-7799-4191-8aad-945d3f07d2d1",
      "exchange": "BINANCE",
      "apiKey": "J5CY9NcR5jQeUIVOCG6VRgS4lwIEevWN9HcT4XaT6Rh92M733dKngldLvaPtSgsk",
      "createdAt": "2022-07-23T23:39:51.699Z",
      "updatedAt": "2022-07-23T23:39:51.699Z"
    },
    {
      "id": "068c1dc4-f387-5de1-a206-90aba8fa4ae0",
      "userID": "648d6476-7799-4191-8aad-945d3f07d2d1",
      "exchange": "OKX",
      "apiKey": "b541500b-f449-4428-b855-ec79d1574cb8",
      "createdAt": "2022-07-23T23:39:33.017Z",
      "updatedAt": "2022-07-23T23:39:33.017Z"
    }
  ],
  "nextToken": null
}

HTTP Request

GET /v1/exchange/api/key/list

Request Query

Parameter Type Required Description
limit Integer No Limit total number items per request.
nextToken String No Handle pagination.

HTTP Response

Content-Type

application/json

POST Exchange API Key

This endpoint adds an exchange API key credential.

Request Example:

{
  "userId": "6414e507-b82d-4c3e-93ed-d4287b74c31a",
  "exchange": "Binance",
  "apiKey": "binanceApiKey",
  "secretKey": "binanceApiKeySecret"
}
{
  "userId": "6414e507-b82d-4c3e-93ed-d4287b74c31a",
  "exchange": "OKX",
  "apiKey": "okxApiKey",
  "secretKey": "okxApiKeySecret",
  "password": "okxApiPassword"
}

Response Example: 200

{
  "id": "ea4471f4-6307-4975-8c82-bda2db39514f",
  "createdAt": "2021-07-11T14:48:00.000Z"
}

422

{
  "message": "Exchange API key already exist"
}

HTTP Request

POST /v1/exchange/api/key

Request Body

Content-Type

application/json

Parameter Type Required Description
userId String Yes Attach the API key to existing user ID created by the user endpoint.
exchange String Yes Exchange account API credential. (case insensitive)
apiKey String Yes Exchange account API key.
secretKey String Yes Exchange account API secret key.
password String No Exchange account API password. (OKX)

HTTP Response

Content-Type

application/json

DELETE Exchange API Key

This endpoint deletes an existing exchange API key credential.

HTTP Request

DELETE /v1/exchange/api/key/<ID>

Request URL

Parameter Type Required Description
ID String Yes Api Key ID to delete.

Errors

ARBITRAGE-CCXT-API API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your authentication is invalid or expired.
404 Not Found -- Your request route could not be found.
422 Unprocessable -- The request content and syntax are correct but cannot process the payload.
429 Too Many Requests -- Too many request.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.