api-balancers.gleec.com Open in urlscan Pro
2606:4700:20::681a:5c7  Public Scan

URL: https://api-balancers.gleec.com/
Submission: On November 27 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

NAV
 * ABOUT Exchange API
 * DEVELOPMENT GUIDE
   * API URLs
   * API Explorer
   * DateTime Format
   * Date Format
   * Number Format
   * Custom Formats
   * Pagination
 * RATE LIMITS
   * Per IP Address
   * Per Account
 * CHANGELOG
   * 22.10.2024
   * 02.10.2024
   * 04.09.2024
   * 17.05.2024
   * 15.05.2024
   * 05.03.2024
   * 05.02.2024
   * 01.02.2024
   * 02.11.2023
   * 09.10.2023
   * 25.09.2023
   * 25.07.2023
   * 07.07.2023
   * 31.05.2023
   * 19.05.2023
   * 15.11.2022
   * 28.07.2022
   * 16.03.2022
   * 27.12.2021
   * 23.11.2021
   * 19.11.2021
   * 10.11.2021
   * 24.08.2021
   * 30.07.2021
   * 28.07.2021
 * BEST PRACTICES
   * Request Parameters
   * HTTP Persistent Connection
   * Retrieving and Updating Account State
 * REST API REFERENCE
   * HTTP Status Codes
   * Error Response
 * Market Data
   * Currencies
   * Symbols
   * Tickers
   * Prices
   * Trades
   * Order Books
   * Candles
 * Authentication
   * Basic
   * HS256
 * Spot Trading
   * Order Model
   * Get Spot Trading Balance
   * Get All Active Spot Orders
   * Get Active Spot Order
   * Create New Spot Order
   * Create New Spot Order List
   * Replace Spot Order
   * Cancel All Spot Orders
   * Cancel Spot Order
   * Get All Trading Commissions
   * Get Trading Commission
 * Spot Trading History
   * Spot Orders History
   * Spot Trades History
 * Wallet Management
   * Wallet Balance
   * Get Whitelisted Addresses
   * Get Deposit Crypto Address
   * Generate Deposit Crypto Address
   * Last 10 Deposit Crypto Addresses
   * Last 10 Withdrawal Crypto Addresses
   * Withdraw Crypto
   * Convert Between Currencies
   * Withdraw Crypto Commit or Rollback
   * Check If Crypto Address Belongs to Current Account
   * Transfer Between Wallet and Exchange
   * Transfer Money to Another User
   * Get Transactions History
   * Check If Offchain is Available
   * Estimate Withdrawal Fees
   * Estimate Withdrawal Fee
   * Bulk Estimate Withdrawal Fee
   * Get Withdrawal Fees Hash
   * Get Withdrawal Fee Levels
   * Get Fixed Withdrawal Fees
   * Get Amount Locks
 * Subaccounts
   * Get Subaccounts List
   * Freeze Subaccount
   * Activate Subaccount
   * Transfer to Subaccount
   * Transfer to Super Account
   * Transfer Across Subaccounts
   * Get ACL Settings
   * Change ACL Settings
   * Get Subaccount Balance
   * Get Subaccount Crypto Address
 * Buy Crypto
   * Get Providers Information
   * Get Rates per Payment Method
   * Get Order List
   * Create Order
 * SOCKET API REFERENCE
   * Connection
   * Ping
   * Request Object
   * Notification
   * Response Object
 * Socket Market Data
   * Subscriptions
   * Batch Notifications
   * Get Active Subscriptions
   * Subscribe to Trades
   * Subscribe to Candles
   * Subscribe to Converted Candles
   * Subscribe to Price Rates
   * Subscribe to Price Rates in Batches
   * Subscribe to Mini Ticker
   * Subscribe to Mini Ticker in Batches
   * Subscribe to Ticker
   * Subscribe to Ticker in Batches
   * Subscribe to Full Order Book
   * Subscribe to Partial Order Book
   * Subscribe to Partial Order Book in Batches
   * Subscribe to Top of Book
   * Subscribe to Top of Book in Batches
 * Socket Authentication
   * Basic
   * HS256
 * Socket Trading
 * Socket Spot Trading
   * Subscribe to Reports
   * Get Active Spot Orders
   * Place New Spot Order
   * Create New Spot Order List
   * Cancel Spot Order
   * Cancel/Replace Spot Order
   * Cancel Spot Orders
   * Subscribe to Spot Balances
   * Get Spot Trading Balances
   * Get Spot Trading Balance
   * Get Spot Fees
   * Get Spot Fee
 * Socket Wallet Management
   * Description
   * Subscribe to Transactions
   * Subscribe to Wallet Balances
   * Request Wallet Balance
   * Get Transactions
 * Errors
   * Market Data
   * Authentication
   * Trading
   * Wallet Management


ABOUT EXCHANGE API

Exchange REST & Streaming API version 3.0 provides programmatic access to
Exchange’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.

API version 2.0 is still available. For detailed description refer to API v2.

By using the Exchange API you confirm that you have read and accepted the API
License Agreement.


DEVELOPMENT GUIDE


API URLS

REST https://api-balancers.gleec.com/api/3 Streaming Market Data
wss://api-balancers.gleec.com/api/3/ws/public Streaming Trading
wss://api-balancers.gleec.com/api/3/ws/trading Streaming Wallet
wss://api-balancers.gleec.com/api/3/ws/wallet


API EXPLORER

You can explore the API using Swagger UI including methods requiring
authorization.


DATETIME FORMAT

All timestamps are returned in ISO 8601 format or UNIX timestamp in milliseconds
(UTC).

Example: "2024-04-03T10:20:49.315Z" or "1614815872000".


DATE FORMAT

Some timestamps are returned in ISO 8601 format which includes a calendar date
only.

Example: "2024-04-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

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 maximum number requests per second (RPS) for specific calls can be limited
by a rate limit and a burst limit.

The server will process a number of requests that do not exceed the sum of the
rate limit and the burst limit within the 1-second sliding window.

For example, if the rate limit is 20 and the burst limit is 30, after the
counter is reset, the server will accept up to 50 requests per second.
It is suggested to not exceed the rate limit in order to get a guaranteed reset
of the counter each second. All residual requests below the burst limit are
accumulated for the next 1–second period, making the resulting system behavior
less predictable.

If both limits in total are exceeded, an HTTP 429 response is returned.

Requests are being counted per call (REST endpoint or WebSocket message) and:

 * per IP address — requests arrived from the same IP address regardless of the
   identity;
 * per account — requests sent under the same identity regardless of an API key,
   session, connection or IP address.


PER IP ADDRESS


REST API

