Introduction
BitUBU API is API which can be used by client application.
APIv2_URL: api.bitubu.com
Last update: 10/01/2022
Authentication
Create new user session
To create Bearer Token, use this code:
curl --location --request POST "{APIv2_URL}/users/api/v1/sessions"
Make sure to replace
email, password and otp_code
with your personal informations..
This endpoint creates a Bearer Token.
HTTP Request
POST {APIv2_URL}/users/api/v1/sessions
Query Parameters
Parameter | Default |
---|---|
example@example.com | |
password | example123456 |
otp_code | 123456 |
Add your BitUBU email address and password. If you enabled Google Authenticator, please add it in otp_code. Otherwise you do not need to add otp_code parameter.
You will get Bearer Token and you can use it like:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Accounts
Get your profile and accounts info
curl --location --request GET '{APIv2_URL}/api/v2/members/me' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"sn": "SN123456789",
"email": "example@example.com",
"anti_pishing": "TEST"
}
Get your profile and accounts info.
HTTP Request
GET {APIv2_URL}/api/v2/members/me
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Wallets
Get your deposit address of specified currency
curl --location --request GET '{APIv2_URL}/api/v2/deposit_address?currency=btc' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"currency": "btc",
"address": "36ZNxC16mW4g4wYqrmz7hLErRPGDL5cYT7"
}
This endpoint retrieves specific currency deposit address. Where to deposit. The address field could be empty when a new address is generating (e.g. for bitcoin), you should try again later in that case.
HTTP Request
GET {APIv2_URL}/api/v2/deposit_address
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Query Parameters
Parameter | Description |
---|---|
currency | Currency value contains BTC, DOGE, ETH. |
Get balance of all currency
curl --location --request GET '{APIv2_URL}/api/v2/accounts' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
[
{
"currency": "btc",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "dash",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "doge",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "eth",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "ltc",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "neo",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "trx",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "try",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "ubu",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "usdt",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "waves",
"balance": "0.0",
"locked": "0.0"
},
{
"currency": "xrp",
"balance": "0.0",
"locked": "0.0"
}
]
This endpoint retrieves list of user balance currencies.
HTTP Request
GET {APIv2_URL}/api/v2/accounts
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Get balance of specific currency
curl --location --request GET '{APIv2_URL}/api/v2/accounts/btc' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"currency": "btc",
"balance": "0.0",
"locked": "0.0"
}
This endpoint retrieves list of user balance in specific currency.
HTTP Request
GET {APIv2_URL}/api/v2/accounts/<ID>
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the currency ticker to retrieve |
Get your all deposit history
curl --location --request GET '{APIv2_URL}/api/v2/deposits' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
[
{
"id": 3428,
"currency": "doge",
"amount": "12937.0",
"fee": "0.0",
"txid": "54166aa608f3749d8749840248ebe0f385ae626d6c1e3cf1913090bb2ee625eb",
"tx_url": "https://live.blockcypher.com/doge/tx/54166aa608f3749d8749840248ebe0f385ae626d6c1e3cf1913090bb2ee625eb",
"confirmations": 83728,
"state": "collected",
"heights": 4057601,
"min_confirm": 20,
"created_at": "2021-11-10T14:23:16+03:00",
"completed_at": "2021-11-10T14:25:32+03:00"
},
]
This endpoint retrieves list of user deposits history.
HTTP Request
GET {APIv2_URL}/api/v2/deposits
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Query Parameters
Parameter | Description |
---|---|
currency | Currency value contains BTC, DOGE, ETH. |
limit | Set result limit. |
state | State of the deposit "pending" |
Get information of specified deposit
curl --location --request GET '{APIv2_URL}/api/v2/deposit' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...." \
-d txid=54166aa608f3749d8749840248ebe0f385ae626d6c1e3cf1913090bb2ee625eb
The above command returns JSON structured like this:
{
"id": 3428,
"currency": "doge",
"amount": "12937.0",
"fee": "0.0",
"txid": "54166aa608f3749d8749840248ebe0f385ae626d6c1e3cf1913090bb2ee625eb",
"tx_url": "https://live.blockcypher.com/doge/tx/54166aa608f3749d8749840248ebe0f385ae626d6c1e3cf1913090bb2ee625eb",
"confirmations": 83736,
"state": "collected",
"heights": 4057609,
"min_confirm": 20,
"created_at": "2021-11-10T14:23:16+03:00",
"completed_at": "2021-11-10T14:25:32+03:00"
}
This endpoint retrieves details of a specific deposit.
HTTP Request
GET {APIv2_URL}/api/v2/deposit
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Query Parameters
Parameter | Description |
---|---|
txid | Deposit txid. |
Get your all withdraw history
curl --location --request GET '{APIv2_URL}/api/v2/withdraws' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
[
{
"id": 2634,
"currency": "btc",
"type": "coin",
"amount": "0.002",
"fee": "0.0004",
"blockchain_txid": "729167df7439bb89422fdb023a4bd5650000ca35ce3fd559b873da9f5228d510",
"tx_url": "https://www.blockchain.com/btc/tx/729167df7439bb89422fdb023a4bd5650000ca35ce3fd559b873da9f5228d510",
"rid": "3LQcwme5EDfHYWcnVs64dhgx9J6uD9jd2q",
"state": "succeed",
"confirmations": 15897,
"created_at": "2021-09-26T05:48:47+03:00",
"updated_at": "2021-09-26T05:51:34+03:00",
"completed_at": "2021-09-26T05:51:34+03:00",
"done_at": "2021-09-26T05:51:34+03:00"
},
]
This endpoint retrieves list of user withdraws history.
HTTP Request
GET {APIv2_URL}/api/v2/withdraws
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
Query Parameters
Parameter | Description |
---|---|
currency | Currency value contains BTC, DOGE, ETH. |
limit | Set result limit. |
page | Page number (defaults to 1). |
Orders
Get information of specified order
curl --location --request GET "{APIv2_URL}/api/v2/order?id=<ID>" \
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"id": 4903,
"side": "buy",
"ord_type": "limit",
"price": "57026.0",
"avg_price": "0.0",
"state": "wait",
"market": "wavesusdt",
"created_at": "2021-12-10T09:28:59+03:00",
"volume": "0.0001",
"received": "0.0",
"remaining_volume": "0.0001",
"executed_volume": "0.0",
"trades_count": 0,
"trades": []
}
This endpoint returns informations of specific order.
HTTP Request
GET {APIv2_URL}/api/v2/order?id=<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID is an order id. |
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this request.
Create a Sell/Buy order
curl --location --request POST \
'{APIv2_URL}/api/v2/orders?market=btcusdt&side=sell&volume=0.005&price=51300' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"id": 7606,
"side": "sell",
"ord_type": "limit",
"price": "51300.0",
"avg_price": "0.0",
"state": "wait",
"market": "btcusdt",
"created_at": "2022-01-11T05:05:02+03:00",
"volume": "0.005",
"received": "0.0",
"remaining_volume": "0.005",
"executed_volume": "0.0",
"trades_count": 0
}
This endpoint allows you to buy and sell.
HTTP Request
POST {APIv2_URL}/api/v2/orders
Parameters
Parameter | Description |
---|---|
market | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
side | Either 'sell' or 'buy'. |
volume | The amount user want to sell/buy. An order could be partially executed, e.g. an order sell 5 btc can be matched with a buy 3 btc order, left 2 btc to be sold; in this case the order's volume would be '5.0', its remaining_volume would be '2.0', its executed volume is '3.0'. |
ord_type | Either 'limit' or 'market'. |
price | Price for each unit. e.g. If you want to sell/buy 1 btc at 3000 usd, the price is '3000.0' |
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this request.
Create multiple sell/buy orders
curl --location --request POST \
'{APIv2_URL}/api/v2/orders/multi' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...." \
-d market=btcusdt \
-d orders: [
{side: 'sell', volume: '0.005', price: '51300.0'},
{side: 'buy', volume: '0.005', price: '51200.0'}
]
The above command returns JSON structured like this:
{
"id": 7606,
"side": "sell",
"ord_type": "limit",
"price": "51300.0",
"avg_price": "0.0",
"state": "wait",
"market": "btcusdt",
"created_at": "2022-01-11T05:05:02+03:00",
"volume": "0.005",
"received": "0.0",
"remaining_volume": "0.005",
"executed_volume": "0.0",
"trades_count": 0
},
{
"id": 7607,
"side": "buy",
"ord_type": "limit",
"price": "51200.0",
"avg_price": "0.0",
"state": "wait",
"market": "btcusdt",
"created_at": "2022-01-11T05:05:03+03:00",
"volume": "0.005",
"received": "0.0",
"remaining_volume": "0.005",
"executed_volume": "0.0",
"trades_count": 0
}
This endpoint allows you to create multiple buy and sell orders.
HTTP Request
POST {APIv2_URL}/api/v2/orders/multi
Parameters
Parameter | Description |
---|---|
market | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
orders[side] | Either 'sell' or 'buy'. |
orders[volume] | The amount user want to sell/buy. An order could be partially executed, e.g. an order sell 5 btc can be matched with a buy 3 btc order, left 2 btc to be sold; in this case the order's volume would be '5.0', its remaining_volume would be '2.0', its executed volume is '3.0'. |
orders[ord_type] | Either 'limit' or 'market'. |
orders[price] | Price for each unit. e.g. If you want to sell/buy 1 btc at 3000 usd, the price is '3000.0' |
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this request.
Cancel an order
curl --location --request POST "{APIv2_URL}/api/v2/order/delete?id=<ID>" \
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
{
"id": 7607,
"side": "sell",
"ord_type": "limit",
"price": "51300.0",
"avg_price": "0.0",
"state": "wait",
"market": "btcusdt",
"created_at": "2022-01-11T05:44:38+03:00",
"volume": "0.005",
"received": "0.0",
"remaining_volume": "0.005",
"executed_volume": "0.0",
"trades_count": 0
}
This endpoint cancels a specific order.
HTTP Request
POST {APIv2_URL}/api/v2/order/delete?id=<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the wait order to cancel |
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this request.
Cancel multiple sell/buy orders
curl --location --request POST "{APIv2_URL}/api/v2/orders/clear?side=sell" \
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
The above command returns JSON structured like this:
[
{
"id": 4904,
"side": "sell",
"ord_type": "limit",
"price": "5000.0",
"avg_price": "5000.0",
"state": "wait",
"market": "ethusdt",
"created_at": "2021-12-13T14:33:16+03:00",
"volume": "0.005",
"received": "19.0",
"remaining_volume": "0.0012",
"executed_volume": "0.0038",
"trades_count": 2
},
]
This endpoint cancels all of sell or buy orders.
HTTP Request
POST {APIv2_URL}/api/v2/orders/clear?side=<SIDE>
URL Parameters
Parameter | Description |
---|---|
SIDE | The SIDE is either "buy" or "sell". |
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this request.
Trades
Get your executed trades
curl --location --request GET "{APIv2_URL}/api/v2/trades/my" \
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...." \
-d market=btcusdt
The above command returns JSON structured like this:
[
{
"id": 371434887,
"price": "43000.0",
"volume": "0.000841",
"funds": "36.163",
"market": "btcusdt",
"created_at": "2022-01-06T15:57:28+03:00",
"maker_type": "sell",
"type": "sell",
"order_id": 1520860395
},
]
This endpoint returns your executed trades. Trades are sorted in reverse creation order.
HTTP Request
GET {APIv2_URL}/api/v2/trades/my?market=btcusdt
Headers
Parameter | Default |
---|---|
Authorization | "Bearer (Token)" |
Authentication is required. Generate a new Bearer Token call this GET request.
URL Parameters
Parameter | Required | Description |
---|---|---|
market | Yes | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
limit | No | Limit the number of returned trades. Default to 50. |
timestamp | No | An integer represents the seconds elapsed since Unix epoch. If set, only trades executed before the time will be returned. |
from | No | Trade id. If set, only trades created after the trade will be returned. |
to | No | Trade id. If set, only trades created before the trade will be returned. |
order_by | No | If set, returned trades will be sorted in specific order, default to 'desc'. |
Get recent trades of specified market
curl --location --request GET "{APIv2_URL}/api/v2/trades" \
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...." \
-d market=btcusdt
The above command returns JSON structured like this:
[
{
"id": 371434887,
"price": "43000.0",
"volume": "0.000841",
"funds": "36.163",
"market": "btcusdt",
"created_at": "2022-01-06T15:57:28+03:00",
"maker_type": "sell",
"type": "sell",
"order_id": 1520860395
},
]
This endpoint returns recent trades on market, each trade is included only once. Trades are sorted in reverse creation order.
HTTP Request
GET {APIv2_URL}/api/v2/trades?market=btcusdt
URL Parameters
Parameter | Required | Description |
---|---|---|
market | Yes | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
limit | No | Limit the number of returned trades. Default to 50. |
timestamp | No | An integer represents the seconds elapsed since Unix epoch. If set, only trades executed before the time will be returned. |
from | No | Trade id. If set, only trades created after the trade will be returned. |
to | No | Trade id. If set, only trades created before the trade will be returned. |
order_by | No | If set, returned trades will be sorted in specific order, default to 'desc'. |
Markets
Get all available markets
curl --location --request GET "{APIv2_URL}/api/v2/markets"
The above command returns JSON structured like this:
[
{
"id": "btcusdt",
"name": "BTC/USDT",
"ask_precision": 8,
"bid_precision": 2,
"bid_unit": "usdt",
"ask_unit": "btc"
}
]
This endpoint returns all available markets.
HTTP Request
GET {APIv2_URL}/api/v2/markets
Tickers
Get ticker of all markets
curl --location --request GET "{APIv2_URL}/api/v2/tickers"
The above command returns JSON structured like this:
{
"btcusdt": {
"at": 1641877373,
"ticker": {
"buy": "42288.0",
"sell": "42290.0",
"low": "39680.0",
"high": "42376.0",
"open": 42190.0,
"last": "42290.0",
"volume": "35.647739",
"avg_price": "41528.47221914653320636889",
"price_change_percent": "+0.24%",
"vol": "35.647739",
"name": "BTC/USDT"
}
},
}
This endpoint returns ticker of all markets.
HTTP Request
GET {APIv2_URL}/api/v2/tickers
Get ticker of specific market
curl --location --request GET "{APIv2_URL}/api/v2/tickers/btcusdt"
The above command returns JSON structured like this:
{
"at": 1641877486,
"ticker": {
"buy": "42279.0",
"sell": "42290.0",
"low": "39680.0",
"high": "42376.0",
"open": 42180.0,
"last": "42280.0",
"volume": "35.68666",
"avg_price": "41528.47221914653320636889",
"price_change_percent": "+0.24%",
"name": "BTC/USDT",
"vol": "35.68666"
}
}
This endpoint returns ticker of specific market.
HTTP Request
GET {APIv2_URL}/api/v2/tickers/<market>
URL Parameters
Parameter | Description |
---|---|
market | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
Currencies
Get list of currencies
curl --location --request GET '{APIv2_URL}/api/v2/currencies'
The above command returns JSON structured like this:
[
{
"id": "ubu",
"enabled": true,
"disabled_deposit": false,
"disabled_withdraw": false,
"name": "UBU",
"symbol": "U",
"min_confirmations": 25,
"explorer_transaction": "https://etherscan.io/tx/#{txid}",
"explorer_address": "https://etherscan.io/address/#{address}",
"type": "coin",
"deposit_fee": "0.0",
"min_deposit_amount": "0.001",
"withdraw_fee": "1.0",
"min_withdraw_amount": "25.0",
"withdraw_limit_24h": "0.0",
"withdraw_limit_72h": "0.0",
"base_factor": 100000000,
"precision": 8
},
]
This endpoint retrieves list of currencies informations.
HTTP Request
GET {APIv2_URL}/api/v2/currencies
Get a specific currency
curl --location --request GET '{APIv2_URL}/api/v2/currencies/ubu'
The above command returns JSON structured like this:
{
"id": "ubu",
"enabled": true,
"disabled_deposit": false,
"disabled_withdraw": false,
"name": "UBU",
"symbol": "U",
"min_confirmations": 25,
"explorer_transaction": "https://etherscan.io/tx/#{txid}",
"explorer_address": "https://etherscan.io/address/#{address}",
"type": "coin",
"deposit_fee": "0.0",
"min_deposit_amount": "0.001",
"withdraw_fee": "1.0",
"min_withdraw_amount": "25.0",
"withdraw_limit_24h": "0.0",
"withdraw_limit_72h": "0.0",
"base_factor": 100000000,
"precision": 8
}
This endpoint retrieves specific currency informations.
HTTP Request
GET {APIv2_URL}/api/v2/currencies/ubu
Order Book
Get the order book of specified market
curl --location --request GET "{APIv2_URL}/api/v2/order_book?market=btcusdt"
The above command returns JSON structured like this:
{
"asks": [
{
"id": 7398,
"side": "sell",
"ord_type": "limit",
"price": "51068.0",
"avg_price": "51068.03",
"state": "wait",
"market": "btcusdt",
"created_at": "2021-12-24T17:25:35+03:00",
"volume": "0.07575671",
"received": "680.58777655",
"remaining_volume": "0.06242963",
"executed_volume": "0.01332708",
"trades_count": 6
}
],
"bids": [
{
"id": 7393,
"side": "buy",
"ord_type": "limit",
"price": "51063.0",
"avg_price": "51024.14",
"state": "wait",
"market": "btcusdt",
"created_at": "2021-12-24T17:25:30+03:00",
"volume": "0.00534645",
"received": "0.00242293",
"remaining_volume": "0.00292352",
"executed_volume": "0.00242293",
"trades_count": 3
}
]
}
This endpoint returns order book of specific pair.
HTTP Request
GET {APIv2_URL}/api/v2/order_book?market=btcusdt
URL Parameters
Parameter | Description |
---|---|
market | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
asks_limit | Limit the number of returned buy orders. Default to 20. |
bids_limit | Limit the number of returned buy orders. Default to 20. |
Depth
Get depth or specified market
curl --location --request GET "{APIv2_URL}/api/v2/depth?market=btcusdt"
The above command returns JSON structured like this:
{
"timestamp": 1641874540,
"asks": [
[
"51068.0",
"0.06242963"
]
],
"bids": [
[
"51063.0",
"0.00292352"
]
]
}
This endpoint returns depth or specified market. Both asks and bids are sorted from highest price to lowest.
HTTP Request
GET {APIv2_URL}/api/v2/depth?market=btcusdt
URL Parameters
Parameter | Description |
---|---|
market | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
limit | Limit the number of returned price levels. Default to 300. |
OHLC
Get OHLC(k line) of specific market
curl --location --request GET "{APIv2_URL}/api/v2/k?market=btcusdt"
The above command returns JSON structured like this:
[
[
1641880620,
42090.0,
42110.0,
42090.0,
42103.0,
0.0045
],
[
1641880680,
42108.0,
42121.0,
42108.0,
42111.0,
0.0052
],
[
1641880740,
42108.0,
42110.0,
42090.0,
42110.0,
0.0067
],
[
1641880800,
42110.0,
42120.0,
42089.0,
42089.0,
0.0268
],
[
1641880860,
42089.0,
42110.0,
42086.0,
42110.0,
0.0297
]
]
This endpoint returns OHLC(k line) of specific market.
HTTP Request
GET {APIv2_URL}/api/v2/k?market=btcusdt
URL Parameters
Parameter | Required | Description |
---|---|---|
market | Yes | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
limit | No | Limit the number of returned trades. Default to 30. |
period | No | Time period of K line, default to 1. You can choose between 1, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080 |
time_from | No | An integer represents the seconds elapsed since Unix epoch. If set, only k-line data after that time will be returned. |
time_to | No | An integer represents the seconds elapsed since Unix epoch. If set, only k-line data till that time will be returned. |
Get K data with pending trades
curl --location --request GET "{APIv2_URL}/api/v2/k_with_pending_trades" \
-d market=btcusdt \
-d trade_id=1641880620
The above command returns JSON structured like this:
{
"k": [
[
1641881100,
42140.0,
42160.0,
42140.0,
42140.0,
0.0156
],
[
1641881160,
42140.0,
42140.0,
42120.0,
42120.0,
0.0213
],
[
1641881220,
42120.0,
42130.0,
42120.0,
42120.0,
0.0047
]
],
"trades": [
{
"tid": 372694963,
"type": "buy",
"date": 1641882851,
"price": "42110.0",
"amount": "0.000075"
},
{
"tid": 372694964,
"type": "sell",
"date": 1641882851,
"price": "42100.0",
"amount": "0.0005"
}
]
}
This endpoint returns K data with pending trades, which are the trades not included in K data yet, because there's delay between trade generated and processed by K data generator.
HTTP Request
GET {APIv2_URL}/api/v2/k_with_pending_trades?market=btcusdt&trade_id=<ID>
URL Parameters
Parameter | Required | Description |
---|---|---|
market | Yes | Unique market id. It's always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'btcusd'. All available markets can be found at /api/v2/markets. |
trade_id | Yes | The trade id of the first trade you received. |
limit | No | Limit the number of returned trades. Default to 30. |
period | No | Time period of K line, default to 1. You can choose between 1, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080 |
time_from | No | An integer represents the seconds elapsed since Unix epoch. If set, only k-line data after that time will be returned. |
time_to | No | An integer represents the seconds elapsed since Unix epoch. If set, only k-line data till that time will be returned. |
Fees
Returns trading fees for markets
curl --location --request GET "{APIv2_URL}/api/v2/fees/trading"
The above command returns JSON structured like this:
[
{
"market": "btcusdt",
"ask_fee": {
"type": "relative",
"value": "0.002"
},
"bid_fee": {
"type": "relative",
"value": "0.002"
}
},
]
This endpoint returns trading fees for markets.
HTTP Request
GET {APIv2_URL}/api/v2/fees/trading
Returns deposit fees for currencies
curl --location --request GET "{APIv2_URL}/api/v2/fees/deposit"
The above command returns JSON structured like this:
[
{
"currency": "btc",
"type": "coin",
"fee": {
"type": "fixed",
"value": "0.0"
}
},
]
This endpoint returns deposit fees for currencies.
HTTP Request
GET {APIv2_URL}/api/v2/fees/deposit
Returns withdraw fees for currencies
curl --location --request GET "{APIv2_URL}/api/v2/fees/withdraw"
The above command returns JSON structured like this:
[
{
"currency": "btc",
"type": "coin",
"fee": {
"type": "fixed",
"value": "0.0006"
}
},
]
This endpoint returns withdraw fees for currencies.
HTTP Request
GET {APIv2_URL}/api/v2/fees/withdraw
Timestamp
Get server current time
curl --location --request GET "{APIv2_URL}/api/v2/timestamp"
The above command returns JSON structured like this:
{
"serverTime": 1641875314624
}
This endpoint returns server current time, in seconds since Unix epoch.
HTTP Request
GET {APIv2_URL}/api/v2/timestamp
Errors
The BitUBU API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your Bearer Token is wrong. |
404 | Not Found -- The specified requests could not be found. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |