ABOUT GLEEC BTC API
GLEEC BTC REST & Streaming API version 3.0 provides programmatic access to GLEEC BTC’s next generation trading engine.
We strongly recommend that our new customers use API version 3.0 to get the best trading experience. We also recommend that our current traders switch to the newest version 3.0.
By using the GLEEC BTC API you confirm that you have read and accepted the API License Agreement.
DEVELOPMENT GUIDE
API URLs
API Explorer
You can explore the API using SwaggerUI including methods requiring authorization.
DateTime Format
All timestamps are returned in ISO 8601 format or UNIX timestamp in milliseconds (UTC).
Example: "2021-06-03T10:20:49.315Z"
or "1614815872000"
.
Date Format
Some timestamps are returned in ISO 8601 format which includes a calendar date only.
Example: "2021-06-03"
.
Number Format
All finance data, e.g., price, quantity, fee, etc., should be arbitrary precision numbers and have a string representation.
Example: "10.2000058"
.
Custom Formats
In nested JSON objects, child objects have custom formats which are described in tables below a place of the first occurrence.
Pagination
Parameters:
Parameter | Description |
---|---|
limit | Number of results per call. |
offset | Number of results offset. |
sort | Sort direction. Accepted values: ASC (ascending order), DESC (descending order) |
by | Filter type. Accepted values: id , timestamp |
from | Interval initial value. If filter by timestamp is used, then parameter type is DateTime ; otherwise — Number . |
till | Interval end value. If filter by timestamp is used, then parameter type is DateTime ; otherwise — Number . |
RATE LIMITS
The following Rate Limits are applied:
- for the Market data and other /public requests, the limit is 30 requests per second for one IP;
- for Trading, the limit is 500 requests per second for one user. Trading includes place, replace and cancel order requests;
- for all other requests, the limit is 20 requests per second for one user.
Significantly exceeding the Rate Limits can lead to suspension.
CHANGELOG
07.07.2023
BEST PRACTICES
The GLEEC BTC API development team strives to bring the best trading experience to API users. This manual contains a set of best practices for using the API as efficiently as possible.
HTTP Persistent Connection
The underlying TCP connection is kept active for multiple requests/responses. Subsequent requests will result in reduced latency as the TCP handshaking process is no longer required.
If you use the HTTP 1.0 client, please ensure it supports the Keep-Alive directive and submit the "Connection: Keep-Alive" header with a request.
Keep-Alive is a part of the HTTP/1.1 or HTTP/2 protocol and enabled by default on compliant clients. However, you will have to ensure your implementation does not set other values as the connection header.
Retrieving and Updating Account State
Use the Streaming API for real-time updates of orders, trades, and any transaction changes.
REST API REFERENCE
HTTP Status Codes
- 200 OK. Successful request
- 400 Bad Request. Returns JSON with the error message
- 401 Unauthorized. Authorization is required or has been failed
- 403 Forbidden. Action is forbidden
- 404 Not Found. Data requested cannot be found
- 429 Too Many Requests. Your connection has been rate limited
- 500 Internal Server. Internal Server Error
- 503 Service Unavailable. Service is down for maintenance
- 504 Gateway Timeout. Request timeout expired
Error Response
{
"error": {
"code": 20001,
"message": "Insufficient funds",
"description": "Check that the funds are sufficient, taken into account the commissions"
}
}
All error responses have error code
and human readable message
fields. Some errors contain an additional description
field.
Market Data
Assets
Get Assets
curl "https://cmc.exchange.gleec.com/assets"
Response:
{
"BTC":
{
"name": "test",
"unified_cryptoasset_id": true,
"can_withdraw": true,
"can_deposit": true,
"min_withdraw": true,
"max_withdraw": "฿",
"maker_fee": "bitcointestnet:",
"taker_fee": "",
"contractAddressUrl": "https://blockchain.info/tx/{tx}",
},
"ETH":
{
"name": "test",
"unified_cryptoasset_id": true,
"can_withdraw": true,
"can_deposit": true,
"min_withdraw": true,
"max_withdraw": "฿",
"maker_fee": "bitcointestnet:",
"taker_fee": "",
"contractAddressUrl": "https://blockchain.info/tx/{tx}",
}
}
GET /assets
Returns the actual list of available assets, tokens, etc.
You can optionally use a comma-separated list of currencies. If it is not provided, null
or empty, the request returns all currencies.
Requires no API key Access Rights.
Parameters:
Name | Type | Description |
---|---|---|
currencies | String | Optional. Comma-separated list of currency codes. |
preferred_network | String | Optional. Code of the default network for currencies. |
Response:
Name | Type | Description |
---|---|---|
name | String | Currency full name (e.g., "Bitcoin" ). |
unified_cryptoasset_id | Boolean | Flag indicating whether the currency is a cryptocurrency. |
can_deposit | Boolean | Flag indicating whether generating deposit addresses is allowed for the currency. |
can_withdraw | Boolean | Flag indicating whether withdrawals are allowed for the currency. |
min_withdraw | String | |
max_withdraw | String | |
maker_fee | String | |
taker_fee | String | |
contractAddressUrl | String | |
contractAddress | String |
Get Asset
curl "https://cmc.exchange.gleec.com/assets?currencies=BTC"
Response:
{
"name": "test",
"unified_cryptoasset_id": true,
"can_withdraw": true,
"can_deposit": true,
"min_withdraw": true,
"max_withdraw": "฿",
"maker_fee": "bitcointestnet:",
"taker_fee": "",
"contractAddressUrl": "https://blockchain.info/tx/{tx}",
}
GET /assets/?currencies={currency}
Returns the data for a certain Asset.
Requires no API key Access Rights.
Response:
Name | Type | Description |
---|---|---|
name | String | Currency full name (e.g., "Bitcoin" ). |
unified_cryptoasset_id | Boolean | Flag indicating whether the currency is a cryptocurrency. |
can_deposit | Boolean | Flag indicating whether generating deposit addresses is allowed for the currency. |
can_withdraw | Boolean | Flag indicating whether withdrawals are allowed for the currency. |
min_withdraw | String | |
max_withdraw | String | |
maker_fee | String | |
taker_fee | String | |
contractAddressUrl | String | |
contractAddress | String |
Tickers
Get Tickers
curl "https://cmc.exchange.gleec.com/tickers"
Response:
{
"ETH_BTC": {
"base_id": "",
"quote_id": "",
"last_price": "0.050042",
"base_volume": "36456.720",
"quote_volume": "1782.625000",
"isFrozen": "0"
}
}
GET /tickers
Returns ticker information.
You can optionally use a comma-separated list of symbols. If it is not provided, null
or empty, the request returns tickers for all symbols.
Requires no API key Access Rights.
Parameters:
Name | Type | Description |
---|---|---|
symbols | String | Optional. Comma-separated list of symbol codes. |
Response:
Name | Type | Description |
---|---|---|
base_id | Number or null | base id. Can return null if no data. |
quote_id | Number or null | quote id. Can return null if no data. |
last_price | Number or null | Last trade price. Can return null if no data. |
base_volume | Number | Total trading amount within 24 hours in base currency. |
quote_volume | Number | Total trading amount within 24 hours in quote currency. |
isFrozen | boolen | 0 or 1. |
Get Ticker by Symbol
curl "https://cmc.exchange.gleec.com/tickers?symbols=ETHBTC"
Response:
{
"base_id": "",
"quote_id": "",
"last_price": "0.020574",
"base_volume": "138444.3666",
"quote_volume": "2853.6874972480",
"isFrozen": "0"
}
GET /tickers?symbols=ETH_BTC
Returns the ticker for a certain symbol.
Requires no API key Access Rights.
Response:
Name | Type | Description |
---|---|---|
base_id | Number or null | base id. Can return null if no data. |
quote_id | Number or null | quote id. Can return null if no data. |
last_price | Number or null | Last trade price. Can return null if no data. |
base_volume | Number | Total trading amount within 24 hours in base currency. |
quote_volume | Number | Total trading amount within 24 hours in quote currency. |
isFrozen | boolen | 0 or 1. |
Trades
Get Trades
curl "https://cmc.exchange.gleec.com/trades"
Response:
{
:[
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"quote_volume":"0.21469",
"type":"sell",
"timestamp":"2021-06-24T12:54:41.972Z"
}
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"quote_volume":"0.21469",
"type":"sell",
"timestamp":"2021-06-24T12:54:41.972Z"
}
],
}
GET /trades
Returns trades information for all or multiple symbols.
You can optionally use a comma-separated list of symbols. If it is not provided, null
or empty, the request returns trades for all symbols.
Requires no API key Access Rights.
All parameters are optional.
Parameters:
Name | Type | Description |
---|---|---|
symbols | String | Comma-separated list of symbol codes. |
by | String | Filter type. Accepted values: id , timestamp Default value: timestamp |
sort | String | Sort direction. Accepted values: ASC , DESC Default value: DESC |
from | DateTime or Number | Interval initial value. If sorting by timestamp is used, then DateTime ; otherwise — Number . |
till | DateTime or Number | Interval end value. If sorting by timestamp is used, then DateTime ; otherwise — Number . |
limit | Number | Default value: 10 Accepted values: 1 – 1000 |
Response:
Name | Type | Description |
---|---|---|
trade_id | Number | Trade identifier. |
price | Number | Trade price. |
base_volume | Number | Trade base volume. |
quote_volume | Number | Trade quote volume. |
side | String | Trade side. Accepted values: sell , buy |
timestamp | DateTime | Trade timestamp. |
Get Trades by Symbol
curl "https://cmc.exchange.gleec.com/trades/?symbols=ETH_BTC&sort=DESC"
Response:
[
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"quote_volume":"0.21469",
"type":"sell",
"timestamp":"2021-06-24T12:54:41.972Z"
},
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"quote_volume":"0.21469",
"type":"sell",
"timestamp":"2021-06-24T12:54:41.972Z"
}
]
GET /trades/?symbols={symbol}
Returns trades information for a certain symbol.
Requires no API key Access Rights.
All parameters are optional.
Parameters:
Name | Type | Description |
---|---|---|
by | String | Filter type. Accepted values: id , timestamp Default value: timestamp |
sort | String | Sort direction. Accepted values: ASC , DESC Default value: DESC |
from | DateTime or Number | Optional. Interval initial value. If sorting by timestamp is used, then DateTime ; otherwise — Number . |
till | DateTime or Number | Optional. Interval end value. If sorting by timestamp is used, then DateTime ; otherwise — Number . |
limit | Number | Default value: 100 Accepted values: 1 – 1000 |
offset | Number | Default value: 0 Accepted values: 0 – 100000 |
Response:
Name | Type | Description |
---|---|---|
trade_id | Number | Trade identifier. |
price | Number | Trade price. |
base_volume | Number | Trade base volume. |
quote_volume | Number | Trade quote volume. |
side | String | Trade side. Accepted values: sell , buy |
timestamp | DateTime | Trade timestamp. |
Order Books
Get Order Books
curl "https://cmc.exchange.gleec.com/orderbook"
Response:
{
"BTC_USDT": {
"timestamp": "2021-06-11T11:18:03.857366871Z",
"ask": [
[
"9777.51", // Price
"4.50579" // Amount
],
[
"9777.52",
"5.79832"
]
],
"bid": [
[
"9777.5",
"0.00002"
],
[
"9776.26",
"0.0001"
]
]
},
"ETH_BTC": {
"timestamp": "2021-06-11T11:18:03.790858502Z",
"ask": [
[
"0.022626",
"0.0057"
],
[
"0.022628",
"1.4259"
]
],
"bid": [
[
"0.022624",
"0.5748"
],
[
"0.022623",
"26.5"
]
]
}
}
GET /orderbook
An Order Book is a list of buy and sell orders for a specific symbol, structured by price level.
You can optionally use a comma-separated list of symbols. If it is not provided, null
or empty, the request returns an Order Book for all symbols.
Requires no API key Access Rights.
Parameters:
Name | Type | Description |
---|---|---|
depth | Number | Optional. Order Book depth. Default value: 10 Set to 0 to view the full Order Book. |
symbols | String | Optional. Comma-separated list of symbol codes. |
Response:
Name | Type | Description |
---|---|---|
timestamp | DateTime | Publication timestamp. |
ask | Array | Ask side array of levels. |
bid | Array | Bid side array of levels. |
Summary
Get Summary
curl "https://cmc.exchange.gleec.com/summary"
Response:
{
:[
{
"trading_pairs": "ETH_BTC",
"last_price": "33079.93",
"lowest_ask": "33236.53",
"highest_bid": "33079.93",
"volume": "146.86223",
"volume_quote": "4877838.3025063"
"price_change_percent_24h": "4877838.3025063"
"highest_price_24h": "4877838.3025063"
"lowest_price_24h": "4877838.3025063"
}
{
"trading_pairs": "XDC_USDT",
"last_price": "33079.93",
"lowest_ask": "33236.53",
"highest_bid": "33079.93",
"volume": "146.86223",
"volume_quote": "4877838.3025063"
"price_change_percent_24h": "4877838.3025063"
"highest_price_24h": "4877838.3025063"
"lowest_price_24h": "4877838.3025063"
}
],
}
GET /summary
get the list of summary
You can optionally use a comma-separated list of symbols. If it is not provided, null
or empty, the request returns candles for all symbols.
Requires no API key Access Rights.
All parameters are optional.
Parameters:
Name | Type | Description |
---|---|---|
symbols | String | Comma-separated list of symbol codes. |
Response:
Name | Type | Description |
---|---|---|
trading_pairs | string | Currency Name. |
last_price | Number | Last price. |
lowest_ask | Number | lowest price. |
highest_bid | Number | The Highest price for the period. |
base_volume | Number | Volume in base currency. |
quote_volume | Number | Volume in quote currency. |
price_change_percent_24h | Number | The price change 24h. |
highest_price_24h | Number | The highest price change. |
lowest_price_24h | Number | The lowest price change. |
Get summary by Symbol
curl "https://cmc.exchange.gleec.com/summary?symbols=ETH_BTC"
Response:
[
{
"trading_pairs": "ETH_BTC",
"last_price": "33079.93",
"lowest_ask": "33236.53",
"highest_bid": "33079.93",
"volume": "146.86223",
"volume_quote": "4877838.3025063"
"price_change_percent_24h": "4877838.3025063"
"highest_price_24h": "4877838.3025063"
"lowest_price_24h": "4877838.3025063"
},
{
"trading_pairs": "ETH_BTC",
"last_price": "33079.93",
"lowest_ask": "33236.53",
"highest_bid": "33079.93",
"volume": "146.86223",
"volume_quote": "4877838.3025063"
"price_change_percent_24h": "4877838.3025063"
"highest_price_24h": "4877838.3025063"
"lowest_price_24h": "4877838.3025063"
}
]
GET /summary?symbols={symbol}
Returns summary for a certain symbol.
Requires no API key Access Rights.
All parameters are optional.
Parameters:
Name | Type | Description |
---|---|---|
symbols | String | symbols. Accepted values: ETH_BTC |
Response:
Name | Type | Description |
---|---|---|
trading_pairs | string | Currency Name. |
last_price | Number | Last price. |
lowest_ask | Number | lowest price. |
highest_bid | Number | The Highest price for the period. |
base_volume | Number | Volume in base currency. |
quote_volume | Number | Volume in quote currency. |
price_change_percent_24h | Number | The price change 24h. |
highest_price_24h | Number | The highest price change. |
lowest_price_24h | Number | The lowest price change. |
Errors
The GLEEC BTC API uses the following error codes:
Error code | HTTP Status Code | Message | Note |
---|---|---|---|
400 | 400 | Bad request | The request contains values that cannot be processed. |
429 | 429 | Too many requests | Action is being rate limited for the account. |
500 | 500 | Internal Server Error | The request cannot be fulfilled at the moment. Try submitting the request later. |
503 | 503 | Service Unavailable | Try sending the request again later. |
504 | 504 | Gateway Timeout | Check the result of a request later. |
600 | 400 | Action not allowed | Operation is not permitted. See the message field for more information. |
601 | 400 | The recipient's address is not on the whitelist | The whitelist has been activated. Any address that is not added there cannot be used. |
602 | 400 | Payout blacklisted | Try sending crypto later. See the message field for the exact timing. |
604 | 400 | Payout amount bigger than locked amount | Provide a smaller payout amount. |
800 | 404 | Resource Not Found | Check the submitted parameters to ensure they were entered correctly. |
1002 | 401 | Authorization required or has been failed | Check that authorization data were provided. |
1003 | 403 | Action forbidden for this API key | Check permissions for API key, whitelists, or any security feature that might block this request. |
1004 | 401 | Unsupported authorization method | Use a valid authentication method. |
1005 | 401 | Authorization is invalid | The device has not been recognized. Use a valid authorization token. |
1006 | 400 | Should upgrade scopes | Check permission scopes. |
2001 | 400 | Symbol not found | The symbol code does not exist. Use GET /api/3/public/symbol to get the list of all available symbols. |
2002 | 400 | Currency not found | The currency code does not exist or is not enabled on a platform. See the message field for more information. |
2003 | 400 | Unknown channel | The channel name value is incorrect. |
2010 | 400 | Quantity not a valid number | Quantity value has to be a positive number. |
2011 | 400 | Quantity too low | Quantity value has to be more than or equal to the quantity_increment parameter value of a symbol. |
2012 | 400 | Bad quantity | Pass the quantity value that can be divided by the quantity_increment value of the selected symbol with no remainder. |
2020 | 400 | Price not a valid number | Price value has to be a positive number no less than the tick_size value of the selected symbol. |
2022 | 400 | Bad price | Pass the price value that can be divided by the tick_size value of the selected symbol with no remainder. |
10001 | 400 | Validation error | Input is not valid or the number of orders in an order list is incorrect. See the message field for more information. |
10022 | 400 | Bad fee markup | Provided markup fee rates are not valid decimals or are out of the accepted range. |
20001 | 400 | Insufficient funds | Insufficient funds for creating an order, placing an order list, or any account operations. Check that the funds are sufficient, given commissions. |
20002 | 400 | Order not found | Attempt to get an active order that does not exist or is filled, canceled, expired. Attempt to cancel a non-existing order. Attempt to cancel an already filled or expired order. |
20003 | 400 | Limit exceeded | Pass a lower limit value. See the message field for more information. |
20004 | 400 | Transaction not found | Requested transaction was not found. |
20005 | 400 | Payout not found | Check the submitted parameters. |
20006 | 400 | Payout already committed | Operation cannot be performed since the payout has already been committed. |
20007 | 400 | Payout already rolled back | Operation cannot be performed since the payout has already been rolled back. |
20008 | 400 | Duplicate clientOrderId | An order with the submitted ID already exists. |
20009 | 400 | Price and quantity not changed | The order has not been changed. Enter a new price/quantity to fix the error. |
20010 | 400 | Exchange temporary closed | Exchange market is temporary closed on the symbol. |
20011 | 400 | Payout address is invalid | Check the payout address format. |
20012 | 400 | Payout payment address is invalid | Check the payment ID format. |
20014 | 400 | Payout offchain unavailable | Address does not belong to exchange, belongs to the same user, or is unavailable for currency. |
20016 | 400 | Payout fee level invalid | Submit a valid fee value. |
20044 | 400 | Trading operation not allowed | Platform is unavailable. |
20045 | 400 | Fat finger limit exceeded | Order price differs from the market price more than for 10% (for stopLimit and takeProfitLimit orders, the restriction is also applied to the difference between the stop price and the limit price). Fix the value and re-submit the request. |
20080 | 400 | Internal order execution deadline exceeded | Order was not placed. |