Path Rate limit Burst limit /* (default) 20 30 /public/* 30 50 /wallet/* 10 10
/buy-crypto/provider/* 10 10 /buy-crypto/fiat2crypto/* 10 10 /spot/order/* 300
450 /transfer-convert/config 10 10


SOCKET API

Path Rate limit Burst limit /ws/public 10 10 /ws/trading 10 10 /ws/wallet 10 10


PER ACCOUNT


REST API

Path Rate limit Burst limit /wallet/*,
/transfer-convert/config 20 30 /buy-crypto/* 20 30 /sub-account/* 20 30


SOCKET API

/ws/trading:

Method Rate limit Burst limit login 5 — spot_subscribe,
spot_unsubscribe,
spot_balance_subscribe,
spot_balance_unsubscribe 5 — spot_balances,
spot_fee 20 10 spot_new_order,
spot_new_order_list,
spot_replace_order 300 200

/ws/wallet:

Method Rate limit Burst limit login 2 10 subscribe_transactions,
unsubscribe_transactions,
subscribe_wallet_balances,
unsubscribe_wallet_balances,
wallet_balances,
wallet_balance,
transactions 5 10


CHANGELOG


22.10.2024

 * Added endpoint:
   * GET /api/3/wallet/crypto/address/white-list.
 * Added the attempt_hashes field in transaction history.


02.10.2024

 * Added endpoints:
   * POST /sub-account/transfer/sub-to-super;
   * POST /sub-account/transfer/sub-to-sub.
 * Added the ability to specify stop_price while replacing an order.


04.09.2024

 * Added endpoints:
   * GET /api/3/wallet/crypto/fee/withdraw/list;
   * GET /api/3/wallet/crypto/fee/withdraw/hash.


17.05.2024

 * Added endpoints:
   * POST /api/3/wallet/crypto/fee/estimate/bulk.


15.05.2024

 * Added last_activity_at field in the transaction model.
 * Added sorting transaction history by last_activity_at.


05.03.2024

Added new 20018 error code.


05.02.2024

GET /buy-crypto/provider/{provider_id}/order:

 * from and till filters are optional now;
 * added new filters: order_by and sort.


01.02.2024

 * Changed the way of calculating rates returned by the GET
   /api/3/public/price/rate call.
 * Added new GET /api/3/public/converted/candles and GET
   /api/3/public/converted/candles/{symbol} endpoints which return candles
   converted to the given currency.
 * Changed the way of calculating rates published by the /price/rate feed.
 * Added a new converted/candles/{period} feed which returns candles converted
   to the given currency.
 * Added a new asset_id field in the network object that contains unique
   arbitrary data identifying the coin.


02.11.2023

Added support of multichain that allows specifying a combination of a currency
and a base blockchain:

 * GET /api/3/public/currency:
   
   * added preferred_network request parameter;
   * added contract_address response field;
   * added networks response field;
   * properties of blockchain networks moved to items in networks.

 * POST /api/3/wallet/crypto/withdraw:
   
   * added network_code request body field.

 * GET /api/3/wallet/transactions:
   
   * added networks request parameter;
   * added network_code response field in native object;
   * added protocol_code response field in native object.

 * GET /api/3/wallet/crypto/address:
   
   * added network_code request parameter;
   * added network_code response field.

 * POST /api/3/wallet/crypto/address:
   
   * added network_code request body field;
   * added network_code response field.

 * GET /api/3/wallet/crypto/address/recent-deposit:
   
   * added network_code request parameter;
   * added network_code response field.

 * GET /api/3/wallet/crypto/address/recent-withdraw:
   
   * added network_code request parameter;
   * added network_code response field.

 * GET /api/3/wallet/crypto/fee/estimate:
   
   * added network_code request parameter.

 * GET /api/3/wallet/crypto/fee/levels:
   
   * added network_code request parameter.

 * GET /api/3/buy-crypto/provider/{provider_id}/order:
   
   * added network_code request body field.

 * POST /api/3/buy-crypto/provider/{provider_id}/order:
   
   * added target_network_code request parameter.

 * GET /api/3/sub-account/crypto/address/{sub_account_id}/{currency}:
   
   * added network_code request parameter.

 * POST /api/3/wallet/crypto/fees/estimate:
   
   * added network_code request body field;
   * added networkCode response field.


09.10.2023

Added the commit risk score in the transaction history for deposits.


25.09.2023

Added a new operation_type field in the transaction history.


25.07.2023

Changed default TIF instructions for new orders.


07.07.2023

A new GET /api/3/wallet/crypto/fees/estimate endpoint.


31.05.2023

A new preferred_network filter in the GET /api/3/public/currency endpoint.


19.05.2023

WebSocket price/rate/ feeds.


15.11.2022

WebSocket balance feed.


28.07.2022

One-Triggers-Other (OTO) order lists.


16.03.2022

All-Or-None (AON), One-Cancels-Other (OCO), and One-Triggers-One-Cancels-Other
(OTOCO) order lists.


27.12.2021

Take-profit orders.


23.11.2021

Amount locks.


19.11.2021

Increased rate limits up to 300 requests per second.


10.11.2021

 * The WebSocket request to get a single–currency trading balance.
 * Allowed to view and get trading history for disabled symbols.
 * Allowed to get trading history by several comma-separated symbols.


24.08.2021

 * Added ability to request Wallet and Trading balance for a single currency.
 * subscribe_balance method replaced by subscribe_wallet_balances. Response was
   changed. Changes are backward compatible.
 * Added taker field to trade execution reports both for REST and WS.
 * Fixed market data subscription acknowledgment wasn't returned in some cases.
 * Fixed unsubscribe methods on trading subscriptions.


30.07.2021

 * Subaccounts section.


28.07.2021

API v3 initial release.


BEST PRACTICES

The Exchange 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.


REQUEST PARAMETERS

Pass a request payload (body) in POST requests and query parameters — in GET
requests.

Passing parameters in a way different from the documentation is not supported.


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, given commissions"
  }
}


All error responses have error code and human-readable message fields. Some
errors contain an additional description field.


MARKET DATA


CURRENCIES


GET CURRENCIES

curl "https://api-balancers.gleec.com/api/3/public/currency"


> Response:

{
  "BTC":
  {
    "full_name": "test",
    "crypto": true,
    "payin_enabled": true,
    "payout_enabled": true,
    "transfer_enabled": true,
    "sign": "฿",
    "qr_prefix": "bitcointestnet:",
    "crypto_payment_id_name": "",
    "crypto_explorer": "https://blockchain.info/tx/{tx}",
    "precision_transfer": "1",
    "delisted": false,
    "networks": [
      {
        "code": "test123",
        "network": "test",
        "protocol": "test123",
        "default": true,
        "is_ens_available": true,
        "payin_enabled": true,
        "payout_enabled": true,
        "precision_payout": "1",
        "payout_fee": "0.000000000000",
        "payout_is_payment_id": false,
        "payin_payment_id": false,
        "payin_confirmations": 3
      }
    ]
  },
  "ETH":
  {
    "full_name": "Ethereum TST",
    "crypto": true,
    "payin_enabled": true,
    "payout_enabled": true,
    "transfer_enabled": true,
    "sign": "E",
    "qr_prefix": "ethereum:",
    "crypto_payment_id_name": "",
    "crypto_explorer": "https://www.etherchain.org/tx/{tx}",
    "precision_transfer": "0.000000000001",
    "delisted": false,
    "networks": [
      {
        "code": "ETHTEST",
        "network_name": "ETHTEST",
        "network": "ETHTEST",
        "protocol": "",
        "default": true,
        "is_ens_available": true,
        "payin_enabled": true,
        "payout_enabled": true,
        "precision_payout": "0.000000000000000001",
        "payout_fee": "0.000000000000",
        "payout_is_payment_id": false,
        "payin_payment_id": false,
        "payin_confirmations": 2,
        "is_multichain": false
      }
    ]
  }
}


GET /api/3/public/currency

Returns the actual list of available currencies, 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 full_name String Currency full name (e.g., "Bitcoin").
crypto Boolean Flag indicating whether the currency is a cryptocurrency.
payin_enabled Boolean Flag indicating whether generating deposit addresses is
allowed for the currency. payout_enabled Boolean Flag indicating whether
withdrawals are allowed for the currency. transfer_enabled Boolean Flag
indicating whether transfers between the bank and the exchange accounts are
allowed for the network (may be disabled on maintenance). sign String Currency
sign. crypto_payment_id_name String The name of an additional account identifier
used for the protocol. crypto_explorer String The link to the currency explorer
with "{tx}" placeholder instead of a hash. precision_transfer Number The minimum
amount of a transfer. account_top_order Number Optional. The absolute position
of the currency in the currency list. qr_prefix String The QR prefix used for
indication of the currency in a deposit address. delisted Boolean Flag
indicating whether the currency has been delisted. networks []Network Networks
that may host operations on the currency.

Network model consists of:

Name Type Description code String Currency code. network_name String Full
network name. network String Code of the currency of the hosting network.
is_ens_available Boolean Flag indicating whether the network supports ENS
(Ethereum Name Service). protocol String Optional. The standard or protocol
underlying network operations or smart contracts.
If equals code, the currency is the network native currency.
If "TOKEN", the currency is a token build on top of this layer-2 network.
Example: "ERC20" default Boolean Flag indicating whether the network is the
default for the currency. payin_enabled Boolean Flag indicating whether
generating deposit addresses is allowed for the network. payout_enabled Boolean
Flag indicating whether withdrawals are allowed for the network.
precision_payout Number The minimum amount of a withdrawal. payout_fee Number
Optional. The minimal possible fee value constituted of the network fee charged
by a blockchain and the maintenance fee charged by the exchange.
payout_is_payment_id Boolean Flag indicating whether providing additional
information for withdrawals is needed. payin_payment_id Boolean Flag indicating
whether providing additional information for deposits is needed.
payin_confirmations Number The number of confirmation needed for a transaction
to be accepted in the network. address_regex String Optional. Regular expression
to a deposit address. payment_id_regex String Optional. Regular expression for a
payment identifier. low_processing_time Number Optional. The lowest processing
time in seconds for a withdrawal. high_processing_time Number Optional. The
highest processing time in seconds for a withdrawal. avg_processing_time Number
Optional. The average processing time in seconds for a withdrawal.
crypto_payment_id_name String Optional. Transaction identifier, e.g., comment,
message, memo, attachment, etc. crypto_explorer String Optional. The link to the
network explorer with "{tx}" placeholder instead of a hash. contract_address
String Token contract address. is_multichain Boolean Flag indicating whether
multichain is active for the network. asset_id JSON Optional. A unique arbitrary
object that identifies a coin. Each network has its own set of properties
returned inside the object.

payout_fee is a valid fee only if both network and maintenance fees fell below
its minimal absolute values given the withdrawal amount.
Call GET /api/3/wallet/crypto/fee/estimate to see the exact value of fees based
on the amount.


GET CURRENCY

curl "https://api-balancers.gleec.com/api/3/public/currency/BTC"


> Response:

{
  "full_name": "test",
  "crypto": true,
  "payin_enabled": true,
  "payout_enabled": true,
  "transfer_enabled": true,
  "sign": "฿",
  "qr_prefix": "bitcointestnet:",
  "crypto_payment_id_name": "",
  "crypto_explorer": "https://blockchain.info/tx/{tx}",
  "precision_transfer": "1",
  "delisted": false,
  "networks": [
    {
      "code": "test123",
      "network_name": "test123",
      "network": "test",
      "protocol": "test123",
      "default": true,
      "is_ens_available": true,
      "payin_enabled": true,
      "payout_enabled": true,
      "precision_payout": "1",
      "payout_fee": "0.000000000000",
      "payout_is_payment_id": false,
      "payin_payment_id": false,
      "payin_confirmations": 3,
      "is_multichain": false
    }
  ]
}


GET /api/3/public/currency/{currency}

Returns the data for a certain currency.

Requires no API key Access Rights.

Response:

Name Type Description full_name String Currency full name (e.g., "Bitcoin").
crypto Boolean Flag indicating whether the currency is a cryptocurrency.
payin_enabled Boolean Flag indicating whether generating deposit addresses is
allowed for the currency. payout_enabled Boolean Flag indicating whether
withdrawals are allowed for the currency. transfer_enabled Boolean Flag
indicating whether transfers between the bank and the exchange accounts are
allowed for the network (may be disabled on maintenance). sign String Currency
sign. crypto_payment_id_name String The name of an additional account identifier
used for the protocol. crypto_explorer String The link to the currency explorer
with "{tx}" placeholder instead of a hash. precision_transfer Number The minimum
amount of a transfer. account_top_order Number Optional. The absolute position
of the currency in the currency list. qr_prefix String The QR prefix used for
indication of the currency in a deposit address. delisted Boolean Flag
indicating whether the currency has been delisted. networks []Network Networks
that may host operations on the currency.


SYMBOLS


GET SYMBOLS

curl "https://api-balancers.gleec.com/api/3/public/symbol"


> Response:

{
  "ETHBTC": {
    "type": "spot",
    "base_currency": "ETH",
    "quote_currency": "BTC",
    "status": "working",
    "quantity_increment": "0.001",
    "tick_size": "0.000001",
    "take_rate": "0.001",
    "make_rate": "-0.0001",
    "fee_currency": "BTC"
  }
}


GET /api/3/public/symbol

Returns the actual list of currency symbols (currency pairs) traded on exchange.
The first listed currency of a symbol is called the base currency, and the
second currency is called the quote currency.

The currency pair indicates how much of the quote currency is needed to purchase
one unit of the base currency.

Read more

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.

All parameters are optional.

Parameters:

Name Type Description symbols String Comma-separated list of symbol codes.

Response:

Name Type Description type String Symbol type.
Possible values: spot base_currency String Name (code) of base currency, (e.g.,
"ETH"). quote_currency String Name (code) of quote currency. status String
Exchange status.
Possible values: working, suspended quantity_increment Number Symbol quantity
should be divided by this value with no remainder. tick_size Number Symbol price
should be divided by this value with no remainder. take_rate Number Default fee
rate. make_rate Number Default fee rate for market making trades. fee_currency
String Currency in which fees are determined.


GET SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/symbol/ETHBTC"


> Response:

{
  "type": "spot",
  "base_currency": "ETH",
  "quote_currency": "BTC",
  "status": "working",
  "quantity_increment": "0.0001",
  "tick_size": "0.000001",
  "take_rate": "0.002",
  "make_rate": "0.001",
  "fee_currency": "BTC"
}


GET /api/3/public/symbol/{symbol}

Returns the data for a certain symbol.

Requires no API key Access Rights.

Response:

Name Type Description type String Symbol type.
Possible values: spot base_currency String Name (code) of base currency, (e.g.,
"ETH"). quote_currency String Name (code) of quote currency. status String
Exchange status.
Possible values: working, suspended quantity_increment Number Symbol quantity
should be divided by this value with no remainder. tick_size Number Symbol price
should be divided by this value with no remainder. take_rate Number Default fee
rate. make_rate Number Default fee rate for market making trades. fee_currency
String Currency in which fees are determined.


TICKERS


GET TICKERS

curl "https://api-balancers.gleec.com/api/3/public/ticker"


> Response:

{
  "ETHBTC": {
    "ask": "0.050043",
    "bid": "0.050042",
    "last": "0.050042",
    "low": "0.047052",
    "high": "0.051679",
    "open": "0.047800",
    "volume": "36456.720",
    "volume_quote": "1782.625000",
    "timestamp": "2024-04-12T14:57:19.999Z"
  }
}


GET /api/3/public/ticker

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 ask Number or null Best ask price. Can return null if no
data. bid Number or null Best bid price. Can return null if no data. last Number
or null Last trade price. Can return null if no data. low Number The lowest
trade price within 24 hours. high Number The highest trade price within 24
hours. open Number or null Last trade price 24 hours ago. Can return null if no
data. volume Number Total trading amount within 24 hours in base currency.
volume_quote Number Total trading amount within 24 hours in quote currency.
timestamp DateTime Last update or refresh ticker timestamp.


GET TICKER BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/ticker/ETHBTC"


> Response:

{
  "ask": "0.020572",
  "bid": "0.020566",
  "last": "0.020574",
  "low": "0.020388",
  "high": "0.021084",
  "open": "0.020913",
  "volume": "138444.3666",
  "volume_quote": "2853.6874972480",
  "timestamp": "2024-04-02T17:52:36.731Z"
}


GET /api/3/public/ticker/{symbol}

Returns the ticker for a certain symbol.

Requires no API key Access Rights.

Response:

Name Type Description ask Number or null Best ask price. Can return null if no
data. bid Number or null Best bid price. Can return null if no data. last Number
or null Last trade price. Can return null if no data. low Number The lowest
trade price within 24 hours. high Number The highest trade price within 24
hours. open Number or null Last trade price 24 hours ago. Can return null if no
data. volume Number Total trading amount within 24 hours in base currency.
volume_quote Number Total trading amount within 24 hours in quote currency.
timestamp DateTime Last update or refresh ticker timestamp.


PRICES


GET PRICES

curl "https://api-balancers.gleec.com/api/3/public/price/rate?from=ETH&to=BTC"


> Response:

{
  "ETH":{
    "currency": "BTC",
    "price": "0.021084",
    "timestamp": "2024-04-02T17:52:36.731Z"
  }
}


GET /api/3/public/price/rate

Returns the mean of "best" bid price and "best" ask price in the order book.

If there is no "best" bid of ask price, the last price is returned.
If provided currencies do not match any existing symbol, the rate for
intermediate pairs are multiplied of inverted depending on the direction of
exchange in these pairs.
If there is no rate, an empty object is returned.

Requires no API key Access Rights.

Parameters:

Name Type Description from String Source currency code. to String Target
currency code.

Response:

Name Type Description currency String Quote currency code. price Number
Quotation price. timestamp DateTime Last update or refresh price timestamp.


GET PRICES HISTORY

curl "https://api-balancers.gleec.com/api/3/public/price/history?from=ETH&to=BTC"


> Response:

{
  "ETH":{
    "currency": "BTC",
    "history": [
    {
      "timestamp": "2021-07-01T20:00:00.000Z",
      "open": "0.063420",
      "close": "0.063767",
      "min": "0.063403",
      "max": "0.063782"
    }
  ]
}


GET /api/3/public/price/history

Returns quotation prices history.

Requires no API key Access Rights.

Parameters:

Name Type Description from String Source currency code. to String Target
currency code. until DateTime Optional. Interval end value. since DateTime
Optional. Interval initial value. limit Number Optional
Default value: 1
Accepted values: 1 – 1000 period String Optional. Accepted values: M1 (one
minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
Default value: M30 (30 minutes) sort String Optional. Sort direction.
Accepted values: ASC, DESC
Default value: DESC

Response:

Name Type Description currency String Quote currency code. history History
Quotation price history entry.

History model consists of:

Name Type Description timestamp DateTime Last update or refresh price timestamp.
open Number Open price. close Number Closing price. min Number The lowest price
for the period. max Number The highest price for the period.


GET TICKER LAST PRICES

curl "https://api-balancers.gleec.com/api/3/public/price/ticker"


> Response:

{
  "ETHBTC": {
    "price": "0.050042",
    "timestamp": "2024-04-12T14:57:19.999Z"
  }
}


GET /api/3/public/price/ticker

Returns tickers' last prices for all symbols.

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 price Number Ticker last price. timestamp DateTime Last
update or refresh ticker timestamp.


GET TICKER LAST PRICE BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/price/ticker/ETHBTC"


> Response:

{
  "price": "0.021084",
  "timestamp": "2024-04-02T17:52:36.731Z"
}


GET /api/3/public/price/ticker/{symbol}

Returns the ticker last price for a certain symbol.

Requires no API key Access Rights.

Response:

Name Type Description price Number Ticker last price. timestamp DateTime Last
update or refresh ticker timestamp.


TRADES


GET TRADES

curl "https://api-balancers.gleec.com/api/3/public/trades"


> Response:

{
  "BTCUSDT":[
    {
      "id":3494,
      "price":"9793.94",
      "qty":"0.21469",
      "side":"sell",
      "timestamp":"2024-04-24T12:54:41.972Z"
    }
  ],
  "ETHBTC":[
    {
      "id":3495,
      "price":"0.027668",
      "qty":"0.069",
      "side":"buy",
      "timestamp":"2024-04-24T12:54:32.843Z"
    }
  ]
}


GET /api/3/public/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 tickers 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 id Number Trade identifier. price Number Trade price. qty
Number Trade quantity. side String Trade side.
Accepted values: sell, buy timestamp DateTime Trade timestamp.


GET TRADES BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/trades/ETHBTC?sort=DESC"


> Response:

[
  {
    "id": 9533117,
    "price": "0.046001",
    "qty": "0.220",
    "side": "sell",
    "timestamp": "2024-04-14T12:18:40.426Z"
  },
  {
    "id": 9533116,
    "price": "0.046002",
    "qty": "0.022",
    "side": "buy",
    "timestamp": "2024-04-14T11:56:37.027Z"
  }
]


GET /api/3/public/trades/{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 id Number Trade identifier. price Number Trade price. qty
Number Trade quantity. side String Trade side.
Possible values: sell, buy timestamp DateTime Trade timestamp.


ORDER BOOKS


GET ORDER BOOKS

curl "https://api-balancers.gleec.com/api/3/public/orderbook"


> Response:

{
  "BTCUSDT": {
    "timestamp": "2024-04-11T11:18:03.857366871Z",
    "ask": [
      [
        "9777.51",                       // Price
        "4.50579"                        // Amount
      ],
      [
        "9777.52",
        "5.79832"
      ]
    ],
    "bid": [
      [
        "9777.5",
        "0.00002"
      ],
      [
        "9776.26",
        "0.0001"
      ]
    ]
  },
  "ETHBTC": {
    "timestamp": "2024-04-11T11:18:03.790858502Z",
    "ask": [
      [
        "0.022626",
        "0.0057"
      ],
      [
        "0.022628",
        "1.4259"
      ]
    ],
    "bid": [
      [
        "0.022624",
        "0.5748"
      ],
      [
        "0.022623",
        "26.5"
      ]
    ]
  }
}


GET /api/3/public/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 tickers 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 []String Ask
side array of levels. bid []String Bid side array of levels.


GET ORDER BOOK BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/orderbook/ETHBTC?volume=0.5"


> Response:

{
  "timestamp": "2024-04-11T11:30:38.597950917Z",
  "ask": [
     [
        "9779.68",                       // Price
        "2.497"                          // Quantity
      ]
    ],
  "bid": [
    [
      "9779.67",
      "0.03719"
    ],
    [
      "9779.29",
      "0.171"
    ],
    [
      "9779.27",
      "0.171"
    ],
    [
      "9779.21",
      "0.171"
    ]
  ]
}


GET /api/3/public/orderbook/{symbol}

The request returns an Order Book for a certain symbol.

Requires no API key Access Rights.

Parameters:

Name Type Description depth Number Optional. Order Book depth.
Default value: 100
Set to 0 to view the full Order Book. volume Number Optional. Desired volume for
market depth search.

Please note that if the volume is specified, the depth will be ignored.

Response:

Name Type Description timestamp DateTime Publication timestamp. ask []String Ask
side array of levels. bid []String Bid side array of levels.


CANDLES


GET CANDLES

curl "https://api-balancers.gleec.com/api/3/public/candles"


> Response:

{
  "BTCUSDT":[
    {
      "timestamp": "2021-07-01T20:00:00.000Z",
      "open": "33079.93",
      "close": "33236.53",
      "min": "33079.93",
      "max": "33295.73",
      "volume": "146.86223",
      "volume_quote": "4877838.3025063"
    }
  ],
  "ETHBTC":[
    {
      "timestamp": "2021-07-01T20:00:00.000Z",
      "open": "0.063420",
      "close": "0.063767",
      "min": "0.063403",
      "max": "0.063782",
      "volume": "866.6776",
      "volume_quote": "55.2132903904"
    }
  ]
}


GET /api/3/public/candles

Candles are used for the representation of a specific symbol as an OHLC chart.

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.

All parameters are optional.

Parameters:

Name Type Description symbols String Comma-separated list of symbol codes. sort
String Sort direction.
Accepted values: ASC, DESC
Default value: DESC period String Accepted values: M1 (one minute), M3, M5, M15,
M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
Default value: M30 (30 minutes) from DateTime Interval initial value. till
DateTime Interval end value. limit Number Default value: 10
Accepted values: 1 – 1000

Response:

Name Type Description timestamp DateTime Candle timestamp. open Number Open
price. close Number Closing price. min Number The lowest price for the period.
max Number The highest price for the period. volume Number Volume in base
currency. volume_quote Number Volume in quote currency.

The result contains candles with non-zero volume only (no trades — no candles).


GET CANDLES BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/candles/ETHBTC"


> Response:

[
  {
    "timestamp": "2024-04-20T20:00:00.000Z",
    "open": "0.050459",
    "close": "0.050087",
    "min": "0.050000",
    "max": "0.050511",
    "volume": "1326.628",
    "volume_quote": "66.555987736"
  },
  {
    "timestamp": "2024-04-20T20:30:00.000Z",
    "open": "0.050108",
    "close": "0.050139",
    "min": "0.050068",
    "max": "0.050223",
    "volume": "87.515",
    "volume_quote": "4.386062831"
  }
]


GET /api/3/public/candles/{symbol}

Returns candles for a certain symbol.

Requires no API key Access Rights.

All parameters are optional.

Parameters:

Name Type Description sort String Sort direction.
Accepted values: ASC, DESC
Default value: DESC period String Accepted values: M1 (one minute), M3, M5, M15,
M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
Default value: M30 (30 minutes) from DateTime Interval initial value. till
DateTime Interval end value. limit Number Default value: 100
Accepted values: 1 – 1000 offset Number Default value: 0
Accepted values: 0 – 100000

Response:

Name Type Description timestamp DateTime Candle timestamp. open Number Open
price. close Number Closing price. min Number The lowest price for the period.
max Number The highest price for the period. volume Number Volume in base
currency. volume_quote Number Volume in quote currency.

The result contains candles with non-zero volume only (no trades — no candles).


GET CONVERTED CANDLES

curl "https://api-balancers.gleec.com/api/3/public/converted/candles?target_currency=USDT"


> Response:

{
  "target_currency": "USDT",
  "data": {
    "BTCUSDT": [
      {
        "timestamp": "2024-02-01T10:30:00.000Z",
        "open": "42265.17",
        "close": "42196.10",
        "min": "42182.49",
        "max": "42269.15",
        "volume": "60.88187",
        "volume_quote": "2569178.2573316"
      }
    ],
    "ETHBTC": [
      {
        "timestamp": "2024-02-01T10:30:00.000Z",
        "open": "2270.91293888",
        "close": "2268.00140384",
        "min": "2267.70603072",
        "max": "2271.50368512",
        "volume": "13.6669",
        "volume_quote": "31032.101773456736"
      }
    ]
  }
}


GET /api/3/public/converted/candles

Returns OHLCV data regarding the last price converted to the target currency for
all symbols.

Candles are used for the representation of a specific symbol as an OHLC chart.

Requires no API key Access Rights.

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.
This call produces the same output as GET /api/3/public/converted/candles except
all values in quote currency are converted to the target currency.
Conversion from the symbol quote currency to the target currency is the mean of
the "best" bid price and the "best" ask price in the order book. If there is no
"best" bid of ask price, the last price is returned.

Parameters:

Name Type Description target_currency String Target currency for conversion.
symbols String Comma-separated list of symbol codes. sort String Sort direction.
Accepted values: ASC, DESC
Default value: DESC period String Accepted values: M1 (one minute), M3, M5, M15,
M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
Default value: M30 (30 minutes) from DateTime Interval initial value. till
DateTime Interval end value. limit Number Default value: 10
Accepted values: 1 – 1000

Response:

Name Type Description target_currency String Target currency for conversion.
data Map Candles converted to the target currency. > []JSON Symbol code. >>
timestamp DateTime Candle timestamp. >> open Number Open price. >> close Number
Closing price. >> min Number The lowest price for the period. >> max Number The
highest price for the period. >> volume Number Volume in base currency. >>
volume_quote Number Volume in quote currency.

The result contains candles with non-zero volume only (no trades — no candles).


GET CONVERTED CANDLES BY SYMBOL

curl "https://api-balancers.gleec.com/api/3/public/converted/candles/ETHBTC?target_currency=USDT"


> Response:

{
  "target_currency": "USDT",
  "data": [
    {
      "timestamp": "2024-02-01T10:30:00.000Z",
      "open": "2270.614518070",
      "close": "2267.450221945",
      "min": "2267.365840715",
      "max": "2271.205186680",
      "volume": "13.7525",
      "volume_quote": "31222.1126879271435"
    }
  ]
}


GET /api/3/public/converted/candles/{symbol}

Returns OHLCV data regarding the last price converted to the target currency for
a symbol.

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.
This call produces the same output as GET /api/3/public/converted/candles except
all values in quote currency are converted to the target currency.
Conversion from the symbol quote currency to the target currency is the mean of
"best" bid price and "best" ask price in the order book. If there is no "best"
bid of ask price, the last price is returned.

All parameters are optional.

Parameters:

Name Type Description sort String Sort direction.
Accepted values: ASC, DESC
Default value: DESC period String Accepted values: M1 (one minute), M3, M5, M15,
M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
Default value: M30 (30 minutes) from DateTime Interval initial value. till
DateTime Interval end value. limit Number Default value: 100
Accepted values: 1 – 1000 offset Number Default value: 0
Accepted values: 0 – 100000

Response:

Name Type Description target_currency String Target currency for conversion.
data []JSON Candles converted to the target currency. > timestamp DateTime
Candle timestamp. > open Number Open price. > close Number Closing price. > min
Number The lowest price for the period. > max Number The highest price for the
period. > volume Number Volume in base currency. > volume_quote Number Volume in
quote currency.

The result contains candles with non-zero volume only (no trades — no candles).


AUTHENTICATION

Public market data are available without authentication. Authentication is
required for other requests.

You should create API keys on the API Settings page. You can create multiple API
keys with different access rights for your applications.

Alternatively, you may obtain API keys via the Auth API by creating a session
(POST /account/auth) and an API key (POST /api-key).


BASIC

curl -u "apiKey:secretKey" "https://api-balancers.gleec.com/api/3/wallet/balance"


import requests

session = requests.session()
session.auth = ("apiKey", "secretKey")


const fetch = require('node-fetch');
const credentials = Buffer
  .from(
    'apiKey'
    + ':'
    + 'secretKey'
  )
  .toString('base64');

fetch(
  'https://api-balancers.gleec.com/api/3/wallet/balance',
  {
    method: 'GET',
    headers: {
      'Authorization': 'Basic ' + credentials
    }
  }
);


To authorize, place credentials to the request header. Those must be constituted
of apiKey and secretKey as follows: "Basic " + apiKey + ":" + secretKey.


HS256

from base64 import b64encode
from hashlib import sha256
from hmac import HMAC
from time import time
from urllib.parse import urlsplit
from requests import Session
from requests.auth import AuthBase


class HS256(AuthBase):
    def __init__(self, api_key: str, secret_key: str, window: int = None):
        self.api_key = api_key
        self.secret_key = secret_key
        self.window = window

    def __call__(self, r):
        url = urlsplit(r.url)
        message = [r.method, url.path]
        if url.query:
            message.append('?')
            message.append(url.query)
        if r.body:
            message.append(r.body)

        timestamp = str(int(time() * 1000))
        window = str(self.window) if self.window else None
        message.append(timestamp)
        if window:
            message.append(window)

        signature = HMAC(key=self.secret_key.encode(),
                         msg=''.join(message).encode(),
                         digestmod=sha256).hexdigest()
        data = [self.api_key, signature, timestamp]
        if window:
            data.append(window)

        base64_encoded = b64encode(':'.join(data).encode()).decode()
        r.headers['Authorization'] = f'HS256 {base64_encoded}'
        return r


auth = HS256(api_key='apiKey', secret_key='secretKey')

with Session() as s:
    response = s.get('https://api-balancers.gleec.com/api/3/wallet/balance', auth=auth)
    print(response.json())


The alternative authentication method is the HMAC signature.

To send a request, you should establish a persistent session using the
credentials signed as follows:

 1. Create an HMAC signature with secret_key as the secret key, SHA256 as the
    hash algorithm, and payload as the message, structured like:
    <method> + <URL path> + [“?” + <query>] + [<body>] + <timestamp> +
    [<window>]
 2. Add the authorization header to a request. It should have the following
    structure:
    "HS256 " + Base64(api_key + ":" + <HMAC signature> + ":" + timestamp + [":"
    + window])

Provided timestamp has to be valid in the specified sliding window (1000 – 60000
milliseconds) or default 10000 milliseconds.


SPOT TRADING


ORDER MODEL

{
  "id": 828680665,
  "client_order_id": "f4307c6e507e49019907c917b6d7a084",
  "symbol": "ETHBTC",
  "side": "sell",
  "status": "partiallyFilled",
  "type": "limit",
  "time_in_force": "GTC",
  "quantity": "13.942",
  "price": "0.011384",
  "quantity_cumulative": "5.240",
  "created_at": "2024-04-16T14:18:47.321Z",
  "updated_at": "2024-04-16T14:18:47.321Z",
  "post_only": false,
  "trades": [
    {
      "id": 1361171432,
      "quantity": "5.240",
      "price": "0.011384",
      "fee": "0.001237803000",
      "taker": true,
      "timestamp": "2024-04-16T14:18:47.321Z"
    }
  ]
}


Order model consists of:

Name Type Description id Number Unique order identifier as assigned by exchange.
client_order_id String Unique order identifier as assigned by the trader.
Uniqueness must be guaranteed until the last order with the same client_order_id
becomes inactive (canceled, expired, or fully executed) and some time after
that. order_list_id String Optional. Order list identifier. Returned only for an
order list request. contingency_type String Optional. Order list type. Returned
only for an order list request.
Possible values:
allOrNone, oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther symbol
String Symbol code. side String Trade side.
Possible values: sell, buy status String Order state.
Possible values:
new — an order is placed in the order book.
suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order
is parked until it meets the conditions for placement in the order book.
partiallyFilled — an order is executed, but a part of its quantity is not filled
yet.
filled — order quantity filled completely.
canceled — an order is canceled. It can either be done by a user through a
cancel/replace request or by the system under specific circumstances.
expired — an order is deactivated after it no longer satisfies Time in Force
(IOC, FOK) or Post Only requirements. type String Order type.
Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit,
takeProfitMarket time_in_force String Time in Force is a special instruction
used when placing an order to indicate how long it will remain active before it
is executed or expired.
GTC — "Good-Till-Canceled" order won't be closed until it is filled.
IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an
IOC order that cannot be filled immediately will be canceled.
FOK — "Fill-Or-Kill" order must be executed immediately and completely or not
executed at all.
Day — keeps the order active until the end of the trading day (23:59 UTC+0).
GTD — "Good-Till-Date" order may remain active until the time specified in
expire_time. quantity Number Order quantity. quantity_cumulative Number Executed
order quantity. price Number Optional. Order price. stop_price Number Optional.
The price level that triggers order activation. Specified if type is stopLimit,
stopMarket, takeProfitLimit, or takeProfitMarket. expire_time DateTime Optional.
Date of order expiration. Specified if time_in_force is GTD. post_only Boolean A
post-only order is an order that does not remove liquidity. If a post-only order
causes a match with a pre-existing order as a taker, then the order will expire.
original_client_order_id String Optional. Identifier of replaced order.
created_at DateTime Date of order's creation. updated_at DateTime Date of
order's last update. trades []Trade Optional. List of trades. Never returned for
an order list request.

Trade model consists of:

Name Type Description id Number Trade identifier. quantity Number Quantity of
trade. price Number Trade price. fee Number Fee paid for trade. taker Boolean
Liquidity indicator. timestamp DateTime Date of trade.


GET SPOT TRADING BALANCE

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/balance"


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")

b = session.get('https://api-balancers.gleec.com/api/3/spot/balance').json()

print(b)


> Response. All currencies:

[
  {
    "currency": "ETH",
    "available": "10.000000000",
    "reserved": "0.56"
  },
  {
    "currency": "BTC",
    "available": "0.010205869",
    "reserved": "0"
  }
]


> Response. One currency:

{
  "available": "10.000000000",
  "reserved": "0.56"
}


GET /api/3/spot/balance GET /api/3/spot/balance/{currency}

Returns the user's trading balance.

Requires the "Orderbook, History, Trading balance" API key Access Right.

Parameters:

Name Type Description currency String Optional. Currency filter.

Response:

Name Type Description currency String Currency code. available Number Amount
available for trading or transfer to wallet. reserved Number Total amount
reserved for active orders and incomplete transfers to wallet.


GET ALL ACTIVE SPOT ORDERS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order"


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")

b = session.get('https://api-balancers.gleec.com/api/3/spot/order').json()

print(b)


> Response:

[
  {
    "id": 840450210,
    "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
    "symbol": "ETHBTC",
    "side": "buy",
    "status": "partiallyFilled",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.020",
    "price": "0.046001",
    "quantity_cumulative": "0.005",
    "post_only": false,
    "created_at": "2024-04-12T17:17:57.437Z",
    "updated_at": "2024-04-12T17:18:08.610Z"
  }
]


GET /api/3/spot/order

Returns a list of all active spot orders.

Requires the "Orderbook, History, Trading balance" API key Access Right.

Parameters:

Name Type Description symbol String Optional. Parameter to filter active spot
orders by symbol.

Response: array of spot orders


GET ACTIVE SPOT ORDER

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/c1837634ef81472a9cd13c81e7b91401"


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")

b = session.get('https://api-balancers.gleec.com/api/3/spot/order/c1837634ef81472a9cd13c81e7b91401').json()

print(b)


> Response:

{
  "id": 840450210,
  "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
  "symbol": "ETHBTC",
  "side": "buy",
  "status": "partiallyFilled",
  "type": "limit",
  "time_in_force": "GTC",
  "quantity": "0.020",
  "price": "0.046001",
  "quantity_cumulative": "0.005",
  "post_only": false,
  "created_at": "2024-04-12T17:17:57.437Z",
  "updated_at": "2024-04-12T17:18:08.610Z"
}


GET /api/3/spot/order/{client_order_id}

Returns an active spot order by client_order_id.

Requires the "Orderbook, History, Trading balance" API key Access Right.

Response: spot order


CREATE NEW SPOT ORDER

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order" \
  -d "symbol=ETHBTC&side=sell&quantity=0.063&price=0.046016"


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
orderData = {'symbol':'ETHBTC', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016' }

r = session.post('https://api-balancers.gleec.com/api/3/spot/order/', data = orderData)

print(r.json())


> Response:

{
  "id": 0,
  "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
  "symbol": "ETHBTC",
  "side": "sell",
  "status": "new",
  "type": "limit",
  "time_in_force": "GTC",
  "quantity": "0.063",
  "price": "0.046016",
  "quantity_cumulative": "0.000",
  "post_only": false,
  "created_at": "2024-04-15T17:01:05.092Z",
  "updated_at": "2024-04-15T17:01:05.092Z"
}


> Error response example:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  }
}


POST /api/3/spot/order

Creates a new spot order.

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description client_order_id String Optional. If omitted, an order will
be created, and it will be generated by the Server. Uniqueness must be
guaranteed until the last order with the same client_order_id becomes inactive
(canceled, expired, or fully executed) and some time after that.
Must be from 8 to 32 long. May include Latin letters of any case, digits, and _,
-.
If specified and corresponds to an existing order, a request will be rejected.
symbol String Symbol code. side String Trade side.
Accepted values: sell, buy type String Optional. Order type.
Must be set to market, stopMarket, or takeProfitMarket if price was left
unspecified.
Accepted values: limit, market, stopLimit, stopMarket, takeProfitLimit,
takeProfitMarket
Default value: limit time_in_force String Optional. Time in Force instruction.
Accepted values: GTC, IOC, FOK, Day, GTD
Default value:
FOK — type is market, stopMarket, takeProfitMarket;
GTC — type is limit, stopLimit, takeProfitLimit. quantity Number Order quantity.
price Number Order price. Required if type is limit, stopLimit, or
takeProfitLimit. stop_price Number The price level that triggers order
activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or
takeProfitMarket. expire_time DateTime Date of order expiration. Required if
time_in_force is GTD. strict_validate Boolean Price and quantity will be checked
for incrementation within the symbol’s tick size and quantity step. See the
symbol's tick_size and quantity_increment. post_only Boolean Optional. If a
post-only order causes a match with a pre-existing order as a taker, then the
order will expire. take_rate Number Optional. Liquidity taker fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup. make_rate Number Optional. Liquidity provider fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup.

Execution of a taker's order may be postponed for 1 millisecond.

Response: spot order

Price accuracy and quantity

Symbol config contains the tick_size parameter which means that price should be
divided by tick_size with no remainder.
quantity should be divided by quantity_increment with no remainder.
By default, if strict_validate is not enabled, the Server rounds half down the
price and quantity for tick_size and quantity_increment.

Example of ETHBTC: if tick_size is 0.000001, then price 0.046016 is valid, and
0.0460165 is invalid.

Fees

Charged fee is determined by the symbol's fee_currency. Maker-taker fees offer a
transaction rebate make_rate to those who provide liquidity (a maker), while
charging customers who take that liquidity take_rate (a taker).

To create buy orders, you must have sufficient balance including fees.

To create market buy orders, you must have sufficient balance including fees.

Available balance > price × quantity + price × quantity × max(take_rate,
make_rate)

Order result status

For orders with time_in_force equal to IOC or FOK, the REST API returns final
order status: filled or expired.

If an order can be instantly executed, then the REST API returns a status of
filled or partiallyFilled in the order's info.


CREATE NEW SPOT ORDER LIST

> AON request:

curl \
  -X POST \
  -H 'Content-Type: application/json'\
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/list" \
  -d '{
        "contingency_type": "allOrNone",
        "orders": [
          {
            "symbol": "ETHBTC",
            "side": "sell",
            "quantity": "0.063",
            "type": "market",
            "time_in_force": "FOK"
          },
          {
            "symbol": "BTCUSDT",
            "side": "sell",
            "quantity": "0.057",
            "type": "market",
            "time_in_force": "FOK"
          }
        ]
      }'


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
headers = {'Content-Type': 'application/json'}
orderData = '{"contingency_type": "allOrNone", "orders": [{"symbol": "ETHBTC", "side": "sell", "quantity": "0.063", "type": "market", "time_in_force": "FOK"}, {"symbol": "BTCUSDT", "side": "sell", "quantity": "0.057", "type": "market", "time_in_force": "FOK"}]}'

r = session.post('https://api-balancers.gleec.com/api/3/spot/order/list', data = orderData, headers=headers)

print(r.json())


> AON response:

[
  {
    "id": 840450210,
    "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "filled",
    "type": "market",
    "time_in_force": "FOK",
    "quantity": "0.063",
    "price": "0.071476",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "allOrNone",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  {
    "id": 840450211,
    "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
    "symbol": "BTCUSDT",
    "side": "sell",
    "status": "filled",
    "type": "market",
    "time_in_force": "FOK",
    "quantity": "0.057",
    "price": "43510.67",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "allOrNone",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  }
]


> OCO request:

curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/list" \
  -d '{
        "contingency_type": "oneCancelOther",
        "orders": [
          {
            "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
            "symbol": "ETHBTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "price": "0.046016",
            "post_only": false
          },
          {
            "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
            "symbol": "ETHBTC",
            "side": "sell",
            "type": "stopMarket",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "stop_price": "0.044050",
            "post_only": false
          }
        ]
      }'


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
headers = {'Content-Type': 'application/json'}
orderData = '{"contingency_type": "oneCancelOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}'

r = session.post('https://api-balancers.gleec.com/api/3/spot/order/list', data = orderData, headers=headers)

print(r.json())


> OCO response:

[
  {
    "id": 840450210,
    "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
    "symbol": "ETHBTC",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.046016",
    "quantity_cumulative": "0.063",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  {
    "id": 840450211,
    "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "suspended",
    "type": "stopMarket",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.044016",
    "quantity_cumulative": "0.057",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  }
]


> OTO request:

curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/list" \
  -d '{
        "contingency_type": "oneTriggerOther",
        "orders": [
          {
            "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
            "symbol": "ETHBTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "price": "0.046016",
            "post_only": false
          },
          {
            "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
            "symbol": "ETHBTC",
            "side": "sell",
            "type": "stopMarket",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "stop_price": "0.044050",
            "post_only": false
          }
        ]
      }'


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
headers = {'Content-Type': 'application/json'}
orderData = '{"contingency_type": "oneTriggerOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}'

r = session.post('https://api-balancers.gleec.com/api/3/spot/order/list', data = orderData, headers=headers)

print(r.json())


> OTO response:

[
  {
    "id": 840450210,
    "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
    "symbol": "ETHBTC",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.046016",
    "quantity_cumulative": "0.063",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneTriggerOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  {
    "id": 840450211,
    "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "suspended",
    "type": "stopMarket",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.044016",
    "quantity_cumulative": "0.057",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneTriggerOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  }
]


> OTOCO request:

curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/list" \
  -d '{
        "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
        "contingency_type": "oneTriggerOneCancelOther",
        "orders": [
          {
            "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
            "symbol": "ETHBTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "price": "0.046016",
            "post_only": false
          },
          {
            "client_order_id": "2723cdfba2d609b621d5d055e3ef9be2",
            "symbol": "ETHBTC",
            "side": "sell",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "price": "0.050000",
            "post_only": false
          },
          {
            "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
            "symbol": "ETHBTC",
            "side": "sell",
            "type": "stopMarket",
            "time_in_force": "GTC",
            "quantity": "0.063",
            "stop_price": "0.044050",
            "post_only": false
          }
        ]
      }'


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
headers = {'Content-Type': 'application/json'}
orderData = '{"contingency_type": "oneTriggerOneCancelOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "2723cdfba2d609b621d5d055e3ef9be2", "symbol": "ETHBTC", "side": "sell", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.050000", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}'

r = session.post('https://api-balancers.gleec.com/api/3/spot/order/list', data = orderData, headers=headers)

print(r.json())


> OTOCO response:

[
  {
    "id": 840450210,
    "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
    "symbol": "ETHBTC",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.046016",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneTriggerOneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  {
    "id": 840450211,
    "client_order_id": "2723cdfba2d609b621d5d055e3ef9be2",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.050000",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "inactive": true,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneTriggerOneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  {
    "id": 840450211,
    "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "suspended",
    "type": "stopMarket",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "stop_price": "0.044050",
    "price": "0.044016",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "inactive": true,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneTriggerOneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  }
]


> Error response example:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  }
}


POST /api/3/spot/order/list

Creates a new spot order list.

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description order_list_id String Order list identifier. If omitted, it
will be generated by the system upon order list creation. Must be equal to
client_order_id of the first order in the request. contingency_type String Order
list type.
Accepted values:
allOrNone (AON) — all orders in the set should be executed within a single
transaction or become expired otherwise;
oneCancelOther (OCO) — all orders in the set should be canceled if one of them
was executed;
oneTriggerOther (OTO) — execution of the first (primary) order on the list
activates other (secondary) orders as independent of each other;
oneTriggerOneCancelOther (OTOCO) — the execution of the first (primary) order on
the list activates the other (secondary) orders as an OCO order list. orders
[]Order Orders in the list. There must be 2 or 3 orders for
allOrNone/oneCancelOther/oneTriggerOther and 3 — for oneTriggerOneCancelOther.
Placing any other number of orders will result in an error.

Order model consists of:

Name Type Description client_order_id String Optional. Must be different from
the identifiers of other orders in the list.
If omitted, it will be generated by the system upon order list creation.
Uniqueness must be guaranteed until the last order with the same client_order_id
becomes inactive (canceled, expired, or fully executed) and some time after
that. symbol String Symbol code.
For a allOrNone order list, symbol code must be unique for each order in the
list.
For an oneTriggerOneCancelOther order list, symbol code must be the same for all
orders in the list (placing orders in different order books is not supported).
side String Trade side.
Accepted values: sell, buy type String Optional. Order type.
Accepted values:
for allOrNone — limit, market;
for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — limit,
stopLimit, stopMarket, takeProfitLimit, takeProfitMarket;
for oneTriggerOneCancelOther — limit, market, stopLimit, stopMarket,
takeProfitLimit, takeProfitMarket.
Default value: limit time_in_force String Optional (required for allOrNone).
Time in Force instruction.
Accepted values:
for allOrNone — FOK;
for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — GTC, IOC
(except limit orders), FOK (except limit orders), Day, GTD;
for oneTriggerOneCancelOther — GTC, IOC, FOK, Day, GTD. quantity Number Order
quantity. price Number Order price. Required if type is limit, stopLimit, or
takeProfitLimit. stop_price Number The price level that triggers order
activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or
takeProfitMarket. expire_time DateTime Date of order expiration. Required if
time_in_force is GTD. strict_validate Boolean Price and quantity will be checked
for incrementation within the symbol’s tick size and quantity step. See the
symbol's tick_size and quantity_increment. post_only Boolean Optional. If a
post-only order causes a match with a pre-existing order as a taker, then the
order will expire. take_rate Number Optional. Liquidity taker fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup. make_rate Number Optional. Liquidity provider fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup.

An OCO order list cannot include more than one limit order (the same applies to
secondary orders in an OTOCO order list).

Response: array of spot orders


REPLACE SPOT ORDER

curl \
  -X PATCH \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef174" \
  -d "quantity=0.063&price=0.046016&new_client_order_id=d8574207d9e3b16a4a5511753eeef175"


import requests


session = requests.session()
session.auth = ("apiKey", "secretKey")
orderData = {'quantity': '0.063', 'price': '0.046016', 'new_client_order_id': 'd8574207d9e3b16a4a5511753eeef175'}

r = session.patch('https://api-balancers.gleec.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef174', data = orderData)

print(r.json())


> Response:

{
  "id": 0,
  "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
  "symbol": "ETHBTC",
  "side": "sell",
  "status": "new",
  "type": "limit",
  "time_in_force": "GTC",
  "quantity": "0.063",
  "price": "0.046016",
  "quantity_cumulative": "0.000",
  "post_only": false,
  "created_at": "2024-04-15T17:01:05.092Z",
  "updated_at": "2024-04-15T17:01:05.092Z"
}


> Error response example:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  }
}


PATCH /api/3/spot/order/{client_order_id}

Replaces a spot order

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description new_client_order_id String Optional. client_order_id for a
new order. quantity Number Order quantity. price Number Optional. Order price.
Required if type is limit, stopLimit, or takeProfitLimit. stop_price Number
Optional. The price level that triggers order activation. Specified if type is
stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket. strict_validate
Boolean Optional. Price and quantity will be checked for incrementation within
the symbol’s tick size and quantity step. See the symbol's tick_size and
quantity_increment.

Response: spot order


CANCEL ALL SPOT ORDERS

DELETE /api/3/spot/order

Cancels all active spot orders.

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description symbol String Optional. Parameter to filter active spot
orders by symbol.

Response: array of spot orders


CANCEL SPOT ORDER

curl \
  -X DELETE \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef175"


> Response:

{
  "id": 0,
  "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
  "symbol": "ETHBTC",
  "side": "sell",
  "status": "canceled",
  "type": "limit",
  "time_in_force": "GTC",
  "quantity": "0.063",
  "price": "0.046016",
  "quantity_cumulative": "0.000",
  "post_only": false,
  "created_at": "2024-04-15T17:01:05.092Z",
  "updated_at": "2024-04-15T17:01:05.092Z"
}


> Example of Order not found error response:

{
  "error": {
    "code": 20002,
    "message": "Order not found",
    "description": ""
  }
}


DELETE /api/3/spot/order/{client_order_id}

Cancels a spot order.

Requires the "Place/cancel orders" API key Access Right.

Response: spot order


GET ALL TRADING COMMISSIONS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/fee"


> Response:

[
  {
    "symbol": "BTCUSDT",
    "take_rate": "0.001",
    "make_rate": "-0.0001"
  },
  {
    "symbol": "ETHBTC",
    "take_rate": "0.001",
    "make_rate": "-0.0001"
  }
]


GET /api/3/spot/fee

Returns personal trading commission rates for all symbols.

Requires the "Orderbook, History, Trading balance" API key Access Right.


GET TRADING COMMISSION

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/fee/ETHBTC"


> Response:

{
  "symbol": "ETHBTC",
  "take_rate": "0.001",
  "make_rate": "-0.0001"
}


GET /api/3/spot/fee/{symbol}

Returns personal trading commission rate by symbol.

Requires the "Place/cancel orders" API key Access Right.


SPOT TRADING HISTORY

Please note that trading history may be updated with a delay up to 30 seconds,
with a mean delay of around 1 second.


SPOT ORDERS HISTORY

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/history/order?symbol=ETHBTC"


[
  {
    "id": 828680665,
    "client_order_id": "f4307c6e507e49019907c917b6d7a084",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "partiallyFilled",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "13.942",
    "price": "0.011384",
    "price_average": "0.055487",
    "quantity_cumulative": "5.240",
    "created_at": "2024-04-16T14:18:47.321Z",
    "updated_at": "2024-04-19T15:23:54.876Z"
  },
  {
    "id": 828680667,
    "client_order_id": "f4307c6e507e49019907c917b6d7a084",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "partiallyFilled",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "13.942",
    "price": "0.011384",
    "price_average": "0.045000",
    "quantity_cumulative": "5.240",
    "created_at": "2024-04-16T14:18:50.321Z",
    "updated_at": "2024-04-19T15:23:56.876Z"
  }
]


GET /api/3/spot/history/order

Returns all spot orders. Orders without executions are deleted after 24 hours.

Requires the "Orderbook, History, Trading balance" API key Access Right.

All parameters are optional.

Parameters:

Name Type Description client_order_id String If specified, other parameters will
be ignored, including limit and offset. symbol String Comma-separated symbol
codes. sort String Sort direction.
Accepted values: DESC, ASC
Default value: DESC by String Filter type.
Accepted values: timestamp, id
Default value: id from DateTime Interval initial value. till DateTime Interval
end value. limit Number Default value: 100
Maximum value: 1000 offset Number Default value: 0
Maximum value: 100000

Response:

Name Type Description id Number Unique order identifier as assigned by exchange.
client_order_id String Unique order identifier as assigned by the trader. The
order history may list several orders with the same client_order_id. symbol
String Symbol code. side String Trade side.
Possible values: sell, buy status String Order state.
Possible values:
new — an order is placed in the order book.
suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order
is parked until it meets the conditions for placement in the order book.
partiallyFilled — an order is executed, but a part of its quantity is not filled
yet.
filled — order quantity filled completely.
canceled — an order is canceled. It can either be done by a user through a
cancel/replace request or by the system under specific circumstances.
expired — an order is deactivated after it no longer satisfies Time in Force
(IOC, FOK) or Post Only requirements. type String Order type.
Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit,
takeProfitMarket time_in_force String Time in Force is a special instruction
used when placing an order to indicate how long it will remain active before it
is executed or expired.
GTC — "Good-Till-Canceled" order won't be closed until it is filled.
IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an
IOC order that cannot be filled immediately will be canceled.
FOK — "Fill-Or-Kill" order must be executed immediately and completely or not
executed at all.
Day — keeps the order active until the end of the trading day (23:59 UTC+0).
GTD — "Good-Till-Date" order may remain active until the time specified in
expire_time. quantity Number Order quantity. quantity_cumulative Number Executed
order quantity. price Number Order price. price_average Number Average price of
executed order quantity. expire_time DateTime Date of order expiration.
Specified if time_in_force is GTD. stop_price Number The price level that
triggers order activation. Specified if type is stopLimit, stopMarket,
takeProfitLimit, or takeProfitMarket. created_at DateTime Date of order's
creation. updated_at DateTime Date of order's last update. order_list_id String
Optional. Order list identifier. contingency_type String Optional. Order list
type.
Possible values:
allOrNone, oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther


SPOT TRADES HISTORY

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/spot/history/trade?symbol=ETHBTC"


[
  {
    "id": 9535486,
    "order_id": 816088377,
    "client_order_id": "f8dbaab336d44d5ba3ff578098a68454",
    "symbol": "ETHBTC",
    "side": "sell",
    "quantity": "0.061",
    "price": "0.045487",
    "fee": "0.000002775",
    "timestamp": "2024-04-17T12:32:57.848Z",
    "taker": true
  },
  {
    "id": 9535437,
    "order_id": 816088021,
    "client_order_id": "27b9bfc068b44194b1f453c7af511ed6",
    "symbol": "ETHBTC",
    "side": "buy",
    "quantity": "0.038",
    "price": "0.046000",
    "fee": "-0.000000174",
    "timestamp": "2024-04-17T12:30:57.848Z",
    "taker": true
  }
]


GET /api/3/spot/history/trade

Returns the user's spot trading history.

Requires the "Orderbook, History, Trading balance" API key Access Right.

All parameters are optional.

Parameters:

Name Type Description order_id String Unique order identifier as assigned by
exchange. symbol String Comma-separated symbol codes. sort String Sort
direction.
Accepted values: DESC, ASC
Default value: DESC by String Filter type.
Accepted values: timestamp, id
Default value: id 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: 100
Maximum value: 1000 offset Number Default value: 0
Maximum value: 100000

Response:

Name Type Description id Number Trade unique identifier as assigned by exchange.
order_id Number Unique order identifier as assigned by exchange. client_order_id
String Unique order identifier as assigned by the trader. The order history may
list several orders with the same client_order_id. symbol String Symbol code.
side String Trade side.
Possible values: sell, buy quantity Number Trade quantity. price Number Trade
price. fee Number Trade commission.
Can be negative ("rebate" — reward paid to the trader). See fee currency in the
symbol config. timestamp DateTime Trade timestamp. taker Boolean Liquidity
indicator.


WALLET MANAGEMENT


WALLET BALANCE

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/balance"


> Response. All currencies:

[
  {
    "currency":"BTC",
    "available":"0.00005821",
    "reserved":"0.00001"
  },
  {
    "currency":"USDT",
    "available":"0.01",
    "reserved":"0"
  }
]


> Response. One currency:

{
  "available":"0.00005821",
  "reserved":"0.00001"
}


GET /api/3/wallet/balance GET /api/3/wallet/balance/{currency}

Returns the user's wallet balances except zero balances.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Optional. Currency filter.

Response:

Name Type Description currency String Currency code. available Number Amount
available for withdrawals or transfers to the trading account. reserved Number
Amount reserved for incomplete transactions (including the fee).


GET WHITELISTED ADDRESSES

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address/white-list"


{
  "addresses": [
    {
      "address": "3A3MR43kUvahSAJtTsxzE8mcTz3VfL9upi",
      "currency": "USDT",
      "name": "ETH withdrawal",
      "network": "ETH"
    }
  ]
}


GET /api/3/wallet/crypto/address/white-list

Returns whitelisted addresses.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description addresses []JSON Whitelisted addresses. > name String Name
of the whitelist item. > currency String Currency code. > network String Code of
the currency of the hosting network. > address String Address for deposits.


GET DEPOSIT CRYPTO ADDRESS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address?currency=BTC"


[
  {
    "currency":"BTC",
    "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
  }
]


GET /api/3/wallet/crypto/address

Get current addresses. Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Optional. Currency code. network_code
String Optional. Network code.

Response:

Name Type Description currency String Optional. Currency code. address String
Address for deposits. payment_id String Optional. An additional identifier
required for specific currencies (for example, "Memo"). public_key String
Optional. An additional identifier required for specific currencies.
network_code String Optional. Network code.

If the address for a currency did not previously exist, calling this method will
generate the address for it automatically.


GENERATE DEPOSIT CRYPTO ADDRESS

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address" \
  -d "currency=BTC"


{
  "currency":"BTC",
  "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
}


POST /api/3/wallet/crypto/address

Creates a new deposit address. Existing addresses may still receive funds. For
some tokens (e.g., Ethereum tokens), a single address is generated per base
currency with additional identifiers which differ for each address: payment_id
or public_key. As a result, generating a new address for such a token will
change the current address for an entire base currency accordingly.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Currency code. network_code String
Optional. Network code.

Response:

Name Type Description currency String Optional. Currency code. address String
Address for deposits. payment_id String Optional. An additional identifier
required for specific currencies (for example, "Memo"). public_key String
Optional. An additional identifier required for specific currencies.
network_code String Optional. Network code.


LAST 10 DEPOSIT CRYPTO ADDRESSES

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address/recent-deposit?currency=BTC"


[
  {
    "currency":"BTC",
    "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
  }
]


GET /api/3/wallet/crypto/address/recent-deposit

Returns the last 10 unique addresses used for deposits (by currency).

Addresses used a long time ago may be omitted, even if they are among the last
10 unique addresses.

Requires the "Payment information" API key Access Right.

Name Type Description currency String Currency code. network_code String
Optional. Network code.

Response:

Name Type Description currency String Optional. Currency code. address String
Address for deposits. payment_id String Optional. An additional identifier
required for specific currencies (for example, "Memo"). public_key String
Optional. An additional identifier required for specific currencies.
network_code String Optional. Network code.


LAST 10 WITHDRAWAL CRYPTO ADDRESSES

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address/recent-withdraw?currency=BTC"


[
  {
    "currency":"BTC",
    "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
  }
]


GET /api/3/wallet/crypto/address/recent-withdraw

Returns the last 10 unique addresses used for withdrawals (by currency).

Addresses used a long time ago may be omitted, even if they are among the last
10 unique addresses.

Requires the "Payment information" API key Access Right.

Name Type Description currency String Currency code. network_code String
Optional. Network code.

Response:

Name Type Description currency String Optional. Currency code. address String
Address for deposits. payment_id String Optional. An additional identifier
required for specific currencies (for example, "Memo"). public_key String
Optional. An additional identifier required for specific currencies.
network_code String Optional. Network code.


WITHDRAW CRYPTO

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/withdraw" \
  -d "currency=BTC&amount=0.001&address=3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv&auto_commit=false"


> Success response:

{
  "id": "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"
}


> Validation error:

{
  "error": {
    "code": 10001,
    "message": "Validation error",
    "description": "Invalid currency: fiat"
  }
}


> Invalid currency error:

{
  "error": {
    "code": 2002,
    "message": "Currency not found",
    "description": "The requested currency can't be found. Requested: USD"
  }
}


> Insufficient funds error:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  }
}


> Limits exceeded error:

{
  "error": {
    "code": 20003,
    "message": "Limit exceeded",
    "description": "Withdrawal limit exceeded"
  }
}


POST /api/3/wallet/crypto/withdraw

Withdraw crypto. The transaction gets the status CREATED right after the
creation.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Please take note that changing security settings affects withdrawals:

 * It is impossible to withdraw funds without enabling two-factor authentication
   (2FA).
 * Password reset blocks withdrawals for 72 hours (3 days).
 * 2FA reset blocks withdrawals for 96 hours (4 days).
 * Each time a new address is added to the whitelist, it takes 48 hours before
   that address becomes active for withdrawal.

Parameters:

Name Type Description currency String Currency code. network_code String
Optional. Network code. amount Number The amount that will be sent to the
specified address. address String Address identifier. wallet_id String Optional.
Wallet ID. payment_id String Optional. An additional identifier required for
specific currencies (for example, "Memo"). include_fee Boolean Default value:
false
If true is set, then total spent value will include fees. auto_commit Boolean
Default value: true
If false is set, then you should commit or rollback a transaction in an hour.
Used in two-phase commit schema. use_offchain String Whether the withdrawal may
be committed off-chain.
Accepted values: never, optionally, required
Default value: never fee_level_id Number Fee level number. public_comment String
Optional. Maximum length is 255.

Response:

Name Type Description id String Transaction unique identifier.

Successful response to the request does not necessarily mean the resulting
transaction got executed immediately. It has to be processed first and may
eventually be rolled back.

To see whether a transaction has been finalized, call GET
/api/3/wallet/transactions/{id} and check out the status.

Nonetheless, a successful request unconditionally results in reservation of
funds on the wallet. The sum reserved covers the transaction amount and the fee.


CONVERT BETWEEN CURRENCIES

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/convert" \
  -d "from_currency=USDT20&to_currency=USDT&amount=0.01"


{
  "result": [
    "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b",
    "d2ce57hf-6g7d-4ka0-b8aa-4a27e5ee5i7b"
  ]
}


POST /api/3/wallet/convert

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description from_currency String Currency code. to_currency String
Currency code. amount Number The amount that will be sent to the specified
address.

Response:

Name Type Description result []JSON Transaction unique identifiers as assigned
by exchange.

Successful response to the request does not necessarily mean the resulting
transaction got executed immediately. It has to be processed first and may
eventually be rolled back.

To see whether a transaction has been finalized, call GET
/api/3/wallet/transactions/{id} and check out the status.


WITHDRAW CRYPTO COMMIT OR ROLLBACK

curl \
  -X PUT \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/withdraw/d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"


{
  "result": true
}


PUT /api/3/wallet/crypto/withdraw/{id}

Commit a withdrawal. The transaction gets the status PENDING.

DELETE /api/3/wallet/crypto/withdraw/{id}

Roll back a withdrawal.

If the auto_commit parameter has been set to false while sending the request for
withdrawing crypto, the withdrawal needs to be committed or rolled back one hour
after the request. Use PUT /api/3/wallet/crypto/withdraw/{id} to approve the
withdrawal operation, or DELETE /api/3/wallet/crypto/withdraw/{id} to discard
it.

The id parameter must contain the unique transaction identifier value received
as a result of the POST /api/3/wallet/crypto/withdraw request.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Parameters:

Name Type Description id String Transaction unique identifier returned to a POST
/api/3/wallet/crypto/withdraw request.

Both methods are idempotent.

Response:

Name Type Description result Boolean true if the request is completed.


CHECK IF CRYPTO ADDRESS BELONGS TO CURRENT ACCOUNT

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/address/check-mine?address=1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2"


{
  "result": true
}


GET /api/3/wallet/crypto/address/check-mine

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description address String Address.

Response:

Name Type Description result Boolean true if the address belongs to the current
account.


TRANSFER BETWEEN WALLET AND EXCHANGE

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/transfer" \
  -d "currency=eth&amount=0.01&source=wallet&destination=spot"


[
  "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"
]


POST /api/3/wallet/transfer

Transfers funds from the wallet to the exchange account to make them available
for trading.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Currency code. amount Number The amount
that will be transferred between accounts. source String Transfer source account
type.
Accepted values: wallet, spot. Must not be the same as destination. destination
String Transfer destination accounts type.
Accepted values: wallet, spot. Must not be the same as source.

Response:

Name Type Description — []String Transaction unique identifier as assigned by
exchange.

Successful response to the request does not necessarily mean the resulting
transaction got executed immediately. It has to be processed first and may
eventually be rolled back.

To see whether a transaction has been finalized, call GET
/api/3/wallet/transactions/{id} and check out the status.


TRANSFER MONEY TO ANOTHER USER

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/internal/withdraw" \
  -d "by=email&identifier=user@example.com&currency=BTC&amount=0.001"


{
  "result": "fd3088da-31a6-428a-b9b6-c482673ff0f2"
}


POST /api/3/wallet/internal/withdraw

Creates and commits an off-chain withdrawal from the wallet of one exchange user
to the wallet of another exchange user.

Apart from available balance, the amount of a withdrawal must exceed the sum of:

 * fees;
 * the total amount reserved on all wallets;
 * the total amount reserved on all exchange accounts;
 * pending amounts of concurrent withdrawals.

An operation may fail due to the following reasons:

 * the user cannot perform this type of operation based on:
   * temporary account limitations;
   * no active 2FA.
 * it does not pass pre-AML checks.

Created but not committed withdrawal will reserve pending amount on the sender
wallet affecting the balance remaining for other withdrawals.
Successful response to the request does not necessarily mean the resulting
transaction got executed immediately. It has to be processed first and may
eventually be rolled back or fail.

Call GET /api/3/public/currency/{currency} and check payout_enabled to determine
if withdrawals are allowed for the currency.

Call GET /api/3/wallet/transactions/{id} to check out the status of resulting
transaction.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Parameters:

Name Type Description currency String Currency code. amount Number The amount
that will be transferred. by String Type of the beneficiary identifier specified
below. Accepted values: email, username, external_id identifier String
Beneficiary identifier value. Either email, external identifier, or username.
public_comment String Optional text comment for the external usage. Can be up to
255 characters long, excluding the following characters: &, ', <, >, "

Response:

Name Type Description result String Transaction unique identifier as assigned by
exchange.


GET TRANSACTIONS HISTORY

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/transactions?currencies=ETH,BTC&sort=DESC"


[
  {
    "id": 50844835,
    "created_at": "2024-04-22T21:03:04.111Z",
    "updated_at": "2024-04-22T21:04:41.487Z",
    "last_activity_at": "2024-04-30T15:42:12.274495Z",
    "status": "SUCCESS",
    "type": "WITHDRAW",
    "subtype": "BLOCKCHAIN",
    "native": {
      "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2",
      "index": 1071885589,
      "currency": "ETH",
      "amount": "0.01042",
      "fee": "0.00958",
      "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20",
      "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba",
      "confirmations": 20
    }
  },
  {
    "id": 36896428,
    "created_at": "2024-04-12T10:27:26.135Z",
    "updated_at": "2024-04-12T10:42:29.065Z",
    "last_activity_at": "2024-04-30T15:42:13.274495Z",
    "status": "SUCCESS",
    "type": "DEPOSIT",
    "subtype": "BLOCKCHAIN",
    "native": {
      "tx_id": "a271ad64-5f34-4115-a63e-1cb5bbe4f67e",
      "index": 429625504,
      "currency": "BTC",
      "amount": "0.04836614",
      "hash": "4d7ae7c9d6fe84405ae167b3f0beacx8c68eb5a9d5189bckeb65d5e306427oe6",
      "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
      "confirmations": 2,
      "senders": [
        "0xd959463c3fcb0d2124bb7ac642d6a6573a6c5aba"
      ]
    },
    "operation_id": "99e78bf4-a708-43a3-ab18-e8e7618cd891"
  }
]


GET /api/3/wallet/transactions

Returns all transactions or a number of transactions by identifiers.

Requires the "Payment information" API key Access Right.

from/till and from_id/till_id are mutually exclusive.

All parameters are optional.

Parameters:

Name Type Description from DateTime Interval initial value (inclusive).
The value type depends on order_by. till DateTime Interval end value
(inclusive).
The value type depends on order_by. types String Comma-separated transaction
types. subtypes String Comma-separated transaction subtypes. statuses String
Comma-separated transaction statuses.
Accepted values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK currencies
String Comma-separated currency codes. networks String Comma-separated network
codes. id_from Number Index interval initial value.
Accepted values: 0 or greater id_till Number Index interval end value.
Accepted values: 0 or greater tx_ids String Comma-separated transaction
identifiers. order_by String The field the entries sorted by.
Accepted values: id, created_at, updated_at, last_activity_at, ID, CREATED_AT,
UPDATED_AT, LAST_ACTIVITY_AT
Default value: created_at
Cannot be id or ID if from and (or) till are provided. sort String Sort
direction.
Accepted values: DESC, ASC
Default value: DESC limit Number Default value: 100
Maximum value: 1000 offset Number Default value: 0
Maximum value: 100000 group_transactions Boolean Flag indicating whether the
returned transactions will be parts of a single operation.
Default value: false

GET /api/3/wallet/transactions/{id}

Returns transaction by identifier.

Requires the "Payment information" API key Access Right.

Response:

Name Type Description id Number Transaction unique identifier as assigned by
exchange. status String Transaction status.
Possible values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK type String
Transaction type. subtype String Transaction subtype. created_at DateTime Date
of transaction creation. updated_at DateTime Date and time of the last
transaction update. last_activity_at DateTime Date and time of the last
transaction info update. native Native Optional. Transaction native attributes
as assigned by the platform. meta Meta Optional. Additional attributes assigned
to certain types of transactions. operation_id String Optional. UUID of the
operation embracing the transaction. commit_risk Commit Risk Optional. Deposit
risk score info.

last_activity_at indicates the timestamp of a history record, whereas updated_at
is the time of the latest actual change of transaction info. So updated_at may
precede last_activity_at but never updates prior to the entire record.

Commit Risk model consists of:

Name Type Description score Number Risk score that decreases non-linearly when
the transaction gains confirmations.
Scores from 0 to 50 imply the transaction may be considered committed (but it is
not guaranteed) or it may take at least half an hour otherwise.
Possible values: 0 – 100 rbf Boolean Flag indicating whether the transaction did
not gain a sufficient number of confirmations and may be replaced by another one
for an additional fee.
This value indicates the transaction is complete and does not affect the score.
false value along with a score above 50 gives a good chance that the transaction
is irreversible. low_fee Boolean Flag indicating whether the actual network fee
is lower than the estimated one.
This value indicates the difference between the estimated fee and the actual
paid fee and does not affect the score.

Native model consists of:

Name Type Description tx_id String Transaction unique identifier as assigned by
exchange. network_code String Optional. Network code. protocol_code String
Optional. The protocol or the standard powering the network. wallet_id String
Wallet ID. index Number Internal index value that represents when the entry was
updated. currency String Currency code. amount Number Amount of funds. fee
Number Payment commission value. address String Address identifier. payment_id
String Optional. An additional identifier required for specific currencies (for
example, "Memo"). hash String Transaction hash. offchain_id String Transaction
identifier of external system. confirmations Number Current count of
confirmations for transaction in network. public_comment String Optional. Custom
text comment for external use. error_code String Payout error reason.
Possible values: INVALID_ADDRESS, INVALID_PAYMENT_ID, BAD_PRECISION senders
[]String Senders for this payin transaction. Displayed only for deposits.
operation_type String Operation type.
Possible values: SWAP attempt_hashes []String Optional. Hash of the attempt to
send a transaction to the blockchain.

Meta model consists of:

Name Type Description fiat_to_crypto Fiat to Crypto Optional. Attributes of a
fiat deposit, or an order (for subtype equal to FIAT).

Fiat to Crypto model consists of:

Name Type Description id Number Order identifier. provider_name String Optional.
Provider name. order_type String Order type.
Possible values: buy source_currency String Source currency code.
target_currency String Destination currency code. wallet_address String Wallet
address for the incoming payment. tx_hash String Transaction hash. target_amount
String Amount in the target currency. source_amount String Amount in the source
currency. status String Order status.
Possible values:
INITIAL—the order is created in the system but will possibly never be submitted
by the user;
IN_PROGRESS—the order is pending;
COMPLETED—the order was successfully processed at the provider's end;
FAILED—the order failed at the provider's end;
EXPIRED—the order expired after not receiving an incoming fiat payment;
UNKNOWN—no status obtained at the provider's end. created_at DateTime Order
creation date. updated_at DateTime Optional. Date of order last update.
deleted_at DateTime Optional. Date of order deletion. payment_method_type String
Optional. Payment system alias.

type field may have the following values:

Type Description DEPOSIT Deposit to a wallet address. WITHDRAW Withdrawal to
another crypto address. TRANSFER Transfer of funds between wallet and trading
accounts. SWAP Exchange funds between different wallets.

subtype field may have the following values:

Type Subtype Description DEPOSIT,
WITHDRAW UNCLASSIFIED Deposit or withdrawal of fiat or crypto. DEPOSIT,
WITHDRAW BLOCKCHAIN Deposit or withdrawal of crypto committed to the Blockchain.
DEPOSIT BUY_CRYPTO Buying crypto with fiat. DEPOSIT,
WITHDRAW OFFCHAIN Deposit or withdrawal of crypto offchain. DEPOSIT,
WITHDRAW FIAT Fiat deposit or withdrawal. DEPOSIT,
WITHDRAW SUB_ACCOUNT Transfer between subaccounts. TRANSFER WALLET_TO_SPOT
Transfer from a wallet to a spot trading account. TRANSFER SPOT_TO_WALLET
Transfer from a futures trading account to a wallet. SWAP CHAIN_SWITCH_FROM
Transferring funds from an original wallet during a conversion. SWAP
CHAIN_SWITCH_TO Transferring funds to a target wallet during a conversion.

status field may have the following values:

Name Description CREATED The transaction has been created and needs to be
approved. For withdrawals, the status means that the transaction has been
created but not committed. It remains in this status until manually validated or
moved to a blockchain. PENDING The transaction has been created and is queued
until the fees are paid and it can be processed further. Also, for withdrawals
and deposits, the status means that blockchain confirmations have not yet been
gathered. FAILED The transaction could not be committed. ROLLED_BACK The
transaction has been canceled. SUCCESS The transaction has been approved and
fully processed.


CHECK IF OFFCHAIN IS AVAILABLE

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/check-offchain-available" \
  -d "currency=ETH&address=0xfaEF4bE10dDF50B68c220c9ab19381e20B8EEB2B"


{
  "result": true
}


POST /api/3/wallet/crypto/check-offchain-available

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Currency code. address String Address
identifier. payment_id String Optional. An additional identifier required for
specific currencies (for example, "Memo").

Response:

Name Type Description result String true if an offchain transaction is available
to the specified address.


ESTIMATE WITHDRAWAL FEES

curl \
  -X POST -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fees/estimate" \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '[
        {
          "amount": "12",
          "currency": "BTC"
        }
      ]'


[
  {
    "fee": "0.09",
    "networkFee": "0",
    "amount": "12",
    "currency": "btc"
  }
]


POST /api/3/wallet/crypto/fees/estimate

Returns estimated fees charged for processing of on-chain withdrawals for
provided combination of currency and network.

This method duplicates POST /api/3/wallet/crypto/fee/estimate/bulk for purposes
of backward compatibility.
In some cases, fee rates cannot be deduced from public info being affected by
the user personal configuration.
The fee value is guaranteed not to change until the transaction is committed.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description * []JSON Combinations of currencies, networks, and
amounts. > currency String Currency code. > amount Number The amount that will
be deposited. > network_code String Optional. Network code.

Response:

Name Type Description * []JSON Combinations of fees, currencies, networks, and
amounts. > fee Number Estimated withdrawal fee considering user's personal
settings. The fee value is guaranteed not to change until the transaction is
committed. > networkFee Number Network fee. > amount Number The amount that will
be withdrawn. > currency String Currency code. > networkCode String Optional.
Network code


ESTIMATE WITHDRAWAL FEE

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fee/estimate?currency=BTC&amount=0.01"


{
  "fee": "0.0008"
}


GET /api/3/wallet/crypto/fee/estimate

Returns estimated fee charged for processing on-chain withdrawals for provided
combination of currency and network.

In some cases, fee rates cannot be deduced from public info being affected by
the user personal configuration.
The fee value is guaranteed not to change until the transaction is committed.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Currency code. amount Number The amount
that will be withdrawn. network_code String Optional. Network code.

Response:

Name Type Description fee String Estimated withdrawal fee considering user's
personal settings. The fee value is guaranteed not to change until the
transaction is committed.


BULK ESTIMATE WITHDRAWAL FEE

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fee/estimate/bulk" \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '[
        {
          "amount": "12",
          "currency": "BTC"
        }
      ]'


[
  {
    "fee": "1.21",
    "currency": "BTC",
    "amount": "12"
  }
]


POST /api/3/wallet/crypto/fee/estimate/bulk

Returns estimated fees charged for processing on-chain withdrawals for provided
combinations of currencies and networks.

In some cases, fee rates cannot be deduced from public info being affected by
the user personal configuration.
The fee value is guaranteed not to change until the transaction is committed.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description * []JSON Combinations of currencies, networks, and
amounts. > currency String Currency code. > amount Number The amount that will
be deposited. > network_code String Optional. Network code.

Response:

Name Type Description * []JSON Combinations of fees, currencies, networks, and
amounts. > fee String Estimated deposit fee considering user's personal
settings. The fee value is guaranteed not to change until the transaction is
committed. > currency String Currency code. > amount Number The amount that will
be deposited. > network_code String Optional. Network code.


GET WITHDRAWAL FEES HASH

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fee/withdraw/hash"


{
  "hash": "3982183395978"
}


GET /api/3/wallet/crypto/fee/withdraw/hash

Returns the hash for withdrawal fees.

Requires the "Payment information" API key Access Right.

Response:

Name Type Description hash String Fees hash.


GET WITHDRAWAL FEE LEVELS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fee/levels?currency=ETH&amount=38.616"


[
  {
    "fee_level_id": 5,
    "comment": "fast",
    "fee": "0.0005",
    "default": true
  }
]


GET /api/3/wallet/crypto/fee/levels

Returns fee levels applied to a withdrawal.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Currency code. amount Number The amount
that will be withdrawn. network_code String Optional. Network code.

Response:

Name Type Description fee_level_id Number Fee level number. comment String
Textual description. fee String Fee amount. default Boolean true if a level is
set as default.


GET FIXED WITHDRAWAL FEES

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/crypto/fee/withdraw/list"


{
  "hash": "3982183395978",
  "default_level_id": 1042,
  "fees": [
    {
      "currency": "USDT2",
      "network_code": "ETH",
      "levels": [
        {
          "level_id": 1042,
          "comment": "for test",
          "is_fixed": false
        }
      ]
    },
    {
      "currency": "USDT2",
      "network_code": "TRX",
      "levels": [
        {
          "level_id": 1042,
          "comment": "for test",
          "is_fixed": false
        }
      ]
    }
  ]
}


GET /api/3/wallet/crypto/fee/withdraw/list

Returns withdrawal fees for each coin with a fixed fee, if any.

Requires the "Payment information" API key Access Right.

Response:

Name Type Description hash String Fees hash. default_level_id Number Default fee
ID. fees []JSON Fees. > currency String Currency code. > network_code String
Network code. > levels []JSON Fee levels. >> level_id Number Level ID. >>
comment String Text comment. >> is_fixed Boolean Flag indicating if the fee is a
fixed value.


GET AMOUNT LOCKS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/wallet/amount-locks?currency=BTC"


[
  {
    "id": 1,
    "currency": "BTC",
    "amount": "12.023",
    "date_end": "",
    "description": "default",
    "canceled": false,
    "canceled_at": null,
    "cancel_description": null,
    "created_at": "2021-07-29T12:07:09.883538Z"
  }
]


GET /api/3/wallet/amount-locks

Returns a list of amount locks.

Amount locks allow setting the minimum user's balance to determine their
solvency. The locked amount is not displayed in the user's balances.

Amount locks are not tied to a currency. All locks in total affect the ability
to withdraw the balance in any currency.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description currency String Optional. Currency code. active Boolean
Optional. Value showing whether the lock is active. limit Number Default value:
100
Accepted range: 0 – 1000 offset Number Optional
Default value: 0
Minimum value: 0

Response:

Name Type Description id Number Lock identifier. currency String Currency code.
amount String Reserved amount. date_end DateTime The date and time of the lock
expiration. description String Lock text description. canceled Boolean Value
showing whether the lock was canceled. canceled_at DateTime The date and time at
which the lock was canceled. cancel_description String Text description on
cancellation. created_at DateTime The date and time of the lock was created.


SUBACCOUNTS


GET SUBACCOUNTS LIST

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account"


> Response:

{
  "result": [
    {
      "sub_account_id": "179B5D",
      "email": "user+1@example.com",
      "status": "active"
    },
    {
      "sub_account_id": "179B5E",
      "email": "user+2@example.com",
      "status": "active"
    },
    {
      "sub_account_id": "179B5F",
      "email": "user+3@example.com",
      "status": "disable"
    }
  ]
}


> Error response example:
> 
> Failed authorization:

{
  "error": {
    "code": 1002,
    "message": "Authorization is required or has been failed"
  }
}


> Empty subaccount's list:

{
  "result": []
}


GET /api/3/sub-account

Returns list of subaccounts per a super account.

Requires no API key Access Rights.

Response:

Name Type Description sub_account_id String Unique identifier of a subaccount.
Hex number. email String Email address of a subaccount. status String User
status of a subaccount. Possible values: new, active, disable


FREEZE SUBACCOUNT

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/freeze" \
  -d "sub_account_ids=179B5D,179B5E"


> Response:

{
  "result": true
}


> Error response example:
> 
> Subaccounts are already frozen or disabled:

{
  "error": {
    "code": 21004,
    "message": "Sub account is already frozen or disabled"
  }
}


POST /api/3/sub-account/freeze

Freezes subaccounts listed. It implies that the Subaccounts frozen wouldn't be
able to:

 * log in;
 * withdraw funds;
 * trade;
 * complete pending orders;
 * use API keys.

For any subaccount listed, all orders will be canceled and all funds will be
transferred from the Trading balance.

Requires no API key Access Rights.

Parameters:

Name Type Description sub_account_ids []String Subaccounts' identifiers
separated by commas (,). Those could be obtained by the GET /api/3/sub-account
request.

Response:

Name Type Description result Boolean Value indicating whether subaccounts were
successfully frozen.


ACTIVATE SUBACCOUNT

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/activate" \
  -d "sub_account_ids=179B5D,179B5E"


> Response:

{
  "result": true
}


> Error response example:
> 
> Subaccounts are disabled, and their functionality can't be restored through
> activation:

{
  "result": false
}


> Failed authorization:

{
  "error": {
    "code": 1002,
    "message": "Authorization is required or has been failed"
  }
}


> Wrong input data format:

{
  "error": {
    "code": 10001,
    "message": "Validation error"
  }
}


> Subaccounts listed don't exist:

{
  "error": {
    "code": 21001,
    "message": "Cannot find sub account"
  }
}


POST /api/3/sub-account/activate

Activates subaccounts listed. It would make subaccounts active after being
frozen.

Requires no API key Access Rights.

Parameters:

Name Type Description sub_account_ids []String Subaccounts' identifiers
separated by commas (,). Those could be obtained by the GET /api/3/sub-account
request.

Response:

Name Type Description result Boolean Value indicating whether subaccounts were
successfully activated.


TRANSFER TO SUBACCOUNT

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/transfer" \
  -d "sub_account_id=179B5D&amount=1&currency=BTC&type=to_sub_account"


> Response:

{
  "result": "ae37e806-0191-45fc-8c49-18137274772c"
}


> Error response example:
> 
> Insufficient permissions:

{
  "error": {
    "code": 1003,
    "message": "Action is forbidden for this API key"
  }
}


> Subaccount is frozen or disabled:

{
  "error": {
    "code": 21004,
    "message": "Sub account is already frozen or disabled"
  }
}


> Insufficient funds:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  }
}


POST /api/3/sub-account/transfer

Transfers funds from the super account to a subaccount or from a subaccount to
the super account.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Parameters:

Name Type Description sub_account_id Number Identifier of a subaccount to
deposit/withdraw funds. amount Number Amount of funds to be transferred.
currency String Name (code) of base currency (e.g., "BTC"). type String Type of
transaction. Accepted values: to_sub_account, from_sub_account

Response:

Name Type Description result String Identifier of the transaction resulting.


TRANSFER TO SUPER ACCOUNT

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/transfer/sub-to-super" \
  -d "sub_amount=1&currency=BTC"


> Response:

{
  "result": "5638da11-a381-477c-9224-37c252583a70"
}


POST /api/3/sub-account/transfer/sub-to-super

Creates and commits a transfer from a subaccount to its super account.

Call is being sent by a subaccount.
Created but not committed transfer will reserve pending amount on the sender
wallet affecting their ability to withdraw or transfer crypto to another
account. Incomplete withdrawals affect subaccount transfers the same way.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Parameters:

Name Type Description amount Number Amount of funds to be transferred. currency
String Name (code) of base currency (e.g., "BTC").

Response:

Name Type Description result String Identifier of the transaction resulting.


TRANSFER ACROSS SUBACCOUNTS

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/transfer/sub-to-sub" \
  -d "sub_account_id=179B5D&amount=1&currency=BTC"


> Response:

{
  "result": "f85edb8e-d2bc-4810-80a6-10a08a505e5f"
}


POST /api/3/sub-account/transfer/sub-to-sub

Creates and commits a transfer between the user (subaccount) and another
subaccount.

Call is being sent by a subaccount.
Created but not committed transfer will reserve pending amount on the sender
wallet affecting their ability to withdraw or transfer crypto to a subaccount.
Incomplete withdrawals affect subaccount transfers the same way.

Requires the "Withdraw cryptocurrencies" API key Access Right.

Parameters:

Name Type Description sub_account_id Number Identifier of a subaccount. amount
Number Amount of funds to be transferred. currency String Name (code) of base
currency (e.g., "BTC").

Response:

Name Type Description result String Identifier of the transaction resulting.


GET ACL SETTINGS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/acl?sub_account_ids=179B5D,179B5E"


> Response:

{
  "result": [
    {
      "sub_account_id": "179B5E",
      "deposit_address_generation_enabled": true,
      "withdraw_enabled": true,
      "description": "",
      "created_at": "2021-07-30T14:50:08.621Z",
      "updated_at": "2021-07-30T14:50:08.621Z"
    }
  ]
}


> Error response example:
> 
> Insufficient permissions:

{
  "error": {
    "code": 1003,
    "message": "Action is forbidden for this API key"
  }
}


> Subaccount is frozen or disabled:

{
  "error": {
    "code": 21004,
    "message": "Sub account is already frozen or disabled"
  }
}


GET /api/3/sub-account/acl

Returns a list of withdrawal settings for subaccounts listed.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description sub_account_ids []String Optional. Subaccounts'
identifiers separated by commas (,). Those could be obtained by the GET
/api/3/sub-account request.

Response:

Name Type Description sub_account_id String Unique identifier of a subaccount.
deposit_address_generation_enabled Boolean Value indicating the desired state of
deposits. withdraw_enabled Boolean Value indicating the desired state of
withdrawals. description String Textual description. Normally left empty.
created_at DateTime ACL creation time. updated_at DateTime ACL update time.


CHANGE ACL SETTINGS

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/acl" \
  -d "sub_account_ids=179B5E&deposit_address_generation_enabled=true&withdraw_enabled=true"


> Response:

{
  "result": [
    {
      "sub_account_id": "179B5E",
      "deposit_address_generation_enabled": true,
      "withdraw_enabled": true,
      "description": "",
      "created_at": "2021-07-30T14:50:08.621Z",
      "updated_at": "2021-07-30T14:50:08.621Z"
    }
  ]
}


> Error response example:
> 
> Subaccount is frozen or disabled:

{
  "error": {
    "code": 21004,
    "message": "Sub account is already frozen or disabled"
  }
}


> Insufficient permissions:

{
  "error": {
    "code": 1003,
    "message": "Action is forbidden for this API key"
  }
}


POST /api/3/sub-account/acl

Disables or enables withdrawals for a subaccount.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description sub_account_ids []String Subaccounts' identifiers
separated by commas (,). Those could be obtained by the GET /api/3/sub-account
request. deposit_address_generation_enabled Boolean Value indicating the desired
state of deposits. withdraw_enabled Boolean Value indicating the desired state
of withdrawals. description String Textual description. Normally left empty.
created_at DateTime ACL creation time. updated_at DateTime ACL update time.

Response:

Name Type Description sub_account_id String Unique identifier of a subaccount.
deposit_address_generation_enabled Boolean Value indicating the desired state of
deposits. withdraw_enabled Boolean Value indicating the desired state of
withdrawals. description String Textual description. Normally left empty.
created_at DateTime ACL creation time. updated_at DateTime ACL update time.


GET SUBACCOUNT BALANCE

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/balance/179B5E"


> Response:

{
  "result": {
    "wallet": [
      {
        "currency": "1ST",
        "available": "0.0",
        "reserved": "0.0"
      }
    ],
    "spot": [
      {
        "currency": "1ST",
        "available": "0",
        "reserved": "0"
      }
    ]
  }
}


> Error response example:
> 
> Insufficient permissions:

{
  "error": {
    "code": 1003,
    "message": "Action is forbidden for this API key"
  }
}


GET /api/3/sub-account/balance/{sub_acc_id}

Returns non-zero balance values by subaccount identifier specified. Report will
include the wallet and Trading balances for each currency. It is functional with
no regard to the state of a subaccount. All account types are optional and
appear only in case of non-zero balance.

Requires the "Payment information" API key Access Right.


GET SUBACCOUNT CRYPTO ADDRESS

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/sub-account/crypto/address/179B5E/BTC"


> Response:

{
  "result": {
    "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
  }
}


GET /api/3/sub-account/crypto/address/{sub_acc_id}/{currency}

Returns subaccount crypto address for currency.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description network_code String Optional. Network code.

Response:

Name Type Description address String Address for deposits. payment_id String
Optional. An additional identifier required for specific currencies (for
example, "Memo"). public_key String Optional. An additional identifier required
for specific currencies.


BUY CRYPTO

You can purchase cryptocurrency on our platform. The current section requests
allow receiving the list of providers, available for buying crypto, and
information about them. You can receive rates and orders, and create orders
using these API methods as well.


GET PROVIDERS INFORMATION

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/buy-crypto/provider"


> Response:

[
  {
    "provider_id": 2,
    "provider_name": "provider",
    "methods": [
      {
        "id": 0,
        "name": "credit_debit_card",
        "description": "",
        "method_type": "credit_card",
        "logo_url": "https://example.com/logo.png",
        "status": "ACTIVE",
        "type": "credit_debit_card",
        "supported_source": [
          {
            "code": "USD",
            "display_name": "USD"
          }
        ],
        "supported_target": [
          {
            "code": "ETH",
            "display_name": "ETH"
          }
        ],
        "transaction_limits": [
          {
            "currency_code": "USD",
            "target_code": "ETH",
            "source_min": "0",
            "source_max": "124"
          }
        ]
      }
    ]
  }
]


GET /api/3/buy-crypto/provider

Returns the providers' information (transaction limits, available currencies,
payment methods).

Requires the "Payment information" API key Access Right.

All parameters are optional.

Parameters:

Name Type Description provider_id Number Provider identifier. source String The
source (fiat) currency code. target String The target (crypto) currency code.

Response:

Name Type Description provider_id Number Provider identifier. provider_name
String Provider name. methods []Method Payment methods list.

Method model consists of:

Name Type Description id Number Payment method identifier. name String Payment
method name. description String Payment method text description. method_type
String Method type. logo_url String Payment method logo URL. status String
Payment method status.
Possible values: active type String Payment method type. supported_source
[]Currency The source currencies, supported by the payment method.
supported_target []Currency The target currencies, supported by the payment
method. transaction_limits []Limit Payment method limits.

Currency model consists of:

Name Type Description code String The currency code. display_name String The
currency display name. network_code String Optional. Network code.

Limit model consists of:

Name Type Description currency_code String Transaction source currency code.
target_code String Transaction target currency code. source_min String Minimum
source currency amount. source_max String Maximum source currency amount.
network_code String Optional. Network code.


GET RATES PER PAYMENT METHOD

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/buy-crypto/provider/1/rate"


> Response:

{
  "spot_price": "10268.74",
  "prices": [
    {
      "payment_method_id": 6025,
      "type": "credit_debit_card",
      "target_code": "BTC",
      "target_amount": "1",
      "source_code": "USD",
      "source_amount": "10472.06"
    }
  ]
}


GET /api/3/buy-crypto/provider/{provider_id}/rate

Returns the rates information per payment method.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description source String Source currency code. target String Target
currency code. source_amount String Optional. Amount in the source currency.
target_amount String Optional. Amount in the target currency. payment_method_id
Number Optional. Payment method identifier.

The source_amount and target_amount parameters are mutually exclusive: specify
only one of them in a single request.

Response:

Name Type Description spot_price String The spot price. prices []Price Prices
list.

Price model consists of:

Name Type Description payment_method_id Number Payment method identifier. type
String Payment method type. target_code String Target currency code. source_code
String Source currency code. target_amount String Amount in the target currency.
source_amount String Amount in the source currency.


GET ORDER LIST

curl \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/buy-crypto/provider/1/order"


> Response:

[
  {
    "id": 79,
    "provider_id": 1,
    "order_type": "buy",
    "source_code": "BTC",
    "target_code": "GBP",
    "wallet_address": "2N2gCeg7C1zKvZpFkdNNEnRFux9VSttzSVx",
    "checkout_url": "",
    "status": "expired",
    "created_at": "2024-04-07T10:04:40Z"
  }
]


GET /api/3/buy-crypto/provider/{provider_id}/order

Returns the list of buying cryptocurrency orders.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description from Number Optional. Unix timestamp, filter by order
creation date. till Number Optional. Unix timestamp, filter by order creation
date. limit Number Optional. Limit. offset Number Optional. Offset. source_code
String Optional. Source currency code. target_code String Optional. Target
currency code. wallet_address String Optional. Filter by wallet address.
target_network_code String Optional. Network code. order_by String Optional.
Defines order type.
Accepted values: created_at sort String Optional. Sort direction.
Accepted values: desc, asc

Response:

Name Type Description id Number Order identifier. provider_id Number Provider
identifier. order_type String Provider order type (buy). source_code String
Source currency code. target_code String Target currency code. wallet_address
String The user will receive cryptocurrency from the crypto provider to this
address. This address is generated and provided to the crypto provider by the
exchange (by us). checkout_url String Checkout URL. status String Provider order
status.
Possible values: initial, in_progress, completed, failed, expired created_at
String Order creation date and time. operation_id String Operation identifier.


CREATE ORDER

curl \
  -X POST \
  -u "apiKey:secretKey" \
  "https://api-balancers.gleec.com/api/3/buy-crypto/provider/1/order" \
  -H "Content-Type: application/json" \
  -d '{
        "target":"BTC",
        "source":"EUR",
        "source_amount":"20",
        "payment_method_id":6037
      }'


> Response:

{
  "id": 79,
  "provider_id": 1,
  "order_type": "buy",
  "source_code": "BTC",
  "target_code": "GBP",
  "wallet_address": "2N2gCeg7C1zKvZpFkdNNEnRFux9VSttzSVx",
  "checkout_url": "",
  "status": "expired",
  "created_at": "2024-04-07T10:04:40Z"
}


POST /api/3/buy-crypto/provider/{provider_id}/order

Creates an order. The checkout_url will lead to a provider's widget page.

Requires the "Payment information" API key Access Right.

Parameters:

Name Type Description target String Target currency. source String Source
currency. source_amount String Amount in source currency. target_amount String
Optional. Amount in target currency. payment_method_id Number Payment method
identifier to use. ip String Optional. IP address. user_agent String Optional.
User's client agent. target_network_code String Optional. Network code.

Response:

Name Type Description id Number Order identifier. provider_id Number Provider
identifier. order_type String Provider order type (buy). source_code String
Source currency code. target_code String Target currency code. wallet_address
String The user will receive cryptocurrency from the crypto provider to this
address. This address is generated and provided to the crypto provider by the
exchange. checkout_url String Checkout URL. status String Provider order status.
Possible values: initial, in_progress, completed, failed, expired created_at
String Order creation date and time. operation_id String Operation identifier.


SOCKET API REFERENCE


CONNECTION

The number of WebSoсket connections established per IP address cannot exceed
100.


PING

wscat -c wss://api-balancers.gleec.com/api/3/ws/public -P


> Ping messages

< Received ping
< Received ping
< Received ping


After a WebSocket connection is established, the system sends ping messages to
the client each 30 seconds.

In order to see incoming ping messages, place -P flag after the endpoint.


REQUEST OBJECT

> Request

{
  "method": "spot_new_order",
  "params": {
    "client_order_id": "57d5525562c945448e3cbd559bd068c4",
    "symbol": "ETHBTC",
    "side": "sell",
    "price": "0.059837",
    "quantity": "0.015"
  },
  "id": 123
}


An RPC call is represented by sending a Request object to a Server.

The Request object has the following members:

 * method — a String containing the name of the method to be invoked;
 * params — a Structured value that holds the parameter values to be used during
   the invocation of the method;
 * id — An identifier established by the Client that MUST contain a String,
   Number, or null value if included. If it is not included it is assumed to be
   a notification. The value SHOULD NOT be null.


NOTIFICATION

> Notification

{
  "ch": "trades",
  "update": {
    "BTCUSDT": [{
      "t": 1626861123552,
      "i": 1555634359,
      "p": "30877.68",
      "q": "0.00006",
      "s": "sell"
    }]
  }
}


A Notification is a Request object without an id member. A Request object (a
Notification) signifies the lack of the Client's interest in the corresponding
Response object. Therefore, no Response objects need to be returned to the
Client.


RESPONSE OBJECT

When an RPC call is made, the server must reply with responses, except for
notifications cases.

Response on success subscription is true. Example:

> Response

{
  "result": true,
  "id": 123
}


> Response error

{
  "error": {
    "code": 2001,
    "message": "Symbol not found",
    "description": "Symbol not found"
  },
  "id": 123
}


The Response is represented as a single JSON Object, with the following members:

 * result — this member is REQUIRED on success. This member MUST NOT exist if
   there was an error during method invocation. The value of this member is
   determined by the method invoked on the Server;
 * error — this member is REQUIRED on error. This member MUST NOT exist if there
   was no error triggered during method invocation. The value for this member
   MUST be an Object as defined in the "Error Response" section.


SOCKET MARKET DATA

In order to access market data via WebSocket interface, connect to the endpoint:

wscat -c wss://api-balancers.gleec.com/api/3/ws/public


> Request

{
  "method": "subscribe",
  "ch": "orderbook/top/1000ms",          // Channel
  "params": {
    "symbols": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


From that point on, you will be able to send request messages in JSON format
with the following parameters:

Name Type Description method String The name of the method to be invoked.
Accepted values: subscribe, unsubscribe, subscriptions ch String Channel name.
params JSON Parameter values to be used during the method invocation. The set of
parameters may vary depending on the channel chosen. id String Optional. Request
identifier as assigned by sender.

Session authentication is not needed.

> Response

{
  "result": {
    "ch": "orderbook/top/1000ms",        // Channel
    "subscriptions": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


Any valid and successfully processed request will result in a JSON-formatted
response message containing the following fields:

Name Type Description result Result Details about resulting subscription status.
id String Optional. Request identifier as assigned by sender.

Result model consists of:

Name Type Description ch String Channel name. subscriptions []String List of
active subscriptions.


SUBSCRIPTIONS

In case of a successful subscriptions, the server will send:

 * for price/rate/{speed}, ticker/price/{speed}, ticker/{speed},
   orderbook/{depth}/{speed}, orderbook/top/{speed}: data notifications (data)
   with a specified rate. {speed} — the period of updating data which embraces
   the changes that have occurred if any;
 * for trades, orderbook/full, candles/{period}: snapshot (snapshot) and update
   (update) notifications.

In the second case, the first snapshot comes right after the response if the
limit parameter is greater than 0. Snapshot gives a full account of the market
within the defined scope, and an update contains only recent changes which are
being sent immediately.

Description of all returned fields can be found in the "Market Data" section.


BATCH NOTIFICATIONS

If a market data request includes a number of subscriptions, a choice of channel
will determine the distribution of updates over incoming notifications.

In the basic scenario, a single notification will contain data on a particular
symbol only. Subscription to "batch" channels (ones ending with /batch) allows
notifying via combined updates per multiple symbols.

Batch notifications are available on data channels only.


GET ACTIVE SUBSCRIPTIONS

> Request

{
  "method": "subscriptions",
  "ch": "trades",                        // Channel
  "params": {
    "symbols": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "trades",                      // Channel
    "subscriptions": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


Method: subscriptions

Returns the list of all active subscriptions on a channel.


SUBSCRIBE TO TRADES

> Request

{
  "method": "subscribe",
  "ch": "trades",                        // Channel
  "params": {
    "symbols": ["ETHBTC", "BTCUSDT"],
    "limit": 1
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "trades",                      // Channel
    "subscriptions": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Notification snapshot

{
  "ch": "trades",                        // Channel
  "snapshot": {
    "BTCUSDT": [{
      "t": 1626861109494,                // Timestamp in milliseconds
      "i": 1555634969,                   // Trade identifier
      "p": "30881.96",                   // Price
      "q": "12.66828",                   // Quantity
      "s": "buy"                         // Side
    }]
  }
}


> Notification update

{
  "ch": "trades",
  "update": {
    "BTCUSDT": [{
      "t": 1626861123552,
      "i": 1555634969,
      "p": "30877.68",
      "q": "0.00006",
      "s": "sell"
    }]
  }
}


Channel: trades

Requires no API key Access Rights.

Parameters:

Name Type Description symbols []String List of symbol codes. limit Number
Optional. Limit to returned entries.
Accepted values: 0 – 1000
Default value: 0 (no history returned)


SUBSCRIBE TO CANDLES

> Request

{
  "method": "subscribe",
    "ch": "candles/M1",                  // Channel
    "params": {
      "symbols": ["BTCUSDT"],
      "limit": 10
    },
    "id": 123
  }


> Response

{
  "result": {
    "ch": "candles/M1",
    "subscriptions": ["ETHBTC", "BTCUSDT"]
  },
  "id": 123
}


> Notification snapshot

{
  "ch": "candles/M1",                    // Channel
  "snapshot": {
    "BTCUSDT": [
      {
        "t": 1626860340000,              // Message timestamp
        "o": "30881.95",                 // Open price
        "c": "30890.96",                 // Last price
        "h": "30900.8",                  // High price
        "l": "30861.27",                 // Low price
        "v": "1.27852",                  // Base asset volume
        "q": "39493.9021811"             // Quote asset volume
      },
      {
        "t": 1626860400000,
        "o": "30888.33",
        "c": "30860.52",
        "h": "30889.53",
        "l": "30860.31",
        "v": "3.80019",
        "q": "117283.0686182"
      },
      {
        "t": 1626860460000,
        "o": "30858.39",
        "c": "30863.56",
        "h": "30864.89",
        "l": "30853.83",
        "v": "53.04288",
        "q": "1636858.7119248"
      }
    ]
  }
}


> Notification update

{
  "ch": "candles/M1",
  "update": {
    "ETHBTC": [
      {
        "t": 1626860880000,
        "o": "0.060711",
        "c": "0.060749",
        "h": "0.060749",
        "l": "0.060711",
        "v": "12.2800",
        "q": "0.7455339675"
      }
    ]
  }
}


Channel: candles/{period}

Supported periods: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one
day), D7, 1M (one month)

Requires no API key Access Rights.

Parameters:

Name Type Description symbols []String List of symbol codes. limit Number
Optional. Limit to returned entries.
Accepted values: 0 – 1000
Default value: 0 (no history returned)


SUBSCRIBE TO CONVERTED CANDLES

> Request

{
  "method": "subscribe",
  "ch": "converted/candles/M1",          // Channel
  "params": {
    "symbols": ["BTCUSDT"],
    "target_currency": "USDT",
    "limit": 10
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "converted/candles/M1",
    "subscriptions": [
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Notification snapshot

{
  "ch": "converted/candles/M1",
  "target_currency": "USDT",
  "snapshot": {
    "BTCUSDT": [
      {
        "t": 1626860340000,              // Message timestamp
        "o": "30881.95",                 // Open price
        "c": "30890.96",                 // Last price
        "h": "30900.8",                  // High price
        "l": "30861.27",                 // Low price
        "v": "1.27852",                  // Base asset volume
        "q": "39493.9021811"             // Quote asset volume
      }
    ]
  }
}


> Notification update

{
  "ch": "converted/candles/M1",
  "target_currency": "USDT",
  "update": {
    "ETHBTC": {
      "BTCUSDT": [
        {
          "t": 1626860340000,
          "o": "30881.95",
          "c": "30890.96",
          "h": "30900.8",
          "l": "30861.27",
          "v": "1.27852",
          "q": "39493.9021811"
        }
      ]
    }
  }
}


Channel: converted/candles/{period}

Supported periods: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one
day), D7, 1M (one month)

Requires no API key Access Rights.

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.
This call produces the same output as GET /api/3/public/converted/candles except
all values in quote currency are converted to the target currency.
Conversion from the symbol quote currency to the target currency is the mean of
the "best" bid price and the "best" ask price in the order book. If there is no
"best" bid of ask price, the last price is returned.

Parameters:

Name Type Description symbols []String List of symbol codes. target_currency
String Target currency. limit Number Optional. Limit to returned entries.
Accepted values: 0 – 1000
Default value: 0 (no history returned)


SUBSCRIBE TO PRICE RATES

> Request

{
  "method": "subscribe",
  "ch": "price/rate/1s",                 // Channel
  "params": {
    "currencies": [
      "ETH",
      "BTC"
    ],
    "target_currency": "USDT"
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "price/rate/1s",               // Channel
    "target_currency": "USDT",
    "subscriptions": ["ETH","BTC"]
  },
  "id": 123
}


> Data notification

{
  "ch": "price/rate/1s",
  "target_currency": "USDT",
  "data": {
    "ETH": {
      "t": 1684490221380,                // Timestamp
      "r": "1810.155"                    // Rate
    }
  }
}

{
  "ch": "price/rate/1s",
  "target_currency": "USDT",
  "data": {
    "BTC": {
      "t": 1684487340001,
      "r": "26863.71"
    }
  }
}


Channel: price/rate/{speed}

Supported speed: 1s, 3s

If there is no "best" bid of ask price, the last price is returned.
If provided currencies do not match any existing symbol, the rate for
intermediate pairs are multiplied of inverted depending on the direction of
exchange in these pairs.
If there is no rate, an empty object is returned.

Parameters:

Name Type Description currencies []String List of currency codes. Value ["*"]
means all symbols are selected. target_currency String Quote currency.


SUBSCRIBE TO PRICE RATES IN BATCHES

> Request

{
  "method": "subscribe",
  "ch": "price/rate/1s/batch",           // Channel
  "params": {
    "currencies": [
      "ETH",
      "BTC"
    ],
    "target_currency": "USDT"
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "price/rate/1s/batch",         // Channel
    "target_currency": "USDT",
    "subscriptions": [
      "ETH",
      "BTC"
    ]
  },
  "id": 123
}


> Data notification

{
  "ch": "price/rate/1s/batch",
  "target_currency": "USDT",
  "data": {
    "ETH": {
      "t": 1684490221380,                // Timestamp
      "r": "1810.155"                    // Rate
    },
    "BTC": {
      "t": 1684487340001,
      "r": "26863.71"
    }
  }
}


Channel: price/rate/{speed}/batch

Supported speed: 1s, 3s

Parameters:

Name Type Description currencies []String List of currency codes. Value ["*"]
means all symbols are selected. target_currency String Quote currency.


SUBSCRIBE TO MINI TICKER

> Request

{
  "method": "subscribe",
  "ch": "ticker/price/1s",               // Channel
  "params": {
    "symbols": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "ticker/price/1s",             // Channel
    "subscriptions": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Data notification

{
  "ch": "ticker/price/1s",
  "data": {
    "ETHBTC": {
      "t": 1614815872000,                // Timestamp in milliseconds
      "o": "0.030781",                   // Open price
      "c": "0.060043",                   // Last price
      "h": "0.031788",                   // High price
      "l": "0.030733",                   // Low price
      "v": "62.587",                     // Base asset volume
      "q": "1.951420577"                 // Quote asset volume
    }
  }
}

{
  "ch": "ticker/price/1s",
  "data": {
    "BTCUSDT": {
      "t": 1614815872030,
      "o": "32636.79",
      "c": "32085.51",
      "h": "33379.92",
      "l": "30683.28",
      "v": "11.90667",
      "q": "384081.1955629"
    }
  }
}


Channel: ticker/price/{speed}

Supported speed: 1s, 3s

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO MINI TICKER IN BATCHES

> Request

{
  "method": "subscribe",
  "ch": "ticker/price/1s/batch",         // Channel
  "params": {
    "symbols": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "ticker/price/1s/batch",       // Channel
    "subscriptions": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Data notification

{
  "ch": "ticker/price/1s/batch",
  "data": {
    "ETHBTC": {
      "t": 1614815872000,                // Timestamp in milliseconds
      "o": "0.030781",                   // Open price
      "c": "0.060043",                   // Last price
      "h": "0.031788",                   // High price
      "l": "0.030733",                   // Low price
      "v": "62.587",                     // Base asset volume
      "q": "1.951420577"                 // Quote asset volume
    },
    "BTCUSDT": {
      "t": 1614815872030,
      "o": "32636.79",
      "c": "32085.51",
      "h": "33379.92",
      "l": "30683.28",
      "v": "11.90667",
      "q": "384081.1955629"
    }
  }
}


Channel: ticker/price/{speed}/batch

Supported speed: 1s, 3s

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO TICKER

> Request

{
  "method": "subscribe",
  "ch": "ticker/1s",                     // Channel
  "params": {
    "symbols": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "ticker/1s",                   // Channel
    "subscriptions": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Data notification

{
  "ch": "ticker/1s",
  "data": {
    "ETHBTC": {
      "t": 1614815872000,                // Timestamp in milliseconds
      "a": "0.031175",                   // Best ask
      "A": "0.03329",                    // Best ask quantity
      "b": "0.031148",                   // Best bid
      "B": "0.10565",                    // Best bid quantity
      "c": "0.031210",                   // Last price
      "o": "0.030781",                   // Open price
      "h": "0.031788",                   // High price
      "l": "0.030733",                   // Low price
      "v": "62.587",                     // Base asset volume
      "q": "1.951420577",                // Quote asset volume
      "p": "0.000429",                   // Price change
      "P": "1.39",                       // Price change percent
      "L": 1182694927                    // Last trade identifier
    }
  }
}

{
  "ch": "ticker/1s",
  "data": {
    "BTCUSDT": {
      "t": 1614815872050,
      "a": "32289.55",
      "A": "0.41210",
      "b": "32286.67",
      "B": "1.70049",
      "c": "0.057069",
      "o": "0.030545",
      "h": "0.029653",
      "l": "0.031804",
      "v": "11.90667",
      "q": "384081.1955629",
      "p": "0.003131",
      "P": "2.77",
      "L": 1182694927
    }
  }
}


Channel: ticker/{speed}

Supported speed: 1s, 3s

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO TICKER IN BATCHES

> Request

{
  "method": "subscribe",
  "ch": "ticker/1s/batch",               // Channel
  "params": {
    "symbols": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "ticker/1s/batch",             // Channel
    "subscriptions": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Data notification

{
  "ch": "ticker/1s/batch",
  "data": {
    "ETHBTC": {
      "t": 1614815872000,                // Timestamp in milliseconds
      "a": "0.031175",                   // Best ask
      "A": "0.03329",                    // Best ask quantity
      "b": "0.031148",                   // Best bid
      "B": "0.10565",                    // Best bid quantity
      "c": "0.031210",                   // Last price
      "o": "0.030781",                   // Open price
      "h": "0.031788",                   // High price
      "l": "0.030733",                   // Low price
      "v": "62.587",                     // Base asset volume
      "q": "1.951420577",                // Quote asset volume
      "p": "0.000429",                   // Price change
      "P": "1.39",                       // Price change percent
      "L": 1182694927                    // Last trade identifier
    },
    "BTCUSDT": {
      "t": 1614815872050,
      "a": "32289.55",
      "A": "0.41210",
      "b": "32286.67",
      "B": "1.70049",
      "c": "0.057069",
      "o": "0.030545",
      "h": "0.029653",
      "l": "0.031804",
      "v": "11.90667",
      "q": "384081.1955629",
      "p": "0.003131",
      "P": "2.77",
      "L": 1182694927
    }
  }
}


Channel: ticker/{speed}/batch

Supported speed: 1s, 3s

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO FULL ORDER BOOK

> Request

{
  "method": "subscribe",
  "ch": "orderbook/full",                // Channel
  "params": {
    "symbols": ["ETHBTC"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "orderbook/full",              // Channel
    "subscriptions": ["ETHBTC"]
  },
  "id": 123
}


> Notification snapshot

{
  "ch": "orderbook/full",                // Channel
  "snapshot": {
    "ETHBTC": {
      "t": 1626866578796,                // Timestamp in milliseconds
      "s": 27617207,                     // Sequence number
      "a": [                             // Asks
        ["0.060506", "0"],
        ["0.060549", "12.6431"],
        ["0.060570", "0"],
        ["0.060612", "0"]
      ],
      "b": [                             // Bids
        ["0.060439", "4.4095"],
        ["0.060414", "0"],
        ["0.060407", "7.3349"],
        ["0.060390", "0"]
      ]
    }
  }
}


> Notification update

{
  "ch": "orderbook/full",
  "update": {
    "ETHBTC": {
      "t": 1626866578902,
      "s": 27617208,
      "a": [
        ["0.060508", "0"],
        ["0.060509", "2.5486"]
        ],
      "b": [
        ["0.060501", "3.9000"],
        ["0.060500", "3.0459"]
        ]
    }
  }
}


Channel: orderbook/full

Parameters:

Name Type Description symbols []String List of symbol codes.


SUBSCRIBE TO PARTIAL ORDER BOOK

> Request

{
  "method": "subscribe",
  "ch": "orderbook/D5/100ms",            // Channel
  "params": {
    "symbols": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "orderbook/D5/100ms",          // Channel
    "subscriptions": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Data notification

{
  "ch": "orderbook/D5/100ms",            // Channel
  "data": {
    "BTCUSDT": {
      "t": 1626958488996,                // Timestamp in milliseconds
      "s": 29472321,                     // Sequence number
      "a": [                             // Asks
        ["32091.84", "0.01016"],
        ["32091.85", "0.41484"],
        ["32095.82", "0.00705"],
        ["32095.95", "0.52001"],
        ["32097.04", "0.20518"]
      ],
      "b": [                             // Bids
        ["32089.29", "0.00228"],
        ["32088.70", "0.40315"],
        ["32084.29", "0.00616"],
        ["32084.27", "0.53169"],
        ["32078.89", "0.01016"]
      ]
    },
    "ETHBTC": {
      "t": 1626958488990,
      "s": 28438797,
      "a": [
        ["0.061873", "4.8257"],
        ["0.061887", "1.9938"],
        ["0.061912", "0.5427"],
        ["0.061913", "0.1696"],
        ["0.061914", "0.1575"]
      ],
      "b": [
        ["0.061867", "0.9868"],
        ["0.061858", "0.1598"],
        ["0.061854", "1.8327"],
        ["0.061850", "0.8125"],
        ["0.061842", "0.1763"]
      ]
    }
  }
}


Channel: orderbook/{depth}/{speed}

Supported depth: D5, D10, D20

Supported speed: 100ms, 500ms, 1000ms

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO PARTIAL ORDER BOOK IN BATCHES

> Request

{
  "method": "subscribe",
  "ch": "orderbook/D5/1000ms/batch",     // Channel
  "params": {
    "symbols": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "orderbook/D5/1000ms/batch",   // Channel
    "subscriptions": ["ETHBTC","BTCUSDT"]
  },
  "id": 123
}


> Data notification

{
  "ch": "orderbook/D5/1000ms/batch",     // Channel
  "data": {
    "BTCUSDT": {
      "t": 1626958488996,                // Timestamp in milliseconds
      "s": 29472321,                     // Sequence number
      "a": [                             // Asks
        ["32091.84", "0.01016"],
        ["32091.85", "0.41484"],
        ["32095.82", "0.00705"],
        ["32095.95", "0.52001"],
        ["32097.04", "0.20518"]
      ],
      "b": [                             // Bids
        ["32089.29", "0.00228"],
        ["32088.70", "0.40315"],
        ["32084.29", "0.00616"],
        ["32084.27", "0.53169"],
        ["32078.89", "0.01016"]
      ]
    },
    "ETHBTC": {
      "t": 1626958488990,
      "s": 28438797,
      "a": [
        ["0.061873", "4.8257"],
        ["0.061887", "1.9938"],
        ["0.061912", "0.5427"],
        ["0.061913", "0.1696"],
        ["0.061914", "0.1575"]
      ],
      "b": [
        ["0.061867", "0.9868"],
        ["0.061858", "0.1598"],
        ["0.061854", "1.8327"],
        ["0.061850", "0.8125"],
        ["0.061842", "0.1763"]
      ]
    }
  }
}


Channel: orderbook/{depth}/{speed}/batch

Supported depth: D5, D10, D20

Supported speed: 100ms, 500ms, 1000ms

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO TOP OF BOOK

> Request

{
  "method": "subscribe",
  "ch": "orderbook/top/1000ms",          // Channel
  "params": {
    "symbols": ["ETHBTC", "BTCUSDT"]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "orderbook/top/1000ms",        // Channel
    "subscriptions": ["ETHBTC", "BTCUSDT"]
  },
  "id": 123
}


> Data notifications

{
  "ch": "orderbook/top/1000ms",
  "data": {
    "ETHBTC": {
      "t": 1626954648761,                // Timestamp in milliseconds
      "a": "0.062135",                   // Best ask
      "A": "4.1591",                     // Best ask quantity
      "b": "0.062124",                   // Best bid
      "B": "0.9877"                      // Best bid quantity
    }
  }
}

{
  "ch": "orderbook/top/1000ms",
  "data": {
    "BTCUSDT": {
      "t": 1626954648863,
      "a": "31936.09",
      "A": "1.30000",
      "b": "31933.40",
      "B": "0.00058"
    }
  }
}


Channel: orderbook/top/{speed}

Supported speed: 100ms, 500ms, 1000ms

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SUBSCRIBE TO TOP OF BOOK IN BATCHES

> Request

{
  "method": "subscribe",
  "ch": "orderbook/top/100ms/batch",     // Channel
  "params": {
    "symbols": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Response

{
  "result": {
    "ch": "orderbook/top/100ms/batch",   // Channel
    "subscriptions": [
      "ETHBTC",
      "BTCUSDT"
    ]
  },
  "id": 123
}


> Data notification

{
  "ch": "orderbook/top/100ms/batch",
  "data": {
    "ETHBTC": {
      "t": 1614815872000                 // Timestamp in milliseconds
      "a": "0.031175",                   // Best ask
      "A": "0.4033",                     // Best ask quantity
      "b": "0.031148",                   // Best bid
      "B": "0.3649",                     // Best bid quantity
    },
    "BTCUSDT": {
      "t": 1614815872005
      "a": "0.031175",
      "A": "0.4033",
      "b": "0.031148",
      "B": "0.3649",
    }
  }
}


Channel: orderbook/top/{speed}/batch

Supported speed: 100ms, 500ms, 1000ms

Parameters:

Name Type Description symbols []String List of symbol codes. Value ["*"] means
all symbols are selected.


SOCKET AUTHENTICATION


BASIC

> Examples with Basic algorithm:

wscat -c wss://api-balancers.gleec.com/api/3/ws/wallet


{
  "method": "login",
  "params": {
    "type": "BASIC",
    "api_key": "apiKey",
    "secret_key": "secretKey"
  }
}


Request method: login

Parameters:

Name Type Description type String Encryption algorithm.
Accepted values: BASIC api_key String API public key. secret_key String API
secret key.


HS256

> Example with HS256 algorithm:


wscat -c wss://api-balancers.gleec.com/api/3/ws/wallet

{
  "method": "login",
  "params": {
    "type": "HS256",
    "api_key": "apiKey",
    "timestamp": 1626861109494,
    "signature": "secretKey"
  }
}


> Signature generation example

from websocket import create_connection
import websocket
import json
from hashlib import sha256
from hmac import HMAC
from time import time


timestamp = int(time() * 1000)
api_key = "apiKey"
secret = "secretKey"
window = 10000
message = str(timestamp)

if window:
    message += str(window)

ws = create_connection('wss://api-balancers.gleec.com/api/3/ws/wallet')

sign = HMAC(key=secret.encode(),
            msg=message.encode(),
            digestmod=sha256).hexdigest()

res = ws.send(json.dumps({"method": "login", "params": {"type": "HS256", "api_key": api_key, "timestamp": timestamp, "window": window, "signature": sign}}))

print(ws.recv())


Request method: login

Parameters:

Name Type Description type String Encryption algorithm.
Accepted values: HS256 api_key String API public key. timestamp Number
Timestamp. window Number Optional. Maximum difference between timestamp and the
moment of request processing in milliseconds.
Accepted range: 1000 – 60000
Default value: 10000 signature String HMAC SHA256 sign with API secret key.


SOCKET TRADING

Trade via socket has some major differences compared to REST:

 * quickness. The time to place a new order is a bit higher than network
   latency;
 * the Server notifies you of any order updates;
 * FIFO. Your requests are executed on a First In First Out basis.

You should authenticate the session once before sending a request.


SOCKET SPOT TRADING


SUBSCRIBE TO REPORTS

> Request

wscat -c wss://api-balancers.gleec.com/api/3/ws/trading


{
  "method": "spot_subscribe",
  "params": {},
  "id": 123
}


> Subscription result:

{
  "jsonrpc": "2.0",
  "result": true,
  "id": 123
}


> Notification Spot orders snapshot

{
  "jsonrpc": "2.0",
  "method": "spot_orders",
  "params": [
    {
      "id": 584244931496,
      "client_order_id": "b5acd79c0a854b01b558665bcf379456",
      "symbol": "BTCUSDT",
      "side": "buy",
      "status": "new",
      "type": "limit",
      "time_in_force": "GTC",
      "quantity": "0.01000",
      "quantity_cumulative": "0",
      "price": "0.01",
      "post_only": false,
      "created_at": "2021-07-02T22:52:32.864Z",
      "updated_at": "2021-07-02T22:52:32.864Z",
      "report_type": "status"
    },
    {
      "id": 584246978340,
      "client_order_id": "eeb7d144eca545cd93d83078bc60b7f4",
      "symbol": "BTCUSDT",
      "side": "buy",
      "status": "new",
      "type": "limit",
      "time_in_force": "GTC",
      "quantity": "0.01000",
      "quantity_cumulative": "0",
      "price": "0.02",
      "post_only": false,
      "created_at": "2021-07-02T22:56:43.588Z",
      "updated_at": "2021-07-02T22:56:43.588Z",
      "report_type": "status"
    }
  ]
}


> Notification Spot order update

{
  "jsonrpc": "2.0",
  "method": "spot_order",
  "params": {
    "id": 584244931496,
    "client_order_id": "b5acd79c0a854b01b558665bcf379456",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.01000",
    "quantity_cumulative": "0",
    "price": "0.01",
    "post_only": false,
    "created_at": "2021-07-02T22:52:32.864Z",
    "updated_at": "2021-07-02T22:52:32.864Z",
    "report_type": "new"
  }
}


> Notification Spot trade

{
  "jsonrpc": "2.0",
  "method": "spot_order",
  "params": {
    "id": 626857425737,
    "client_order_id": "rqq6qnVTWvHa5YYG-7RviHLyA8JBu6Gj",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "filled",
    "type": "market",
    "time_in_force": "GTC",
    "quantity": "0.00001",
    "quantity_cumulative": "0.00001",
    "post_only": false,
    "created_at": "2021-08-23T16:29:24.006Z",
    "updated_at": "2021-08-23T16:29:24.006Z",
    "trade_id": 1361977606,
    "trade_quantity": "0.00001",
    "trade_price": "49595.04",
    "trade_fee": "0.001239876000",
    "trade_taker": true,
    "report_type": "trade"
  }
}


Method: spot_subscribe, spot_unsubscribe

Income methods: spot_order, spot_orders

Subscribes to execution reports of user's orders.

Requires the "Orderbook, History, Trading balance" API key Access Right.

Response:

Name Type Description id Number Unique order identifier as assigned by exchange.
client_order_id String Unique order identifier as assigned by the trader. symbol
String Symbol code. side String Trade side.
Accepted values: sell, buy status String Order state.
Possible values:
new — an order is placed in the order book.
suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order
is parked until it meets the conditions for placement in the order book.
partiallyFilled — an order is executed, but a part of its quantity is not filled
yet.
filled — (in updates) order quantity filled completely.
canceled — (in updates) an order is canceled. It can either be done by a user
through a cancel/replace request or by the system under specific circumstances.
expired — (in updates) an order is deactivated after it no longer satisfies Time
in Force (IOC, FOK) or Post Only requirements. type String Order type.
Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit,
takeProfitMarket time_in_force String Time in Force is a special instruction
used when placing an order to indicate how long it will remain active before it
is executed or expired.
GTC — "Good-Till-Canceled" order won't be closed until it is filled.
IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an
IOC order that cannot be filled immediately will be canceled.
FOK — "Fill-Or-Kill" order must be executed immediately and completely or not
executed at all.
Day — keeps the order active until the end of the trading day (23:59 UTC+0).
GTD — "Good-Till-Date" order may remain active until the time specified in
expire_time. quantity Number Order quantity. price Number Order price.
cum_quantity Number Cumulative executed quantity. post_only Boolean A post-only
order is an order that does not remove liquidity. If a post-only order causes a
match with a pre-existing order as a taker, then the order will expire.
created_at DateTime Report creation date. updated_at DateTime Date of the
report's last update. stop_price Number Required for stop-limit, stop-market,
take-profit limit, and take-profit market orders. expire_time DateTime Date of
order expiration for time_in_force equal to GTD. original_client_order_id String
Identifier of replaced order. trade_id Number Trade identifier. Required if
report_type is trade. trade_quantity Number Quantity of trade. Required if
report_type is trade. trade_price Number Trade price. Required if report_type is
trade. trade_fee Number Fee paid for trade. Required if report_type is trade.
trade_taker Boolean Liquidity indicator. Required if report_type is trade.
report_type String Report type.
Possible values:
status — (in snapshots) the record of an event occurred during the last snapshot
period.
new — (in updates) an order has been placed in the order book (status is new).
suspended — (in updates) a stopLimit, stopMarket, takeProfitLimit or
takeProfitMarket order is parked until it meets the conditions for placement in
the order book (status is suspended).
canceled — (in updates) an order is canceled. It can either be done by a user
through a cancel/replace request or by the system under specific circumstances.
rejected — (in updates) order request has been rejected (it is applicable
exclusively to a request entry, so the status of the related canceled/replaced
order will not change — i.e., it cannot be different from new, suspended,
partiallyFilled). status is rejected.
expired — (in updates) an order is deactivated as it no longer satisfies Time in
Force (IOC, FOK) or Post Only requirements (status is expired).
replaced — (in updates) an order cancel/replace request has been accepted and
successfully processed (status is canceled, a new order placed instead has the
new status value).
trade — (in updates) an order has been fully or partially executed (status is
filled or partiallyFilled).


GET ACTIVE SPOT ORDERS

> Notification report

{
  "jsonrpc": "2.0",
  "result": [
    {
      "id": 583502239480,
      "client_order_id": "9be4d950d3c04485854ec5d7f260b1e8",
      "symbol": "BTCUSDT",
      "side": "buy",
      "status": "new",
      "type": "limit",
      "time_in_force": "GTC",
      "quantity": "0.01000",
      "quantity_cumulative": "0",
      "price": "0.01",
      "post_only": false,
      "created_at": "2021-07-01T23:04:04.048Z",
      "updated_at": "2021-07-01T23:04:04.048Z",
      "report_type": "status"
    }
  ],
  "id": 123
}


Method: spot_get_orders

Returns active orders.


PLACE NEW SPOT ORDER

> Request:

{
  "method": "spot_new_order",
  "params": {
    "client_order_id": "57d5525562c945448e3cbd559bd068c4",
    "symbol": "ETHBTC",
    "side": "sell",
    "type": "limit",
    "quantity": "0.015",
    "price": "0.059837"
  },
  "id": 123
}


> Success response:

{
  "jsonrpc": "2.0",
  "result": {
    "id": 583565960004,
    "client_order_id": "57d5525562c945448e3cbd559bd06211",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "new",
    "type": "market",
    "time_in_force": "GTC",
    "quantity": "0.00001",
    "quantity_cumulative": "0",
    "post_only": false,
    "created_at": "2021-07-02T00:58:05.307Z",
    "updated_at": "2021-07-02T00:58:05.307Z",
    "report_type": "new"
  },
  "id": 123
}


> Example error response:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  },
  "id": 123
}


Method: spot_new_order

Creates a new spot order.

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description client_order_id String Optional. Unique order identifier
as assigned by the trader. Uniqueness must be guaranteed until the last order
with the same client_order_id becomes inactive (canceled, expired, or fully
executed) and some time after that. symbol String Symbol code. side String Trade
side.
Accepted values: sell, buy type String Optional. Order type.
Must be set to market, stopMarket, or takeProfitMarket if price was left
unspecified.
Accepted values: limit, market, stopLimit, stopMarket, takeProfitLimit,
takeProfitMarket
Default value: limit time_in_force String Optional. Order type.
Accepted values: GTC, IOC, FOK, Day, GTD
Default value:
FOK — type is market, stopMarket, takeProfitMarket;
GTC — type is limit, stopLimit, takeProfitLimit. quantity Number Order quantity.
price Number Order price. Required for limit types. stop_price Number Required
for stop-limit, stop-market, take-profit limit, and take-profit market orders.
expire_time DateTime Required if time_in_force is GTD. strict_validate Boolean
Price and quantity will be checked for incrementation within the symbol's tick
size and quantity step. See the symbol's tick_size and quantity_increment.
post_only Boolean A post-only order is an order that does not remove liquidity.
If a post-only order causes a match with a pre-existing order as a taker, then
the order will expire. take_rate Number Optional. Liquidity taker fee, a
fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the
fee. Used for fee markup. make_rate Number Optional. Liquidity provider fee, a
fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the
fee. Used for fee markup.

A report notification will arrive before the request result.
The execution of a taker's order may be postponed for 1 millisecond.


CREATE NEW SPOT ORDER LIST

> Request:

{
  "method": "spot_new_order_list",
  "params": {
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneCancelOther",
    "orders": [
      {
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "buy",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "post_only": false
      },
      {
        "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
        "symbol": "ETHBTC",
        "side": "sell",
        "type": "stopMarket",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "stop_price": "0.044050",
        "price": "0.044016",
        "post_only": false
      }
    ]
  },
  "id": 123
}


> Success response:

{
  "jsonrpc": "2.0",
  "result":
  {
    "id": 840450210,
    "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
    "symbol": "ETHBTC",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "price": "0.046016",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  "id": 123
}


{
  "jsonrpc": "2.0",
  "result":
  {
    "id": 840450211,
    "client_order_id": "a53406ea49e160c63b620ca21e9fb634",
    "symbol": "ETHBTC",
    "side": "sell",
    "status": "suspended",
    "type": "stopMarket",
    "time_in_force": "GTC",
    "quantity": "0.063",
    "stop_price": "0.044050",
    "price": "0.044016",
    "quantity_cumulative": "0.000",
    "post_only": false,
    "order_list_id": "d8574207d9e3b16a4a5511753eeef175",
    "contingency_type": "oneCancelOther",
    "created_at": "2024-04-15T17:01:05.092Z",
    "updated_at": "2024-04-15T17:01:05.092Z"
  },
  "id": 123
}


> Example error response:

{
  "error": {
    "code": 20001,
    "message": "Insufficient funds",
    "description": "Check that the funds are sufficient, given commissions"
  },
  "id": 123
}


Method: spot_new_order_list

Creates a new spot order list.

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description order_list_id String Order list identifier. If omitted, it
will be generated by the system upon order list creation. Must be equal to
client_order_id of the first order in the request. contingency_type String Order
list type.
Accepted values:
allOrNone (AON) — all orders in the set should be executed within a single
transaction or become expired otherwise;
oneCancelOther (OCO) — all orders in the set should be canceled if one of them
was executed;
oneTriggerOther (OTO) — execution of the first (primary) order on the list
activates other (secondary) orders as independent of each other;
oneTriggerOneCancelOther (OTOCO) — the execution of the first (primary) order on
the list activates the other (secondary) orders as an OCO order list. orders
[]Order Orders in the list. There must be 2 or 3 orders for
allOrNone/oneCancelOther/oneTriggerOther and 3 — for oneTriggerOneCancelOther.
Placing any other number of orders will result in an error.

Order model consists of:

Name Type Description client_order_id String Optional. Must be different from
the identifiers of other orders in the list.
If omitted, it will be generated by the system upon order list creation.
Uniqueness must be guaranteed until the last order with the same client_order_id
becomes inactive (canceled, expired, or fully executed) and some time after
that. symbol String Symbol code.
For an allOrNone order list, symbol code must be unique for each order in the
list.
For an oneTriggerOneCancelOther order list, symbol code must be the same for all
orders in the list (placing orders in different order books is not supported).
side String Trade side.
Accepted values: sell, buy type String Optional. Order type.
Accepted values:
for allOrNone — limit, market;
for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — limit,
stopLimit, stopMarket, takeProfitLimit, takeProfitMarket;
for oneTriggerOneCancelOther — limit, market, stopLimit, stopMarket,
takeProfitLimit, takeProfitMarket.
Default value: limit time_in_force String Optional (required for allOrNone).
Time in Force instruction.
Accepted values:
for allOrNone — FOK;
for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — GTC, IOC
(except limit orders), FOK (except limit orders), Day, GTD;
for oneTriggerOneCancelOther — GTC, IOC, FOK, Day, GTD. quantity Number Order
quantity. price Number Order price. Required if type is limit, stopLimit, or
takeProfitLimit. stop_price Number The price level that triggers order
activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or
takeProfitMarket. expire_time DateTime Date of order expiration. Required if
time_in_force is GTD. strict_validate Boolean Price and quantity will be checked
for incrementation within the symbol’s tick size and quantity step. See the
symbol's tick_size and quantity_increment. post_only Boolean Optional. If a
post-only order causes a match with a pre-existing order as a taker, then the
order will expire. take_rate Number Optional. Liquidity taker fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup. make_rate Number Optional. Liquidity provider fee, a fraction of
order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for
fee markup.

An OCO order list cannot include more than one limit order (the same applies to
secondary orders in an OTOCO order list).
A report notification will arrive before the request result.


CANCEL SPOT ORDER

> Request:

{
  "method": "spot_cancel_order",
  "params": {
    "client_order_id": "57d5525562c945448e3cbd559bd068c4"
  },
  "id": 123
}


> Response:

{
  "jsonrpc": "2.0",
  "result": {
    "id": 583569472521,
    "client_order_id": "8a97337322774d8ea56448290fbc87b3",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "canceled",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.00001",
    "quantity_cumulative": "0",
    "price": "0.01",
    "post_only": false,
    "created_at": "2021-07-02T01:03:56.625Z",
    "updated_at": "2021-07-02T01:05:41.84Z",
    "report_type": "canceled"
  },
  "id": 123
}


Method: spot_cancel_order

Cancels an existing order.


CANCEL/REPLACE SPOT ORDER

> Request:

{
  "method": "spot_replace_order",
  "params": {
    "client_order_id": "d6b645556af740b1bd1683400fd9cbce",
    "new_client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
    "quantity": "0.00001",
    "price": "0.02"
  },
  "id": 123
}


> Response:

{
  "jsonrpc": "2.0",
  "result": {
    "id": 583572753114,
    "client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.00001",
    "quantity_cumulative": "0",
    "price": "0.02",
    "post_only": false,
    "created_at": "2021-07-02T01:10:06.976Z",
    "updated_at": "2021-07-02T01:11:18.238Z",
    "original_client_order_id": "d6b645556af740b1bd1683400fd9cbce",
    "report_type": "replaced"
  }
}


The Cancel/Replace request is used to change the parameters of an existing order
and to change the quantity or price attribute of an open order.

Do not use this request to cancel the quantity remaining in an outstanding
order. Use the Cancel request message for this purpose.

It is stipulated that a newly entered order cancels a prior order that has been
entered but not yet executed.

Method: spot_replace_order

Requires the "Place/cancel orders" API key Access Right.

Parameters:

Name Type Description client_order_id String Identifier of the order being
replaced. new_client_order_id String Optional. client_order_id for a new order.
Uniqueness must be guaranteed until the last order with the same client_order_id
becomes inactive (canceled, expired, or fully executed) and some time after
that. quantity Number New order quantity. price Number Optional. Order price.
Required if type is limit, stopLimit, or takeProfitLimit. stop_price Number
Optional. The price level that triggers order activation. Specified if type is
stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket. strict_validate
Boolean Optional. Price and quantity will be checked for the incrementation
within tick size and quantity step. See symbol's tick_size and
quantity_increment.


CANCEL SPOT ORDERS

> Request:

{
  "method": "spot_cancel_orders",
  "params": {},
  "id": 123
}


> Response:

{
  "jsonrpc": "2.0",
  "result": [
  {
    "id": 583572753114,
    "client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
    "symbol": "BTCUSDT",
    "side": "buy",
    "status": "new",
    "type": "limit",
    "time_in_force": "GTC",
    "quantity": "0.00001",
    "quantity_cumulative": "0",
    "price": "0.02",
    "post_only": false,
    "created_at": "2021-07-02T01:10:06.976Z",
    "updated_at": "2021-07-02T01:11:18.238Z",
    "report_type": "canceled"
  }
  ]
}


Method: spot_cancel_orders

Cancels all user's active orders and returns the ones which could not be
canceled.

Requires the "Place/cancel orders" API key Access Right.


SUBSCRIBE TO SPOT BALANCES

> Request

{
  "method": "spot_balance_subscribe",
  "params": {
    "mode": "updates"
  },
  "id": 123
}


> Subscription result:

{
  "jsonrpc": "2.0",
  "result": true,
  "id": 123
}


> Notification Spot balance

{
  "jsonrpc": "2.0",
  "method": "spot_balance",
  "params": [
    {
      "currency": "BCN",
      "available": "100.000000000000",
      "reserved": "0"
    },
    {
      "currency": "BTC",
      "available": "0.013634021",
      "reserved": "0"
    },
    {
      "currency": "ETH",
      "available": "0",
      "reserved": "0"
    }
  ]
}


Method: spot_balance_subscribe, spot_balance_unsubscribe

Income methods: spot_balance

Subscribes to the user's balances.

Requires the "Orderbook, History, Trading balance" API key Access Right.

Parameters:

Name Type Description mode String Subscription mode.
Accepted values:
updates — messages arrive after balance updates.
batches — messages arrive at equal intervals if there were any updates.

Successful unsubscription in any mode provided results in termination of all
balance subscriptions.

Response:

Name Type Description currency String Currency code. available Number Amount
available for trading or transfer to wallet. reserved Number Total amount
reserved for active orders and incomplete transfers to wallet.


GET SPOT TRADING BALANCES

> Request:

{
  "method": "spot_balances",
  "params": {},
  "id": 123
}


> Response:

{
  "jsonrpc":"2.0",
  "result": [
    {
      "currency": "BCN",
      "available": "100.000000000000",
      "reserved": "0"
    },
    {
      "currency": "BTC",
      "available": "0.013634021",
      "reserved": "0"
    },
    {
      "currency": "ETH",
      "available": "0",
      "reserved": "0"
    }
  ],
  "id": 123
}


Method: spot_balances

Returns all non-zero trading balances.

Requires the "Orderbook, History, Trading balance" API key Access Right.


GET SPOT TRADING BALANCE

> Request:

{
  "method": "spot_balance",
  "params": {
    "currency": "BTC"
  },
  "id": 123
}


> Response:

{
  "jsonrpc":"2.0",
  "result": {
    "currency": "BTC",
    "available": "0.013634021",
    "reserved": "0"
  },
  "id": 123
}


Method: spot_balance

Returns trading balance for a single currency.


GET SPOT FEES

> Request:

{
  "method": "spot_fees",
  "params": {},
  "id": 123
}


> Response:

{
  "jsonrpc":"2.0",
  "result": [
  {
    "symbol": "BTCUSDT",
    "take_rate": "0.001",
    "make_rate": "-0.0001"
  },
  {
    "symbol": "ETHBTC",
    "take_rate": "0.001",
    "make_rate": "-0.0001"
  }
  ],
  "id": 123
}


Method: spot_fees

Returns fees for all available symbols.

Requires the "Orderbook, History, Trading balance" API key Access Right.


GET SPOT FEE

> Request:

{
  "jsonrpc":"2.0",
  "method": "spot_fee",
  "params": {
    "symbol": "BTCUSDT"
  },
  "id": 123
}


> Response:

{
  "jsonrpc":"2.0",
  "result":
  {
    "symbol": "BTCUSDT",
    "take_rate": "0.001",
    "make_rate": "-0.0001"
  },
  "id": 123
}


Method: spot_fee

Returns fees for the symbol specified.

Requires the "Orderbook, History, Trading balance" API key Access Right.


SOCKET WALLET MANAGEMENT


DESCRIPTION

WebSocket Account API uses the same authorization approach as described in the
Socket Session Authentication section.

API provides the following tools to manage a general account:

 * a subscription to the transactions:
   * any sequenced transaction changes such as creating or updating.
 * a balance request;
 * a transaction history request.


SUBSCRIBE TO TRANSACTIONS

Method: subscribe_transactions and the corresponding unsubscription method:
unsubscribe_transactions

Income method: transaction_update

A full transaction model description can be found in the "Get Transactions
History" section.

A subscription to the transactions has to be used rather than the transaction
polling.

A transaction notification occurs each time the transaction has been changed,
such as creating a transaction, updating the pending state (e.g., the hash
assigned) or completing a transaction. This is the easiest way to track deposits
or develop real-time asset monitoring.

> Subscription request:

wscat -c wss://api-balancers.gleec.com/api/3/ws/wallet


{
  "method": "subscribe_transactions",
  "params": {},
  "id": 7652
}


> Subscription result:

{
  "result": true,
  "id": 7652
}


> Notification. Updated Transaction:

{
  "method": "transaction_update",
  "params": {
    "id": 50844835,
    "created_at": "2024-04-22T21:03:04.111Z",
    "updated_at": "2024-04-22T21:04:41.487Z",
    "status": "SUCCESS",
    "type": "WITHDRAW",
    "subtype": "BLOCKCHAIN",
    "native": {
      "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2",
      "index": 1071885589,
      "currency": "ETH",
      "amount": "0.01042",
      "fee": "0.00958",
      "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20",
      "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba",
      "confirmations": 20
    },
    "operation_id": "99e78bf4-a708-43a3-ab18-e8e7618cd891"
  }
}



SUBSCRIBE TO WALLET BALANCES

Method: subscribe_wallet_balances and the corresponding unsubscription method:
unsubscribe_wallet_balances

Income methods: wallet_balances, wallet_balance_update

This subscription aims to provide an easy way to be informed of the current
balance state.

If the state has been changed or potentially changed, the wallet_balance_update
event will come with the actual state.

Please be aware that only non-zero values are present.

Event wallet_balances arrives after each successful subscription.

> Subscription request:

{
  "method": "subscribe_wallet_balances",
  "params": {},
  "id": 7653
}


> Subscription result:

{
  "jsonrpc": "2.0",
  "result": true,
  "id": 7653
}


> Notification. Balance snapshot:

{
  "jsonrpc": "2.0",
  "method": "wallet_balances",
  "params": [
    {
      "currency": "BTC",
      "available": "0.00005821",
      "reserved": "0"
    },
    {
      "currency": "ETH",
      "available": "11",
      "reserved": "0"
    }
  ]
}


> Notification. Balance update:

{
  "jsonrpc": "2.0",
  "method": "wallet_balance_update",
  "params": {
    "currency": "BTC",
    "available": "0.10005821",
    "reserved": "0"
  }
}



REQUEST WALLET BALANCE

> Request:

{
  "method": "wallet_balances",
  "params": {},
  "id": 5543
}


> Response:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "currency": "BTC",
      "available": "0.00005821",
      "reserved": "0"
    },
    {
      "currency": "ETH",
      "available": "11",
      "reserved": "0"
    }
  ],
  "id": 5543
}


> Request:

{
  "method": "wallet_balance",
  "params": {
    "currency": "BTC"
  },
  "id": 5543
}


> Response:

{
  "jsonrpc": "2.0",
  "result": {
    "currency": "BTC",
    "available": "0.00005821",
    "reserved": "0"
  },
  "id": 5543
}


Methods: wallet_balances, wallet_balance

Get all wallet balances or balance for a single asset.

Please note that the method returns non-zero balances only.


GET TRANSACTIONS

> Request:

{
  "method": "transactions",
  "params": {
    "limit": 10,
    "offset": 0,
    "sort": "desc",
    "from": "2020-01-31T00:00:00.000Z",
    "till": "2021-07-31T22:33:00.555Z",
    "statuses": "SUCCESS",
    "currencies": "ETH,BTC"
  },
  "id": 7655
}


> Response:

{
  "jsonrpc": "2.0",
  "result":
  [
    {
      "id": 18155514,
      "created_at": "2023-05-31T05:40:38.732Z",
      "updated_at": "2023-05-31T05:40:38.77Z",
      "last_activity_at": "2024-04-30T15:42:12.274495Z",
      "status": "SUCCESS",
      "type": "TRANSFER",
      "subtype": "WALLET_TO_SPOT",
      "native":
      {
        "tx_id": "7a04e62c-563c-4797-8eeb-ea8e3fa354d3",
        "index": 153796572,
        "currency": "USDT",
        "amount": "0.01"
      },
      "operation_id": "55b58d62-959d-2b96-51b1-035f87e55885"
    },
    {
      "id": 716817,
      "created_at": "2024-04-12T11:34:00.766Z",
      "updated_at": "2024-04-12T11:43:59.88Z",
      "last_activity_at": "2024-04-30T15:42:12.274495Z",
      "status": "PENDING",
      "type": "WITHDRAW",
      "subtype": "BLOCKCHAIN",
      "native":
      {
        "tx_id": "80f890f7-7f49-4d69-af39-73d1ee539663",
        "index": 94582527,
        "currency": "BTC",
        "amount": "0.001",
        "fee": "0.00146454",
        "address": "3E8WKmTJzaTsBc4",
        "confirmations": 0
      }
    },
    {
      "id": 36497,
      "created_at": "2024-04-19T13:10:16.238Z",
      "updated_at": "2024-04-19T13:10:16.245Z",
      "status": "SUCCESS",
      "type": "DEPOSIT",
      "subtype": "UNCLASSIFIED",
      "native":
      {
        "tx_id": "cda7121b-de8f-4554-8ba7-c6beabfd9a88",
        "index": 44204086,
        "currency": "BTC",
        "amount": "0.2"
      }
    }
  ],
  "id": 1408
}


Method: transactions

from/till and from_id/till_id are mutually exclusive.

All parameters are optional.

Parameters:

Name Type Description from DateTime Interval initial value (inclusive).
The value type depends on order_by. till DateTime Interval end value
(inclusive).
The value type depends on order_by. types String Comma-separated transaction
types. subtypes String Comma-separated transaction subtypes. statuses String
Comma-separated transaction statuses.
Accepted values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK currencies
String Comma-separated currency codes. id_from Number Index interval initial
value.
Accepted values: 0 or greater id_till Number Index interval end value.
Accepted values: 0 or greater tx_ids String Comma-separated transaction
identifiers. order_by String The field the entries sorted by.
Accepted values: id, created_at, updated_at, last_activity_at, ID, CREATED_AT,
UPDATED_AT, LAST_ACTIVITY_AT
Default value: created_at
Cannot be id or ID if from and (or) till are provided. sort String Sort
direction.
Accepted values: DESC, ASC
Default value: DESC limit Number Default value: 100
Maximum value: 1000 offset Number Default value: 0
Maximum value: 100000 group_transactions Boolean Flag indicating whether the
returned transactions will be parts of a single operation.
Default value: false

For response fields, refer to description of GET /api/3/wallet/transactions
endpoint.


ERRORS

The same set of custom error codes is applicable to both REST and Socket APIs.


MARKET DATA

Custom code HTTP status code Reason 2002 400 Provided currency or symbol not
found. 10001 400 Any of:
- missing required parameter;
- invalid value of a numeric parameter.

"HTTP status code" is applicable to REST API calls only.


AUTHENTICATION

Custom code HTTP status code Reason 1002 401 Any of:
- invalid API key;
- user is not allowed to perform the requested operation. 1002 401 Any of:
- invalid API key;
- user is not allowed to perform the requested operation;
- invalid time window value;
- invalid HMAC signature format;
- invalid HMAC signature value. 1004 401 Provided parameters do not meet any
supported authentication scheme. 1004 401 Any of:
- missing required parameters;
- the maximum time window is exceeded.


TRADING

Custom code HTTP status code Reason 500 500 Unclassified internal error. 20048
400 Provided Time-In-Force instruction is invalid or the combination of the
instruction and the order type is not allowed. 20049 400 Provided order type is
invalid. 504 504 Operation has expired before completion. 504 504 Operation was
canceled. 1003 403 Any of:
- insufficient API key permissions;
- provided IP address is not in the white list;
- the user is not eligible for the given liquidity pool due to the
configuration. 1003 403 The user is not allowed to place new orders in the given
market. 2001 400 The symbol featured in the request has not been found. 2002 400
Provided currency has not been found.

Any of:
- the currency is disabled;
- the currency is unavailable for a given market. 2010 400 Invalid quantity
value.

Any of:
- quantity is not a decimal with a dot as the separator;
- maximum bit depth is exceeded. 2011 400 Quantity is less or equal to zero or
the quantity increment. 2012 400 Invalid quantity format. 2016 400 Orders in the
order list are on symbols that are unacceptable in combination for the given
type.

Any of:
- for allOrNone—all symbols must be different;
- for oneTriggerOneCancelOther—all symbols must be the same. 2017 400 The number
of an order in the order list violates the conditions for its contingency type.
2020 400 Invalid price value.

Any of:
- price is not a decimal with a dot as the separator;
- maximum bit depth is exceeded;
- price is less or equal to zero. 2022 400 Invalid price format. 10001 400 Any
of:
- invalid JSON payload;
- invalid form payload;
- specified parameters are mutually exclusive;
- a required parameter is missing;
- the value of a parameter is invalid;
- pair parameters have different formats;
- provided value does not match the currency precision while the strict-validate
mode is enabled. 10021 404 User is disabled. 20002 400 Canceled or replaced
order has not been found or the user has no active or parked orders. 20003 400
Turnover limit is exceeded meaning trading is disabled for the user. 20008 400
Provided client order identifier is user in an active order or has been used
lately. 20009 400 Provided parameters for a new order are the as of the replaced
one. 20010 400 Trades on the given symbol are suspended. 20044 400 Trading on
the requested market is not available. 20045 400 Fat finger limit is exceeded.

If a replace request is rejected, it cancels the original order without placing
a new one. 20046 400 Trades on the given symbol are suspended. 20080 400 The
order met its expiration time before it might be processed.


WALLET MANAGEMENT

Custom code HTTP status code Reason 404 404 Any of:
- a subaccount is not found;
- the user is not a super account. 10021 404 A subaccount has not confirmed the
registration or is disabled which is required for execution of the operation.
21001 404 Any of:
- a subaccount does not exist;
- a subaccount does not belong to the super account. 21003 400 A subaccount has
already been frozen or disabled regardless of super account actions. 400 400
Invalid request body. 408 408 The request has been canceled. 429 429 Rate limits
are exceeded. 500 500 Internal error.

Any of:
- unclassified internal error;
- user bank account is blocked;
- transaction(s) for the requested operation have not been created;
- transaction(s) for the requested operation have been rolled back. 500 500
Funds needed for execution of the operation are locked. 502 502 Unclassified
error while connecting the authentication service. 503 503 Any of:
- withdrawals are disabled;
- unclassified internal error. 600 400 Operations on the requested currency are
not allowed.

Any of:
- currency is disabled;
- operations of the given type are disabled for the currency;
- operations on the needed account types are disabled for the currency;
- conversion is not allowed for the provided currencies. 602 400 User is in the
blacklist and can no longer make withdrawals. 604 400 Operation amount in total
with locked amount exceeds available balance. 1003 403 Any of:
- currency settings forbid the requested operation;
- the user has insufficient permissions for the operation;
- requested operation is forbidden for the user;
- insufficient API key permissions;
- provided IP address is not in the white list;
- the user is not eligible for the given currency by the configuration;
- provided operation parameters are forbidden by the configuration;
- a withdrawal operation failed to pass pre-AML checks. 22001 400 Acquiring
provider is not set up for a broker. 1006 403 Current permission scope in the
authentication service is insufficient. 1007 403 Current permission scope in the
authentication service is insufficient. 2002 400 Currency is not found.

Any of:
- requested network is not found;
- requested currency is not found;
- no currency provided while the network is specified;
- requested network is disabled;
- operations relating to the request are disabled for the currency;
- currencies featured in an operation are not found. 10001 400 Any of:
- invalid JSON payload;
- invalid form payload;
- invalid payload format;
- invalid parameter value;
- invalid parameter format;
- specified parameters are mutually exclusive;
- a required parameter is missing;
- the value of a parameter is invalid;
- provided value is not unique;
- in an update request, no parameters provided. 10001 400 Operation amount is
too low.

Any of:
- provided amount is lesser than the currency precision (bit depth);
- fees are included in the final amount, and the amount is lesser than fees.
20001 400 Available balance is insufficient for execution of the operation.
20003 400 The amount of operation exceeds a daily, hourly, weekly, or monthly
limit. 20004 404 Any of:
- a transaction has failed to create;
- the requested transaction is not found. 20005 400 The requested withdrawal is
not found. 20006 400 Transaction associated with the operation was complete
before being committed or rolled back. 20007 400 Transaction associated with the
operation has been rolled-back or failed. 20011 400 Receiver deposit address has
an invalid format. 20012 400 Any of:
- an internal transfer recipient did not complete the registration;
- recipient payment identifier is of an invalid format. 20014 400 The internal
transfer is directed to the sender of the request.

Any of:
- off-chain operations are disabled;
- the receiver is not a valid target for an off-chain operation. 20018 400
Withdrawals are unavailable due to the current configuration.
Any of:
- internal withdrawals are disabled;
- in-chain withdrawals are disabled. 22004 404 User is not found. 22008 504
Gateway timeout exceeded. 20090 403 Verification level is insufficient for the
given operation.