Trade API 2.0
Trade API 2.0 is a publicly available HTTP API that provides programmatic access to trading functionality of CREX24 crypto exchange. Support of the previous version of API was discontinued on December 5, 2019.
Base URL: https://api.crex24.com/v2/
The API requests and responses are in JSON format. Basic data types:
Type | Example | Description |
---|---|---|
string | "some text" |
Text |
boolean | true |
Logical data type, an instance can have either of two values: true or false |
int | 1203 |
Integer number |
decimal | 0.12345 |
Floating point number, used for financial and monetary data |
datetime | "2017-11-07T18:40:01Z" |
String representation of UTC date and time in ISO8601 format.
List of recognized input formats: YYYY-MM-DDThh:mm:ssZ , YYYY-MM-DDThh:mm:ss YYYY-MM-DDThh:mmZ , YYYY-MM-DDThh:mm YYYY-MM-DDThhZ , YYYY-MM-DDThh YYYY-MM-DDZ , YYYY-MM-DD YYYY-MMZ , YYYY-MM YYYYZ , YYYY YYYYMMDDThhmmssZ , YYYYMMDDThhmmss YYYYMMDDThhmmZ , YYYYMMDDThhmm YYYYMMDDThhZ , YYYYMMDDThh YYYYMMDDZ , YYYYMMDD Output format: YYYY-MM-DDThh:mm:ssZ
|
Announcements
Introducing Fee-Related API Changes for withdrawals
Our withdrawal system has been improved. Users will able to choose which currency they want to pay as a withdrawal fee.
We provide our traders with a 14-days period (until August 14, 2020) during which their trading bots should be updated (if necessary) to use the new API functionality.
To get a list of currencies which can be used as "withdrawal fee currencies" use the following method: withdrawalFees.
After August 14, 2020, the optional field feeCurrency in methods previewWithdrawal and withdrawal will become mandatory.
July 31, 2020
SignalR API 1.0 Released
The first version of SignalR API has been released.
The API is built upon subscription-based communication model: instead of repeatedly polling the server to check for new data, a client can subscribe to the server's data channel and have updates pushed by the server. The WebSocket protocol is used as a transport. For more details, please refer to the corresponding section of the documentation.
February 11, 2020
Introducing Fee-Related API Changes
To adjust for growing diversity of trading instruments we're introducing instrument-tiered fee schedules – instead of having one fee schedule for all instruments, there will be multiple schedules, each targeted at a specific category of trading instruments.
The following changes are being made to the API:
- method tradeFee is being deprecated;
- a new field and new methods are added:
- field feeSchedule of the instrument object - indicates which fee schedule is applied to the instrument;
- method tradingFeeSchedules - returns detailed information about the fee schedules used on Crex24;
- method tradingFee - returns personalized fee info: currently applied fee rates and 30-day trading volume.
The new field and methods are already available in the API.
Crex24 won't start applying new fee schedules until February 18, 2020. This provides 14-day transitional period during which trading bots should be updated (if necessary) to utilize the new API functionality and stop relying on old method tradeFee, which is now considered legacy and whose support will be discontinued on February 18, 2020.
February 4, 2020
Announced API Changes Have Come into Effect
Previously announced changes [1], [2] have come in force:
- API 1.0 support discontinued. All methods of the API 1.0 will soon become unavailable.
- From now on new orders supplied via API 2.0 must comply with parameters maxPrice, maxVolume, volumeIncrement, minQuoteVolume and maxQuoteVolume of an instrument.
December 5, 2019
Upcoming Changes to Trade API 2.0
Five new fields are being introduced to trade instrument object:
- maxPrice - limits maximum price of a new order;
- maxVolume - limits maximum volume of a new order;
- volumeIncrement - restricts volume of a new order to quantities divisible of this value;
- minQuoteVolume - limits minimum notional value (volume expressed in quote currency) of a new order;
- maxQuoteVolume - limits maximum notional value of a new order.
These fields are already available in the API.
The goal of these changes is to establish a clear policy for order-spamming protection (safeguard against new orders that are too far from the market price, inadequately small, make no economic sense, etc.) and improve overall trading experience on CREX24 platform.
On December 5, 2019 these rules will become mandatory for all newly placed and modified orders. Trading bots should be updated to follow the introduced restrictions by the aforementioned date. This requires revision of how the values of the following parameters are set in trading bot's code:
- parameters price, volume, stop-price and strictValidation of the placeOrder method;
- parameters newPrice, newVolume and strictValidation of the modifyOrder method.
The introduced limits will be kept reasonably wide (e.g., minPrice=0.000000001
and maxPrice=1000000000
) for all trading instruments from the date of publication of this announcement and until December 5, 2019. This will provide 70-day transitional period during which:
- trading bots that are yet unaware of the new restrictions will be able to continue working seamlessly;
- bots that have been updated to follow the new restrictions and bots that haven't been updated yet and, consequently, ignore the new restrictions, will be trading on equal footing.
September 27, 2019
API 1.0 End of Life
On December 5, 2019 the Trade API 1.0 will be retired and no longer supported.
The reasoning behind this is to increase security and eliminate duplicative systems. If you are still using the first version of the API, update your trading bot to use Trade API 2.0, which is more secure, provides wider range of functionality and easier to use.
September 27, 2019
Market Data
Base URL: https://api.crex24.com/v2/public
Currencies
GET https://api.crex24.com/v2/public/currencies
The above request returns JSON structured like this:
[
{
"symbol": "$PAC",
"name": "PACCoin",
"isFiat": false,
"depositsAllowed": true,
"depositConfirmationCount": 8,
"minDeposit": 0.0,
"withdrawalsAllowed": true,
"withdrawalPrecision": 8,
"minWithdrawal": 4.0,
"maxWithdrawal": null,
"isDelisted": false
},
{
"symbol": "2GIVE",
"name": "2Give",
"isFiat": false,
"depositsAllowed": false,
"depositConfirmationCount": 8,
"minDeposit": 0.0,
"withdrawalsAllowed": false,
"withdrawalPrecision": 8,
"minWithdrawal": 2.0,
"maxWithdrawal": null,
"isDelisted": true
},
...
]
GET https://api.crex24.com/v2/public/currencies?filter=ETH,USD
The above request returns JSON structured like this:
[
{
"symbol": "ETH",
"name": "Ethereum",
"isFiat": false,
"depositsAllowed": true,
"depositConfirmationCount": 12,
"minDeposit": 0.01,
"withdrawalsAllowed": true,
"withdrawalPrecision": 8,
"minWithdrawal": 0.01,
"maxWithdrawal": 5000.0,
"isDelisted": false
},
{
"symbol": "USD",
"name": "US dollar",
"isFiat": true,
"depositsAllowed": true,
"depositConfirmationCount": null,
"minDeposit": null,
"withdrawalsAllowed": true,
"withdrawalPrecision": 2,
"minWithdrawal": null,
"maxWithdrawal": null,
"isDelisted": false
}
]
GET https://api.crex24.com/v2/public/currencies
Returns the list of available currencies (including coins, tokens, etc.) with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
filter | string | Optional. Comma-separated list of currencies for which the detailed information is requested. If the parameter is not specified, the detailed information about all available currencies is returned |
Response
Returns an array of Currency objects, each with the following structure:
Field | Type | Description |
---|---|---|
symbol | string | Unique identifier of the currency, e.g. "BTC" |
name | string | Currency name, e.g. "Bitcoin" |
isFiat | boolean | Reports whether the currency is fiat |
depositsAllowed | boolean | Contains the value false if deposits for the currency are not accepted at the moment |
depositConfirmationCount | int | The number of blockchain confirmations the deposit is required to receive before the funds are credited to the account (for cryptocurrencies only; in case of fiat currency, the field contains the value null ) |
minDeposit | decimal | Minimum deposit threshold (for cryptocurrencies only; in case of fiat currency, the field contains the value null )If the deposit doesn’t meet the minimum threshold, the funds will not be credited to the account until the moment, when in the result of following deposits, their total amount will have reached the threshold |
withdrawalsAllowed | boolean | Contains the value false if withdrawals are not currently available for the currency |
withdrawalPrecision | int | Precision of withdrawal amount, expressed in the number of decimal places (digits to the right of a decimal point) |
minWithdrawal | decimal | Minimum withdrawal amount (for cryptocurrencies only; in case of fiat currency, the field contains the value null ) |
maxWithdrawal | decimal | Maximum withdrawal amount (for cryptocurrencies only; in case of fiat currency, the field contains the value null ). If a currency doesn’t have an upper withdrawal limit, the field contains the value null |
isDelisted | boolean | Reports whether the currency is delisted |
The data returned is in JSON format.
Trade Instruments
GET https://api.crex24.com/v2/public/instruments
The above request returns JSON structured like this:
[
{
"symbol": "$PAC-BTC",
"baseCurrency": "$PAC",
"quoteCurrency": "BTC",
"feeCurrency": "BTC",
"feeSchedule": "A",
"tickSize": 0.00000001,
"minPrice": 0.00000001,
"maxPrice": 100000.0,
"volumeIncrement": 0.00000001,
"minVolume": 1.0,
"maxVolume": 1000000000.0,
"minQuoteVolume": 0.0000000001,
"maxQuoteVolume": 10000.0,
"supportedOrderTypes": [
"limit"
],
"state": "active"
},
{
"symbol": "AAA-BTC",
"baseCurrency": "AAA",
"quoteCurrency": "BTC",
"feeCurrency": "BTC",
"feeSchedule": "A",
"tickSize": 0.00000001,
"minPrice": 0.00000001,
"maxPrice": 100000.0,
"volumeIncrement": 0.00000001,
"minVolume": 1.0,
"maxVolume": 1000000000.0,
"minQuoteVolume": 0.0000000001,
"maxQuoteVolume": 10000.0,
"supportedOrderTypes": [
"limit"
],
"state": "active"
},
...
]
GET https://api.crex24.com/v2/public/instruments?filter=ETH-BTC,BTC-USDT
The above request returns JSON structured like this:
[
{
"symbol": "BTC-USDT",
"baseCurrency": "BTC",
"quoteCurrency": "USDT",
"feeCurrency": "USDT",
"feeSchedule": "FeeSchedule08",
"tickSize": 1.0,
"minPrice": 0.00000001,
"maxPrice": 10000000000.0,
"volumeIncrement": 0.00000001,
"minVolume": 0.00001,
"maxVolume": 1000000000.0,
"minQuoteVolume": 0.000000000000001,
"maxQuoteVolume": 100000000000.0,
"supportedOrderTypes": [
"limit"
],
"state": "active"
},
{
"symbol": "ETH-BTC",
"baseCurrency": "ETH",
"quoteCurrency": "BTC",
"feeCurrency": "BTC",
"feeSchedule": "FeeSchedule08",
"tickSize": 0.00001,
"minPrice": 0.00000001,
"maxPrice": 10000000000.0,
"volumeIncrement": 0.00000001,
"minVolume": 0.0001,
"maxVolume": 1000000000.0,
"minQuoteVolume": 0.000000000000001,
"maxQuoteVolume": 100000000000.0,
"supportedOrderTypes": [
"limit"
],
"state": "active"
}
]
GET https://api.crex24.com/v2/public/instruments
Returns the list of available trade instruments with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
filter | string | Optional. Comma-separated list of instruments for which the detailed information is requested. If the parameter is not specified, the detailed information about all available instruments is returned |
Response
Returns an array of Instrument objects, each with the following structure:
Field | Type | Description |
---|---|---|
symbol | string | Unique identifier of the instrument, e.g. "LTC-BTC" for trading in LTC/BTC pair |
baseCurrency | string | Base currency of the instrument |
quoteCurrency | string | Quote currency of the instrument |
feeCurrency | string | Currency in which the fee is charged (rebate is paid), when trading the instrument |
feeSchedule** | string | Trading fee schedule that is applied to the instrument |
tickSize | decimal | The minimum price movement of the instrument (the smallest price increment of an order placed for the instrument) |
minPrice | decimal | Minimum price of an order placed for the instrument |
maxPrice* | decimal | Maximum price of an order placed for the instrument |
volumeIncrement* | decimal | The smallest increment of volume of an order placed for the instrument (i.e., volume of a new order must be multiple of this value) |
minVolume | decimal | Minimum volume of an order placed for the instrument |
maxVolume* | decimal | Maximum volume of an order placed for the instrument |
minQuoteVolume* | decimal | Minimum notional value (volume expressed in quote currency) of an order placed for the instrument |
maxQuoteVolume* | decimal | Maximum notional value (volume expressed in quote currency) of an order placed for the instrument |
supportedOrderTypes | string[] | Array of order types supported by the instrument. May contain the following items:"limit" - limit order;"market" - market order;"stopLimit" - stop-limit order.More about order types in the corresponding section of documentation |
state | string | Instrument state, can have one of the following values:"active" - working in a normal mode;"suspended" - trading is suspended;"delisted" - instrument is delisted
|
* - new fields, introduced on September 27, 2019
** - new field, introduced on February 4, 2020
The data returned is in JSON format.
Quotes (Tickers)
GET https://api.crex24.com/v2/public/tickers
The above request returns JSON structured like this:
[
{
"instrument": "$PAC-BTC",
"last": 0.0000005,
"percentChange": 8.6957,
"low": 0.00000046,
"high": 0.0000005,
"baseVolume": 144.855144855145,
"quoteVolume": 0.0000724275724275725,
"volumeInBtc": 0.0000724275724275725,
"volumeInUsd": 0.538195529470530008725,
"ask": 0.0000005,
"bid": 0.00000046,
"timestamp": "2018-05-31T12:48:56Z"
},
{
"instrument": "AAA-BTC",
"last": 0.00000002,
"percentChange": 0.0,
"low": 0.00000001,
"high": 0.00000002,
"baseVolume": 1549096.693306693307,
"quoteVolume": 0.02048589386613386614,
"volumeInBtc": 0.02048589386613386614,
"volumeInUsd": 152.2267849994061938517734,
"ask": 0.00000002,
"bid": null,
"timestamp": "2018-05-31T12:48:56Z"
},
...
]
GET https://api.crex24.com/v2/public/tickers?instrument=ETH-BTC,BTC-USDT
The above request returns JSON structured like this:
[
{
"instrument": "BTC-USDT",
"last": 9500.0,
"percentChange": 1.01,
"low": 9326.0,
"high": 9700.0,
"baseVolume": 0.42938522,
"quoteVolume": 4085.254614168045,
"volumeInBtc": 0.428410532977822,
"volumeInUsd": 4199.465356381075106,
"ask": 9619.0,
"bid": 9500.0,
"timestamp": "2020-06-23T07:16:10Z"
},
{
"instrument": "ETH-BTC",
"last": 0.0252,
"percentChange": 1.12,
"low": 0.02486,
"high": 0.02558,
"baseVolume": 77.11948753,
"quoteVolume": 1.945553953316,
"volumeInBtc": 1.945553953316,
"volumeInUsd": 18819.178114604597,
"ask": 0.02525,
"bid": 0.02515,
"timestamp": "2020-06-23T07:16:10Z"
}
]
GET https://api.crex24.com/v2/public/tickers
Returns the list of tickers with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Optional. Comma-separated list of tickers for which the detailed information is requested. If the parameter is not specified, the detailed information about all available tickers is returned |
Response
Returns an array of Ticker objects, each with the following structure:
Field | Type | Description |
---|---|---|
instrument | string | Unique ticker identifier, e.g. "LTC-BTC" |
last | decimal | Last price.
If this information is not available, the field contains the value null |
percentChange | decimal | Percentage change of the price over the last 24 hours.
If this information is not available, the field contains the value null |
low | decimal | Lowest price over the last 24 hours.
If this information is not available, the field contains the value null |
high | decimal | Highest price over the last 24 hours.
If this information is not available, the field contains the value null |
baseVolume | decimal | Total trading volume of the instrument over the last 24 hours, expressed in base currency |
quoteVolume | decimal | Total trading volume of the instrument over the last 24 hours, expressed in quote currency |
volumeInBtc | decimal | Total trading volume of the instrument over the last 24 hours, expressed in BTC |
volumeInUsd | decimal | Total trading volume of the instrument over the last 24 hours, expressed in USD |
ask | decimal |
Best ask price. If there are no active selling orders, the field contains the value null
|
bid | decimal |
Best bid price. If there are no active buying orders at the moment, the field contains the value null
|
timestamp | datetime | Date and time when the ticker was updated |
The data returned is in JSON format.
Recent Trades
GET https://api.crex24.com/v2/public/recentTrades?instrument=LTC-BTC
The above request returns JSON structured like this:
[
{
"price": 0.0159019,
"volume": 0.043717,
"side": "buy",
"timestamp": "2018-05-31T10:08:53Z"
},
{
"price": 0.0158989,
"volume": 0.045283,
"side": "buy",
"timestamp": "2018-05-31T10:08:53Z"
},
{
"price": 0.0158989,
"volume": 0.242679,
"side": "buy",
"timestamp": "2018-05-31T10:08:45Z"
},
...
]
GET https://api.crex24.com/v2/public/recentTrades?instrument=LTC-BTC&limit=2
The above request returns JSON structured like this:
[
{
"price": 0.0159019,
"volume": 0.043717,
"side": "buy",
"timestamp": "2018-05-31T10:08:53Z"
},
{
"price": 0.0158989,
"volume": 0.045283,
"side": "buy",
"timestamp": "2018-05-31T10:08:53Z"
}
]
GET https://api.crex24.com/v2/public/recentTrades
Returns the list of recent trades made with the specified instrument, sorted from newest to oldest.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Trade instrument for which the trades are requested |
limit | int | Optional. Maximum number of results per call. Accepted values: 1 - 1000 . If the parameter is not specified, the number of results is limited to 100 |
Response
Returns an array of objects, each with the following structure:
Field | Type | Description |
---|---|---|
price | decimal | Price for which the base currency was bought or sold |
volume | decimal | Trade volume (the amount of base currency that was bought or sold) |
side | string | Trade direction, can have either of the two values: "buy" or "sell" |
timestamp | datetime | Date and time when the trade took place |
The data returned is in JSON format.
Order Book
GET https://api.crex24.com/v2/public/orderBook?instrument=LTC-BTC
The above request returns JSON structured like this:
{
"buyLevels": [
{
"price": 0.01573481,
"volume": 0.032
},
{
"price": 0.01500001,
"volume": 0.75
},
...
{
"price": 0.00000001,
"volume": 10309.0
}
],
"sellLevels": [
{
"price": 0.01593,
"volume": 0.059355644356
},
{
"price": 0.01594994,
"volume": 0.3
},
...
{
"price": 1566320.0,
"volume": 0.135
}
]
}
GET https://api.crex24.com/v2/public/orderBook?instrument=LTC-BTC&limit=2
The above request returns JSON structured like this:
{
"buyLevels": [
{
"price": 0.01573481,
"volume": 0.032
},
{
"price": 0.01500001,
"volume": 0.75
}
],
"sellLevels": [
{
"price": 0.01593,
"volume": 0.059355644356
},
{
"price": 0.01594994,
"volume": 0.3
}
]
}
GET https://api.crex24.com/v2/public/orderBook
Returns information about bids and asks for the specified instrument, organized by price level.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Trade instrument for which the order book is requested |
limit | int | Optional. Maximum number of returned price levels (both buying and selling) per call. If the parameter is not specified, the number of levels is limited to 100 |
Response
Returns an object with the following structure:
Field | Type | Description |
---|---|---|
buyLevels | PriceLevel[] | An array of price levels for buying orders, sorted by price from highest to lowest |
sellLevels | PriceLevel[] | An array of price levels for selling orders, sorted by price from lowest to highest |
Structure of PriceLevel object:
Field | Type | Description |
---|---|---|
price | decimal | Price for which the base currency is bought or sold |
volume | decimal | Total volume of base currency that is bought or sold on the price level |
The data returned is in JSON format.
OHLCV Data
GET https://api.crex24.com/v2/public/ohlcv?instrument=ETH-BTC&granularity=30m
The above request returns JSON structured like this:
[
{
"timestamp": "2018-12-14T15:30:00Z",
"open": 0.02623,
"high": 0.02623,
"low": 0.02603,
"close": 0.02623,
"volume": 2.34421365
},
{
"timestamp": "2018-12-14T16:00:00Z",
"open": 0.02615,
"high": 0.02625,
"low": 0.02611,
"close": 0.02611,
"volume": 2.55170514
},
...
]
GET https://api.crex24.com/v2/public/ohlcv?instrument=LTC-BTC&granularity=1d&limit=2
The above request returns JSON structured like this:
[
{
"timestamp": "2018-12-15T00:00:00Z",
"open": 0.007221,
"high": 0.007427,
"low": 0.007196,
"close": 0.007362,
"volume": 300.87186072
},
{
"timestamp": "2018-12-16T00:00:00Z",
"open": 0.007346,
"high": 0.008157,
"low": 0.007336,
"close": 0.00802,
"volume": 396.51717076
}
]
GET https://api.crex24.com/v2/public/ohlcv
Returns the most recent OHLCV (Open, High, Low, Close, Volume) data for the specified instrument.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Trade instrument for which the OHLCV data is requested |
granularity | string | OHLCV data granularity, can have one of the following values:1m , 3m , 5m , 15m , 30m - 1, 3, 5, 15 or 30 minutes respectively;1h , 4h - 1 or 4 hours respectively;1d - 1 day;1w - 1 week;1mo - 1 month
|
limit | int | Optional. Maximum number of results per call. Accepted values: 1 - 1000 . If the parameter is not specified, the number of results is limited to 100 |
Response
Returns an array of objects, each with the following structure:
Field | Type | Description |
---|---|---|
timestamp | datetime | Date and time when the timeframe started |
open | decimal | Opening price |
high | decimal | Highest price |
low | decimal | Lowest price |
close | decimal | Closing price |
volume | decimal | Total amount of base currency traded within the timeframe |
The data returned is in JSON format.
Trading Fee Schedules
GET https://api.crex24.com/v2/public/tradingFeeSchedules
The above request returns JSON structured like this:
[
{
"name": "A",
"feeRates": [
{ "volumeThreshold": 0, "maker": -0.0001, "taker": 0.0010 },
{ "volumeThreshold": 5, "maker": -0.0002, "taker": 0.0009 },
{ "volumeThreshold": 15, "maker": -0.0003, "taker": 0.0008 },
{ "volumeThreshold": 30, "maker": -0.0004, "taker": 0.0007 },
{ "volumeThreshold": 50, "maker": -0.0005, "taker": 0.0006 }
]
},
{
"name": "B",
"feeRates": [
{ "volumeThreshold": 0, "maker": 0.0010, "taker": 0.0010 },
{ "volumeThreshold": 2, "maker": 0.0008, "taker": 0.0009 },
{ "volumeThreshold": 5, "maker": 0.0006, "taker": 0.0008 },
{ "volumeThreshold": 10, "maker": 0.0004, "taker": 0.0007 },
{ "volumeThreshold": 20, "maker": 0.0002, "taker": 0.0005 },
{ "volumeThreshold": 50, "maker": 0.0000, "taker": 0.0003 }
]
},
...
]
GET https://api.crex24.com/v2/public/tradingFeeSchedules
Returns the list of all trading fee schedules with detailed information.
Parameters
None.
Response
Returns an array of FeeSchedule objects, each with the following structure:
Field | Type | Description |
---|---|---|
name | string | Unique name of the fee schedule |
feeRates | FeeTier[] | An array of objects each representing a fee tier (maker and taker fee rates that come in force once a corresponding trading volume threshold has been met), ordered by volumeThreshold from smallest to largest |
Structure of FeeTier object:
Field | Type | Description |
---|---|---|
volumeThreshold | decimal | The value of 30-day trading volume (expressed in BTC) that must be reached to qualify for the tier |
maker | decimal | Market-maker fee rate. E.g., value 0.001 stands for a fee that amounts to 0.1% of the trade value.Negative value means rebate |
taker | decimal | Market-taker fee rate. E.g., value 0.001 stands for a fee that amounts to 0.1% of the trade value.Negative value means rebate |
The data returned is in JSON format.
Comments
FeeSchedule objects from the example should be interpreted as follows:
Schedule A
30-day trading volume | maker fee | taker fee |
---|---|---|
≥ 0 BTC | -0.01% (rebate) | 0.10% |
≥ 5 BTC | -0.02% (rebate) | 0.09% |
≥ 15 BTC | -0.03% (rebate) | 0.08% |
≥ 30 BTC | -0.04% (rebate) | 0.07% |
≥ 50 BTC | -0.05% (rebate) | 0.06% |
Schedule B
30-day trading volume | maker fee | taker fee |
---|---|---|
≥ 0 BTC | 0.10% | 0.10% |
≥ 2 BTC | 0.08% | 0.09% |
≥ 5 BTC | 0.06% | 0.08% |
≥ 10 BTC | 0.04% | 0.07% |
≥ 20 BTC | 0.02% | 0.05% |
≥ 50 BTC | 0.00% | 0.03% |
Withdrawal Fees
GET https://api.crex24.com/v2/public/withdrawalFees?currency=LTC
The above request returns JSON structured like this:
[
{
"feeCurrency": "LTC",
"amount": 0.00002000
},
{
"feeCurrency": "CREX",
"amount": 0.01000000
},
...
]
GET https://api.crex24.com/v2/public/withdrawalFees
Returns the list of all fees for currency withdrawal.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
currency | string | Currency identifier |
Response
Returns an array of FeeCurrency objects, each with the following structure:
Field | Type | Description |
---|---|---|
feeCurrency | string | Currency identifier |
amount | decimal | Fee amount |
The data returned is in JSON format.
Currencies Withdrawal Fees
GET https://api.crex24.com/v2/public/currenciesWithdrawalFees?filter=BTC,LTC
The above request returns JSON structured like this:
[
{
"currency": "BTC",
"fees": [
{
"feeCurrency": "BTC",
"amount": 0.00100000
}
]
},
{
"currency": "LTC",
"fees": [
{
"feeCurrency": "LTC",
"amount": 0.00002000
},
{
"feeCurrency": "CREX",
"amount": 0.01000000
}
]
}
]
GET https://api.crex24.com/v2/public/currenciesWithdrawalFees
Returns the list of all fees for currencies withdrawal.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
filter | string | Optional. Comma-separated list of currencies for which the withdrawal fees is requested. If the parameter is not specified, the withdrawal fees about all available currencies is returned |
Response
Returns an array of CurrencyFees objects, each with the following structure:
Field | Type | Description |
---|---|---|
сurrency | string | Currency identifier |
fees | FeeCurrency[] | An array of objects each representing a possible currency and amount for withdrawal fee payout. Structure of FeeCurrency object is specified in the withdrawalFees |
The data returned is in JSON format.
Trading
Base URL: https://api.crex24.com/v2/trading
Order Placement
POST https://api.crex24.com/v2/trading/placeOrder
{
"instrument": "BTS-BTC",
"side": "buy",
"volume": 4,
"price": 0.000025
}
The above request returns JSON structured like this:
{
"id": 469594855,
"timestamp": "2018-06-08T16:59:44Z",
"instrument": "BTS-BTC",
"side": "buy",
"type": "limit",
"status": "submitting",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 4.0,
"price": 0.000025,
"stopPrice": null,
"remainingVolume": 4.0,
"lastUpdate": "2018-06-08T16:59:44Z",
"parentOrderId": null,
"childOrderId": null
}
POST https://api.crex24.com/v2/trading/placeOrder
Places a new order.
Parameters
The parameters should be passed in the body of POST request as fields of a JSON object.
Parameter | Type | Description |
---|---|---|
instrument | string | Trade instrument for which the order should be placed, e.g. "ETH-BTC" |
side | string |
Order side, can have either of the two values:"buy" - buying order;"sell" - selling order
|
type | string |
Optional. Order type. Accepted values:"limit" - limit order;"market" - market order;"stopLimit" - stop-limit order.The value must comply with the list of order types supported by the instrument (see the value of parameter supportedOrderTypes of the Instrument). If the parameter is not specified, the default value "limit" is used.More about order types in the corresponding section of documentation |
timeInForce | string |
Optional. Sets the length of time over which the order will continue working before it’s cancelled. Accepted values:"GTC" - Good-Til-Cancelled;"IOC" - Immediate-Or-Cancel (currently not supported, reserved for future use);"FOK" - Fill-Or-Kill (currently not supported, reserved for future use).If the parameter is not specified, the default value "GTC" is used for limit orders.More about limit order lifecycle in the section Limit Order |
volume* | decimal |
The amount of base currency to be bought or sold. The value must be greater than or equal to the minVolume and less than or equal to the maxVolume of the Instrument. The volume expressed in quote currency (notional value, calculated as price × volume) must be greater than or equal to the minQuoteVolume and less than or equal to the maxQuoteVolume of the Instrument |
price* | decimal |
Order price. The value must be greater than or equal to the minPrice and less than or equal to the maxPrice of the Instrument. This parameter is not necessary for market orders (if set explicitly, the value is ignored) |
stopPrice* | decimal |
The price in a stop-limit order that triggers the creation of a limit order. The value must be greater than or equal to the minPrice and less than or equal to the maxPrice of the Instrument. This parameter is mandatory for stop-limit orders only. In case of alternate order types, the value is ignored |
strictValidation* | boolean |
Optional. The values of parameters price and stopPrice must be multiples of tickSize, and the value of parameter volume must be a multiple of volumeIncrement of the Instrument. This field defines how such values should be processed, if they don’t meet the requirements:false - prices and volume will be rounded to meet the requirements;true - execution of the method will be aborted and an error message will be returned.The default value is false .Until December 5, 2019 a value of volume that doesn't meet the requirement won't trigger an error (even if strictValidation is set to true ) and will be silently rounded (for backward compatibility)
|
* - description has been updated on Semptember 27, 2019
Response
Returns an object Order with the following structure:
Field | Type | Description |
---|---|---|
id | int | Unique order identifier |
timestamp | datetime | Date and time of creation |
instrument | string | Trade instrument identifier |
side | string |
Direction of trade, can have either of the two values:"buy" - buying order;"sell" - selling order
|
type | string |
Order type, can have one of the following values:"limit" - limit order;"market" - market order;"stopLimit" - stop-limit order
|
status | string |
Order status, can have one of the following values:"submitting" - in the process of submission;"unfilledActive" - active, no trades have taken place yet;"partiallyFilledActive" - part of the order is active, the other part has already been filled;"filled" - the order has been filled and is no longer active;"unfilledCancelled" - cancelled, no trades had been completed;"partiallyFilledCancelled" - cancelled being partially filled: part of the order has been filled, the other part has been cancelled."waiting" - stop-limit order is waiting to be triggered to place a limit order;More about order statuses in the section Order types |
cancellationReason | string |
Reason why the order has been cancelled (only for orders, that have status "unfilledCancelled" or "partiallyFilledCancelled" , in other cases the field contains the value null ). Can have one of the following values:"cancelledByUser" - the user has cancelled the order;"failedToFillRightAway" - an attempt to immediately fill an IOC or FOK order has failed, consequently the order has been cancelled;"failedToPassValidation" - the order has not passed validation;"marketClosed" - the instrument has been suspended from trading;"orderExpired" - the order has expired (reserved for future use)
Reserved for future use. Currently is always set to null
|
timeInForce | string |
Length of time over which the order will continue working before it’s cancelled, can have one of the following values:"GTC" - Good-Til-Cancelled;"IOC" - Immediate-Or-Cancel;"FOK" - Fill-Or-Kill.This field is for limit orders only. If the order is of different type, the field contains the value null .More about limit order lifecycle in the section Limit Order |
volume | decimal | Initial volume of the order |
price | decimal | Initial price of the order. In case of market order, this field contains the value null |
stopPrice | decimal | Stop-price (for stop-limit orders only; if the order is of different type, this field contains the value null ) |
remainingVolume | decimal | Remaining volume of the order (volume that hasn’t been filled) |
lastUpdate | datetime |
Last time the order had undergone changes (remaining volume decreased, status changed, etc.). If this information is not available, the field contains the value null .
|
parentOrderId | int |
ID of an order that served as a base order for the current one. This field contains an integer value if the current order has been placed due to triggering of a stop-limit order or as a result of modification of another order. Otherwise the field contains the value null .
Reserved for future use. Currently is always set to null
|
childOrderId | int |
ID of an order that has been created based on the current order. This field contains an integer value if the current order is a stop-limit order that has been triggered or the current order is a limit order that has been modified. Otherwise the field contains the value null .
Reserved for future use. Currently is always set to null
|
The data returned is in JSON format.
Comments
Order submission is not instantaneous, it’s a process that takes some time (usually less than one second). Consequently, if one sends a request to place an order which implies immediate execution, the response may still contain the status "submitting"
. In this situation the orderStatus method may be of use to track the status of order execution later.
Order Status
GET https://api.crex24.com/v2/trading/orderStatus?id=466747915
The above request returns JSON structured like this:
[
{
"id": 466747915,
"timestamp": "2018-05-26T06:43:49Z",
"instrument": "UNI-BTC",
"side": "sell",
"type": "limit",
"status": "partiallyFilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 5700.0,
"price": 0.000005,
"stopPrice": null,
"remainingVolume": 1.948051948052,
"lastUpdate": "2018-05-26T06:43:53Z",
"parentOrderId": null,
"childOrderId": null
}
]
GET https://api.crex24.com/v2/trading/orderStatus?id=466747915,466748077
The above request returns JSON structured like this:
[
{
"id": 466747915,
"timestamp": "2018-05-26T06:43:49Z",
"instrument": "UNI-BTC",
"side": "sell",
"type": "limit",
"status": "partiallyFilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 5700.0,
"price": 0.000005,
"stopPrice": null,
"remainingVolume": 1.948051948052,
"lastUpdate": "2018-05-26T06:43:53Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 466748077,
"timestamp": "2018-05-26T06:45:29Z",
"instrument": "PRJ-BTC",
"side": "sell",
"type": "limit",
"status": "partiallyFilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 10000.0,
"price": 0.0000007,
"stopPrice": null,
"remainingVolume": 9975.0,
"lastUpdate": "2018-05-26T06:45:58Z",
"parentOrderId": null,
"childOrderId": null
}
]
GET https://api.crex24.com/v2/trading/orderStatus
Returns detailed information about the specified order(s).
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
id | int | Comma-separated list of identifiers of orders for which the detailed information is requested |
Response
Returns an array of Order objects, each with the structure described in the section Order Placement. The data returned is in JSON format.
Order Trades
GET https://api.crex24.com/v2/trading/orderTrades?id=416475861
The above request returns JSON structured like this:
[
{
"id": 1939477,
"orderId": 416475861,
"timestamp": "2018-03-15T10:22:10Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.02,
"volume": 0.02,
"fee": 0.00002,
"feeCurrency": "LTC"
},
{
"id": 1939478,
"orderId": 416475861,
"timestamp": "2018-03-15T10:22:10Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.02,
"volume": 0.169,
"fee": 0.000169,
"feeCurrency": "LTC"
},
{
"id": 1939479,
"orderId": 416475861,
"timestamp": "2018-03-15T10:22:10Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.02,
"volume": 0.02,
"fee": 0.00002,
"feeCurrency": "LTC"
},
...
]
GET https://api.crex24.com/v2/trading/orderTrades
Returns information about trades generated by the specified order.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
id | int | ID of the order for which the information about trades is requested |
Response
Returns an array of Trade objects, each with the structure described in the section Trade History. The data returned is in JSON format.
Order Modification
POST https://api.crex24.com/v2/trading/modifyOrder
{
"id": 469708782,
"newPrice": 0.000028,
"newVolume": 3.14
}
The above request returns JSON structured like this:
{
"id": 469708849,
"timestamp": "2018-06-09T16:57:35Z",
"instrument": "B2C-BTC",
"side": "buy",
"type": "limit",
"status": "submitting",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 3.14,
"price": 0.000028,
"stopPrice": null,
"remainingVolume": 3.14,
"lastUpdate": "2018-06-09T16:57:35Z",
"parentOrderId": null,
"childOrderId": null
}
POST https://api.crex24.com/v2/trading/modifyOrder
Modifies price and/or volume of an existing order.
Parameters
The parameters should be passed in the body of POST request as fields of a JSON object.
Name | Type | Description |
---|---|---|
id | int | Identifier of the order that should be modified |
newPrice* | decimal |
Optional. New value of price. If the parameter is not specified or its value is null or 0 , the current value of price is used.The value must be greater than or equal to the minPrice and less than or equal to the maxPrice of the Instrument |
newVolume* | decimal |
Optional. New value of volume. If the parameter is not specified or its value is null or 0 , the current value of remainingVolume is used.The value must be greater than or equal to the minVolume and less than or equal to the maxVolume of the Instrument. The volume expressed in quote currency (notional value, calculated as newPrice × newVolume) must be greater than or equal to the minQuoteVolume and less than or equal to the maxQuoteVolume of the Instrument |
strictValidation* | boolean |
Optional. The value of parameter newPrice must be a multiple of tickSize, and the value of parameter newVolume must be a multiple of volumeIncrement of the Instrument. This field defines how such values should be processed, if they are set explicitly in the request and don’t meet the requirements:false - price and volume will be rounded to meet the requirements;true - execution of the method will be aborted and an error message will be returned.The default value is false Until December 5, 2019 a value of volume that doesn't meet the requirement won't trigger an error (even if strictValidation is set to true ) and will be silently rounded (for backward compatibility)
|
* - description has been updated on Semptember 27, 2019
Comments
This method is for active limit GTC orders only, invoking it for any other order will result in an error.
Essentially, this method cancels an existing order and places a new one with different price and/or volume instead of it. As a result, the order is moved to the back of the price level queue of the order book after modification. If, however, the modification is not necessary (the new price and volume are the same as the ones of the current order), then the current order is returned without any changes.
This method allows modifying the price and volume only. If modification of other parameters is necessary, one should cancel an existing order and place a new one (with required characteristics) instead of it manually.
Response
Returns an object Order that contains information about the modified order. The structure of the object is described in the section Order Placement. The data returned is in JSON format.
Active Orders
GET https://api.crex24.com/v2/trading/activeOrders
The above request returns JSON structured like this:
[
{
"id": 466747915,
"timestamp": "2018-05-26T06:43:49Z",
"instrument": "UNI-BTC",
"side": "sell",
"type": "limit",
"status": "partiallyFilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 5700.0,
"price": 0.000005,
"stopPrice": null,
"remainingVolume": 1.948051948052,
"lastUpdate": "2018-05-26T06:43:53Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 466748077,
"timestamp": "2018-05-26T06:45:29Z",
"instrument": "PRJ-BTC",
"side": "sell",
"type": "limit",
"status": "partiallyFilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 10000.0,
"price": 0.0000007,
"stopPrice": null,
"remainingVolume": 9975.0,
"lastUpdate": "2018-05-26T06:45:58Z",
"parentOrderId": null,
"childOrderId": null
},
...
]
GET https://api.crex24.com/v2/trading/activeOrders?instrument=ETH-BTC,BTC-USDT
The above request returns JSON structured like this:
[
{
"id": 1134586371,
"timestamp": "2020-06-23T07:36:07Z",
"instrument": "BTC-USDT",
"side": "sell",
"type": "limit",
"status": "unfilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.0001,
"price": 20000.0,
"stopPrice": null,
"remainingVolume": 0.0001,
"lastUpdate": "2020-06-23T07:36:07Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 1134587019,
"timestamp": "2020-06-23T07:36:44Z",
"instrument": "ETH-BTC",
"side": "buy",
"type": "limit",
"status": "unfilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.1,
"price": 0.0001,
"stopPrice": null,
"remainingVolume": 0.1,
"lastUpdate": "2020-06-23T07:36:45Z",
"parentOrderId": null,
"childOrderId": null
},
...
]
GET https://api.crex24.com/v2/trading/activeOrders
Returns the list of active orders with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Optional. Comma-separated list of trade instruments for which the active orders are requested. If the parameter is not specified, the active orders for all instruments are returned |
Response
Returns an array of Order objects, each with the structure described in the section Order Placement. The data returned is in JSON format.
Order Cancellation
Cancellation by ID
POST https://api.crex24.com/v2/trading/cancelOrdersById
{
"ids": [465448358, 468364313]
}
The above request returns JSON structured like this:
[
465448358,
468364313
]
POST https://api.crex24.com/v2/trading/cancelOrdersById
Cancels orders with the specified identifiers.
Parameters
The parameters should be passed in the body of POST request as fields of a JSON object.
Name | Type | Description |
---|---|---|
ids | int[] | Array of identifiers of orders that should be cancelled |
Cancellation by Instrument
POST https://api.crex24.com/v2/trading/cancelOrdersByInstrument
{
"instruments": ["LTC-BTC", "ETH-BTC"]
}
The above request returns JSON structured like this:
[
465448350,
468364474,
468904570
]
POST https://api.crex24.com/v2/trading/cancelOrdersByInstrument
Cancels all orders for each of the specified trade instruments.
Parameters
The parameters should be passed in the body of POST request as fields of a JSON object.
Name | Type | Description |
---|---|---|
instruments | string[] | Array of identifiers of trade instruments for which all orders should be cancelled |
Cancellation of All Orders
POST https://api.crex24.com/v2/trading/cancelAllOrders
The above request returns JSON structured like this:
[
465448350,
465448358,
468364313,
468364474,
468904570
]
POST https://api.crex24.com/v2/trading/cancelAllOrders
Cancels all active orders and all orders that are in the process of submission.
Parameters
None (body of POST request is empty).
Response
Each of the above listed methods returns an array of identifiers of successfully cancelled orders. The data returned is in JSON format.
Order History
GET https://api.crex24.com/v2/trading/orderHistory
The above request returns JSON structured like this:
[
{
"id": 468535711,
"timestamp": "2018-06-02T16:42:40Z",
"instrument": "BTC-EUR",
"side": "sell",
"type": "limit",
"status": "submitting",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.00770733,
"price": 6724.9,
"stopPrice": null,
"remainingVolume": 0.00770733,
"lastUpdate": "2018-06-02T16:42:40Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 468535707,
"timestamp": "2018-06-02T16:42:37Z",
"instrument": "BTG-BTC",
"side": "buy",
"type": "limit",
"status": "unfilledActive",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.0173737,
"price": 0.00589027,
"stopPrice": null,
"remainingVolume": 0.0173737,
"lastUpdate": "2018-06-02T16:42:37Z",
"parentOrderId": null,
"childOrderId": null
},
...
]
GET https://api.crex24.com/v2/trading/orderHistory?instrument=ETH-BTC,BTC-USDT
The above request returns JSON structured like this:
[
{
"id": 1134592496,
"timestamp": "2020-06-23T07:42:41Z",
"instrument": "ETH-BTC",
"side": "sell",
"type": "limit",
"status": "filled",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.001,
"price": 0.02523,
"stopPrice": null,
"remainingVolume": 0.0,
"lastUpdate": "2020-06-23T07:42:41Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 1134591670,
"timestamp": "2020-06-23T07:41:47Z",
"instrument": "BTC-USDT",
"side": "buy",
"type": "limit",
"status": "partiallyFilledCancelled",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.0001,
"price": 9619.0,
"stopPrice": null,
"remainingVolume": 0.00000008,
"lastUpdate": "2020-06-23T07:41:47Z",
"parentOrderId": null,
"childOrderId": null
},
...
]
GET https://api.crex24.com/v2/trading/orderHistory?from=2018-04-01
The above request returns JSON structured like this:
[
{
"id": 429924578,
"timestamp": "2018-04-01T00:00:13Z",
"instrument": "BTC-CNY",
"side": "buy",
"type": "limit",
"status": "unfilledCancelled",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.00936817,
"price": 41455.3,
"stopPrice": null,
"remainingVolume": 0.00936817,
"lastUpdate": "2018-04-03T11:24:37Z",
"parentOrderId": null,
"childOrderId": null
},
{
"id": 429924503,
"timestamp": "2018-04-01T00:00:12Z",
"instrument": "XMR-BTC",
"side": "sell",
"type": "limit",
"status": "unfilledCancelled",
"cancellationReason": null,
"timeInForce": "GTC",
"volume": 0.465514,
"price": 0.025869,
"stopPrice": null,
"remainingVolume": 0.465514,
"lastUpdate": "2018-04-01T01:04:01Z",
"parentOrderId": null,
"childOrderId": null
},
...
]
GET https://api.crex24.com/v2/trading/orderHistory
Returns the list of trader’s orders with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Optional. Comma-separated list of trade instruments for which the information about orders is requested. If the parameter is not specified, the information about orders is provided for all instruments |
from | datetime | Optional. The start point of the time frame from which the information about orders should be collected |
till | datetime | Optional. The end point of the time frame from which the information about orders should be collected |
limit | int | Optional. Maximum number of results per call. Accepted values: 1 - 1000 . If the parameter is not specified, the number of results is limited to 100 |
Comments
If parameters from and till are not specified, the most recent orders are returned.
If the value of parameter from is set, the set of orders after the specified date is returned.
If the value of parameter till is set, the set of orders before the specified date is returned.
If both the parameters - from and till - are specified, then either all orders from the time frame are returned, if their number doesn’t exceed the limit, or the latest orders from the time frame are returned otherwise.
Response
Returns an array of Order objects, each with the structure described in the section Order Placement. The data returned is in JSON format.
Trade History
GET https://api.crex24.com/v2/trading/tradeHistory
The above request returns JSON structured like this:
[
{
"id": 3005866,
"orderId": 468533093,
"timestamp": "2018-06-02T16:26:27Z",
"instrument": "BCH-ETH",
"side": "buy",
"price": 1.78882,
"volume": 0.027,
"fee": 0.0000483,
"feeCurrency": "ETH"
},
{
"id": 3005812,
"orderId": 468515771,
"timestamp": "2018-06-02T16:16:05Z",
"instrument": "ETC-BTC",
"side": "sell",
"price": 0.00210958,
"volume": 0.05994006,
"fee": -0.000000063224,
"feeCurrency": "BTC"
},
...
]
GET https://api.crex24.com/v2/trading/tradeHistory?instrument=LTC-BTC
The above request returns JSON structured like this:
[
{
"id": 3005729,
"orderId": 468529980,
"timestamp": "2018-06-02T16:07:45Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.0159865,
"volume": 0.03235111,
"fee": -0.000000258591,
"feeCurrency": "BTC"
},
{
"id": 3005663,
"orderId": 468527248,
"timestamp": "2018-06-02T15:57:41Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.01595213,
"volume": 0.0497125,
"fee": -0.00000039651,
"feeCurrency": "BTC"
},
...
]
GET https://api.crex24.com/v2/trading/tradeHistory?instrument=LTC-BTC&from=2018-03-15T09:00&till=2018-03-15T11:00
The above request returns JSON structured like this:
[
{
"id": 1939487,
"orderId": 416476592,
"timestamp": "2018-03-15T10:23:12Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.0201,
"volume": 0.02,
"fee": 0.00002,
"feeCurrency": "LTC"
},
{
"id": 1939464,
"orderId": 416442461,
"timestamp": "2018-03-15T09:29:00Z",
"instrument": "LTC-BTC",
"side": "buy",
"price": 0.0199,
"volume": 0.017,
"fee": 0.000017,
"feeCurrency": "LTC"
}
]
GET https://api.crex24.com/v2/trading/tradeHistory
Returns the list of trades with detailed information.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
instrument | string | Optional. Comma-separated list of trade instruments for which the information about trades is requested. If the parameter is not specified, the information about trades is provided for all instruments |
from | datetime | Optional. The start point of the time frame from which the information about trades should be collected |
till | datetime | Optional. The end point of the time frame from which the information about trades should be collected |
limit | int | Optional. Maximum number of results per call. Accepted values: 1 - 1000 . If the parameter is not specified, the number of results is limited to 100 |
Comments
If parameters from and till are not specified, the most recent trades are returned.
If the value of parameter from is set, the set of trades after the specified date is returned.
If the value of parameter till is set, the set of trades before the specified date is returned.
If both the parameters - from and till - are specified, then either all trades from the time frame are returned, if their number doesn’t exceed the limit, or the latest trades from the time frame are returned otherwise.
Response
Returns an array of Trade objects, each with the following structure:
Field | Type | Description |
---|---|---|
id | int | Unique* trade identifier |
orderId | int | Identifier of the order that generated the trade |
timestamp | datetime | Date and time when the trade took place |
instrument | string | Trade instrument identifier |
side | string | Trade direction, can have either of the two values: "buy" or "sell" |
price | decimal | Price for which the base currency was bought or sold |
volume | decimal | Trade volume (the amount of base currency that was bought or sold) |
fee | decimal | The amount of fee charged (negative value means rebate) |
feeCurrency | string | Fee/rebate currency |
* If a user acts both as a buyer and a seller in the same trade, the response will contain two results for such trade - one with information for the buyer and the other with information for the seller - both with the same trade ID
The data returned is in JSON format.
Fee and Rebate
GET https://api.crex24.com/v2/trading/tradingFee
The above request returns JSON structured like this:
{
"feeRates": [
{ "schedule": "A", "maker": -0.0001, "taker": 0.0010 },
{ "schedule": "B", "maker": 0.0010, "taker": 0.0010 },
...
]
"tradingVolume": 0.958,
"lastUpdate" : "2020-01-31T15:48:03Z"
}
GET https://api.crex24.com/v2/trading/tradingFee
Returns information about trade commissions: current maker and taker fee rates used in each fee schedule. These values depend on 30-day trading volume (expressed in BTC) and updated at least once every 24 hours. More about trade commissions in the Fees section of the website.
Parameters
None.
Response
Returns an object with the following structure:
Field | Type | Description |
---|---|---|
feeRates | FeeRate[] | An array of objects, one per fee schedule, each describing currently applied fee rate |
tradingVolume | decimal | Total volume of trades that took place over the last 30 days, expressed in BTC |
lastUpdate | datetime | Date and time when the fee rates and 30-day trading volume were last updated |
Structure of FeeRate object:
Field | Type | Description |
---|---|---|
schedule | string | Name of the fee schedule |
maker | decimal | Currently applied maker-fee rate of the schedule. E.g., value 0.001 stands for a fee that amounts to 0.1% of the trade value.Negative value means rebate |
taker | decimal | Currently applied taker-fee rate of the schedule. E.g., value 0.001 stands for a fee that amounts to 0.1% of the trade value.Negative value means rebate |
The data returned is in JSON format.
Trade Fee and Rebate (Discontinued)
GET https://api.crex24.com/v2/trading/tradeFee
The above request returns JSON structured like this:
{
"makerFeeRate": -0.0001,
"takerFeeRate": 0.001,
"tradeVolume": 1.1201,
"lastUpdate" : "2017-12-31T23:59:59Z"
}
GET https://api.crex24.com/v2/trading/tradeFee
Returns information about trade commissions: market-taker fee and market-maker fee/rebate. Both values depend on trader’s 30-day trailing volume (expressed in BTC) and updated at least once every 24 hours. More about trade commissions in the Fees section of the website.
Parameters
None.
Response
Returns an object with the following structure:
Field | Type | Description |
---|---|---|
makerFeeRate | decimal | Relative size of market-maker fee, e.g. the value 0.001 stands for a fee that amounts to 0.1% of the trade value (negative value means rebate) |
takerFeeRate | decimal | Relative size of market-taker fee, e.g. the value 0.001 stands for a fee that amounts to 0.1% of the trade value |
tradeVolume | decimal | Total volume of trades that took place over the last 30 days, expressed in BTC |
lastUpdate | datetime | Date and time when the values of trade fees and trailing 30-day volume were last updated |
The data returned is in JSON format.
Account
Base URL: https://api.crex24.com/v2/account
Balances
GET https://api.crex24.com/v2/account/balance
The above request returns JSON structured like this:
[
{
"currency": "ALPS",
"available": 0.0979,
"reserved": 0.0
},
{
"currency": "BCD",
"available": 12.43897,
"reserved": 0.0
},
{
"currency": "BCH",
"available": 1.3394,
"reserved": 1.4013
},
...
]
GET https://api.crex24.com/v2/account/balance?currency=BBN,ETH&nonZeroOnly=false
The above request returns JSON structured like this:
[
{
"currency": "BBN",
"available": 0.0,
"reserved": 0.0
},
{
"currency": "ETH",
"available": 0.4778,
"reserved": 3.5261
}
]
GET https://api.crex24.com/v2/account/balance
Returns information about trader’s balances in different currencies.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
currency | string | Optional. Comma-separated list of currencies for which the balance information is requested. If the parameter is not specified, the balance information is requested for all currencies |
nonZeroOnly | boolean |
Optional. Can have either of the two values:true - return only non-zero balances;false - return all balances.The default value is true
|
Response
Returns an array of objects, each with the following structure:
Field | Type | Description |
---|---|---|
currency | string | Currency identifier, e.g. "BTC" |
available | decimal | Available balance (funds that can be withdrawn or used for trading) |
reserved | decimal | Reserved balance (funds that are being used in active orders and, consequently, can’t be withdrawn or used elsewhere at the moment) |
The data returned is in JSON format.
Crypto Deposit Address
GET https://api.crex24.com/v2/account/depositAddress?currency=BTC
The above request returns JSON structured like this:
{
"currency": "BTC",
"address": "5xF3EVqwOf53PLeU78iGJpbWz45qzPIfnd",
"paymentId": null
}
GET https://api.crex24.com/v2/account/depositAddress?currency=BTS
The above request returns JSON structured like this:
{
"currency": "BTS",
"address": "crex24",
"paymentId": "0fg4da4186741579"
}
GET https://api.crex24.com/v2/account/depositAddress
Returns the address (and Payment ID, if necessary) for cryptocurrency deposit.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
currency | string | Identifier of the cryptocurrency, that you would like to deposit |
Response
Returns an object with the following structure:
Field | Type | Description |
---|---|---|
currency | string | Cryptocurrency identifier |
address | string | Address of the wallet to send the cryptocurrency to |
paymentId | string |
Additional information (such as Payment ID, Message, Memo, etc.) that defines the destination of money transfer along with the address and should be specified when sending the deposit. If there’s no need to specify an additional information, the field contains the value null
|
The data returned is in JSON format.
Money Transfer History
GET https://api.crex24.com/v2/account/moneyTransfers
The above request returns JSON structured like this:
[
{
"id": 756446,
"type": "deposit",
"currency": "ETH",
"feeCurrency": null,
"address": "0x451d5a1b7519aa75164f440df78c74aac96023fe",
"paymentId": null,
"amount": 0.142,
"fee": null,
"txId": "0x2b49098749840a9482c4894be94f94864b498a1306b6874687a5640cc9871918",
"createdAt": "2018-06-02T19:30:28Z",
"processedAt": "2018-06-02T21:10:41Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
},
{
"id": 755417,
"type": "deposit",
"currency": "BTC",
"feeCurrency": null,
"address": "1Hre55iru4Gewk4ewYGUiyugh44rBYUGFB",
"paymentId": null,
"amount": 0.01,
"fee": null,
"txId": "74979a487960c987d7918ddfa74978a9717c0879877098e7809831084ff09874",
"createdAt": "2018-06-02T17:39:56Z",
"processedAt": "2018-06-02T17:45:12Z",
"confirmationsRequired": 1,
"confirmationCount": 1,
"status": "success",
"errorDescription": null
},
{
"id": 754618,
"type": "deposit",
"currency": "BTC",
"feeCurrency": null,
"address": "1IgNfmERVcier4IhfGEfutkLfu4AcmeiUC",
"paymentId": null,
"amount": 0.09,
"fee": null,
"txId": "6876541687a9187e987c9187654f7198b9718af974641687b19a87987f91874f",
"createdAt": "2018-06-02T16:19:44Z",
"processedAt": "2018-06-02T16:20:50Z",
"confirmationsRequired": 1,
"confirmationCount": 1,
"status": "success",
"errorDescription": null
},
...
]
GET https://api.crex24.com/v2/account/moneyTransfers?currency=ETH
The above request returns JSON structured like this:
[
{
"id": 756446,
"type": "deposit",
"currency": "ETH",
"feeCurrency": null,
"address": "0x451d5a1b7519aa75164f440df78c74aac96023fe",
"paymentId": null,
"amount": 0.142,
"fee": null,
"txId": "0x2b49098749840a9482c4894be94f94864b498a1306b6874687a5640cc9871918",
"createdAt": "2018-06-02T19:30:28Z",
"processedAt": "2018-06-02T21:10:41Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
},
{
"id": 737551,
"type": "withdrawal",
"currency": "ETH",
"feeCurrency": "ETH",
"address": "0x184189a9187c918ef91875641f9781a9187b75a7",
"paymentId": "",
"amount": 54.1,
"fee": 0.005,
"txId": "0x1983645416f16a16c1687643086f7c91767a9817b981765140c8176871fc79fa",
"createdAt": "2018-06-01T06:48:32Z",
"processedAt": "2018-06-01T07:12:15Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
}
]
GET https://api.crex24.com/v2/account/moneyTransfers?currency=BTC&from=2018-06-02T15:00&till=2018-06-02T20:30
The above request returns JSON structured like this:
[
{
"id": 755417,
"type": "deposit",
"currency": "BTC",
"feeCurrency": null,
"address": "1Hre55iru4Gewk4ewYGUiyugh44rBYUGFB",
"paymentId": null,
"amount": 0.01,
"fee": null,
"txId": "74979a487960c987d7918ddfa74978a9717c0879877098e7809831084ff09874",
"createdAt": "2018-06-02T17:39:56Z",
"processedAt": "2018-06-02T17:45:12Z",
"confirmationsRequired": 1,
"confirmationCount": 1,
"status": "success",
"errorDescription": null
},
{
"id": 754618,
"type": "deposit",
"currency": "BTC",
"feeCurrency": null,
"address": "1IgNfmERVcier4IhfGEfutkLfu4AcmeiUC",
"paymentId": null,
"amount": 0.09,
"fee": null,
"txId": "6876541687a9187e987c9187654f7198b9718af974641687b19a87987f91874f",
"createdAt": "2018-06-02T16:19:44Z",
"processedAt": "2018-06-02T16:20:50Z",
"confirmationsRequired": 1,
"confirmationCount": 1,
"status": "success",
"errorDescription": null
}
]
GET https://api.crex24.com/v2/account/moneyTransfers
Returns information about deposits and withdrawals.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
type | string |
Optional. Filters money transfers by type, can have either of the two values:"deposit" - get deposits only;"withdrawal" - get withdrawals only.If the parameter is not specified, both the deposits and withdrawals are returned |
currency | string | Optional. Comma-separated list of currencies for which the money transfer history is requested. If the parameter is not specified, the money transfers are returned for all currencies |
from | datetime | Optional. The start point of the time frame from which the money transfer history is collected |
till | datetime | Optional. The end point of the time frame from which the money transfer history is collected |
limit | int | Optional. Maximum number of results per call. Accepted values: 1 - 1000 . If the parameter is not specified, the number of results is limited to 100 |
Comments
If parameters from and till are not specified, the most recent money transfers are returned.
If the value of parameter from is set, the set of money transfers after the specified date is returned.
If the value of parameter till is set, the set of money transfers before the specified date is returned.
If both the parameters - from and till - are specified, then either all money transfers from the time frame are returned, if their number doesn’t exceed the limit, or the latest money transfers from the time frame are returned otherwise.
Parameters from and till filter the results based on the value of createdAt field.
Response
Returns an array of MoneyTransfer objects, sorted from newest to oldest, each with the following structure:
Field | Type | Description |
---|---|---|
id | int | Unique identifier of money transfer |
type | string | Type of money transfer, can have either of the two values: "deposit" or "withdrawal" |
currency | string | Cryptocurrency identifier |
feeCurrency | string | Cryptocurrency identifier used to pay the withdrawal commission. In case of a deposit, the field contains null |
address | string |
Cryptocurrency wallet address. In case of cryptocurrency deposit, this field contains the address of the CREX24 wallet associated with trader’s account. In case of cryptocurrency withdrawal, this field contains the address of external wallet, to which the money were transferred from trader’s account. For fiat deposits and withdrawals, this field contains the value null . The field also contains the value null for cryptocurrency deposits and withdrawals, if the information about the wallet address is unavailable
|
paymentId | string |
Additional information (such as Payment ID, Message, Memo, etc.) that was specified along with the wallet address. For fiat deposits and withdrawals, this field contains the value null . The field also contains the value null for cryptocurrency deposits and withdrawals, if such information is not unavailable
|
amount | decimal | The amount of currency that was deposited or withdrawn |
fee | decimal | The amount of fee charged for money transfer. If this information is not available, the field contains the value null |
txId | string |
Identifier of the transaction in the cryptocurrency blockchain. For fiat deposits and withdrawals, this field contains the value null . The field also contains the value null for cryptocurrency deposits and withdrawals, if the information about the transaction ID is unavailable
|
createdAt | datetime | Date and time when the money transfer was initiated |
processedAt | datetime | Date and time when the money transfer was processed. If this information is not available or the money transfer hasn’t been processed yet, the field contains the value null |
confirmationsRequired | int | The number of blockchain confirmations the cryptocurrency deposit is required to receive before the funds are credited to the account, or the number of confirmations the cryptocurrency withdrawal is required to receive before it is considered successful.
In case of fiat deposits and withdrawals, this field contains the value null
|
confirmationCount | int |
Current number of blockchain confirmations of the cryptocurrency deposit/withdrawal (in case of fiat deposits and withdrawals, the field contains the value null )
|
status | string |
Money transfer status, can have one of the following values:"pending" - transfer is in progress;"success" - completed successfully;"failed" - aborted at some point (money will be credited back to the account of origin)
|
errorDescription | string |
Error description (only for money transfers with status "failed" , in other cases the field contains the value null )
|
The data returned is in JSON format.
Money Transfer Status
GET https://api.crex24.com/v2/account/moneyTransferStatus?id=756446
The above request returns JSON structured like this:
[
{
"id": 756446,
"type": "deposit",
"currency": "ETH",
"feeCurrency": null,
"address": "0x451d5a1b7519aa75164f440df78c74aac96023fe",
"paymentId": null,
"amount": 0.142,
"fee": null,
"txId": "0x2b49098749840a9482c4894be94f94864b498a1306b6874687a5640cc9871918",
"createdAt": "2018-06-02T19:30:28Z",
"processedAt": "2018-06-02T21:10:41Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
}
]
GET https://api.crex24.com/v2/account/moneyTransferStatus?id=756446,737551
The above request returns JSON structured like this:
[
{
"id": 756446,
"type": "deposit",
"currency": "ETH",
"feeCurrency": null,
"address": "0x451d5a1b7519aa75164f440df78c74aac96023fe",
"paymentId": null,
"amount": 0.142,
"fee": null,
"txId": "0x2b49098749840a9482c4894be94f94864b498a1306b6874687a5640cc9871918",
"createdAt": "2018-06-02T19:30:28Z",
"processedAt": "2018-06-02T21:10:41Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
},
{
"id": 737551,
"type": "withdrawal",
"currency": "ETH",
"feeCurrency": "ETH",
"address": "0x184189a9187c918ef91875641f9781a9187b75a7",
"paymentId": "",
"amount": 54.1,
"fee": 0.005,
"txId": "0x1983645416f16a16c1687643086f7c91767a9817b981765140c8176871fc79fa",
"createdAt": "2018-06-01T06:48:32Z",
"processedAt": "2018-06-01T07:12:15Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
}
]
GET https://api.crex24.com/v2/account/moneyTransferStatus
Returns information about the specified money transfer(s).
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
id | int | Comma-separated list of identifiers of money transfers for which the detailed information is requested |
Response
Returns an array of MoneyTransfer objects, each with the structure described in the section Money Transfer History. The data returned is in JSON format.
Crypto Withdrawal Preview
GET https://api.crex24.com/v2/account/previewWithdrawal?currency=LTC&amount=10&feeCurrency=LTC&includeFee=false
The above request returns JSON structured like this:
{
"warning": null,
"balanceDeduction": 10.002,
"fee": 0.002,
"payout": 10.0
}
GET https://api.crex24.com/v2/account/previewWithdrawal?currency=LTC&amount=10&feeCurrency=LTC&includeFee=true
The above request returns JSON structured like this:
{
"warning": null,
"balanceDeduction": 10,
"fee": 0.002,
"payout": 9.998
}
GET https://api.crex24.com/v2/account/previewWithdrawal?currency=LTC&amount=10&feeCurrency=CREX
The above request returns JSON structured like this:
{
"warning": null,
"balanceDeduction": 10.0,
"fee": 0.1,
"payout": 10.0
}
GET https://api.crex24.com/v2/account/previewWithdrawal
Allows previewing a cryptocurrency withdrawal without actually conducting it. Useful for estimating the size of non-flat withdrawal fee and ensuring that the withdrawal meets formal requirements.
Parameters
The parameters should be passed in the query component of the URL of GET request.
Name | Type | Description |
---|---|---|
currency | string | The value of parameter currency that will be specified in the actual withdrawal request |
amount | decimal | The value of parameter amount that will be specified in the actual withdrawal request |
feeCurrency | sting | The value of parameter feeCurrency that will be specified in the actual withdrawal request |
includeFee | bool | Optional. The value of parameter includeFee that will be specified in the actual withdrawal request |
Response
Returns an object with the following structure:
Field | Type | Description |
---|---|---|
warning | string |
If withdrawal meets formal requirements (minimum and maximum limits, withdrawal amount covers the fee, etc.), the field contains the value null , and the fields below provide a preview information for a withdrawal with the specified parameters.Otherwise this field contains a warning message indicating the source of the problem, and the fields below provide information for a substitute withdrawal that is close to the original one but would meet formal requirements. It is up to your software to decide whether to use the suggested modification of the withdrawal or not. An attempt to perform an actual withdrawal with the originally specified parameters will result in an error |
balanceDeduction | decimal | The total amount that will be debited from the account (subtracted from the balance), if the withdrawal is performed |
fee | decimal | The size of the fee that will be charged, if the withdrawal is performed |
payout | decimal | The amount that will be transferred to the specified address, if the withdrawal is performed |
The data returned is in JSON format.
Crypto Withdrawal
POST https://api.crex24.com/v2/account/withdraw
{
"currency": "ETH",
"amount": 54.1,
"feeCurrency": "ETH",
"address": "0x184189a9187c918ef91875641f9781a9187b75a7"
}
The above request returns JSON structured like this:
{
"id": 737551,
"type": "withdrawal",
"currency": "ETH",
"feeCurrency": "ETH",
"address": "0x184189a9187c918ef91875641f9781a9187b75a7",
"paymentId": "",
"amount": 54.1,
"fee": 0.005,
"txId": "0x1983645416f16a16c1687643086f7c91767a9817b981765140c8176871fc79fa",
"createdAt": "2018-06-01T06:48:32Z",
"processedAt": "2018-06-01T07:20:14Z",
"confirmationsRequired": 12,
"confirmationCount": 12,
"status": "success",
"errorDescription": null
}
POST https://api.crex24.com/v2/account/withdraw
Withdraws certain amount of cryptocurrency from the account and sends it to the specified crypto address.
Parameters
The parameters should be passed in the body of POST request as fields of a JSON object.
Name | Type | Description |
---|---|---|
currency | string | Currency identifier |
amount | decimal | Withdrawal amount (the precision is limited to a number of decimal places specified in the withdrawalPrecision field of the Currency, the value is rounded automatically to meet the precision limitation) |
address | string | Crypto address to which the money will be transferred |
paymentId | string | Optional. Additional information (such as Payment ID, Message, Memo, etc.) that specifies the destination of money transfer along with the address. If this information is not required or not supported by the cryptocurrency, the parameter should be omitted |
feeCurrency | string | Currency identifier to be used to pay the commission |
includeFee | boolean |
Optional. Sets whether the specified amount includes fee, can have either of the two values:true - balance will be decreased by amount, whereas [amount - fee] will be transferred to the specified address;false - amount will be deposited to the specified address, whereas the balance will be decreased by [amount + fee].The default value is false
|
Comments
The total amount debited from the account in the result of withdrawal must be not less than the value of minWithdrawal field and not greater than the value of maxWithdrawal field of withdrawing Currency, otherwise the request will result in an error. You may find calling the method previewWithdrawal prior to performing an actual withdrawal useful as it provides assistance in planning the withdrawal and ensuring its conformity to the formal requirements.
Response
Returns an object MoneyTransfer. The structure of the object is described in the section Money Transfer History. The data returned is in JSON format.
Authentication
Authentication Keys and Access Rights
Some parts of the API require authentication. In order to access them, you need to obtain an authentication key. You can generate one on the API keys tab of the account management page.
Each authentication key contains a pair of credentials:
- API key, that acts both as trader’s identifier and access token;
- Secret, that is used to sign API calls and verify response signatures.
On the contrary, API key is not confidential and may be shared with CREX24 support, if necessary.
It is possible to generate multiple authentication keys, each having custom access rights associated with it. The following access permissions can be granted to an authentication key:
- R1 – request information about orders, trades, balances;
- R2 – place, modify and cancel orders;
- R3 – request payment information, such as cryptocurrency deposit address, money transfer history or money transfer status, and preview cryptocurrency withdrawals;
- R4 – withdraw cryptocurrency (fiat withdrawals are conducted manually at the moment and not available via the API).
You can temporarily disable an authentication key or delete it completely at any time. It is recommended that you delete old authentication keys that are no longer in use.
Authentication Process
CREX Trade API 2.0 uses a custom HTTP scheme based on HMAC-SHA512 for authentication. A request to an authenticated endpoint should contain the following headers:
Header | Value |
---|---|
X-CREX24-API-KEY | Your API key |
X-CREX24-API-NONCE | Arbitrary integer value that increases with each request (Nonce) |
X-CREX24-API-SIGN | HMAC-generated request signature (Signature) |
X-CREX24-API-NONCE Header
Nonce is a value that varies with each request. It serves the purpose of preventing replay attacks (i.e., when one of the previously sent valid requests is intercepted and fraudulently repeated by an attacker).
The value of Nonce must be in the range from 1 to 18 446 744 073 709 551 615 (maximum unsigned 64-bit integer) and must be greater in each consecutive request than in the previous one. For instance, system time expressed in milliseconds elapsed since certain moment in the past may be used as Nonce.
The value of previously used Nonce is stored on the server and cannot be reset for security reasons. If you accidentally used too large number, you may have to delete an existing authentication key and generate a new one instead of it with the same access privileges. The same may apply to a situation when you would like to switch from one nonce-generation algorithm to another.
X-CREX24-API-SIGN Header
Request signature is a string generated by HMAC-SHA512 algorithm, it ensures that the request was sent by you and wasn’t modified by a 3rd party on the way.
In order to sign the request, one should perform HMAC-SHA512 with the following parameters:
Parameter | Value |
---|---|
Key | Base64-decoded Secret |
Message |
The result of concatenation Path + Nonce + Body, where
Path is a URL-path of the request with parameters, e.g. /v2/account/balance?currency=LTC ,
Nonce is a value passed in X-CREX24-API-NONCE header,
Body is a request body (in case of POST request) or omitted (in case of GET request) |
The result of HMAC-SHA512 execution is then Base64-encoded and passed in the request as a value of X-CREX24-API-SIGN header.
Examples
The following code samples demonstrate the process of sending GET and POST requests to authenticated endpoints:
C# (GET)
string baseUrl = "https://api.crex24.com"; string apiKey = "-- Your API key --"; string secret = "-- Your secret --"; string path = "/v2/account/balance?currency=BTC"; string nonce = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); byte[] key = Convert.FromBase64String(secret); byte[] message = Encoding.UTF8.GetBytes(path + nonce); HMACSHA512 hmac = new HMACSHA512(key); string signature = Convert.ToBase64String(hmac.ComputeHash(message)); WebRequest request = WebRequest.Create(baseUrl + path); request.Method = "GET"; request.Headers.Add("X-CREX24-API-KEY", apiKey); request.Headers.Add("X-CREX24-API-NONCE", nonce); request.Headers.Add("X-CREX24-API-SIGN", signature); HttpWebResponse response; try { response = (HttpWebResponse)request.GetResponse(); } catch (WebException exception) { response = (HttpWebResponse)exception.Response; } HttpStatusCode responseStatusCode = response.StatusCode; string responseBody; using (Stream stream = response.GetResponseStream()) using (StreamReader streamReader = new StreamReader(stream)) responseBody = streamReader.ReadToEnd();
C# (POST)
string baseUrl = "https://api.crex24.com"; string apiKey = "-- Your API key --"; string secret = "-- Your secret --"; string path = "/v2/trading/placeOrder"; string body = @"{ ""instrument"": ""ETH-BTC"", ""side"": ""sell"", ""volume"": 1, ""price"": 12345.67 }"; string nonce = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); byte[] key = Convert.FromBase64String(secret); byte[] message = Encoding.UTF8.GetBytes(path + nonce + body); HMACSHA512 hmac = new HMACSHA512(key); string signature = Convert.ToBase64String(hmac.ComputeHash(message)); WebRequest request = WebRequest.Create(baseUrl + path); request.Method = "POST"; request.Headers.Add("X-CREX24-API-KEY", apiKey); request.Headers.Add("X-CREX24-API-NONCE", nonce); request.Headers.Add("X-CREX24-API-SIGN", signature); byte[] requestBody = Encoding.UTF8.GetBytes(body); request.ContentLength = requestBody.Length; using (Stream stream = request.GetRequestStream()) stream.Write(requestBody, 0, requestBody.Length); HttpWebResponse response; try { response = (HttpWebResponse) request.GetResponse(); } catch (WebException exception) { response = (HttpWebResponse) exception.Response; } HttpStatusCode responseStatusCode = response.StatusCode; string responseBody; using (Stream stream = response.GetResponseStream()) using (StreamReader streamReader = new StreamReader(stream)) responseBody = streamReader.ReadToEnd();
NodeJS (GET)
const crypto = require("crypto"); const request = require("request"); var baseUrl = "https://api.crex24.com"; var apiKey = "-- Your API key --"; var secret = "-- Your secret --"; var path = "/v2/account/balance?currency=BTC"; var nonce = Date.now(); var key = Buffer(secret, "base64"); var message = path + nonce; var hmac = crypto.createHmac("sha512", key); var signature = hmac.update(message).digest("base64"); request({ url: baseUrl + path, method: "GET", headers: { "X-CREX24-API-KEY": apiKey, "X-CREX24-API-NONCE": nonce, "X-CREX24-API-SIGN": signature } }, function (error, response, body) { console.log("error:", error); console.log("statusCode:", response && response.statusCode); console.log("body:", body); } );
NodeJS (POST)
const crypto = require("crypto"); const request = require("request"); var baseUrl = "https://api.crex24.com"; var apiKey = "-- Your API key --"; var secret = "-- Your secret --"; var path = "/v2/trading/placeOrder"; var body = JSON.stringify({ instrument: "ETH-BTC", side: "sell", volume: 1, price: 12345.67 }); var nonce = Date.now(); var key = Buffer(secret, "base64"); var message = path + nonce + body; var hmac = crypto.createHmac("sha512", key); var signature = hmac.update(message).digest('base64'); request({ url: baseUrl + path, method: "POST", headers: { "X-CREX24-API-KEY": apiKey, "X-CREX24-API-NONCE": nonce, "X-CREX24-API-SIGN": signature }, body: body }, function (error, response, body) { console.log("error:", error); console.log("statusCode:", response && response.statusCode); console.log("body:", body); } );
PHP (GET)
$baseUrl = 'https://api.crex24.com'; $apiKey = '-- Your API key --'; $secret = '-- Your secret --'; $path = '/v2/account/balance?currency=BTC'; $nonce = round(microtime(true) * 1000); $key = base64_decode($secret); $message = $path . $nonce; $signature = base64_encode(hash_hmac('sha512', $message, $key, true)); $curl = curl_init($baseUrl . $path); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'X-CREX24-API-KEY:' . $apiKey, 'X-CREX24-API-NONCE:' . $nonce, 'X-CREX24-API-SIGN:' . $signature ]); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $responseBody = curl_exec($curl); $responseStatusCode = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl);
PHP (POST)
$baseUrl = 'https://api.crex24.com'; $apiKey = '-- Your API key --'; $secret = '-- Your secret --'; $path = '/v2/trading/placeOrder'; $body = '{ "instrument": "ETH-BTC", "side": "sell", "volume": 1, "price": 12345.67 }'; $nonce = round(microtime(true) * 1000); $key = base64_decode($secret); $message = $path . $nonce . $body; $signature = base64_encode(hash_hmac('sha512', $message, $key, true)); $curl = curl_init($baseUrl . $path); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'Content-Length:' . strlen($body), 'X-CREX24-API-KEY:' . $apiKey, 'X-CREX24-API-NONCE:' . $nonce, 'X-CREX24-API-SIGN:' . $signature ]); curl_setopt($curl, CURLOPT_POSTFIELDS, $body); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $responseBody = curl_exec($curl); $responseStatusCode = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl);
Python (GET)
import datetime import base64 import hmac from hashlib import sha512 from urllib.request import urlopen, Request from urllib.error import HTTPError baseUrl = "https://api.crex24.com" apiKey = "-- Your API key --" secret = "-- Your secret --" path = "/v2/account/balance?currency=BTC" nonce = round(datetime.datetime.now().timestamp() * 1000) key = base64.b64decode(secret) message = str.encode(path + str(nonce), "utf-8") hmac = hmac.new(key, message, sha512) signature = base64.b64encode(hmac.digest()).decode() request = Request(baseUrl + path) request.method = "GET" request.add_header("X-CREX24-API-KEY", apiKey) request.add_header("X-CREX24-API-NONCE", nonce) request.add_header("X-CREX24-API-SIGN", signature) try: response = urlopen(request) except HTTPError as e: response = e status = response.getcode() body = bytes.decode(response.read()) print("Status code: " + str(status)) print(body)
Python (POST)
import datetime import base64 import hmac import json from hashlib import sha512 from urllib.request import urlopen, Request from urllib.error import HTTPError baseUrl = "https://api.crex24.com" apiKey = "-- Your API key --" secret = "-- Your secret --" path = "/v2/trading/placeOrder" body = json.dumps({ "instrument": "ETH-BTC", "side": "sell", "volume": 1, "price": 12345.67 }, separators=(',', ':')) nonce = round(datetime.datetime.now().timestamp() * 1000) key = base64.b64decode(secret) message = str.encode(path + str(nonce) + body, "utf-8") hmac = hmac.new(key, message, sha512) signature = base64.b64encode(hmac.digest()).decode() request = Request(baseUrl + path) request.method = "POST" request.data = str.encode(body, "utf-8") request.add_header("Content-Length", len(body)) request.add_header("X-CREX24-API-KEY", apiKey) request.add_header("X-CREX24-API-NONCE", nonce) request.add_header("X-CREX24-API-SIGN", signature) try: response = urlopen(request) except HTTPError as e: response = e status = response.getcode() body = bytes.decode(response.read()) print("Status code: " + str(status)) print(body)
Response Signature
API responses that carry critical data are signed by the server, which provides additional assurance of their integrity and authenticity. Response signature is created by the rules similar to those of the request signature:
-
HMAC-SHA512 is executed with parameters
Parameter Value Key Base64-decoded Secret that was used to sign the request Message The result of concatenation Path + Nonce + Status-Code + Body, where
Path is the URL-path of the request with parameters, e.g./v2/account/depositAddress?currency=BTC
,
Nonce is the value that was sent in theX-CREX24-API-NONCE
header of the request,
Status-Code is the response status-code, e.g.200
,
Body is the response body -
The result of HMAC-SHA512 execution is Base64-encoded and passed in the response as a value of
X-CREX24-API-SIGN
header.
In order to verify the response signature one should evaluate it on their side and check if it matches the value of X-CREX24-API-SIGN
header of the response.
Order Types
Limit Order
A limit order is an order to buy or sell a limited amount of a specified currency at a specified price or better. A buying order is executed at a price lower or equal to the specified, whereas a selling order is executed at a price higher or equal to the specified. Since the market doesn’t necessarily have the required amount of the currency to offer at the given price, a limit order is not guaranteed to execute.
Main Parameters
Name | Description |
---|---|
Volume | The amount of base currency that a trader would like to buy or sell |
Price | The worst price for which the base currency should be bought or sold |
Time In Force (TIF) |
Sets the strategy that regulates how long an order should remain active before it is filled:
|
Lifecycle
A newly created limit order has a status "submitting"
until it has been processed. This status changes during the lifetime of an order and can have different values depending on the value of the parameter Time In Force.
Good-Til-Cancelled (GTC) orders
Once the order has been processed, its status can have either of the following values:
"unfilledActive"
- order is active, no trades have been made;"partiallyFilledActive"
- part of the order has been filled, the other part is active;"filled"
- order has been filled entirely;"partiallyFilledCancelled"
- part of the order has been filled, the other part has been cancelled either by the trader or by the system (see the value of cancellationReason of an Order for more details on the reason of cancellation);"unfilledCancelled"
- order has been cancelled, no trades have taken place (see the value of cancellationReason of an Order for more details on the reason of cancellation).
Immediate-Or-Cancel (IOC) orders
Once the order has been processed, its status can have either of the following values:
"filled"
- order has been filled entirely;"partiallyFilledCancelled"
- part of the order has been filled immediately, the other part has been cancelled (the field cancellationReason of the Order contains the value"failedToFillRightAway"
);"unfilledCancelled"
- entire order was cancelled due to inability to fill it right away (the field cancellationReason of the Order contains the value"failedToFillRightAway"
).
Fill-Or-Kill (FOK) orders
Once the order has been processed, its status can have either of the following values:
"filled"
- order has been entirely filled right away;"unfilledCancelled"
- it was impossible to fill the entire order immediately, as a result it was cancelled (the field cancellationReason of the Order contains the value"failedToFillRightAway"
).
Market Order
A market order is an order to immediately buy or sell a limited amount of a specified currency at a current market price. The execution of the order starts from the best price available on the market and, if the order is not entirely filled by it, continues at the next best price and so on. If there’s not enough liquidity at the market to fill the order immediately, it is filled partially and the unfilled part is cancelled.
Main Parameters
Name | Description |
---|---|
Volume | The amount of base currency that a trader would like to buy or sell at a current market price |
Lifecycle
A newly created market order has a status "submitting"
until it has been processed.
Once the order has been processed, its status can have either of the following values:
"filled"
- order has been filled entirely;"partiallyFilledCancelled"
- part of the order has been filled, the other part has been cancelled (the field cancellationReason of the Order contains the value"failedToFillRightAway"
);"unfilledCancelled"
- order has been cancelled entirely (the field cancellationReason of the Order contains the value"failedToFillRightAway"
).
Stop-Limit Order
A stop-limit order is an order that waits for the market price to reach a certain threshold (called the stop price) and when it happens, creates a new limit order with predefined characteristics. A buying stop-limit order is triggered when the market price becomes equal to or greater than the stop price, whereas a selling stop-limit order is triggered when the market price becomes equal to or less than the stop price.
Main Parameters
Name | Description |
---|---|
Stop Price | The price at which the order is triggered and a new limit order with predefined characteristics is placed |
Volume | Predefined volume of the new limit order (see the Limit Order section of documentation) |
Price | Predefined price of the new limit order (see the Limit Order section of documentation) |
Time In Force (TIF) | Predefined TIF of the new limit order (see the Limit Order section of documentation) |
Lifecycle
A newly created stop-limit order has a status "submitting"
until it has been processed.
Once the order has been processed, its status can have either of the following values:
"waiting"
- order is waiting to be triggered, the market price hasn’t reached the stop price yet;"filled"
- order has been triggered because the market price has reached the stop price, and a new limit order with predefined characteristics has been placed;"unfilledCancelled"
- order has been cancelled either by the system or by the trader (for more information see the value of the field cancellationReason of the Order) before it’s been triggered.
Handling Errors
GET https://api.crex24.com/v2/public/currencies?filter=ASDFASDF
The above request executes with code 400 and returns JSON structured like this:
{
"errorDescription":"Parameter 'filter' contains invalid value."
}
GET https://api.crex24.com/v2/public/recentTrades
The above request executes with code 400 and returns JSON structured like this:
{
"errorDescription":"Mandatory parameter 'instrument' is missing."
}
GET https://api.crex24.com/v2/trading/tradeHistory?from=2018-04&till=2018-03
The above request executes with code 400 and returns JSON structured like this:
{
"errorDescription":"The value of parameter 'till' must be greater than or equal to the value of parameter 'from'."
}
Successfully executed API calls return the HTTP status-code 200 OK.
Failed API calls return one of the following status-codes:
Status-code | Description |
---|---|
400 Bad Request | Request is incorrect, for more information see the error description in the response |
401 Unauthorized |
Method requires authentication, but the request either doesn’t contain the authentication data or the authentication data is not valid. For more information see the error description in the response. More about the process of authentication in the corresponding section of documentation |
403 Forbidden |
Token used for authentication is either disabled or doesn’t have the necessary rights. For more information see the error description in the response. More about managing authentication keys in the section Authentication Keys and Access Rights |
404 Not Found | Resource not found. Please, make sure that you are using the correct URL |
405 Method Not Allowed | Requested resource exists, but it should be accessed using different HTTP request method (i.e., GET should be used to send the request instead of POST or vice versa) |
429 Too Many Requests | The request rate quota is exceeded. Cut down the number of requests per second or contact the support to have your personal request rate limit raised |
500 Internal Server Error | Server encountered an internal error while processing your request |
503 Service Unavailable | Server is temporarily unavailable (either due to maintenance or because of overload). Try sending the request again later |
In case of an error with HTTP code 400, 401, 403, 404, 405 or 429, a JSON object with the following structure is returned:
Name | Type | Description |
---|---|---|
errorDescription | string | Information about the source of the error |
SignalR API 1.0 (WebSocket)
SignalR API 1.0 is a streaming bidirectional RPC API that provides programmatic access to CREX24 market data. It relies on SignlaR Hub approach for client-server communication and uses WebSocket protocol as a transport.
Data types
Type | Example | Description |
---|---|---|
string | "some text" |
Text |
decimal | "0.12345" |
Floating point number, used for financial and monetary data |
datetime | 1581179995 |
Unix time in seconds |
Getting Started
In order to consume the data provided by the API, one should set up their client through the following steps:
- Create and configure SignalR Hub proxy with the following parameters:
- base URL -
https://api.crex24.com/signalr
- Hub name -
publicCryptoHub
- base URL -
- Register event handlers
initSource
andupdateSource
with the Hub proxy. - Connect to the Hub.
- Subscribe to a data channel by invoking one of the Hub's methods:
C# Example
using Microsoft.AspNet.SignalR.Client; using Microsoft.AspNet.SignalR.Client.Transports; using System; using System.Threading.Tasks; namespace SignalRClient { class Program { static async Task Main(string[] args) { using (var hubConnection = new HubConnection("https://api.crex24.com/signalr")) { hubConnection.TraceLevel = TraceLevels.Events | TraceLevels.StateChanges; hubConnection.TraceWriter = Console.Out; var hubProxy = hubConnection.CreateHubProxy("publicCryptoHub"); hubProxy.On<string, string>("initSource", InitSource); hubProxy.On<string, string>("updateSource", UpdateSource); await hubConnection.Start(new WebSocketTransport()); await hubProxy.Invoke("joinTickers"); await hubProxy.Invoke("joinTradeHistory", "ETH-BTC"); await hubProxy.Invoke("joinOrderBook", "ETH-BTC"); Console.ReadLine(); } } private static void InitSource(string name, string payload) { Console.WriteLine($"{nameof(InitSource)} - {name}{Environment.NewLine}{payload}"); } private static void UpdateSource(string name, string payload) { Console.WriteLine($"{nameof(UpdateSource)} - {name}{Environment.NewLine}{payload}"); } } }
JavaScript Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>SignalR Client</title> </head> <body> <p>Please, see the console output.</p> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script> <script src="https://ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.2.min.js"></script> <script> $(function () { var connection = $.hubConnection('https://api.crex24.com/signalr', { useDefaultPath: false, logging: true }); var hubProxy = connection.createHubProxy('publicCryptoHub'); hubProxy.on('initSource', function(name, payload) { console.log(name + ' ' + payload); }); hubProxy.on('updateSource', function(name, payload) { console.log(name + ' ' + payload); }); connection.start({ transport: 'webSockets', jsonp: true }) .done(function() { console.log('Connected, transport = ' + connection.transport.name); hubProxy.invoke('joinTickers'); hubProxy.invoke('joinTradeHistory', 'ETH-BTC'); hubProxy.invoke('joinOrderBook', 'ETH-BTC'); }) .fail(function() { console.log('Failed to connect to the hub.'); }); }); </script> </body> </html>
For more information on client development and configuration please refer to the guides: C#, JavaScript.
Ticker Channel
Initalization event payload:
{
"LST": [{
"I": "LTC-BTC",
"LST": "0.00772",
"PC": "2.8",
"L": "0.00738",
"H": "0.00776",
"BV": "252.38126232",
"QV": "1.918628615207",
"VB": "1.918628615207",
"VU": "18869.691811266869"
}, {
"I": "DOGE-BTC",
"LST": "0.000000323",
"PC": "15.36",
"L": "0.000000277",
"H": "0.000000327",
"BV": "9058776.42906294",
"QV": "2.711492473916",
"VB": "2.711492473916",
"VU": "26625.589709240933"
},
...
]
}
Update event payload:
{
"U": [{
"I": "ENTS-BTC",
"U": [{
"V": "5.767184641972",
"N": "VU"
}, {
"V": "0.000584831654",
"N": "VB"
}, {
"V": "2248544.60061738",
"N": "BV"
}, {
"V": "0.000584831654",
"N": "QV"
}
],
}, {
"I": "SIN-ETH",
"U": [{
"V": "0.0000073",
"N": "LST"
}, {
"V": "9372.4988196767641",
"N": "VU"
}, {
"V": "0.953106885579745",
"N": "VB"
}, {
"V": "-7.83",
"N": "PC"
}, {
"V": "5165417.59432868",
"N": "BV"
}, {
"V": "41.996815456246",
"N": "QV"
}
],
},
...
]
}
Subscribing
In order to connect to the channel one should invoke hub's method joinTickers
without parameters.
Upon connection initSource
event will be fired with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Always has the value "Tickers" |
payload | string | JSON object containing a snapshot of tickers for all instruments |
Each ticker object in the payload has the following structure:
Field | Type | Description |
---|---|---|
I | string | Instrument - unique ticker identifier, e.g. "LTC-BTC" |
LST | decimal | Last price.
If this information is not available, the field contains the value "0" |
PC | decimal | Percentage change of the price over the last 24 hours |
L | decimal | Lowest price over the last 24 hours.
If this information is not available, the field contains the value "0" |
H | decimal | Highest price over the last 24 hours.
If this information is not available, the field contains the value "0" |
BV | decimal | Base volume - total trading volume of the instrument over the last 24 hours, expressed in base currency |
QV | decimal | Quote volume - total trading volume of the instrument over the last 24 hours, expressed in quote currency |
VB | decimal | Volume in BTC - total trading volume of the instrument over the last 24 hours, expressed in BTC |
VU | decimal | Volume in USD - total trading volume of the instrument over the last 24 hours, expressed in USD |
Processing Updates
When update arrives, the updateSource
event handler is invoked with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Always has the value "Tickers" |
payload | string | JSON object containing updated ticker data |
The payload contains an array of objects (one for each updated ticker) with the structure:
Field | Type | Description |
---|---|---|
I | string | Instrument, e.g. ETH-BTC |
U | UpdatedField[] | Array of updated fields of the ticker |
Structure of UpdatedField object:
Field | Type | Description |
---|---|---|
N | string | Name of the ticker's field, e.g. "LST" |
V | string | New value of the field |
Unsubscribing
In order to disconnect from the channel one should invoke hub's method leaveTickers
without arguments.
Trade History Channel
Initalization event payload:
{
"I": "ETH-BTC",
"LST": [{
"P": "0.02276",
"V": "0.36247922",
"S": "s",
"T": 1581179155
}, {
"P": "0.02279",
"V": "0.00434",
"S": "s",
"T": 1581179021
}, {
"P": "0.0228",
"V": "0.00016337",
"S": "b",
"T": 1581178875
},
...
]
}
Update event payload:
{
"I": "ETH-BTC",
"NT": [{
"P": "0.02278",
"V": "0.01287829",
"S": "s",
"T": 1581179995
}
]
}
Subscribing
In order to connect to the channel one should invoke hub's method joinTradeHistory
passing the name of the instrument (e.g., ETH-BTC
) as an argument.
Upon connection initSource
event will be fired with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Has the value "TradeHistory_{instrument}" where {instrument} is the name of trade instrument, e.g. "TradeHistory_ETH-BTC" |
payload | string | JSON object containing a list of 100 recent trades |
Each trade object in the payload has the following structure:
Field | Type | Description |
---|---|---|
P | decimal | Price for which the base currency was bought or sold |
V | decimal | Volume - the amount of base currency that was bought or sold |
S | string | Side - direction of the trade, can have either of the two values:"b" - buy (taker was a buyer in the trade);"s" - sell (taker was a seller in the trade)
|
T | datetime | Timestamp - date and time when the trade took place |
Processing Updates
When update arrives, the updateSource
event handler is invoked with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Has the value "TradeHistory_{instrument}" where {instrument} is the name of trade instrument, e.g. "TradeHistory_ETH-BTC" |
payload | string | JSON object containing new trade history data |
The payload contains an array of new trades, each represented by an object with the same structure as in initSource
event.
Unsubscribing
In order to disconnect from the channel one should invoke hub's method leaveTradeHistory
passing the name of the instrument (e.g., ETH-BTC
) as an argument.
Order Book Channel
Initalization event payload:
{
"I": "ETH-BTC",
"B": [{
"P": "0.02279",
"V": "0.001305"
}, {
"P": "0.02277",
"V": "2.3499"
}, {
"P": "0.02276",
"V": "0.01594413"
}, {
"P": "0.0226",
"V": "0.0058"
}, {
"P": "0.02242",
"V": "0.01516502"
},
...
],
"S": [{
"P": "0.02285",
"V": "0.35623465"
}, {
"P": "0.02287",
"V": "2.345"
}, {
"P": "0.02288",
"V": "0.0683296"
}, {
"P": "0.02289",
"V": "0.1229"
}, {
"P": "0.02291",
"V": "3.33"
},
...
]
}
Update event payload:
{
"I": "ETH-BTC",
"BU": [{
"V": {
"P": "0.02277",
"V": "0.0049"
},
"N": "LU"
}
],
"SU": [{
"V": {
"P": "0.0229",
"V": "0.8654"
},
"N": "L"
}, {
"V": "0.02287",
"N": "R"
}, {
"V": {
"P": "0.02286",
"V": "0.40223465"
},
"N": "LU"
}
]
}
Subscribing
In order to connect to the channel one should invoke hub's method joinOrderBook
passing the name of the instrument (e.g., ETH-BTC
) as an argument.
Upon connection initSource
event will be fired with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Has the value "OrderBook_{instrument}" where {instrument} is the name of trade instrument, e.g. "OrderBook_ETH-BTC" |
payload | string | JSON object containing an entire order book data |
The payload contains an object that represents the order book and has the following structure:
Field | Type | Description |
---|---|---|
I | string | Instrument, e.g. "ETH-BTC" |
B | PriceLevel[] | An array of price levels on the buying side of the order book |
S | PriceLevel[] | An array of price levels on the selling side of the order book |
Structure of PriceLevel object:
Field | Type | Description |
---|---|---|
P | decimal | Price for which the base currency is bought or sold |
V | decimal | Total volume of base currency that is bought or sold on the price level |
Processing Updates
When update arrives, the updateSource
event handler is invoked with the arguments:
Argument | Type | Description |
---|---|---|
name | string | Has value "OrderBook_{instrument}" where {instrument} is the name of trade instrument, e.g. "OrderBook_ETH-BTC" |
payload | string | JSON object containing the data representation of order book transformations |
The payload contains an object that describes changes that the order book has undergone since the last received update from the server:
Field | Type | Description |
---|---|---|
I | string | Instrument, e.g. "ETH-BTC" |
BU | PriceLevelUpdate[] | An array of updates that price levels on the buying side of the order book have undergone |
SU | PriceLevelUpdate[] | An array of updates that price levels on the selling side of the order book have undergone |
PriceLevelUpdate object can represent one of the following transformations:
- New price level added. Object structure:
Field Description N Always has the value "L"
V Is an object with two fields:
"P"
- the value of price of the new level;
"V"
- the value of volume of the new level; - Existing price level updated. Object structure:
Field Description N Always has the value "LU"
V Is an object with two fields:
"P"
- the value of price of the existing level;
"V"
- new value of level's volume; - Price level removed. Object structure:
Field Description N Always has the value "R"
V The value of price of the level that was removed
Unsubscribing
In order to disconnect from the channel one should invoke hub's method leaveOrderBook
passing the name of the instrument (e.g., ETH-BTC
) as an argument.