NAV Navigation
cURL Python Java Node.JS

One Trading API v1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Introduction

The One Trading API is designed to allow programmatic access to exchange features. This documentation provides information on the available functionality of the One Trading. We provide two APIs: HTTP REST and WebSockets. For detailed information about our API visit the Rest API Overview section or the WSS Overview section.

FAST Upgrade 🚀

The updated API documentation for our new ultra fast crypto exchange includes significant enhancements for improved performance and efficiency. Key changes include:

Getting started

URLs

There are 2 URLs to communicate via WebSockets and 1 for REST API calls:

For each section of the API documentation, it will be stated which URL serves those particular endpoints.

Terms of service

Authentication

The One Trading API requires an api key to access private endpoints. You can generate API keys via the One Trading website.

⚠️ Never share an API key, if you suspect that an API key was compromised revoke it immediately.

When generating an API key, you may select one or more scopes for the key.

You may optionally add an IP restriction. Any request using that API key is rejected, unless the source IP of the request is one of the trusted IPs.

⚠️ Always select the minimal required scope for an api key. We recommend to set one or more trusted IPs to further harden API keys with scope Trade or Withdraw.

Requests to private endpoints MUST use the Bearer Token Scheme to be authenticated. The API key must be transmitted via the Authorization header with the Bearer scheme

Authorization: Bearer eyJvcmciOiJiaXRwYW5kYS1nZSIsImFsZyI6IlJTMjU2Iiwia2lkIjoiZXhjaGFuZ2UtbGl2ZSJ9.eyJhdW...

To protect API keys and sensitive data in transit, all requests to the One Trading API MUST use TLS encryption. Plain HTTP requests are not accepted.

⚠️ Make sure that your client validates the server certificate and aborts if validation fails.

Order placement limits

Each user can have at most 200 open orders at a given time. This limit is global, across all instruments. When submitting a new order that exceeds this limit, it will be rejected with an HTTP status 422 and an error code MAX_OPEN_ORDERS_EXCEEDED.

Public

Base URL: https://api.onetrading.com/fast/v1

Everything that is publicly available without any authorisation

Currencies

Code samples

curl --request GET \
  --url https://example.com/currencies \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/currencies", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/currencies")
  .header("Accept", "application/json")
  .asString();

GET /currencies

Get a list of all available currencies.

Example responses

200 Response

[
  {
    "code": "BTC",
    "precision": 5,
    "unified_cryptoasset_id": 1,
    "name": "Bitcoin"
  },
  {
    "code": "XRP",
    "precision": 8,
    "unified_cryptoasset_id": 52,
    "name": "XRP"
  },
  {
    "code": "USDT",
    "precision": 3,
    "unified_cryptoasset_id": 825,
    "name": "Tether USDt"
  },
  {
    "code": "EUR",
    "precision": 2,
    "unified_cryptoasset_id": 0,
    "name": "Euro"
  }
]

default Response

{
  "error": "SOME_ERROR_CODE"
}

Responses

Status Meaning Description Schema
200 OK Array of available currencies Currency
default Default General error response, explanations for all error code can be found here Error

Candlesticks

Code samples

curl --request GET \
  --url 'https://example.com/candlesticks/BTC_EUR?unit=HOURS&period=1&from=2019-10-03T04%3A59%3A59.999Z&to=2019-10-03T07%3A59%3A59.999Z' \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/candlesticks/BTC_EUR?unit=HOURS&period=1&from=2019-10-03T04%3A59%3A59.999Z&to=2019-10-03T07%3A59%3A59.999Z", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/candlesticks/BTC_EUR?unit=HOURS&period=1&from=2019-10-03T04%3A59%3A59.999Z&to=2019-10-03T07%3A59%3A59.999Z")
  .header("Accept", "application/json")
  .asString();

GET /candlesticks/{instrument_code}

Get instrument candlesticks for a specified time period. The requested time period may include up to 5000 candlesticks; for example, a request for minutely candles is limited to at most ~83 hours. Please note that fewer candlesticks than the theoretical limit may be provided for a given time period due to gaps in trading activity. Additionally, the endpoint now accepts a parameter called 'countBack,' which specifies the exact number of bars to load. If not provided, the default value is set to 5000. It's important to note that 'countBack' takes precedence over 'from' when both parameters are present.

Parameters

Name In Type Required Description
unit query TimeGranularityUnit true Defines the unit of candlestick time granularity
period query TimeGranularityPeriod true Defines the period of candlestick time granularity.
from query MarketTime true Defines start of a query search
to query MarketTime true Defines end of a query search
instrument_code path Instrument true Defines market by using unique instrument
countBack query number false Defines the exact number of candlesticks to load.

Enumerated Values

Parameter Value
unit MINUTES
unit HOURS
unit DAYS
unit WEEKS
unit MONTHS

Example responses

200 Response

{
  "status": "data",
  "candlesticks": [
    {
      "last_sequence": 12345,
      "instrument_code": "BTC_EUR",
      "granularity": {
        "unit": "MINUTES",
        "period": 1
      },
      "high": "123.456",
      "low": "123.456",
      "open": "123.456",
      "close": "123.456",
      "total_amount": "123.456",
      "volume": "123.456",
      "time": "2019-08-24T14:15:22Z"
    }
  ]
}

400 Response

{
  "error": "CANDLESTICKS_TIME_RANGE_TOO_BIG"
}

Responses

Status Meaning Description Schema
200 OK Array of Candlesticks Inline
400 Bad Request The requested time range of candlesticks data exceeds max. supported size of 1500 items. Error
default Default General error response, explanations for all error code can be found here Error

Response Schema

Status Code 200

Name Type Required Restrictions Description
» status string false none none
» candlesticks [Candlestick] false none [Candlestick representing price action for a given period]
»» last_sequence number true none The value of the sequence field of the last price tick (see PriceTickSequence) considered for this candlestick (see Websocket channel Price Ticks)
»» instrument_code Instrument true none The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
»» granularity TimeGranularity true none A length of time defined by unit and period used to identify the granularity of candlestick. For possible combinations see each property's documentation.
»»» unit TimeGranularityUnit true none none
»»» period TimeGranularityPeriod true none Combined with the unit, supported resolutions are 1, 5, 15, 30 MINUTES & 1, 4 HOURS & 1 DAYS & 1 WEEKS & 1 MONTHS.
»» high BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» low BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» open BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» close BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» total_amount BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» volume BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
»» time MarketTime(date-time) true none Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.

Enumerated Values

Property Value
unit MINUTES
unit HOURS
unit DAYS
unit WEEKS
unit MONTHS

Fee Groups

Code samples

curl --request GET \
  --url https://example.com/fees \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/fees", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/fees")
  .header("Accept", "application/json")
  .asString();

GET /fees

Returns details of all general Fee Groups.

Example responses

200 Response

