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
Tickers
Get Tickers
curl "https://cg.exchange.gleec.com/tickers"
Response:
{
"[": {
"ticker_id": "ETHBTC",
"base_currency": "BTC",
"target_currency": "ETH",
"last_price": "0.050042",
"base_volume": "36456.720",
"target_volume": "1782.625000",
"pool_id": "ETHBTC"
"liquidity_in_usd": ""
"bid": "0.050042"
"ask": "0.050042"
"high": "0.050042"
"low": "0.050042"
}
]
}
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 |
---|---|---|
ticker_id | string or null | ticker id. Can return null if no data. |
base_currency | Number or null | base currency. Can return null if no data. |
target_currency | Number or null | target currency. 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. |
target_volume | Number | Total trading amount within 24 hours in quote currency. |
pool_id | string | pool id. |
liquidity_in_usd | string | liquidity in usd. |
bid | string | bid price. |
ask | string | ask price. |
high | string | high price. |
low | string | low price. |
Get Ticker by Symbol
curl "https://cmc.exchange.gleec.com/tickers?symbols=ETHBTC"
Response:
{
"ticker_id": "ETHBTC",
"base_currency": "BTC",
"target_currency": "ETH",
"last_price": "0.050042",
"base_volume": "36456.720",
"target_volume": "1782.625000",
"pool_id": "ETHBTC"
"liquidity_in_usd": ""
"bid": "0.050042"
"ask": "0.050042"
"high": "0.050042"
"low": "0.050042"
}
GET /tickers?symbols=ETHBTC
Returns the ticker for a certain symbol.
Requires no API key Access Rights.
Response:
Name | Type | Description |
---|---|---|
ticker_id | string or null | ticker id. Can return null if no data. |
base_currency | Number or null | base currency. Can return null if no data. |
target_currency | Number or null | target currency. 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. |
target_volume | Number | Total trading amount within 24 hours in quote currency. |
pool_id | string | pool id. |
liquidity_in_usd | string | liquidity in usd. |
bid | string | bid price. |
ask | string | ask price. |
high | string | high price. |
low | string | low price. |
Order Books
Get Order Books
curl "https://cg.exchange.gleec.com/orderbook"
Response:
{
: {
"ticker_id": "ETHBTC",
"timestamp": "2021-06-11T11:18:03.857366871Z",
"asks": [
[
"9777.51", // Price
"4.50579" // Amount
],
[
"9777.52",
"5.79832"
]
],
"bids": [
[
"9777.5",
"0.00002"
],
[
"9776.26",
"0.0001"
]
]
},
: {
"ticker_id": "ETHBTC",
"timestamp": "2021-06-11T11:18:03.790858502Z",
"asks": [
[
"0.022626",
"0.0057"
],
[
"0.022628",
"1.4259"
]
],
"bids": [
[
"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 |
---|---|---|
ticker_id | string | ticker currency. |
timestamp | DateTime | Publication timestamp. |
asks | Array | Ask side array of levels. |
bids | Array | Bid side array of levels. |
historical trades
Get historical trades
curl "https://cg.exchange.gleec.com/historical_trades"
Response:
{
:[
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"target_volume":"0.21469",
"type":"sell",
"trade_timestamp":"2021-06-24T12:54:41.972Z"
}
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"target_volume":"0.21469",
"type":"sell",
"trade_timestamp":"2021-06-24T12:54:41.972Z"
}
],
}
GET /historical_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. |
target_volume | Number | Trade quote volume. |
type | String | Trade side. Accepted values: sell , buy |
trade_timestamp | DateTime | Trade timestamp. |
Get Trades by Symbol
curl "https://cmc.exchange.gleec.com/trades/?symbols=ETHBTC&sort=DESC"
Response:
[
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"target_volume":"0.21469",
"type":"sell",
"trade_timestamp":"2021-06-24T12:54:41.972Z"
},
{
"trade_id":3494,
"price":"9793.94",
"base_volume":"0.21469",
"target_volume":"0.21469",
"type":"sell",
"trade_timestamp":"2021-06-24T12:54:41.972Z"
}
]
GET /historical_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. |
target_volume | Number | Trade quote volume. |
type | String | Trade side. Accepted values: sell , buy |
trade_timestamp | DateTime | Trade timestamp. |
Pairs
Get Pairs
curl "https://cg.exchange.gleec.com/pairs"
Response:
{
:[
{
"ticker_id": "ETHBTC",
"base": "ETH",
"target": "BTC",
"pool_id": "",
}
{
"ticker_id": "ETHBTC",
"base": "ETH",
"target": "BTC",
"pool_id": "",
}
],
}
GET /pairs
get the list of pairs
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 |
---|---|---|
ticker_id | string | Currency Name. |
base | string | base currency. |
target | string | target currency. |
pool_id | string | The pool id. |
Get pairs by Symbol
curl "https://cg.exchange.gleec.com/pairs?symbols=ETHBTC"
Response:
[
{
"ticker_id": "ETHBTC",
"base": "ETH",
"target": "BTC",
"pool_id": "",
},
{
"ticker_id": "ETHBTC",
"base": "ETH",
"target": "BTC",
"pool_id": "",
}
]
GET /pairs?symbols={symbol}
Returns pairs for a certain symbol.
Requires no API key Access Rights.
All parameters are optional.
Parameters:
Name | Type | Description |
---|---|---|
symbols | String | symbols. Accepted values: ETHBTC |
Response:
Name | Type | Description |
---|---|---|
trade_id | Number | Trade identifier. |
price | Number | Trade price. |
base_volume | Number | Trade base volume. |
target_volume | Number | Trade quote volume. |
type | String | Trade side. Accepted values: sell , buy |
trade_timestamp | DateTime | Trade timestamp. |
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. |