xRocket Exchange REST API
xRocket Exchange API allows developers to integrate xRocket exchange features in their projects to be able to create, execute or cancel orders, retrieve market data, track trading pair price dynamics, etc.
- xRocket wallet has two types of balance, Trading and Funding.
This version of API is designed to enable the interactions of the two balances.
API v1 deprecation notice
Trade API v1 (https://trade.xrocket.tg/api) is deprecated, unsupported, and will soon be removed. Please migrate to the latest Exchange API.
Authorization
- Get your Bearer token (API Key) to use any private endpoints. In Telegram bot go to Settings➡Exchange settings➡API token.
- Add the Bearer token in the requests while using any private endpoints as follows:
"Authorization: Bearer SpjEQPuvEGMae7QLaNzR8I47D3qzUP"
Please use testnet bot to get Bearer token for testnet integration.
Entities
xRocket Exchange API implies interaction of the following entities:
account // xRocket user account
balance // balance can be funding or trading and belongs to an xRocket account
symbol // a trading pair, for example BTC-USDT
order // a trading order to buy/sell asset at user-specified conditions
trade // a execution of orders on the exchange
ticker // market data of a symbol (trading pair) for a specified time interval
candle // aggregated trading data for a specified pair and time interval
orderbook // total bid/ask amounts of a trading pair with a specified depth and precision
transfer // movement of an asset within user account from/to funding/trading balance
Request/response example
In this example the GET /api/v1/orders/history method is used to request history of closed and cancelled BTC-USDT trading orders for a specified time interval. The method requests an xRocket account-related data. Such requests require authorization token that can be issued to a user account.
curl -X 'GET' \
'https://exchange.api.xrocket.tg/api/v1/orders/history?symbol=BTC-USDT&side=buy&startAt=2024-12-24T14%3A49%3A13.543Z&endAt=2024-12-24T14%3A49%3A13.543Z¤tPage=1&pageSize=20&hideCanceled=false' \
-H 'accept: application/json' \
-H 'Authorization: Bearer 10Q9DG5BG0ReG3jCdyEQ6C5yQkhHRX'
The request is sent to URL of the API method: /api/v1/orders/history
| Example field and value | Description |
|---|---|
symbol=BTC-USDT | BTC-USDT is specified as the trading pair (symbol). |
side=buy | Only buy orders are requested. This field can be set to buy or sell. Don’t use the field to get all (buy and sell) orders. |
startAt=2024-12-24T1:49:13.543Z | This field specifies the beginning timestamp of the requested history. |
endAt=2024-12-24T14:49:13.543Z | This field specifies the ending timestamp of the requested history. |
currentPage=1 | This field specifies the page to display in the response. A response can consist of several pages. |
pageSize=20 | This field specifies the number of trading records on a page of the returned response. |
hideCanceled=false | This field indicates if the cancelled orders are included in the response. |
'Authorization: Bearer 10Q9DG5BG0ReG3jCdyEQ6C5yQkhHRX' | The GET /api/v1/orders/history method requests an xRocket account-related data. Such requests require authorization token that can be issued to a user account by xRocket bot. |
Example response:
{
"orders": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clientOrderId": "string",
"symbol": "BTC-USDT",
"side": "buy",
"status": "working",
"createdAt": "2024-12-05T12:51:20.917Z",
"updatedAt": "2024-12-05T12:51:20.917Z",
"dealSize": "19.781",
"dealFunds": "19.781",
"fee": "1.82",
"feeAsset": "USDT",
"remark": "string",
"timeInForce": "GTC",
"type": "stopMarket",
"size": "109.34",
"stopTriggered": false,
"stopPrice": "300.5"
}
],
"currentPage": 1,
"pageSize": 20,
"totalNum": 1,
"totalPage": 1
}
| Example field and value | Description |
|---|---|
| "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" | Order ID. |
| "clientOrderId": "string" | Unique identifier created by the client. |
| "symbol": "BTC-USDT" | Symbol (trading pair). |
| "side": "buy" | Buy or sell order [ buy, sell ]. |
| "status": "working" | Order status [ working, rejected, cancelled, completed, expired, pending, sending ]. |
| "createdAt": "2024-12-05T12:51:20.917Z" | Order creation timestamp. |
| "updatedAt": "2024-12-05T12:51:20.917Z" | Order updated timestamp. |
| "dealSize": "19.781" | Executed amount in base asset (BTC). |
| "dealFunds": "19.781" | Executed size of funds in quote asset (USDT). |
| "fee": "1.82" | The amount of fee. |
| "feeAsset": "USDT" | The asset to pay the fee. |
| "timeInForce": "GTC" | Time in force parameter [ GTC, IOC, FOK ]. GTC (Good 'Til Canceled), IOC (Immediate or Cancel), and FOK (Fill or Kill). |
| "type": "stopMarket" | Type of order [limit, market, stopLimit, stopMarket]. |
| "size": "109.34" | Order amount. |
| "stopTriggered": false | Indicates if the stop order is triggered or not. |
| "stopPrice": "300.5" | Indicates the stop price. |
| "currentPage": 1 | Current page. |
| "pageSize": 20 | Max number of records on a page. |
| "totalNum": 1 | Total number of records returned. |
| "totalPage": 1 | Total number of pages returned. |
Methods
Find the right endpoint for your application in the following list of all the available xRocket Exchange API methods with brief descriptions grouped by category for easy navigation.
| Method | Description |
|---|---|
| Market data | Methods for requesting exchange market public data. |
| Get symbol | Request details of a specified trading pair. |
| Get symbols | Request the list of all currently available trading pairs. |
| Get ticker | Request market data of a trading pair for a specified time interval. |
| Get candles | Request current market candles data for specified trading pair. |
| Get orderbook | Request current order book data for specified trading pair. |
| Get trades | Request details of completed trading orders for a specified trading pair. |
| Get assets | Request the list of all available assets. |
| Get asset | Request details of a specified asset. |
| Rates | Methods for requesting public exchange rates. |
| Get rates | Request current rates of specified cryptos in a specified fiat. |
| Orders | Methods for requesting orders details and managing orders of a specified account. |
| Get orders history | Request orders history. Requires authorization |
| Get active orders | Request active orders list. Requires authorization |
| Get order | Request order details by order ID. Requires authorization |
| Delete order | Cancel trading order by ID. Requires authorization |
| Place order | Place trading order. Requires authorization |
| Get order estimation | Request order estimation. Requires authorization |
| Account | Methods for requesting account data. |
| Get account trading balances | Request current trading balances. Requires authorization |
| Get exchange fees | Request current exchange fees for specified trading pair. |
| Funding | Methods for managing funding balances and withdrawals of a specified account. |
| Create withdrawal | Create withdrawal. Requires authorization |
| Get account funding balances | Request current funding balances. Requires authorization |
| Get withdrawal by ID | Request details of withdrawal by withdrawal ID. Requires authorization |
| Get withdrawals history | Request withdrawal history. Requires authorization |
| Get withdrawal quotas | Request details of withdrawal quotas. |
| Transfers | Methods for managing transfers of assets between funding/trading balances within specified xRocket account. |
| Transfer | Transfer assets between funding/trading balances within xRocket account. Requires authorization |
| Get transfers history | Request transfers history for a specified direction and timeframe. Requires authorization |
| Get transfer by transfer ID | Request details of a specified transfer by ID. Requires authorization |