[
  {
    "fee_group_id": "default",
    "display_text": "The standard fee plan.",
    "fee_tiers": [
      {
        "volume": "0.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "100.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "250.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "1000.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "5000.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "10000.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "20000.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      },
      {
        "volume": "50000.0",
        "fee_group_id": "default",
        "maker_fee": "0.0",
        "taker_fee": "0.0"
      }
    ]
  }
]

Responses

Status Meaning Description Schema
200 OK Available fee groups and their fee tiers FeeGroup

Instruments

Code samples

curl --request GET \
  --url https://example.com/instruments \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/instruments", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/instruments")
  .header("Accept", "application/json")
  .asString();

GET /instruments

Get a list of all available trade instruments

Example responses

200 Response

[
  {
    "state": "ACTIVE",
    "base": {
      "code": "BTC",
      "precision": 5
    },
    "quote": {
      "code": "USDT",
      "precision": 2
    },
    "amount_precision": 5,
    "market_precision": 2,
    "min_size": "10.0",
    "min_price": "1000",
    "max_price": "10000000"
  },
  {
    "state": "ACTIVE",
    "base": {
      "code": "BTC",
      "precision": 5
    },
    "quote": {
      "code": "EUR",
      "precision": 2
    },
    "amount_precision": 5,
    "market_precision": 2,
    "min_size": "10.0",
    "min_price": "1000",
    "max_price": "10000000"
  },
  {
    "state": "ACTIVE",
    "base": {
      "code": "ETH",
      "precision": 4
    },
    "quote": {
      "code": "USDT",
      "precision": 2
    },
    "amount_precision": 4,
    "market_precision": 2,
    "min_size": "10.0",
    "min_price": "100",
    "max_price": "10000000"
  }
]

Responses

Status Meaning Description Schema
200 OK none Inline
default Default General error response, explanations for all error code can be found here Error

Response Schema

Status Code 200

Name Type Required Restrictions Description
» base CurrencyCode true none Currency code.
» quote CurrencyCode true none Currency code.
» min_size BigDecimal true none A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
» amount_precision number true none The maximum allowed precision of the amount when creating an order
» market_precision number true none The maximum allowed precision of the price when creating an order
» state string true none Current status of the instrument.
- NEW => A new instrument is launched. No trading is possible.
- ACTIVE => All trading operations are supported.
- SUSPENDED => Creating orders is suspended. Cancellation is possible.
- IN_MAINTENANCE => Instrument is in maintenance. No trading is possible.
- POST_ONLY => Only LimitOrders with post_only=true are allowed to establish liquidity in the order book.
- CLOSED => A decomissioned instrument. No trading is possible.
- UNDEFINED => No trading is possible.

Enumerated Values

Property Value
state NEW
state ACTIVE
state SUSPENDED
state IN_MAINTENANCE
state POST_ONLY
state CLOSED
state UNDEFINED

Order Book

Code samples

curl --request GET \
  --url https://example.com/order-book/BTC_EUR \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/order-book/BTC_EUR", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/order-book/BTC_EUR")
  .header("Accept", "application/json")
  .asString();

GET /order-book/{instrument_code}

Get given instrument's order book.

Parameters

Name In Type Required Description
level query number false Specifies which level of order-book should be returned. Level 1 means only the best bid and ask, Level 2 is a compiled order book up to market precision and level 3 is a full orderbook. Orderbook level 3 is returned if no level is specified. If you wish to get regular updates about orderbooks please use our Websocket channel.
depth query number false Specifies how many ask/bids should be returned. If there are more entries available, each order book side is
instrument_code path Instrument true Defines market by using unique instrument

Detailed descriptions

depth: Specifies how many ask/bids should be returned. If there are more entries available, each order book side is truncated to the given depth. The order of entries is preserved. The depth of a level 1 order book cannot be limited.

Example responses

This example shows all three representations of possible responses, not an actual response. You can only get one type based on what level of order book you choose

{
  "instrument_code": "BTC_EUR",
  "time": 1705506255137273000,
  "asks": [
    {
      "price": "9449.0",
      "amount": "54.46"
    }
  ],
  "bids": [
    {
      "price": "8888.0",
      "amount": "16.464"
    }
  ]
}
{
  "instrument_code": "BTC_EUR",
  "time": 1705506255137273000,
  "bids": [
    {
      "price": "8673.0",
      "amount": "14.48"
    },
    {
      "price": "8670.0",
      "amount": "6.354"
    }
  ],
  "asks": [
    {
      "price": "8978.0",
      "amount": "624.24"
    },
    {
      "price": "9757.0",
      "amount": "12.7"
    }
  ]
}
{
  "instrument_code": "BTC_EUR",
  "time": 1705506255137273000,
  "sequence": 123456,
  "bids": [
    {
      "price": "8882.0",
      "amount": "0.1156316"
    }
  ],
  "asks": [
    {
      "price": "8945.4",
      "amount": "0.1"
    },
    {
      "price": "8945.9",
      "amount": "0.95574218"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK This example shows all three representations of possible responses, not an actual response. You can only get one type based on what level of order book you choose OrderBookSnapshot

Market Ticker

Code samples

curl --request GET \
  --url https://example.com/market-ticker \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/market-ticker", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/market-ticker")
  .header("Accept", "application/json")
  .asString();

GET /market-ticker

The market ticker provides information about the current state of a market and summary statistics on activity within the last 24 hours. Volume, low, high and price change are calculated based on a sliding window starting 24 hours ago and using minutely granularity. Market ticks are pushed on each trade when the 24 hour sliding window is moved forward. If there are no changes, no updates will be pushed.

Example responses

200 Response

[
  {
    "instrument_code": "BTC_EUR",
    "state": "ACTIVE",
    "base_volume": "3.39563",
    "high": "58500.00",
    "highest_bid": "58331.51",
    "last_price": "58100.00",
    "low": "56501.00",
    "lowest_ask": "56527.86",
    "price_change_percentage": "-2.11",
    "price_change": "-1200.00",
    "quote_volume": "194388.38",
    "sequence": 1715611933889742000
  },
  {
    "instrument_code": "BTC_USDT",
    "state": "ACTIVE",
    "base_volume": "30.81793",
    "high": "63149.84",
    "highest_bid": "63116.15",
    "last_price": "58100.00",
    "low": "56501.00",
    "lowest_ask": "56527.86",
    "price_change_percentage": "-2.81",
    "price_change": "-1709.20",
    "quote_volume": "194388.38",
    "sequence": 1715612190307321900
  }
]

Responses

Status Meaning Description Schema
200 OK Array of latest market-ticks MarketTick

Market Ticker For Instrument

Code samples

curl --request GET \
  --url https://example.com/market-ticker/BTC_EUR \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/market-ticker/BTC_EUR", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/market-ticker/BTC_EUR")
  .header("Accept", "application/json")
  .asString();

GET /market-ticker/{instrument_code}

Get statistics on a single market.

Parameters

Name In Type Required Description
instrument_code path Instrument true Defines market by using unique instrument

Example responses

200 Response

{
  "instrument_code": "ETH_BTC",
  "state": "ACTIVE",
  "base_volume": "63.183",
  "high": "0.04779",
  "highest_bid": "0.04774",
  "last_price": "0.04727",
  "low": "0.04720",
  "lowest_ask": "0.04720",
  "price_change_percentage": "0.90147",
  "price_change": "0.00043",
  "quote_volume": "2.99754",
  "sequence": 1715593326581079600
}

Responses

Status Meaning Description Schema
200 OK Market-tick MarketTick

Time

Code samples

curl --request GET \
  --url https://example.com/time \
  --header 'Accept: application/json'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'Accept': "application/json" }

conn.request("GET", "/time", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/time")
  .header("Accept", "application/json")
  .asString();

GET /time

Returns the current server time in UTC.

Example responses

200 Response

{
  "iso": "2018-12-11T10:58:41.219Z",
  "epoch_millis": 1544525921219
}

Responses

Status Meaning Description Schema
200 OK Time Inline
default Default General error response, explanations for all error code can be found here Error

Response Schema

Status Code 200

Name Type Required Restrictions Description
» iso MarketTime(date-time) true none Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
» epoch_millis number true none elapsed milliseconds since Unix Epoch.

Trading

Base URL: https://api.onetrading.com/fast/v1

Everything regarding user order management.

❗️It is recommended to use the WebSocket for trading in order to get the lowest possible latencies and the best possible trading experience.

Balances

Code samples

curl --request GET \
  --url https://example.com/account/balances \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/balances", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/balances")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/balances

Account balances

Returns the balance details for an account, balances are updated approximately 5 seconds after any trading activity on the exchange, or any time funds are moved. If you wish to have real time balance updates, it is recommended to use our websocket Account History Channel.

Example responses

200 Response

{
  "account_id": "e4eaaaf2-d142-11e1-b3e4-080027620cdd",
  "balances": [
    {
      "account_id": "e4eaaaf2-d142-11e1-b3e4-080027620cdd",
      "currency_code": "BTC",
      "change": 0.5,
      "available": "10.0",
      "locked": "1.1234567",
      "sequence": "5",
      "time": "2024-05-10T14:38:58.506Z"
    },
    {
      "account_id": "e4eaaaf2-d142-11e1-b3e4-080027620cdd",
      "currency_code": "ETH",
      "change": 0.5,
      "available": "10.0",
      "locked": "1.1234567",
      "sequence": "6",
      "time": "2024-05-10T14:38:58.506Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Balance information Account

Fees

Code samples

curl --request GET \
  --url https://example.com/account/fees \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/fees", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/fees")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/fees

Current fees

Returns the fee tiers, the running 30 day trading volume and active fee tier.

Example responses

200 Response

{
  "account_id": "ed524d00-820a-11e9-8f1e-69602df16d85",
  "running_trading_volume": "0.0",
  "running_volume": "0.0",
  "running_volume_currency": "EUR",
  "fee_group_id": "default",
  "fee_tiers": [
    {
      "volume": "0.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "100.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "250.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "1000.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "5000.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "10000.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "20000.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    },
    {
      "volume": "50000.0",
      "fee_group_id": "default",
      "maker_fee": "0.0",
      "taker_fee": "0.0"
    }
  ],
  "active_fee_tier": {
    "volume": "0.0",
    "fee_group_id": "default",
    "maker_fee": "0.0",
    "taker_fee": "0.0"
  }
}

Responses

Status Meaning Description Schema
200 OK Fee information for account AccountFeeGroup

Get Orders

Code samples

curl --request GET \
  --url https://example.com/account/orders \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/orders", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/orders")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/orders

Get orders

Return a paginated report on currently open orders, sorted by creation timestamp (newest first). Query parameters and filters can be used to specify if historical orders should be reported as well. If no query filters are defined, all orders which are currently active will be returned. If you want to query specific time frame parameters, from and to are mandatory, otherwise it will start from the latest orders. Note: This endpoint only returns a maximum of the last 400 orders, prioritising currently open orders. To get longer term trade data you can use the export functionality form the UI. Note: After the FAST upgrade 🚀, orders from the legacy Exchange are no longer returned. To get legacy orders, you will need to use the export functionality from the UI and not the API.

Parameters

Name In Type Required Description
from query MarketTime false Defines start of a query search
to query MarketTime false Defines end of a query search
instrument_code query Instrument false Filter order history by instrument code
with_cancelled_and_rejected query boolean false Return orders which have been cancelled by the user before being filled or rejected by the system as invalid. Additionally, all inactive filled orders which would return with "with_just_filled_inactive".
with_just_filled_inactive query boolean false Return order history for orders which have been filled and are no longer open. Use of "with_cancelled_and_rejected" extends "with_just_filled_inactive" and in case both are specified the latter is ignored.
with_just_orders query boolean false Returns order history for orders but does not return any trades corresponding to the orders. It may be significantly faster and should be used if user is not interesting in trade information. Can be combined with any other filter.
max_page_size query string false Set max desired page size. If no value is provided, by default a maximum of 100 results per page are returned. The maximum upper limit is 100 results per page.
cursor query string false Pointer specifying the position from which the next pages should be returned.

Example responses

200 Response

{
  "order_history": [
    {
      "order": {
        "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
        "order_id": "d453ca12-c650-46dd-9dee-66910d96bfc0",
        "client_id": "6f770867-7673-4786-909a-4f7b4c1fa8d9",
        "amount": "0.2",
        "side": "SELL",
        "instrument_code": "BTC_USDT",
        "price": "10159.76",
        "time": "2019-08-23T10:02:31.663Z",
        "sequence": 8,
        "time_last_updated": "2019-08-23T10:02:31.663Z",
        "filled_amount": "0.2",
        "status": "FILLED_FULLY"
      },
      "trades": [
        {
          "fee": {
            "fee_amount": "0.4188869",
            "fee_currency": "USDT",
            "fee_percentage": "0.1",
            "fee_group_id": "default",
            "fee_type": "TAKER",
            "running_trading_volume": "0.0"
          },
          "trade": {
            "trade_id": "ec82896f-fd1b-4cbb-89df-a9da85ccbb4b",
            "order_id": "d453ca12-c650-46dd-9dee-66910d96bfc0",
            "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
            "amount": "0.2",
            "side": "SELL",
            "instrument_code": "BTC_USDT",
            "price": "10159.76",
            "time": "2019-08-23T10:02:32.663Z",
            "sequence": 9
          }
        }
      ]
    }
  ],
  "max_page_size": 100,
  "cursor": "1704316702735:5fcd9ff0-9a45-426c-8490-5338b5b7178e"
}

default Response

{
  "error": "SOME_ERROR_CODE"
}

Responses

Status Meaning Description Schema
200 OK Order history for account OrderHistory
default Default General error response, explanations for all error code can be found here Error

Create Order

Code samples

curl --request POST \
  --url https://example.com/account/orders \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"instrument_code":"BTC_EUR","side":"BUY","type":"LIMIT","amount":"1.23","price":"5000.00","time_in_force":"GOOD_TILL_CANCELLED"}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\"instrument_code\":\"BTC_EUR\",\"side\":\"BUY\",\"type\":\"LIMIT\",\"amount\":\"1.23\",\"price\":\"5000.00\",\"time_in_force\":\"GOOD_TILL_CANCELLED\"}"

headers = {
    'Content-Type': "application/json",
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("POST", "/account/orders", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://example.com/account/orders")
  .header("Content-Type", "application/json")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .body("{\"instrument_code\":\"BTC_EUR\",\"side\":\"BUY\",\"type\":\"LIMIT\",\"amount\":\"1.23\",\"price\":\"5000.00\",\"time_in_force\":\"GOOD_TILL_CANCELLED\"}")
  .asString();

POST /account/orders

Create a new order

Create a new order of the type LIMIT.

Additionally, LIMIT Orders support GOOD_TILL_CANCELLED, GOOD_TILL_TIME, IMMEDIATE_OR_CANCELLED and FILL_OR_KILL which can be specified as time_in_force option. If none is specified GOOD_TILL_CANCELLED is assumed. If GOOD_TILL_TIME is set as time_in_force, client is also expected to provide time after which the limit order expires.

There is a minimum size per order which can be looked up by querying the /instruments endpoint. Additionally, the precision limitations can be found there. Globally across all markets, at most 200 orders can be kept open at any given point in time.

Optionally a client_id can be set by clients to track orders without waiting for the assigned order id. NOTE: You are responsible for uniqueness of a client_id. If two or more orders are created with the same client_id, the older orders can then only be cancelled using order_id, or via the cancel all orders endpoint.

Make sure to have a valid api key with the scope TRADE, otherwise this operation will be rejected. The api key can be generated via the user interface at https://exchange.onetrading.com/trading-accounts/account/api.

Body parameter

{
  "instrument_code": "BTC_EUR",
  "side": "BUY",
  "type": "LIMIT",
  "amount": "1.23",
  "price": "5000.00",
  "time_in_force": "GOOD_TILL_CANCELLED"
}

Parameters

Name In Type Required Description
body body CreateOrder true none

Example responses

200 Response

{
  "amount": "1",
  "instrument_code": "BTC_EUR",
  "price": "5000",
  "side": "BUY",
  "time_in_force": "GOOD_TILL_CANCELLED",
  "type": "LIMIT",
  "client_id": "2cc6f8d6-bf0c-4944-bcaa-f989c4c8def5"
}

400 Response

{
  "error": "INVALID_PRICE"
}

422 Response

{
  "error": "INSUFFICIENT_FUNDS"
}

Responses

Status Meaning Description Schema
200 OK The order is valid and was successfully accepted. OrderSubmitted
400 Bad Request An invalid body was provided and therefore the request was rejected. Check the error code for details. Error
422 Unprocessable Entity The request is unprocessable. Check the error code for details. Error

Close All Orders

Code samples

curl --request DELETE \
  --url https://example.com/account/orders \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("DELETE", "/account/orders", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.delete("https://example.com/account/orders")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

DELETE /account/orders

Close multiple orders

Submits a close request for all open orders of an account.

Optionally the user can specify one of an instrument_code, a list of ids or a list of client_ids as HTTP query parameters. The instrument_code parameter will only close orders for the given instrument, while the ids and client_ids parameter can be used to specify various orders regardless to which markets they belong. Calling this endpoint without any of the optional parameters will close all orders of the account. Calling this endpoint with more than one of the specified query parameters is not supported.

The orders must be submitted by the account that the API key has been created for. When the API returns 200 OK, it returns a list of UUIDs representing either the order IDs or client order IDs, that were submitted for cancellation, depending on whether the client_ids query parameter was used or not.

One Trading will always fill orders with best effort. Therefore, when attempting to close all orders, these orders may be in the process of being filled. In this case, One Trading will attempt to close the orders but the order may already be partially/fully filled.

Make sure to have a valid API key with the scope TRADE, otherwise this operation will be rejected. The API key can be generated via the user interface at https://exchange.onetrading.com/trading-accounts/account/api.

Parameters

Name In Type Required Description
instrument_code query string false Only close orders in given market (omit to close all orders)
ids query string false An array of comma separated order IDs, in the form of [UUID_1,UUID_2,UUID_3,...,UUID_N]
client_ids query string false An array of comma separated client order IDs, in the form of [UUID_1,UUID_2,UUID_3,...,UUID_N]

Example responses

200 Response

[
  "d1efc79d-f78d-4a9d-a4c0-dbe76c9a4e6f",
  "8ada8f2d-56ea-4b24-bfd4-06723dfbb3be",
  "82d36d62-9d02-4154-8686-9b16472a4a38",
  "09759fa5-8b3a-47e7-a8c7-a0833b749855",
  "6eb6a84a-eca9-4348-8c2d-cac1a18e81e7"
]

400 Response

{
  "error": "MAX_NUMBER_OF_ORDERS_TO_CLOSE_EXCEEDED"
}

404 Response

{
  "error": "INVALID_ORDER_ID"
}

Responses

Status Meaning Description Schema
200 OK The following orders ids were submitted for closing Inline
400 Bad Request The number of UUIDs to cancel exceeds the advertised upper limit Error
404 Not Found A supplied UUID value was invalid Error
default Default General error response, explanations for all error code can be found here Error

Response Schema

Get Order

Code samples

curl --request GET \
  --url https://example.com/account/orders/ \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/orders/", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/orders/")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/orders/{order_id}

Get information for an order by orderId

Get information for an order

Example responses

200 Response

{
  "order": {
    "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
    "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
    "amount": "100.0",
    "side": "BUY",
    "instrument_code": "BTC_EUR",
    "price": "7349.2",
    "time": "2019-09-27T15:05:32.063Z",
    "sequence": 48782,
    "time_last_updated": "2019-09-27T15:05:35.096Z",
    "filled_amount": "100.0",
    "status": "FILLED_FULLY"
  },
  "trades": [
    {
      "fee": {
        "collection_type": "STANDARD"
      },
      "trade": {
        "trade_id": "fdff2bcc-37d6-4a2d-92a5-46e09c868664",
        "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
        "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
        "amount": "1.4",
        "side": "BUY",
        "instrument_code": "BTC_EUR",
        "price": "7341.4",
        "time": "2019-09-27T15:05:32.564Z",
        "sequence": 48670
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK none OrderHistoryEntry

Close Order by Order Id

Code samples

curl --request DELETE \
  --url https://example.com/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("DELETE", "/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.delete("https://example.com/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

DELETE /account/orders/{order_id}

Close an Order by Order Id

Submits a request to close an open order by providing a valid order_id. Closing by client_id is possible here.

A successful response indicates that the order cancellation has been accepted, a final confirmation of closing is sent to the ACCOUNT_HISTORY and TRADING WebSocket channels. Additionally the account history via REST API will contain the event. In some cases, orders can not be closed successfully as they have already been closed or filled. An error response will point to the reason in a such scenario.

Make sure to have a valid api key with the scope TRADE, otherwise this operation will be rejected. The api key can be generated via the user interface at https://exchange.onetrading.com/trading-accounts/account/api.

Note: This endpoint will not return legacy orders after the FAST upgrade. You can export your legacy order information using the export functionality on the UI.

Parameters

Name In Type Required Description
order_id path string(uuid) true Order Id of order which should be closed.

Example responses

404 Response

{
  "error": "Order not found."
}

Responses

Status Meaning Description Schema
204 No Content Order cancellation has been submitted None
404 Not Found Order not found, it might be already closed Error

Get Order by Client ID

Code samples

curl --request GET \
  --url https://example.com/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/orders/client/{client_id}

Get Order by Client ID

Fetches order and it's corresponding trades based on client ID provided.

Parameters

Name In Type Required Description
client_id path string(uuid) true Client Id of orders to fetch.

Example responses

200 Response

{
  "order_history": [
    {
      "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
      "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
      "client_id": "6f770867-7673-4786-909a-4f7b4c1fa8d9",
      "amount": "100.0",
      "side": "BUY",
      "instrument_code": "BTC_EUR",
      "price": "7349.2",
      "time": "2019-09-27T15:05:32.063Z",
      "sequence": 48782,
      "time_last_updated": "2019-09-27T15:05:35.096Z",
      "filled_amount": "100.0",
      "status": "FILLED_FULLY",
      "trades": [
        {
          "fee": {
            "collection_type": "STANDARD"
          },
          "trade": {
            "trade_id": "fdff2bcc-37d6-4a2d-92a5-46e09c868664",
            "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
            "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
            "amount": "1.4",
            "side": "BUY",
            "instrument_code": "BTC_EUR",
            "price": "7341.4",
            "time": "2019-09-27T15:05:32.564Z",
            "sequence": 48670
          }
        }
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK none OrderHistoryEntry

Close Order by Client Id

Code samples

curl --request DELETE \
  --url https://example.com/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("DELETE", "/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.delete("https://example.com/account/orders/client/497f6eca-6276-4993-bfeb-53cbbbba6f08")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

DELETE /account/orders/client/{client_id}

Close an Order by Client Id

Submits a request to close an open order by providing a valid client_id. Closing by order_id is possible here.

A successful response indicates that the order cancellation has been accepted, a final confirmation of closing is sent to the ACCOUNT_HISTORY and TRADING WebSocket channels. Additionally the account history via REST API will contain the event. In some cases, orders can not be closed successfully as they have already been closed or filled. An error response will point to the reason in a such scenario.

Make sure to have a valid api key with the scope TRADE, otherwise this operation will be rejected. The api key can be generated via the user interface at https://exchange.onetrading.com/trading-accounts/account/api.

Parameters

Name In Type Required Description
client_id path string(uuid) true Client Id of order which should be closed.

Example responses

404 Response

{
  "error": "Order not found."
}

Responses

Status Meaning Description Schema
204 No Content Order cancellation has been submitted None
404 Not Found Order not found, it might be already closed Error

Trades For Order

Code samples

curl --request GET \
  --url https://example.com/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08/trades \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08/trades", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08/trades")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/orders/{order_id}/trades

Get trade information for a specific order.

Parameters

Name In Type Required Description
order_id path string(uuid) true none

Example responses

200 Response

{
  "trade_history": [
    {
      "fee": {
        "collection_type": "STANDARD"
      },
      "trade": {
        "trade_id": "ec82896f-fd1b-4cbb-89df-a9da85ccbb4b",
        "order_id": "cab1ca1d-8102-4e97-b7a0-b53f66c811d0",
        "account_holder": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
        "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
        "amount": "0.04123",
        "side": "SELL",
        "instrument_code": "BTC_USDT",
        "price": "10159.76",
        "time": "2019-08-23T09:33:52.433Z",
        "sequence": 4
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK none TradeHistory

All Trades

Code samples

curl --request GET \
  --url https://example.com/account/trades \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = {
    'Accept': "application/json",
    'Authorization': "Bearer {access-token}"
    }

conn.request("GET", "/account/trades", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/account/trades")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer {access-token}")
  .asString();

GET /account/trades

Return a paginated report on past trades, sorted by timestamp (newest first). If you want to query specific time frame parameters, from and to are mandatory, otherwise it will start from the latest trades.

Note: After the FAST upgrade this endpoint will not return data from the legacy Exchange. You can still retrieve legacy data using the export functionality available on the UI.

Parameters

Name In Type Required Description
from query MarketTime false Defines start of a query search
to query MarketTime false Defines end of a query search
instrument_code query Instrument false Filter order history by instrument_code
max_page_size query string false Set max desired page size. If no value is provided, by default a maximum of 100 results per page are returned. The maximum upper limit is 100 results per page.
cursor query string false Pointer specifying the position from which the next pages should be returned.

Example responses

200 Response

{
  "trade_history": [
    {
      "trade": {
        "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
        "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
        "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "amount": "123.456",
        "side": "BUY",
        "instrument_code": "BTC_EUR",
        "price": "123.456",
        "time": "2019-08-24T14:15:22Z",
        "price_tick_sequence": 0,
        "sequence": 123456789
      },
      "fee": {
        "collection_type": "string"
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK none TradeHistory

Schemas

BigDecimal

"123.456"

A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected. Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).

Properties

Name Type Required Description
anonymous string false A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).

NanoTime

0

Timestamp in nano seconds.

Properties

Name Type Required Description
anonymous number false Timestamp in nano seconds.

MarketTime

"2019-08-24T14:15:22Z"

Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.

Properties

Name Type Required Description
anonymous string(date-time) false Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.

AccountSequence

123456789

Global monotonically-increasing numerical sequence bound to account activity.

Properties

Name Type Required Description
anonymous number false Global monotonically-increasing numerical sequence bound to account activity.

Currency

{
  "code": "BTC",
  "precision": 8
}

Describes each currency with unique currency code and precision which is allowed.

Properties

Name Type Required Description
code CurrencyCode true Currency code.
precision integer true Precision the currency is traded with.

CurrencyCode

"BTC"

Currency code.

Properties

Name Type Required Description
anonymous string false Currency code.

Instrument

"BTC_EUR"

The instrument denotes unique market identifier. Both base and quote must be valid currency codes.

Properties

Name Type Required Description
anonymous string false The instrument denotes unique market identifier. Both base and quote must be valid currency codes.

TimeGranularity

{
  "unit": "MINUTES",
  "period": 1
}

A length of time defined by unit and period used to identify the granularity of candlestick. For possible combinations see each property's documentation.

Properties

Name Type Required Description
unit TimeGranularityUnit true none
period TimeGranularityPeriod true Combined with the unit, supported resolutions are 1, 5, 15, 30 MINUTES & 1, 4 HOURS & 1 DAYS & 1 WEEKS & 1 MONTHS.

TimeGranularityPeriod

1

Combined with the unit, supported resolutions are 1, 5, 15, 30 MINUTES & 1, 4 HOURS & 1 DAYS & 1 WEEKS & 1 MONTHS.

Properties

Name Type Required Description
anonymous number false Combined with the unit, supported resolutions are 1, 5, 15, 30 MINUTES & 1, 4 HOURS & 1 DAYS & 1 WEEKS & 1 MONTHS.

TimeGranularityUnit

"MINUTES"

Properties

Name Type Required Description
anonymous string false none

Enumerated Values

Property Value
anonymous MINUTES
anonymous HOURS
anonymous DAYS
anonymous WEEKS
anonymous MONTHS

MarketTick

{
  "instrument_code": "BTC_EUR",
  "state": "NEW",
  "base_volume": "123.456",
  "high": "123.456",
  "last_price": "123.456",
  "low": "123.456",
  "price_change_percentage": "123.456",
  "price_change": "123.456",
  "quote_volume": "123.456",
  "sequence": 123456
}

*Statistics on market activity within the last 24 hours. Market ticks are updated on every trade of a market and use a sliding window with minutely granularity to calculate statistics on activity with the last 24 hours. *

Properties

Name Type Required Description
instrument_code Instrument true Code of the described market.
state string true Current status of the market.
base_volume BigDecimal true Volume within the last 24 hours in the base currency.
high BigDecimal true Highest matched price within the last 24 hours.
last_price BigDecimal true Price of the last trade.
low BigDecimal true Lowest matched price within the last 24 hours.
price_change_percentage BigDecimal true Relative price movement in the last 24 hours.
price_change BigDecimal true Difference between the price 24 hours ago and now.
quote_volume BigDecimal true Volume within the last 24 hours in the quote currency.
sequence integer true Monotonically increasing sequence number of the market tick.

Enumerated Values

Property Value
state NEW
state POST_ONLY
state ACTIVE
state SUSPENDED
state IN_MAINTENANCE
state CLOSED
state UNDEFINED

Account

{
  "account_id": "08d84399-f5e2-46ca-846b-960aa699b69c",
  "balances": [
    {
      "account_id": "08d84399-f5e2-46ca-846b-960aa699b69c",
      "currency_code": "BTC",
      "change": "123.456",
      "available": "123.456",
      "locked": "123.456",
      "sequence": 123456789,
      "time": "2019-08-24T14:15:22Z"
    }
  ]
}

Account details of a registered user's balance(s).

Properties

Name Type Required Description
account_id string(uuid) true Unique identifier for account.
balances [Balance] true [Account balance for one single currency]

Balance

{
  "account_id": "08d84399-f5e2-46ca-846b-960aa699b69c",
  "currency_code": "BTC",
  "change": "123.456",
  "available": "123.456",
  "locked": "123.456",
  "sequence": 123456789,
  "time": "2019-08-24T14:15:22Z"
}

Account balance for one single currency

Properties

Name Type Required Description
account_id string(uuid) true Unique identifier for account.
currency_code CurrencyCode true Currency in which the balance is.
change BigDecimal true This value denotes the last change that was made on the balance.
available BigDecimal true Denotes all available balance to the user.
locked BigDecimal true Denotes all currently locked balance in orders.
sequence AccountSequence true Global monotonically-increasing numerical sequence bound to account activity.
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.

Order

{
  "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
  "account_id": "1eb2ad5d-55f1-40b5-bc92-7dc05869e905",
  "client_id": "2677aeb3-8b36-48b4-a44d-342a772724d7",
  "instrument_code": "BTC_EUR",
  "amount": "123.456",
  "filled_amount": "123.456",
  "side": "BUY",
  "type": "LIMIT",
  "status": "OPEN",
  "sequence": 123456789,
  "order_book_sequence": 0,
  "update_modification_sequence": 0,
  "price": "123.456",
  "average_price": "123.456",
  "reason": "INSUFFICIENT_FUNDS",
  "time": "2019-08-24T14:15:22Z",
  "time_in_force": "GOOD_TILL_CANCELLED",
  "time_last_updated": "2019-08-24T14:15:22Z",
  "expire_after": "2019-08-24T14:15:22Z",
  "is_post_only": false,
  "time_triggered": "2019-08-24T14:15:22Z",
  "trigger_price": "123.456",
  "total_fee": "123.456",
  "fee_currency": "BTC"
}

Properties

Name Type Required Description
order_id string(uuid) true Uniquely identifies order.
account_id string(uuid) true Uniquely identifies account.
client_id string(uuid) false Unique idenfier defined by client for this order
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
amount BigDecimal true The amount of currency for this order
filled_amount BigDecimal true The already filled amount of currency for this order
side Side true Direction of the order
type string true The type of the order
status string true An order is tracked in the system with a specific status. If an order is successfully executed, then it is considered to be in the state OPEN and is submitted to the order book. If an order validation fails, the order status is updated to REJECTED, specifying the reason for the rejection. If the system fails to process an order due to unforeseen service disruptions, then the order status is updated to FAILED and the user should re-submit the order.
sequence AccountSequence true Global monotonically-increasing numerical sequence bound to account activity.
order_book_sequence OrderBookSequence true Highest orderbook sequence recorded for the order.
update_modification_sequence number false Last orderbook sequence which was emmited by update order modification (changing Amount of placed order), this field contains an orderbook sequence of such modification which has been already applied to the order.
price BigDecimal true The price at which the order is set to execute. Applicable to LIMIT and STOP orders.
average_price BigDecimal true Weighed average price of all trades belonging to this order. Missing if there are no trades for this order.
reason string false Reason specifying why an order was rejected. Only applicable to order status REJECTED and FILLED_REJECTED.
time MarketTime true The time at which the order was executed.
time_in_force string false Only applicable to LIMIT orders. If IMMEDIATE_OR_CANCELLED is specified then the order must be filled immediately, only at the limit price or better. If the order cannot be filled immediately or fully, the unfilled portion will be cancelled. Alternatively, FILL_OR_KILL instructs the the exchange to either fully-fill the limit order at the desired price of cancel it automatically. If none is specified then GOOD_TILL_CANCELLED is considered. Lastly, if GOOD_TILL_TIME is specified, client is also required to provide a valid expiration date time.
time_last_updated MarketTime true The time at which the order was last updated, i.e. the order status changed.
expire_after MarketTime false Valid MarketTime adjusted to minutely granularity
is_post_only boolean false Only applicable to GOOD_TILL_CANCELLED and GOOD_TILL_TIME as time-in-force. When set to true (defaults to false), the order will be executed with a booking guarantee unless it results in a price match in which case it gets automatically cancelled.
time_triggered MarketTime false The time at which the STOP order was triggered.
trigger_price BigDecimal false The price at which the STOP order is set to trigger conversion into a LIMIT order. Only applicable to STOP orders.
total_fee BigDecimal false The total fee amount paid with this order.
fee_currency CurrencyCode false The currency this order's fees were paid in.

Enumerated Values

Property Value
type LIMIT
type MARKET
type STOP
status OPEN
status STOP_TRIGGERED
status FILLED
status FILLED_FULLY
status FILLED_CLOSED
status FILLED_REJECTED
status REJECTED
status CLOSED
status FAILED
reason INSUFFICIENT_FUNDS
reason INSUFFICIENT_LIQUIDITY
reason SELF_TRADE_PREVENTED
time_in_force GOOD_TILL_CANCELLED
time_in_force GOOD_TILL_TIME
time_in_force IMMEDIATE_OR_CANCELLED
time_in_force FILL_OR_KILL

OrderSubmitted

{
  "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
  "client_id": "5b3fa7ba-57d3-4017-a65b-d57dcd2db643",
  "account_id": "1eb2ad5d-55f1-40b5-bc92-7dc05869e905",
  "instrument_code": "BTC_EUR",
  "amount": "123.456",
  "filled_amount": "123.456",
  "side": "BUY",
  "type": "LIMIT",
  "price": "123.456",
  "time": "2019-08-24T14:15:22Z",
  "time_in_force": "GOOD_TILL_CANCELLED",
  "is_post_only": false,
  "trigger_price": "123.456"
}

Properties

Name Type Required Description
order_id string(uuid) true Uniquely identifies order.
client_id string(uuid) false User specified client_id for this order. It is used if you need assign custom UUIDs to the orders to help keeping track of them.
account_id string(uuid) true Uniquely identifies account.
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
amount BigDecimal true The amount of currency for this order
filled_amount BigDecimal true The already filled amount of currency for this order
side Side true Direction of the order
type string true The type of the order
price BigDecimal true The price at which the order is set to execute. Applicable to LIMIT and STOP orders.
time MarketTime true The time at which the order was executed.
time_in_force string false Only applicable to LIMIT orders. If IMMEDIATE_OR_CANCELLED is specified then the order must be filled immediately, only at the limit price or better. If the order cannot be filled immediately or fully, the unfilled portion will be cancelled. Alternatively, FILL_OR_KILL instructs the the exchange to either fully-fill the limit order at the desired price of cancel it automatically. If none is specified then GOOD_TILL_CANCELLED is considered. Lastly, if GOOD_TILL_TIME is specified, client is also required to provide a valid expiration date time.
is_post_only boolean false Only applicable to GOOD_TILL_CANCELLED and GOOD_TILL_TIME as time-in-force. When set to true (defaults to false), the order will be executed with a booking guarantee unless it results in a price match in which case it gets automatically cancelled.
trigger_price BigDecimal false The price at which the STOP order is set to trigger conversion into a LIMIT order. Only applicable to STOP orders.

Enumerated Values

Property Value
type LIMIT
type MARKET
type STOP
time_in_force GOOD_TILL_CANCELLED
time_in_force GOOD_TILL_TIME
time_in_force IMMEDIATE_OR_CANCELLED
time_in_force FILL_OR_KILL

OrderBookSequence

0

monotonically increasing sequence number of single increments which progresses whenever order book changes due to market activity. Market data carrying this sequence is always totally ordered.

Properties

Name Type Required Description
anonymous number false monotonically increasing sequence number of single increments which progresses whenever order book changes due to market activity. Market data carrying this sequence is always totally ordered.

PriceTickSequence

0

monotonically increasing sequence number of single increments which progresses whenever a new price is emmitted due to trading activity. Market data carrying this sequence is always totally ordered.

Properties

Name Type Required Description
anonymous number false monotonically increasing sequence number of single increments which progresses whenever a new price is emmitted due to trading activity. Market data carrying this sequence is always totally ordered.

OrderBookEntry

{
  "price": "123.456",
  "amount": "123.456",
  "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
}

Represent bid and ask entries in a (compiled) orderbook

Properties

Name Type Required Description
price BigDecimal true Price of the price level.
amount BigDecimal true Size of the price level.
order_id string(uuid) false If the entry represents an individual order, its unique id

OrderBook

{
  "instrument_code": "BTC_EUR",
  "time": 0,
  "sequence": 12345,
  "bids": [
    {
      "price": "123.456",
      "amount": "123.456",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
    }
  ],
  "asks": [
    {
      "price": "123.456",
      "amount": "123.456",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
    }
  ]
}

A snapshot of the compiled order book state

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
time NanoTime true Timestamp in nano seconds.
sequence number false The value of the current order book sequence. See orderbook sequencing for more details.
bids [OrderBookEntry] true [Represent bid and ask entries in a (compiled) orderbook]
asks [OrderBookEntry] true [Represent bid and ask entries in a (compiled) orderbook]

OrderBookLevelOne

{
  "instrument_code": "BTC_EUR",
  "time": "2019-08-24T14:15:22Z",
  "sequence": 0,
  "bids": [
    {
      "price": "123.456",
      "amount": "123.456",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
    }
  ],
  "asks": {
    "description": null,
    "properties": null,
    "required": null
  }
}

A snapshot of the order book state

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
sequence OrderBookSequence false monotonically increasing sequence number of single increments which progresses whenever order book changes due to market activity. Market data carrying this sequence is always totally ordered.
bids [OrderBookEntry] true [Represent bid and ask entries in a (compiled) orderbook]
asks object true none
» $ref any false none

Candlestick

{
  "last_sequence": 12345,
  "instrument_code": "BTC_EUR",
  "granularity": {
    "unit": "MINUTES",
    "period": 1
  },
  "high": "123.456",
  "low": "123.456",
  "open": "123.456",
  "close": "123.456",
  "total_amount": "123.456",
  "volume": "123.456",
  "time": "2019-08-24T14:15:22Z"
}

Candlestick representing price action for a given period

Properties

Name Type Required Description
last_sequence number true The value of the sequence field of the last price tick (see PriceTickSequence) considered for this candlestick (see Websocket channel Price Ticks)
instrument_code Instrument true The instrument/market the candlestick belongs to
granularity TimeGranularity true The time resolution of the candlestick
high BigDecimal true The highest price during the candlestick duration
low BigDecimal true The lowest price during the candlestick duration
open BigDecimal true The opening price of the candlestick period
close BigDecimal true The closing price of the candlestick period
total_amount BigDecimal true The total amount in base currency of trades on the market during the candlestick period
volume BigDecimal true The total volume in quote currency of trades on the market during the candlestick period. Volume is defined as amount multiplied by price.
time MarketTime true Cutoff time for the candlestick. It is the time at the right end of the candlestick interval window.

CreateOrder

{
  "instrument_code": "BTC_EUR",
  "type": "LIMIT",
  "side": "BUY",
  "amount": "123.456",
  "price": "123.456",
  "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
  "time_in_force": "GOOD_TILL_CANCELLED",
  "expire_after": "2019-08-24T14:15:22Z",
  "is_post_only": false
}

A wrapper for accepted order types which can be submitted for execution.

Properties

oneOf

Name Type Required Description
anonymous CreateLimitOrder false none

xor

Name Type Required Description
anonymous CreateMarketOrder false none

xor

Name Type Required Description
anonymous CreateStopOrder false none

CreateLimitOrder

{
  "instrument_code": "BTC_EUR",
  "type": "LIMIT",
  "side": "BUY",
  "amount": "123.456",
  "price": "123.456",
  "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
  "time_in_force": "GOOD_TILL_CANCELLED",
  "expire_after": "2019-08-24T14:15:22Z",
  "is_post_only": false
}

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
type string true The type of the order
side Side true Direction of the Order
amount BigDecimal true The number of units to open order for
price BigDecimal false Is mandatory for LIMIT and STOP orders. Setting price for MARKET order type is ignored as this order type is always executed against instrument pricing available at the execution time.
client_id string(uuid) false The optional client order id prevents duplicated orders. Should be a unique and valid UUID of version 4 . An order, with a client order id that already has been processed, will be rejected.
time_in_force string false Only applicable to LIMIT orders. If IMMEDIATE_OR_CANCELLED is specified then the order must be filled immediately, only at the limit price or better. If the order cannot be filled immediately or fully, the unfilled portion will be cancelled. Alternatively, FILL_OR_KILL instructs the the exchange to either fully-fill the limit order at the desired price of cancel it automatically. If none is specified then GOOD_TILL_CANCELLED is considered.
expire_after MarketTime false Only applicable to GOOD_TILL_TIME as time-in-force. The expiration time must be a valid MarketTime in the future relative to observed server time adjusted to minutely granularity.
is_post_only boolean false Only applicable to GOOD_TILL_CANCELLED and GOOD_TILL_TIME as time-in-force. When set to true (defaults to false), the order will be executed with a booking guarantee unless it results in a price match in which case it gets automatically cancelled.

Enumerated Values

Property Value
type LIMIT
time_in_force GOOD_TILL_CANCELLED
time_in_force GOOD_TILL_TIME
time_in_force IMMEDIATE_OR_CANCELLED
time_in_force FILL_OR_KILL

CreateStopOrder

{
  "instrument_code": "BTC_EUR",
  "type": "STOP",
  "side": "BUY",
  "amount": "123.456",
  "price": "123.456",
  "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
  "trigger_price": "123.456"
}

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
type string true The type of the order
side Side true Direction of the Order
amount BigDecimal true The number of units to open order for
price BigDecimal true Is mandatory for LIMIT and STOP orders. Setting price for MARKET order type is ignored as this order type is always executed against instrument pricing available at the execution time.
client_id string(uuid) false The optional client order id prevents duplicated orders. Should be a unique and valid UUID of version 4 . An order, with a client order id that already has been processed, will be rejected.
trigger_price BigDecimal true Is mandatory for STOP orders. A stop-limit order will be executed at a specified price (see price), or better, after the given trigger price has been reached.

Enumerated Values

Property Value
type STOP

CreateMarketOrder

{
  "instrument_code": "BTC_EUR",
  "type": "MARKET",
  "side": "BUY",
  "amount": "123.456",
  "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206"
}

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
type string true The type of the order
side Side true Direction of the Order
amount BigDecimal true The number of units to open order for
client_id string(uuid) false The optional client order id prevents duplicated orders. Should be a unique and valid UUID of version 4 . An order, with a client order id that already has been processed, will be rejected.

Enumerated Values

Property Value
type MARKET

FeeGroupId

"default"

Unique identifier of a FeeGroup.

Properties

Name Type Required Description
anonymous string false Unique identifier of a FeeGroup.

FeeTier

{
  "fee_group_id": "default",
  "volume": "123.456",
  "maker_fee": "123.456",
  "taker_fee": "123.456"
}

Properties

Name Type Required Description
fee_group_id FeeGroupId true Identifier of the fee group
volume BigDecimal true Volume beyond which this fee tier is activated
maker_fee BigDecimal true Percentage fee rate that will be used for fee calculation when trade is settled as MAKER
taker_fee BigDecimal true Percentage fee rate that will be used for fee calculation when trade is settled as TAKER

AccountFeeGroup

{
  "account_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
  "running_trading_volume": "123.456",
  "running_volume": "123.456",
  "running_volume_currency": "string",
  "active_fee_tier": {
    "fee_group_id": "default",
    "volume": "123.456",
    "maker_fee": "123.456",
    "taker_fee": "123.456"
  },
  "collect_fees_in_best": true,
  "fee_discount_rate": "123.456",
  "minimum_price_value": "123.456",
  "fee_group_id": "default",
  "fee_tiers": [
    {
      "fee_group_id": "default",
      "volume": "123.456",
      "maker_fee": "123.456",
      "taker_fee": "123.456"
    }
  ]
}

Properties

Name Type Required Description
account_id string(uuid) true Unique identifier of account
running_trading_volume BigDecimal true The accumulated trading volume in BTC. This field is deprecated and will be removed soon. It is replaced by running_volume and running_volume_currency.
running_volume BigDecimal true The accumulated trading volume denoted in running_volume_currency.
running_volume_currency string true The code of the currency running_volume is denoted in.
active_fee_tier FeeTier true Currently active fee tier for user
collect_fees_in_best boolean true Flag to collect fees in BEST
fee_discount_rate BigDecimal true A discount rate applied to your fees, if you opted in to pay your fees using BEST
minimum_price_value BigDecimal true The minimum guaranteed price of 1 BEST in EUR, if you opted in to pay your fees using BEST
fee_group_id FeeGroupId true Unique identifier of a FeeGroup.
fee_tiers [FeeTier] true Specific fee tiers for the fee group

FeeGroup

{
  "fee_group_id": "default",
  "display_text": "Default fee group",
  "volume_currency": "EUR",
  "fee_tiers": [
    {
      "fee_group_id": "default",
      "volume": "123.456",
      "maker_fee": "123.456",
      "taker_fee": "123.456"
    }
  ],
  "fee_discount_rate": "123.456",
  "minimum_price_value": "123.456"
}

Properties

Name Type Required Description
fee_group_id FeeGroupId true Unique identifier of a FeeGroup.
display_text string true Textual description of a Fee Group
volume_currency string false The code of the currency volume is denoted in.
fee_tiers [FeeTier] true Fee tiers that belong to a specific fee tier.
fee_discount_rate BigDecimal true A discount rate applied to your fees, if you opted in to pay your fees using BEST
minimum_price_value BigDecimal true The minimum guaranteed price of 1 BEST in EUR, if you opted in to pay your fees using BEST

Trade

{
  "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
  "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
  "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "amount": "123.456",
  "side": "BUY",
  "instrument_code": "BTC_EUR",
  "price": "123.456",
  "time": "2019-08-24T14:15:22Z",
  "price_tick_sequence": 0,
  "sequence": 123456789
}

Properties

Name Type Required Description
trade_id string(uuid) true Unique identifier for trade
order_id string(uuid) true Unique identifier for order
account_holder string(uuid) false Unique identifier for main account holder id
account_id string(uuid) true Unique identifier for account id
amount BigDecimal true This is the gross amount of transaction including fees.
side Side true Represents a side of Trade or Order. It can have values BUY and SELL.
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
price BigDecimal true A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
price_tick_sequence PriceTickSequence false monotonically increasing sequence number of single increments which progresses whenever a new price is emmitted due to trading activity. Market data carrying this sequence is always totally ordered.
sequence AccountSequence true Global monotonically-increasing numerical sequence bound to account activity.

Side

"BUY"

Represents a side of Trade or Order. It can have values BUY and SELL.

Properties

Name Type Required Description
anonymous string false Represents a side of Trade or Order. It can have values BUY and SELL.

Enumerated Values

Property Value
anonymous BUY
anonymous SELL

PriceTick

{
  "instrument_code": "BTC_EUR",
  "price": "123.456",
  "amount": "123.456",
  "volume": "123.456",
  "sequence": 0,
  "taker_side": "BUY",
  "time": "2019-08-24T14:15:22Z",
  "trade_timestamp": 1646366
}

Properties

Name Type Required Description
instrument_code Instrument true The instrument denotes unique market identifier. Both base and quote must be valid currency codes.
price BigDecimal true Price at which trade was matched
amount BigDecimal true Amount of the trade in base currency that was matched
volume BigDecimal true Volume of the trade in quote currency
sequence PriceTickSequence true monotonically increasing sequence number of single increments which progresses whenever a new price is emmitted due to trading activity. Market data carrying this sequence is always totally ordered.
taker_side Side true Denotes which side had the the taker of the trade.
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
trade_timestamp number true Time in epoch miliseconds.

TradeHistoryEntry

{
  "trade": {
    "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
    "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
    "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
    "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
    "amount": "123.456",
    "side": "BUY",
    "instrument_code": "BTC_EUR",
    "price": "123.456",
    "time": "2019-08-24T14:15:22Z",
    "price_tick_sequence": 0,
    "sequence": 123456789
  },
  "fee": {
    "collection_type": "string"
  }
}

Single trade recorded for an order.

Properties

Name Type Required Description
trade Trade true Trade object containing all information relevant to the trade.
fee object true Fee applied account balance as part of trade settlement.
» collection_type string true Fee amount that was payed with this specific trade.

TradeHistoryEntryWithBestFees

{
  "trade": {
    "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
    "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
    "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
    "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
    "amount": "123.456",
    "side": "BUY",
    "instrument_code": "BTC_EUR",
    "price": "123.456",
    "time": "2019-08-24T14:15:22Z",
    "price_tick_sequence": 0,
    "sequence": 123456789
  },
  "fee": {
    "fee_amount": "123.456",
    "fee_percentage": "123.456",
    "fee_group_id": "default",
    "running_trading_volume": "123.456",
    "fee_currency": "BEST",
    "fee_type": "TAKER",
    "applied_best_eur_rate": "1.04402"
  }
}

BEST fee collection is deprecated, only legacy trades will have these specific fields

Properties

Name Type Required Description
trade Trade true Trade object containing all information relevant to the trade.
fee object true Fee applied account balance as part of trade settlement.
» fee_amount BigDecimal true Fee amount that was payed with this specific trade.
» fee_percentage BigDecimal true Fee percentage that was used to calculate fee amount.
» fee_group_id FeeGroupId true Unique identifier of a FeeGroup.
» running_trading_volume BigDecimal true Represent a running trading volume at the time of trade settlement.
» fee_currency string true none
» fee_type string true Fee type used to the fee calculation, corresponding to how the trade was matched.
» applied_best_eur_rate string false The applied BEST/EUR exchange rate for the trade. Only applicable to trades with BEST fee collection enabled.

Enumerated Values

Property Value
fee_type TAKER
fee_type MAKER

OrderHistoryEntry

{
  "order": {
    "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
    "account_id": "1eb2ad5d-55f1-40b5-bc92-7dc05869e905",
    "client_id": "2677aeb3-8b36-48b4-a44d-342a772724d7",
    "instrument_code": "BTC_EUR",
    "amount": "123.456",
    "filled_amount": "123.456",
    "side": "BUY",
    "type": "LIMIT",
    "status": "OPEN",
    "sequence": 123456789,
    "order_book_sequence": 0,
    "update_modification_sequence": 0,
    "price": "123.456",
    "average_price": "123.456",
    "reason": "INSUFFICIENT_FUNDS",
    "time": "2019-08-24T14:15:22Z",
    "time_in_force": "GOOD_TILL_CANCELLED",
    "time_last_updated": "2019-08-24T14:15:22Z",
    "expire_after": "2019-08-24T14:15:22Z",
    "is_post_only": false,
    "time_triggered": "2019-08-24T14:15:22Z",
    "trigger_price": "123.456",
    "total_fee": "123.456",
    "fee_currency": "BTC"
  },
  "trades": [
    {
      "trade": {
        "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
        "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
        "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "amount": "123.456",
        "side": "BUY",
        "instrument_code": "BTC_EUR",
        "price": "123.456",
        "time": "2019-08-24T14:15:22Z",
        "price_tick_sequence": 0,
        "sequence": 123456789
      },
      "fee": {
        "collection_type": "string"
      }
    }
  ]
}

Active or Inactive order, for orders with the status FILLED, FILLED_FULLY, FILLED_CLOSED and FILLED_REJECTED, information about trades and fees is returned.

Properties

Name Type Required Description
order Order true none
trades [oneOf] false one or more trades if this order is FILLED

oneOf

Name Type Required Description
» anonymous TradeHistoryEntry false Single trade recorded for an order.

xor

Name Type Required Description
» anonymous TradeHistoryEntryWithBestFees false BEST fee collection is deprecated, only legacy trades will have these specific fields

OrderHistory

{
  "order_history": [
    {
      "order": {
        "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
        "account_id": "1eb2ad5d-55f1-40b5-bc92-7dc05869e905",
        "client_id": "2677aeb3-8b36-48b4-a44d-342a772724d7",
        "instrument_code": "BTC_EUR",
        "amount": "123.456",
        "filled_amount": "123.456",
        "side": "BUY",
        "type": "LIMIT",
        "status": "OPEN",
        "sequence": 123456789,
        "order_book_sequence": 0,
        "update_modification_sequence": 0,
        "price": "123.456",
        "average_price": "123.456",
        "reason": "INSUFFICIENT_FUNDS",
        "time": "2019-08-24T14:15:22Z",
        "time_in_force": "GOOD_TILL_CANCELLED",
        "time_last_updated": "2019-08-24T14:15:22Z",
        "expire_after": "2019-08-24T14:15:22Z",
        "is_post_only": false,
        "time_triggered": "2019-08-24T14:15:22Z",
        "trigger_price": "123.456",
        "total_fee": "123.456",
        "fee_currency": "BTC"
      },
      "trades": [
        {
          "trade": {
            "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
            "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
            "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
            "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
            "amount": "123.456",
            "side": "BUY",
            "instrument_code": "BTC_EUR",
            "price": "123.456",
            "time": "2019-08-24T14:15:22Z",
            "price_tick_sequence": 0,
            "sequence": 123456789
          },
          "fee": {
            "collection_type": "string"
          }
        }
      ]
    }
  ],
  "max_page_size": 100,
  "cursor": "string"
}

Paginated collection of account orders

Properties

Name Type Required Description
order_history [OrderHistoryEntry] true [Active or Inactive order, for orders with the status FILLED, FILLED_FULLY, FILLED_CLOSED and FILLED_REJECTED, information about trades and fees is returned.]
max_page_size integer true Maximum number of returned results
cursor string false Cursor indicating if there are more results available to be fetched. Please use this cursor in the next query.

TradeHistory

{
  "trade_history": [
    {
      "trade": {
        "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
        "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
        "account_holder": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
        "amount": "123.456",
        "side": "BUY",
        "instrument_code": "BTC_EUR",
        "price": "123.456",
        "time": "2019-08-24T14:15:22Z",
        "price_tick_sequence": 0,
        "sequence": 123456789
      },
      "fee": {
        "collection_type": "string"
      }
    }
  ]
}

Paginated collection of account trades

Properties

Name Type Required Description
trade_history [oneOf] true none

oneOf

Name Type Required Description
» anonymous TradeHistoryEntry false Single trade recorded for an order.

xor

Name Type Required Description
» anonymous TradeHistoryEntryWithBestFees false BEST fee collection is deprecated, only legacy trades will have these specific fields

DepositHistory

{
  "deposit_history": [
    {
      "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
      "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
      "amount": "123.456",
      "funds_source": "INTERNAL",
      "time": "2019-08-24T14:15:22Z",
      "currency": "BTC",
      "fee_amount": "123.456",
      "fee_currency": "BTC",
      "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
    }
  ],
  "max_page_size": 100,
  "cursor": "string"
}

Paginated collection of deposits

Properties

Name Type Required Description
deposit_history [Deposit] true none
max_page_size integer true Maximum number of returned results.
cursor string true Cursor indicating if there are more results available to be fetched. Please use this cursor in the next query.

WithdrawalHistory

{
  "withdrawal_history": [
    {
      "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
      "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
      "amount": "123.456",
      "time": "2019-08-24T14:15:22Z",
      "funds_source": "INTERNAL",
      "currency": "BTC",
      "fee_amount": "123.456",
      "fee_currency": "BTC",
      "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
      "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
    }
  ],
  "max_page_size": 100,
  "cursor": "string"
}

Paginated collection of withdrawals

Properties

Name Type Required Description
withdrawal_history [Withdrawal] true none
max_page_size integer true Maximum number of returned results.
cursor string true Cursor indicating if there are more results available to be fetched. Please use this cursor in the next query.

Deposit

{
  "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
  "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "amount": "123.456",
  "funds_source": "INTERNAL",
  "time": "2019-08-24T14:15:22Z",
  "currency": "BTC",
  "fee_amount": "123.456",
  "fee_currency": "BTC",
  "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
}

Properties

Name Type Required Description
transaction_id string true Unique identifier for transaction
account_id string(uuid) true Unique identifier for account id
amount BigDecimal true This is the net amount of transaction excluding fees.
funds_source FundsSource true Source of funds, which will be EXTERNAL in most cases.
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
currency CurrencyCode true Currency code.
fee_amount BigDecimal true A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
fee_currency CurrencyCode true Currency code.
related_transaction_id string(uuid) false A transaction id of the related transaction, used in failed transactions only.

Withdrawal

{
  "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
  "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "amount": "123.456",
  "time": "2019-08-24T14:15:22Z",
  "funds_source": "INTERNAL",
  "currency": "BTC",
  "fee_amount": "123.456",
  "fee_currency": "BTC",
  "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
  "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
}

Properties

Name Type Required Description
transaction_id string true Unique identifier for transaction
account_id string(uuid) true Unique identifier for account id
amount BigDecimal true This is the net amount of transaction excluding fees.
time MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
funds_source FundsSource true Source of funds, which will be EXTERNAL in most cases.
currency CurrencyCode true Currency code.
fee_amount BigDecimal true A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
fee_currency CurrencyCode true Currency code.
blockchain_transaction_id string false Blockchain transaction id of the withdrawal transaction
related_transaction_id string(uuid) false A transaction id of the related transaction, used in failed transactions only.

FundsSource

"INTERNAL"

Source of funds, which will be EXTERNAL in most cases.

Properties

Name Type Required Description
anonymous string false Source of funds, which will be EXTERNAL in most cases.

Enumerated Values

Property Value
anonymous INTERNAL
anonymous EXTERNAL

Error

{
  "error": "SOME_ERROR_CODE"
}

Default format for all errors returned by REST API. Explanation of error codes can be found here

Properties

Name Type Required Description
error string false Error code related to the problem

WithdrawCryptoBody

{
  "currency": "BTC",
  "amount": "123.456",
  "recipient": {
    "address": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
    "destination_tag": "",
    "dt_type": "memo_id"
  }
}

Body of an POST request used for crypto withdrawal

Properties

Name Type Required Description
currency CurrencyCode true Currency code of crypto asset
amount BigDecimal true Amount to withdraw
recipient object true none
» address string true Crypo address to which should be the transfer executed.
» destination_tag string false Destination tag for the transaction, if the transaction requires it.
» dt_type string false Destination tag type specifies which type of destination tag should be used if it's required to choose. It is only required for XLM currency.

Enumerated Values

Property Value
dt_type memo_id
dt_type memo_text

CryptoWithdraw

{
  "amount": "123.456",
  "fee": "123.456",
  "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
  "destination_tag": "",
  "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
}

Respose for an crypto withdrawal request.

Properties

Name Type Required Description
amount BigDecimal true Amount of withdrawal
fee BigDecimal false Fee of the withdrawal
recipient string false Address of the recipient
destination_tag string false Destination tag used if required.
transaction_id string(uuid) false Transaction id of the executed withdrawal

WithdrawalRequestBody

{
  "currency_code": "EUR",
  "amount": "123.45",
  "payout_account_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
  "type": "SEPA"
}

Body of an POST request used for withdrawal

Properties

Name Type Required Description
currency_code string true Currency code of fiat or crypto asset
amount string true Amount to withdraw
payout_account_id string(uuid) true Id of an payout account which is tied to specific bank account and transfer method.
type TransferMethodType true none

PayoutAccountResponse

{
  "payout_accounts": [
    {
      "payout_account_id": "7b43b931-10c4-4fe0-bc72-eb75fb1fee71",
      "account_holder_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
      "currency": "BTC",
      "type": "SEPA",
      "state": "PENDING",
      "created": "2019-08-24T14:15:22Z",
      "label": "bank-number-one",
      "blinc_id": 833333333333,
      "account_holder_name": "John Doe",
      "iban": "IT60X0542811101000000123456",
      "bic": "AKROITMMXXX",
      "address": "Via Sant'Andrea, Milano MI, Italy",
      "country_code": "IT",
      "signet_address": "0x4a371d8809828f366bf67f142a6ec471752445ad",
      "bank_name": "BANCA",
      "bank_address": "Indirizzo Bancario Italy",
      "blockchain_address": "0xE4F8021d41fC886fB5Ef27Eb5999a9348E7b1b3c",
      "destination_tag": 123456,
      "destination_tag_type": "memo"
    }
  ]
}

Properties

Name Type Required Description
payout_accounts [PayoutAccount] false [Payout account of account holder which connects with external account]

PayoutAccountStatus

"PENDING"

Properties

Name Type Required Description
anonymous string false none

Enumerated Values

Property Value
anonymous PENDING
anonymous CREATED
anonymous DEACTIVATED

PayoutAccount

{
  "payout_account_id": "7b43b931-10c4-4fe0-bc72-eb75fb1fee71",
  "account_holder_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "currency": "BTC",
  "type": "SEPA",
  "state": "PENDING",
  "created": "2019-08-24T14:15:22Z",
  "label": "bank-number-one",
  "blinc_id": 833333333333,
  "account_holder_name": "John Doe",
  "iban": "IT60X0542811101000000123456",
  "bic": "AKROITMMXXX",
  "address": "Via Sant'Andrea, Milano MI, Italy",
  "country_code": "IT",
  "signet_address": "0x4a371d8809828f366bf67f142a6ec471752445ad",
  "bank_name": "BANCA",
  "bank_address": "Indirizzo Bancario Italy",
  "blockchain_address": "0xE4F8021d41fC886fB5Ef27Eb5999a9348E7b1b3c",
  "destination_tag": 123456,
  "destination_tag_type": "memo"
}

Payout account of account holder which connects with external account

Properties

Name Type Required Description
payout_account_id string(uuid) true none
account_holder_id string(uuid) false Unique identifier for account id
currency CurrencyCode true Currency code.
type TransferMethodType true none
state PayoutAccountStatus true none
created MarketTime true Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
label string true A user specified label
blinc_id number false Blinc id from the payout accounts for outgoing transactions(Only applicable to BLINC account)
account_holder_name string false none
iban string false none
bic string false none
address string false none
country_code string false none
signet_address string false none
bank_name string false none
bank_address string false none
blockchain_address string false none
destination_tag string false none
destination_tag_type string false none

Enumerated Values

Property Value
destination_tag_type memo
destination_tag_type message
destination_tag_type destinationTag

OrderBookSnapshot

{
  "instrument_code": "BTC_EUR",
  "time": 0,
  "sequence": 12345,
  "bids": [
    {
      "price": "123.456",
      "amount": "123.456",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
    }
  ],
  "asks": [
    {
      "price": "123.456",
      "amount": "123.456",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"
    }
  ]
}

A wrapper for two different layout of orderbook snapshot responses depending on which level is queried.

Properties

oneOf

Name Type Required Description
anonymous OrderBook false A snapshot of the compiled order book state

xor

Name Type Required Description
anonymous OrderBookLevelOne false A snapshot of the order book state

TransferMethodType

"SEPA"

Properties

Name Type Required Description
anonymous string false none

Enumerated Values

Property Value
anonymous BLINC
anonymous SEPA
anonymous SWIFT
anonymous BLOCKCHAIN
anonymous SUBACCOUNT_TRANSFER
anonymous CARD

Transaction

{
  "transaction_id": "0fec1e58-b197-4052-99cf-2218496c5482",
  "source_account": "0b96a69a-83bf-4bb3-9b52-1bfb05c01fa0",
  "destination_account": "424706b0-e56e-4efc-bbf8-a61e68ec05de",
  "account_holder_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
  "transfer_method_type": "SEPA",
  "direction": "INCOMING",
  "currency": "BTC",
  "amount": "123.456",
  "net_amount": "123.456",
  "transfer_status": "INITIATED",
  "user_requested_at": "2019-08-24T14:15:22Z",
  "user_confirmed_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "payout_account_label": "Testing account",
  "destination_blinc_id": 0,
  "iban": "AL35202111090000000001234567",
  "bic": "GBTYBKEN104",
  "fee_amount": "123.456",
  "blockchain_transaction_id": 1.0853838427549474e+76
}

Transactional representation of funds transfer

Properties

Name Type Required Description
transaction_id string(uuid) false none
source_account string(uuid) false none
destination_account string(uuid) false none
account_holder_id string(uuid) false Unique identifier for account holder
account_id string(uuid) false Unique identifier for account id
transfer_method_type TransferMethodType false none
direction string false none
currency CurrencyCode false Currency code.
amount BigDecimal false A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
net_amount BigDecimal false A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
transfer_status TransferStatus false none
user_requested_at MarketTime false Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
user_confirmed_at MarketTime false Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
completed_at MarketTime false Zoned date time value compliant with ISO 8601 which adheres to RFC3339. All market times are in UTC.
payout_account_label string false none
destination_blinc_id integer false Blinc id from the payout accounts for outgoing transactions(Only applicable to BLINC transfer_method_type)
iban string false iban from the payout accounts(Only applicable to SEPA/SWIFT transfer_method_type)
bic string false bic from the payout accounts(Only applicable to SEPA/SWIFT transfer_method_type)
fee_amount BigDecimal false A decimal unit. All decimal fields are of the type string to ensure that all floating-point arithmetic operations can be performed with precision. If they are not encoded as strings then the post requests will be rejected.
Any number in this format that is being used as input, is limited to contain a maximum of 19 digits in total (after and before decimal points).
blockchain_transaction_id string false Present for blockchain transactions. It's a hash for transaction on it's respective blockchain

Enumerated Values

Property Value
direction INCOMING
direction OUTGOING

TransactionHistory

{
  "cursor": "string",
  "max_page_size": 0,
  "transactions": [
    {
      "transaction_id": "0fec1e58-b197-4052-99cf-2218496c5482",
      "source_account": "0b96a69a-83bf-4bb3-9b52-1bfb05c01fa0",
      "destination_account": "424706b0-e56e-4efc-bbf8-a61e68ec05de",
      "account_holder_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
      "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
      "transfer_method_type": "SEPA",
      "direction": "INCOMING",
      "currency": "BTC",
      "amount": "123.456",
      "net_amount": "123.456",
      "transfer_status": "INITIATED",
      "user_requested_at": "2019-08-24T14:15:22Z",
      "user_confirmed_at": "2019-08-24T14:15:22Z",
      "completed_at": "2019-08-24T14:15:22Z",
      "payout_account_label": "Testing account",
      "destination_blinc_id": 0,
      "iban": "AL35202111090000000001234567",
      "bic": "GBTYBKEN104",
      "fee_amount": "123.456",
      "blockchain_transaction_id": 1.0853838427549474e+76
    }
  ]
}

Properties

Name Type Required Description
cursor string false An optional pointer to the next page, this field is omitted if there are no more pages for the query
max_page_size integer false Maximum number of returned results.
transactions [Transaction] true [Transactional representation of funds transfer]

TransferStatus

"INITIATED"

Properties

Name Type Required Description
anonymous string false none

Enumerated Values

Property Value
anonymous INITIATED
anonymous PENDING
anonymous CONFIRMED
anonymous DONE
anonymous CANCELLED
anonymous REJECTED
anonymous FAILED

undefined

REST API Overview

One Trading REST API delivers a comprehensive set of resources which clients can create, modify and query. All resources are defined under the following URL:

https://api.onetrading.com/fast/v1

Public Endpoints

Public endpoints are scoped for querying Exchange market data, allowing One Trading clients and visitors to gauge status of our order books in terms of provided liquidity and pricing.

Private Endpoints

Private endpoints are scoped to account-specific resources, allowing One Trading client to create, modify and query status for balances, orders and trades. These invocations require a valid API key that is sent in the HTTP header Authorization as a Bearer token.

Authorization: Bearer apiKey

An API key can be generated through our web user interface.

API Key

An API key can be generated through the user interface at https://onetrading.com/trading-accounts/account/api. Be aware that this API key is unique and valid only for the One Trading. This API key can have three distinct scopes, namely READ, TRADE and WITHDRAW. With the READ scope, you can read all private endpoints, the TRADE scope allows you to additionally create and cancel orders and the WITHDRAW scope allows you to deposit and withdraw funds from your account to the off-site wallets. You can also create an IP restriction on your API key so that it will be rejected if used by IP addresses that are not whitelisted. This is recommended additional security measure especially for an API key with scope WITHDRAW.

API key permissions required by specific endpoints are specified in the documentation.

Pagination

The One Trading REST API uses paginated results for endpoints that return historical trades and orders.

To paginate an array of results, the API uses cursors that indicate the current position in the array. To request the consecutive page of entries, the API user should specify the next cursor returned with previous response. Please note that the next request has to be same with the additional cursor parameter. The cursors we provide are backward only, as the history results we serve are always sorted by latest first.

GET /public/v1/account/orders?from=2019-10-06T22:00:00.000Z&to=2020-01-07T23:59:59.999Z&max_page_size=20&cursor=eyJhY2NvdW50X2lkIjp7InMiOiI1NTAwNWYzMC01YTlmLTExZTktOWQ1MS1kMzAxNTk1OGYyZmYifSwiZ2xvYmFsX29yZGVyX2luZGV4X2hhc2hfa2V5Ijp7InMiOiI1NTAwNWYzMC01YTlmLTExZTktOWQ1MS1kMzAxNTk1OGYyZmY6OklOQUNUSVZFIn0sInNvcnRfa2V5Ijp7InMiOiJPUkRFUjo6NzkwNDJhZWItYmViMy00ZTgzLWJhZTQtMTQ5ZDIyZjNmNzE5In0sImdsb2JhbF9vcmRlcl9pbmRleF9yYW5nZV9rZXkiOnsicyI6IjE1Nzg0Nzg1Mzk5OTMifX0=

Errors

{
  "error":"ERROR_CODE"
}

Valid requests will result in responses with HTTP 2xx status codes. Every other response in the HTTP 4xx range will return a well defined error in the response body.

Websocket API Overview

One Trading WSS API can be used to subscribe for a feed of real time data, such as price evolution or market state data.

In addition to the subscribe model, the API can allow clients to create and cancel orders by reusing the same established web socket connection.

Endpoint

🚀As part of our new FAST exchange, there are now 2 websocket URLs.

wss://streams.fast.onetrading.com?x-version=3 - TRADING, PRICE_TICKS, ORDER_BOOK

wss://garcon.fast.onetrading.com - ACCOUNT_HISTORY, MARKET_TICKER

Connectivity

A single web socket connection is only valid for 24 hours. After that the server will send out a message announcing a pending connection termination:

{
    "subscription": "SYSTEM",
    "time": "2019-01-01T01:01:01Z",
    "channel_name": "SYSTEM",
    "type": "CONNECTION_CLOSING"
}

There is a short grace period for the client to react by re-connecting and re-subscribing to the server. If no action is taken, then the server will close the connection with the status code 1000 and the reason PLEASE_RECONNECT.

Websocket clients must not send the Origin header when connecting. Otherwise, the handshake may fail and display a 403 Forbidden response.

Some calls require that the client sends the API token. Creating and cancelling orders, for instance, require a valid API token to be sent.
If the no API token is sent of if it is invalid, then the server will return an message like "{"error":"MISSING_PERMISSION"} and close the connection.

Subscription Channels

A subscriber may choose to subscribe to an arbitrary list of channels that suits his needs. Once successfully subscribed, the client will receive messages in real time as events occur.

Summary of publicly-available subscription channels:

Channel Name Description Availability Supports Subscription Updates URL
ORDER_BOOK price level feed delivering all bids and asks followed by incremental changes public yes wss://streams.fast.onetrading.com?x-version=3
PRICE_TICKS trading feed delivering all matched prices as they happen public yes wss://streams.fast.onetrading.com?x-version=3
MARKET_TICKER market stats feed public yes wss://garcon.fast.onetrading.com

A client may compose the above channels into a single websocket feed in any order or simply subscribe to all channels at once. However, only one subscription per channel is allowed.

Summary of authenticated subscription channels:

Channel Name Description Availability Supports Subscription Updates URL
ACCOUNT_HISTORY authenticated private channel delivering trading and funding activity authenticated no wss://garcon.fast.onetrading.com
TRADING authenticated private channel delivering trading activity authenticated no wss://streams.fast.onetrading.com?x-version=3

Protocol

Authenticate

All private channels require that the client authenticates first and then subscribes to the private channels. Clients should first send an AUTHENTICATE message, which contains the API token, and they can then subscribe to any private channel. If the supplied API token is valid, then it will be used to authorize subscriptions and requests for all private channels in this websocket connection.

{
  "type": "AUTHENTICATE",
  "api_token": "eyJ..."
}

If authentication succeeds, a confirmation is sent:

{
    "type": "AUTHENTICATED"
}

Once authenticated, the next step would be to subscribe to any of the private channels.

{
    "type": "SUBSCRIBE",
    "channels": [
      {
        "name": "TRADING"
      }
    ]
}

If the apikey is not valid or is missing required permissions the websocket connection is closed immediately with an error.

{
  "error" : "INVALID_APIKEY"
}

Subscribe

All messages are expected and delivered in strict JSON format. When a client wishes to initiate a subscription to one or more channels, a subscribe message is composed and sent to the endpoint. The detailed subscribe payloads are documented in the corresponding sections.

As an example, the following subscribe message activates the Order Book Channel and the Price Tick Channel.

{
    "type": "SUBSCRIBE",
    "channels": [
      {
        "name": "ORDER_BOOK",
        "instrument_codes": [
          "BTC_EUR",
          "ETH_EUR"
        ]
      },
      {
        "name": "PRICE_TICKS",
        "instrument_codes": [
          "BTC_EUR",
          "ETH_EUR"
        ]
      }
    ]
}

Confirmation

If the subscriptions have been successful two responses are returned:

{
    "type": "SUBSCRIPTIONS",
    "channels": [
      {
        "name": "ORDER_BOOK",
        "instrument_codes": [
          "BTC_EUR",
          "ETH_EUR"
        ]
      }
    ]
}
{
    "type": "SUBSCRIPTIONS",
    "channels": [
      {
        "name": "PRICE_TICKS",
        "instrument_codes": [
          "BTC_EUR",
          "ETH_EUR"
        ]
      }
    ]
}

Update Subscription

Publicly-available data channels which support subscription updates can deliver a seamless stream of additional or fewer markets based on specifcied instrument configuration. As an example, let's assume the client is currently subscribed to BTC_EUR market.

{
  "type": "SUBSCRIBE",
  "channels": [
    {
      "name": "ORDER_BOOK",
      "depth": 200,
      "instrument_codes": ["BTC_EUR"]
    },
    {
      "name": "PRICE_TICKS",
      "instrument_codes": ["BTC_EUR"]
    }
  ]
}

Next, the client wants to additionally listen to all updates for ETH_EUR market. To do so and avoid data-loss which would be incurred if the client unsubscribed and subscribed explicitly, the following message can be sent to the server instead:

{
  "type": "UPDATE_SUBSCRIPTION",
  "channels": [
    {
      "name": "ORDER_BOOK",
      "depth": 200,
      "instrument_codes": [
        "BTC_EUR",  
        "ETH_EUR"
      ]
    },
    {
      "name": "PRICE_TICKS",
      "instrument_codes": [
        "BTC_EUR",
        "ETH_EUR"
      ]
    }
  ]
}

This creates a new subscription which replaces the existing one. The server completes the protocol message exchange with:

{
  "type": "SUBSCRIPTION_UPDATED",
  "channel_name": "PRICE_TICKS",
  "time": 1715350241645982152,
  "details": "1 price tick subscriptions added"
}
{
  "type": "SUBSCRIPTION_UPDATED",
  "channel_name": "ORDER_BOOK",
  "time": 1715350241645894830,
  "details": "1 orderbook subscriptions added"
}

Unsubscribe

A client can send an unsubscribe message when a particular channel should be deactivated.

{
    "type": "UNSUBSCRIBE",
    "channels": [
      "PRICE_TICKS"
    ]
}

Confirmation

If the unsubscribe was successful two responses are returned:

{
  "type": "UNSUBSCRIBED",
  "channel_name": "PRICE_TICKS"
}

Sequence numbers

Sequence numbers for market data are monotonically increasing numerical sequences assigned to data fragments. Those numbers are stricly monotonic but not gap-less.
Subscribers can use sequence numbers to establish total order of messages.

Encoding

Messages that WSS API sends or receives are encoded in JSON.

Idle Connections

🚀 The exchange (wss://streams.fast.onetrading.com?x-version=3) will send heartbeat messages approximately every 20 seconds, it also accepts WS ping packets to reset the connection timer. Heartbeats are also sent from the other websocket (wss://garcon.fast.onetrading.com) every 10 seconds.

{
    "channel_name": "SYSTEM",
    "subscription": "SYSTEM",
    "time": "2019-04-16T08:38:13.293Z",
    "type": "HEARTBEAT"
}

Resilience

Despite websocket connections providing a high level of stability and performance, clients can use advanced features to prepare for rare failure scenarios and minimize risks:

Trading / Orders channel

Base URL: wss://streams.fast.onetrading.com?x-version=3

🚀 As part of our FAST exchange upgrade, we have merged the trading and orders channel.

Description

Create and cancel orders and a feed of order updates based on your trading activity in your account.

This channel requires authentication, otherwise subscription requests fail with an error.

Consider subscribing to the ACCOUNT_HISTORY channel instead of TRADING if you require additional information on trade settlements, transfers and non-trading activity.

Subscribe

{
    "type": "SUBSCRIBE",
    "channels": [
      {
        "name": "TRADING"
      }
    ]
}

Confirmation

{
  "type": "SUBSCRIPTIONS",
  "channels": [
    {
      "name": "TRADING"
    }
  ]
}

Error

If the subscribe request cannot be authenticated the web socket connection terminates with the status code 1008 and a reason in the following format:

{
  "error" : "INVALID_APIKEY"
}

Create order requests

🚀 As part of our FAST exchange upgrade, we have made the decision to remove MARKET orders.

Market orders aren’t conducive to optimal execution, if you are prepared to sell 1 BTC for 1 EUR, then you could always send in a LIMIT order to that effect.

Once subscribed, the client must send a JSON payload representing the order to be created. The following request examples highlight the 1 type of order that can be placed: LIMIT. For an explanation of what each field of the order field represents, please consult https://docs.onetrading.com/#tocscreateorder.

Important: We highly recommend that requests populate the client_id field when creating orders. The client_id field will be present in the response so that clients can correlate responses to the original requests. Optionally the client_id can be used to cancel or update open orders.

NOTE: You are responsible for uniqueness of a client_id. If two or more orders are created with the same client_id, the older orders can then only be cancelled using order_id, or via the cancel all orders endpoint.

Limit order request

{
  "type": "CREATE_ORDER",
  "order": {
    "instrument_code": "BTC_EUR",
    "type": "LIMIT",
    "side": "BUY",
    "amount": "1.23",
    "price": "9876.99",
    "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
    "time_in_force": "GOOD_TILL_CANCELLED"
  }
}

The WSS API will respond back with the outcome of the operation, success or failure.

Successfully created order response

{
  "order_book_sequence": 32290460516,
  "side": "BUY",
  "uid": 123,
  "amount": "1.23",
  "price": "9876.99",
  "instrument_code": "BTC_EUR",
  "client_id": "dbf8e35b-f33e-4cfc-b5d9-8308dd341d8e",
  "order_id": "59f95128-b5fe-4359-a68b-8b839bdbd706",
  "channel_name": "TRADING",
  "type": "BOOKED",
  "time": 1704889994528163405
}

The fields in the response will contain information that will match what was asked for in the request.

Failed order creation response

The following examples are of requests which failed. Check the error code for details.

Note that the response includes the original request.

{
    "type": "DONE",
    "status": "INSUFFICIENT_FUNDS",
    "channel_name": "TRADING",
    "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
    "instrument_code": "BTC_EUR",
    "side": "BUY",
    "amount": "1.23",
    "price": "9876.99",
    "time": 1704891103562945943
}

Important: ORDER_CREATION_FAILED error with code INTERNAL_SERVER_ERROR have to be handled as order in unknown state. A request could in rare cases fail to yield a concrete response (e.g. due to a timeout) and it could be that your order was successfully processed and submitted to the orderbook. We highly recommend subscribing to the Trading Channel to observe your activity in order book.

If you don't see order confirmation in the TRADING channel after 30 seconds, you can safely assume your order has failed to execute.

Cancel order

Clients can call the API to cancel existing orders. Note that success indicates submission for cancellation.

Important: Each cancel request contains the order_id field which is returned in the response so that clients can correlate the responses back to requests.

🚀 Due to the internal structure of the new FAST exchange you will find better cancellation performance if you specify the instrument code in the cancellation packet.

Cancel order by order id

The following JSON represents how to cancel an order with known order_id.

{
  "type": "CANCEL_ORDER",
  "order_id": "d44cf37a-335d-4936-9336-4c7944cd00eb",
  "instrument_code":"BTC_EUR" // This is optional, but will result in an even faster cancellation
}

Cancel order by client id

The following JSON represents how to cancel an order with known client_id. Note that it is not allowed to provide order_id and client_id together. The request will result in an error.

{
  "type": "CANCEL_ORDER",
  "client_id": "123cf37a-335d-4936-9336-4c7944cd00eb",
  "instrument_code":"BTC_EUR" // This is optional, but will result in an even faster cancellation
}

Successfully cancelled order response

The cancelled order response includes the order_id for which the cancellation has been requested.

{
  "status":"CANCELLED",
  "channel_name":"TRADING",
  "uid":123,
  "instrument_code":"ETH_BTC",
  "client_id":"f098a435-a4ce-4f35-b25b-75ce463dc8ac",
  "order_id":"d44cf37a-335d-4936-9336-4c7944cd00eb",
  "type":"DONE",
  "side":"BUY",
  "order_book_sequence":32303065154,
  "remaining":"1",
  "amount":"1",
  "price":"0.05",
  "time":1704891498321559623
}

Failed to cancel order response

An instance where the order_id has not been found and couldn't be cancelled. Check the error code for details.

{
  "error": "ORDER_NOT_FOUND"
}

Cancel all orders

Clients can call the API to cancel all existing orders. Note that success indicates submitting a cancellation request. Clients should observe events in Trading channel if all orders have been successfully cancelled.

{
  "type": "CANCEL_ALL_ORDERS"
}

Successfully cancelled all order response

You will receive a cancellation message for each order as it is cancelled

{
  "status":"CANCELLED",
  "channel_name":"TRADING",
  "uid":123,
  "instrument_code":"ETH_BTC",
  "client_id":"f098a435-a4ce-4f35-b25b-75ce463dc8ac",
  "order_id":"d44cf37a-335d-4936-9336-4c7944cd00eb",
  "type":"DONE",
  "side":"BUY",
  "order_book_sequence":32303065154,
  "remaining":"1",
  "amount":"1",
  "price":"0.05",
  "time":1704891498321559623
}
{
  "status":"CANCELLED",
  "channel_name":"TRADING",
  "uid":123,
  "instrument_code":"ETH_BTC",
  "client_id":"d44cf37a-335d-4936-9336-4c7944cd00eb",
  "order_id":"f098a435-a4ce-4f35-b25b-75ce463dc8ac",
  "type":"DONE",
  "side":"BUY",
  "order_book_sequence":32303065154,
  "remaining":"2",
  "amount":"3",
  "price":"0.05",
  "time":1704891498321559729
}

Cancel all orders with instrument code

Clients can request cancellation of all active orders for a specific market identified by instrument_code.

{
  "type": "CANCEL_ALL_ORDERS",
  "instrument_code": "BTC_EUR" // This is optional, but will result in an even faster cancellation
}

Auto-cancellation (Dead Man Switch)

For a detailed description of Dead Man Switch see Activate Close All Orders via REST API.

Activate Auto-Cancellation Timer

The following examples outlines valid request and expected response payloads.

Request

{
  "type": "CANCEL_ALL_AFTER",
  "timeout": 23456
}

Response

{
    "channel_name": "TRADING",
    "type": "AUTO_CANCELLATION_TIMER_SET",
    "timeout": 23456,
    "time": 1710927208222806419
}

Deactivate Auto-cancellation timer

These values are ephemeral and can be set or reset at any time.

Request

{
  "type": "CANCEL_ALL_AFTER",
  "timeout": 1000
}
{
  "type": "CANCEL_ALL_AFTER",
  "timeout": 0
}

Response

{
  "channel_name": "TRADING",
  "type": "AUTO_CANCELLATION_TIMER_DEACTIVATED"
}

Events

All order updates share a set of properties describing the current order state:

{
  "type": "TYPE",
  "channel_name": "TRADING",
  "instrument_code": "BASE_QUOTE",
  "order_id": "00000000-0000-0000-0000-000000000000",
  "client_id": "11111111-1111-1111-1111-111111111111",
  "time": 1715350900427981632, // Nanosecond timestamp
}

Fill

The order was matched and (partially) filled. This event includes additional information about the trade:

{
  "type": "FILL",
  "channel_name": "TRADING",
  "instrument_code": "BTC_EUR",
  "client_id": "81c88763-80e0-4ffa-80ac-d5802b596052",
  "order_id": "20713dbb-f4a9-4595-bc93-9ce7fa58eb7e",
  "time": 1715351831605522001,
  "side": "SELL",
  "order_book_sequence": 42029146112,
  "remaining": "0.08",
  "amount": "0.1",
  "trade_id": "59c10cdd-9c38-46aa-b505-7470825bcc6d",
  "matched_as": "MAKER",
  "matched_amount": "0.02",
  "matched_price": "10000"
}

Booked

The order was not fully filled immediately and is now open in the order book. Only limit orders can be booked.

{
  "order_book_sequence": 42029146112,
  "side": "SELL",
  "uid": 2,
  "amount": "0.1",
  "price": "10000",
  "instrument_code": "BTC_EUR",
  "client_id": "81c88763-80e0-4ffa-80ac-d5802b596052",
  "order_id": "20713dbb-f4a9-4595-bc93-9ce7fa58eb7e",
  "channel_name": "TRADING",
  "type": "BOOKED",
  "time": 1715351726137871539
}

Done

The order is not in the order book anymore. If an order is filled fully, all FILL events are sent and a final DONE event with remaining == 0. This event includes additional information about the order status:

{
  "status": "CANCELLED",
  "uid": 2,
  "instrument_code": "BTC_EUR",
  "client_id": "81c88763-80e0-4ffa-80ac-d5802b596052",
  "order_id": "20713dbb-f4a9-4595-bc93-9ce7fa58eb7e",
  "channel_name": "TRADING",
  "type": "DONE",
  "side": "SELL",
  "order_book_sequence": 42029146112,
  "remaining": "0.08",
  "amount": "0.1",
  "price": "10000",
  "time": 1715351936255076636
}

Account history channel

Base URL: wss://garcon.fast.onetrading.com

Description

Authenticated API clients should have access to a stream of account history events corresponding to one account.

Monitoring Account Activity

The ACCOUNT_HISTORY channel delivers updates on any account activity. To avoid missing updates it is recommended to set up the subscription before creating/cancelling orders:

  1. Subscribe to the ACCOUNT_HISTORY channel and await initial snapshots
  2. Submit new orders and cancellations through websockets or the http api
  3. Update local state on open orders and balances based on received events

Consider subscribing to the TRADING channel instead if you require low-latency updates on order updates only.

Subscribe

In the following example, a client is attempting to create an authenticated subscription. In order for this request to succeed, a valid API token must be provided via the Authenticate call.

{
  "type": "SUBSCRIBE",
  "channels": [
    {
      "name": "ACCOUNT_HISTORY"
    }
  ]
}

Additionally, subscribers can specify a just_orders flag, which, when set true will omit the trades from ACTIVE_ORDERS_SNAPSHOT and INACTIVE_ORDERS_SNAPSHOT messages. The default value for the flag is false.

{
  "type": "SUBSCRIBE",
  "bp_remaining_quota": 200,
  "channels": [
    {
      "name": "ACCOUNT_HISTORY",
      "just_orders": true
    }
  ]
}

Confirmation

If the authenticated subscription request succeeded, a confirmation is sent back to the client.

{
  "type": "SUBSCRIPTIONS",
  "channels": [
    {
      "name": "ACCOUNT_HISTORY",
      "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6"
    }
  ]
}

Error

If authentication fails within the initial subscribe message, due to an invalid API token or another reason, the web socket connection terminates with the status code 1008 and a reason in the following format:

{
  "error" : "INVALID_APIKEY"
}

Active Orders Snapshot

The active orders snapshot returns all active orders. Note that active orders might be partially-filled and thus include trades.

{
  "account_id": "f6c74144-9e0d-49f7-8f6e-a8770f3ad77f",
  "channel_name": "ACCOUNT_HISTORY",
  "orders": [
    {
      "order": {
        "account_id": "f6c74144-9e0d-49f7-8f6e-a8770f3ad77f",
        "amount": "1.0",
        "average_price": "197.32",
        "client_id": "9897a12e-3802-4533-81c9-fc3f32c1c396",
        "filled_amount": "0.5",
        "instrument_code": "BTC_ETH",
        "order_book_sequence": 123456,
        "order_id": "07ba933f-29dc-4ec1-b00f-578cca8c5082",
        "price": "200",
        "sequence": 1,
        "side": "BUY",
        "status": "FILLED",
        "time": "2019-03-21T16:38:17.093Z",
        "time_last_updated": "2019-03-21T16:38:18.093Z",
        "type": "LIMIT",
        "update_modification_sequence": 12333
      },
      "trades": [
        {
          "fee": {
            "fee_amount": "0.0002",
            "fee_currency": "BTC",
            "fee_group_id": "default",
            "fee_percentage": "0.1",
            "fee_type": "TAKER",
            "running_trading_volume": "0.00277069"
          },
          "trade": {
            "account_id": "f6c74144-9e0d-49f7-8f6e-a8770f3ad77f",
            "amount": "0.5",
            "instrument_code": "BTC_ETH",
            "order_id": "07ba933f-29dc-4ec1-b00f-578cca8c5082",
            "price": "197.32",
            "sequence": 1000,
            "side": "BUY",
            "time": "2019-07-01T07:02:51.919Z",
            "trade_id": "6c252d23-2366-40fa-b7a7-ffc6b5cfa74c"
          }
        }
      ]
    }
  ],
  "time": "2019-03-21T16:38:17.093Z",
  "type": "ACTIVE_ORDERS_SNAPSHOT"
}

The field trades is omitted if the subscription has the flag with_orders set to true.

{
  "account_id": "55005f30-5a9f-11e9-9d51-d3015958f2ff",
  "channel_name": "ACCOUNT_HISTORY",
  "orders": [
    {
      "order": {
        "account_id": "55005f30-5a9f-11e9-9d51-d3015958f2ff",
        "amount": "5000.0",
        "client_id": "9897a12e-3802-4533-81c9-fc3f32c1c396",
        "filled_amount": "0.0",
        "instrument_code": "BTC_EUR",
        "is_post_only": false,
        "order_id": "9f3f6c0c-07b1-4d01-8afb-1cb4497db821",
        "price": "1000.0",
        "sequence": 603100485,
        "side": "BUY",
        "status": "OPEN",
        "time": "2021-04-01T14:17:32.494188Z",
        "time_in_force": "GOOD_TILL_CANCELLED",
        "type": "LIMIT"
      }
    }
  ],
  "time": "2021-04-14T09:31:54.397160Z",
  "type": "ACTIVE_ORDERS_SNAPSHOT"
}

Inactive Orders Snapshot

The inactive orders snapshot returns the 50 most recent inactive orders within the last 24 hours. Inactive orders are those which satisfy one of these criteria:

  1. partially-filled and then cancelled by user.
  2. fully-filled.
  3. partially-filled and then rejected.

If no such order satisfied any of the above criteria then an empty snapshot is returned. Once the order is inactive it can no-longer participate in the market.

{
  "channel_name": "ACCOUNT_HISTORY",
  "type": "INACTIVE_ORDERS_SNAPSHOT",
  "time": "2019-07-22T07:06:23.073Z",
  "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
  "orders": [
    {
      "order": {
        "order_id": "43394171-9e79-4c61-ba19-61e33365c29a",
        "client_id": "9897a12e-3802-4533-81c9-fc3f32c1c396",
        "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
        "instrument_code": "BTC_EUR",
        "time": "2019-07-22T07:06:23.073Z",
        "side": "BUY",
        "price": "9441.89",
        "amount": "0.08709",
        "filled_amount": "0.08709",
        "average_price": "9441.89",
        "type": "LIMIT",
        "sequence": 11959,
        "order_book_sequence": 123456,
        "update_modification_sequence": 12333,
        "status": "FILLED_FULLY",
        "time_last_updated": "2019-07-22T07:06:25.338Z"
      },
      "trades": [
        {
          "fee": {
            "fee_amount": "0.00008709",
            "fee_currency": "BTC",
            "fee_percentage": "0.1",
            "fee_group_id": "default",
            "fee_type": "TAKER",
            "running_trading_volume": "0.00277069"
          },
          "trade": {
            "trade_id": "5a974cdf-4eac-499c-8fa5-2f5b40b3eabd",
            "order_id": "43394171-9e79-4c61-ba19-61e33365c29a",
            "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
            "amount": "0.08709",
            "side": "BUY",
            "instrument_code": "BTC_EUR",
            "price": "9441.89",
            "time": "2019-07-22T07:06:24.054Z",
            "sequence": 11959
          }
        }
      ]
    }
  ]
}

The field trades is omitted if the subscription has the flag with_orders set to true.

{
  "channel_name": "ACCOUNT_HISTORY",
  "type": "INACTIVE_ORDERS_SNAPSHOT",
  "time": "2019-07-22T07:06:23.073Z",
  "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
  "orders": [
    {
      "order": {
        "order_id": "43394171-9e79-4c61-ba19-61e33365c29a",
        "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
        "client_id": "9897a12e-3802-4533-81c9-fc3f32c1c396",
        "instrument_code": "BTC_EUR",
        "time": "2019-07-22T07:06:23.073Z",
        "side": "BUY",
        "price": "9441.89",
        "amount": "0.08709",
        "filled_amount": "0.08709",
        "average_price": "9441.89",
        "type": "LIMIT",
        "sequence": 11959,
        "order_book_sequence": 123456,
        "update_modification_sequence": 12333,
        "status": "FILLED_FULLY",
        "time_last_updated": "2019-07-22T07:06:25.338Z"
      }
    }
  ]
}

Balances Snapshot

Next, a snapshot of all last-known account balances is returned.

{
  "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
  "type": "BALANCES_SNAPSHOT",
  "channel_name": "ACCOUNT_HISTORY",
  "time": "2019-04-01T13:39:17.155Z",
  "balances": [
    {
      "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
      "currency_code": "BTC",
      "change": "0.5",
      "available": "10.0",
      "locked": "1.1234567",
      "sequence": 1,
      "time": "2019-04-01T13:39:17.155Z"
    },
    {
      "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
      "currency_code": "ETH",
      "change": "0.5",
      "available": "10.0",
      "locked": "1.1234567",
      "sequence": 2,
      "time": "2019-04-01T13:39:17.155Z"
    }
  ]
}

Account Updates

Once the trading history has been delivered, all subsequent messages relating to the subscribed account are delivered.

Each account history update is delivered in the following format:

{
  "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
  "update": {
    // see message definitions below
   },
  "channel_name": "ACCOUNT_HISTORY",
  "type": "ACCOUNT_UPDATE"
}

Account Update: Order Created

Emitted after the system has successfully accepted a client's order.

{
  "id": "d3fe6025-5b27-4df6-a957-98b8d131cb9d",
  "type": "ORDER_CREATED",
  "activity": "TRADING",
  "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
  "timestamp": "2018-08-01T13:39:15.590Z",
  "sequence" : 0,
  "order": {
    "status": "OPEN",
    "order_id": "6f991342-da2c-45c6-8830-8bf519cfc8cc",
    "client_id": "0742f495-b030-4ae9-948f-d8daf4942c7b",
    "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
    "instrument_code": "BTC_EUR",
    "time": "2018-08-01T13:39:15.586Z",
    "side": "SELL",
    "price": "3",
    "amount": "1.5",
    "filled_amount": "0.0",
    "type": "LIMIT",
    "time_in_force": "GOOD_TILL_CANCELLED"
  },
  "balances": [
    {
      "currency_code": "BTC",
      "amount_locked": "3",
      "amount_available": "5.1232"
    }
  ]
}

Account Update: Order Rejected

Emitted after the system establishes that an order could not be processed. The client can expect a reason field detailing the rejection.

{
  "id": "d3fe6025-5b27-4df6-a957-98b8d131cb9d",
  "type": "ORDER_REJECTED",
  "activity": "TRADING",
  "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
  "sequence": 0,
  "timestamp": "2018-08-01T13:39:15.590Z",
  "reason": "INSUFFICIENT_FUNDS",
  "order_id": "6f991342-da2c-45c6-8830-8bf519cfc8cc",
  "client_id": "fb497387-8223-4111-87dc-66a86f98a7cf",
  "filled_amount" : "0.0",
  "balances": [
    {
      "currency_code": "BTC",
      "amount_locked": "0",
      "amount_available": "0.1232"
    }
  ]
}

Account Update: Trade Settled

Emitted after an open order leads to a trade.

{
    "id": "fbd51897-5d7d-43b1-9551-7a76bcea1cd7",
    "sequence": 361801,
    "order_book_sequence": 123456,
    "type": "TRADE_SETTLED",
    "activity": "TRADING",
    "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
    "time": "2019-10-22T12:12:12.745Z",
    "order_id": "f8c7e7cd-105b-48ab-a0bb-7b53e363a161",
    "client_id": "fb497387-8223-4111-87dc-66a86f98a7cf",
    "order": {
      "amount": "0.5",
      "filled_amount": "0.5"
    },
    "trade": {
      "trade_id": "38875c5d-b466-4e38-beea-2f6c5d795d47",
      "order_id": "f8c7e7cd-105b-48ab-a0bb-7b53e363a161",
      "account_id": "379a12c0-4560-11e9-82fe-2b25c6f7d123",
      "amount": "0.5",
      "side": "BUY",
      "instrument_code": "BTC_EUR",
      "price": "40000",
      "time": "2019-10-22T12:12:12.376Z"
    },
    "fee": {
      "fee_amount": "0.0005",
      "fee_currency": "BTC",
      "fee_percentage": "0.1",
      "fee_group_id": "default",
      "fee_type": "TAKER",
      "running_trading_volume": "0.10058",
      "collection_type": "STANDARD"
    },
    "balances": [
      {
        "currency_code": "BTC",
        "amount_locked": "0",
        "amount_available": "8.12351236"
      },
      {
        "currency_code": "EUR",
        "amount_locked": "0",
        "amount_available": "124000"
      }
    ]
  }

Account Update: Order Closed

Emitted after an open order is closed.

{
  "id": "c2373ec1-a2da-4e48-baa2-dfb774802342",
  "type": "ORDER_CLOSED",
  "activity": "TRADING",
  "account_id": "b355abb8-aaae-4fae-903c-c60ff74723c6",
  "timestamp": "2018-08-01T13:39:05.773Z",
  "order_id": "025293a1-53d8-4a08-996b-2132a18721dc",
  "client_id": "fb497387-8223-4111-87dc-66a86f98a7cf",
  "sequence": 0,
  "order_book_sequence": 123456,
  "filled_amount" : "0.0",
  "balances": [
    {
      "currency_code": "BTC",
      "amount_locked": "0",
      "amount_available": "8.12351236"
    }
  ]
}

Account Update Order Fully Filled

Emitted when LIMIT or STOP order has been fully filled.



{
    "activity": "TRADING",
    "type": "ORDER_FULLY_FILLED",
    "account_id": "b4c5e198-0974-4711-9d72-8e23dac1cdf0",
    "order_id": "26dcfb42-b0be-4648-9f2b-cbf7483ddb5f",
    "time": "2021-07-28T10:16:04.646715Z",
    "order":
    {
        "time_in_force": "IMMEDIATE_OR_CANCELLED",
        "is_post_only": false,
        "order_id": "26dcfb42-b0be-4648-9f2b-cbf7483ddb5f",
        "account_id": "b4c5e198-0974-4711-9d72-8e23dac1cdf0",
        "instrument_code": "ETH_EUR",
        "time": "2021-07-28T10:16:04.606935Z",
        "side": "BUY",
        "price": "100.0",
        "amount": "0.5",
        "filled_amount": "0.5",
        "type": "LIMIT"
    },
    "id": "cd74b17d-474b-40e6-84f2-597b59271647",
    "sequence": 200910
}

Account Update Funds Deposited

Emitted after a user has successfully deposited funds.

{
  "channel_name": "ACCOUNT_HISTORY",
  "time": "2024-03-20T08:49:53.072Z",
  "type": "ACCOUNT_UPDATE",
  "update": {
    "id": "2967caef-6d09-45a5-95d0-80f1f67b6a3b",
    "activity": "FUNDING",
    "type": "FUNDS_DEPOSITED",
    "account_id": "726288e6-a463-4f88-9068-024ae8f97a34",
    "amount": "0.00100000",
    "currency_code": "BTC",
    "balances": [
      {
        "currency_code": "BTC",
        "amount_locked": "0.0",
        "amount_available": "0.0695918"
      }
    ]
  }
}

Account Update Funds Withdrawn

Emitted after a user has successfully withdrawn funds.

{
  "channel_name": "ACCOUNT_HISTORY",
  "time": "2024-03-20T08:10:25.000Z",
  "type": "ACCOUNT_UPDATE",
  "update": {
    "id": "a4559dcf-913f-408e-b262-8b280925bcd0",
    "activity": "FUNDING",
    "type": "FUNDS_WITHDRAWN",
    "account_id": "726288e6-a463-4f88-9068-024ae8f97a34",
    "amount": "0.5",
    "currency_code": "ETH",
    "balances": [
      {
        "currency_code": "ETH",
        "amount_locked": "0.0",
        "amount_available": "1.1105"
      }
    ]
  }
}

Market Ticker channel

Base URL: wss://garcon.fast.onetrading.com

Description

Publicly available feed of market data: market ticks. Market ticks provide a client with the following market insights:

Volume, low, high and price change are calculated based on a sliding window of trades starting from 24 hours ago and using minutely granularity. Market ticks are pushed on each trade when the 24 hour sliding window is moved forward. If there are no changes, no updates will be pushed.

Additionally, there is information detailing how the price evolved over the last 24hrs.

Subscribe

Unauthenticated access to any number of instruments can be specified in the subscription request.

The price points are part of each market tick message.

{
  "type":"SUBSCRIBE",
  "channels": [
    {
      "name":"MARKET_TICKER",
      "instrument_codes": ["ETH_USDT"]
    }
  ]
}

Confirmation

{
  "type": "SUBSCRIPTIONS",
  "channels": [
    {
      "name": "MARKET_TICKER"
    }
  ]
}

Ticker Updates

Updates are pushed when there is new information available. If there are no changes, no updates will be pushed.

{
  "channel_name": "MARKET_TICKER",
  "time": "2024-05-10T14:06:34.745Z",
  "type": "MARKET_TICKER_UPDATES",
  "ticker_updates": [
    {
      "instrument": "ETH_USDT",
      "last_price": "3022.88",
      "high": "3039.15",
      "low": "2973.42",
      "price_change": "49.460000000000036",
      "price_change_percentage": "1.663404429915721",
      "price_points": [
        {
          "time": "2024-05-09T14:21:00.000Z",
          "price": "2973.42",
          "sequence": "1715264461680412400"
        },
        {
          "time": "2024-05-09T14:35:00.000Z",
          "price": "2982.54",
          "sequence": "1715265355733654300"
        },
        {
          "time": "2024-05-09T15:00:00.000Z",
          "price": "2998.15",
          "sequence": "1715267848708587300"
        },
        {
          "time": "2024-05-09T16:00:00.000Z",
          "price": "3022.89",
          "sequence": "1715271515291799600"
        }
      ],
      "volume": "38389.950000000004"
    }
  ]
}

Orderbook channel

Base URL: wss://streams.fast.onetrading.com?x-version=3

Description

Publicly available feed of market data: order book. User has to specify depth of the order book that is to be served.

Depth parameter

User can specify what depth of the orderbook he wishes to maintain, this depth is then applied to the both side of orderbook (bids,asks). It means that user will receive at most depth price levels on each side of orderbook. Should the price level within this depth region be removed from orderbook, the system will handle it and will always try to send to user such updates that would result in maintaining specified depth.

For example, user has specified depth of 10. Two orders get matched around spread which results in removal of two price levels, this will emit update event with those price levels being removed (volume = 0), and since the depth is not fulfilled as it would result only in 8 price levels the update event will also include additional price level which the system previously omitted.

Similarly, it works when additional price level with better price are added, update event will include those new ones and signal removal of the ones which are already beyond the specified depth.

Subscribe

Unauthenticated access to any number of order books backed by instruments can be specified in the request. Depth of the displayed order book can be also defined, depth 0 means full depth.

{
  "type": "SUBSCRIBE",
  "channels": [
    {
      "name": "ORDER_BOOK",
      "depth": 1000,
      "instrument_codes": [
        "BTC_EUR",
        "ETH_EUR"
      ]
    }
  ]
}

Confirmation

{
  "channels": [
    {
      "name": "ORDER_BOOK",
      "depth": 1000,
      "instrument_codes": [
        "BTC_EUR",
        "ETH_EUR"
      ]
    }
  ],
  "type": "SUBSCRIPTIONS",
  "time": 1715268699243070457
}

Order Book Snapshot

On subscribe, the most recent compiled order book snapshot is sent back.

An order book entry is defined as a tuple of price and amount.

[
  "123.456",
  "0.12345678"
]

Full message examples:

{
  "type": "ORDER_BOOK_SNAPSHOT",
  "channel_name": "ORDER_BOOK",
  "time": 1715268699243100946,
  "instrument_code": "BTC_EUR",
  "bids": [
    [
      "6500.11",
      "0.45054140"
    ]
  ],
  "asks": [
    [
      "6500.15",
      "0.57753524"
    ]
  ]
}

Order Book Updates

Whenever a subscribed order book gets modified, a list of changes is emitted.

Note that the amount always specifies the actual amount and not the delta. If the amount is set to 0 it means that the price level has been removed.

{
  "type": "ORDER_BOOK_UPDATE",
  "channel_name": "ORDER_BOOK",
  "time": 1715268699262970610,
  "instrument_code": "BTC_EUR",
  "changes": [
    [
      "BUY",
      "6500.09",
      "0.84702376"
    ],
    [
      "SELL",
      "6507.00",
      "1.88933140"
    ],
    [
      "SELL",
      "6505.54",
      "1.12386524"
    ],
    [
      "SELL",
      "6504.38",
      "0"
    ]
  ]
}

Price Ticks channel

Base URL: wss://streams.fast.onetrading.com?x-version=3

Description

Publicly available feed of market data: price ticks.

Subscribe

Unauthenticated access to any number of instruments that can be specified in the request.

{
  "type": "SUBSCRIBE",
  "channels": [
    {
      "name": "PRICE_TICKS",
      "instrument_codes": [
        "BTC_USDT"
      ]
    }
  ]
}

Confirmation

{
  "channels": [
    {
      "name": "PRICE_TICKS",
      "instrument_codes": [
        "BTC_USDT"
      ]
    }
  ],
  "type": "SUBSCRIPTIONS",
  "time": 1715268986586599201
}

Price Ticks

Whenever an order match happens a new price tick is emitted.

{
  "type": "PRICE_TICK",
  "channel_name": "PRICE_TICKS",
  "time": 1715337132095550557,
  "instrument_code": "BTC_USDT",
  "price": "63052.63",
  "amount": "0.04",
  "volume": "2522.1052",
  "best_bid": "63027.11",
  "best_ask": "63070.06",
  "taker_side": "BUY"
}

Error Codes

Both the REST and WSS API use the same error codes. If you found error which is not documented, or think that system is behaving not as expected please reach out to us via the Ticketing System.

Although errors are generally sent as json responses, in rare cases a request may not reach Bipanda Pro systems and fail with no or a HTML response body. The HTTP status code will signal an error (502 or 504) and the request can be retried.

If you experience repeated server errors, reach out to support.

Create Order

Cancel Order

Update Order

General errors

Authorization errors

Changelog

06/2023 Migration to One Trading