Cloud REST Open API v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
General Info
General API Information
- The base endpoint is: https://api.binance.th
- All endpoints return either a JSON object or array.
- Data is returned in ascending order. Oldest first, newest last.
- All time and timestamp related fields are in milliseconds.
HTTP Return Codes
- HTTP
4XX
return codes are used for malformed requests; the issue is on the sender's side. - HTTP
403
return code is used when the WAF Limit (Web Application Firewall) has been violated. - HTTP
429
return code is used when breaking a request rate limit. - HTTP
418
return code is used when an IP has been auto-banned for continuing to send requests after receiving429
codes. - HTTP
5XX
return codes are used for internal errors; the issue is on Server's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
Response fields description
Name | Type | Mandatory | Description |
---|---|---|---|
code | Number | Yes | Error Code,0 is success,else is fail |
msg | String | Yes | error message |
timestamp | Number | Yes | server timestamp |
data | Object | No | response data |
General Information on Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
endpoints, the parameters may be sent as aquery string
or in therequest body
with content typeapplication/x-www-form-urlencoded
. You may mix parameters between both thequery string
andrequest body
if you wish to do so. - Parameters may be sent in any order.
- If a parameter sent in both the
query string
andrequest body
, thebody string
parameter will be used.
LIMITS
General Info on Limits
- The following
intervalLetter
values for headers:- SECOND => S
- MINUTE => M
- HOUR => H
- DAY => D
intervalNum
describes the amount of the interval. For example,intervalNum
5 withintervalLetter
M means "Every 5 minutes".- A 429 will be returned when either rate limit is violated.
IP Limits
- Every request will contain
X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter)
in the response headers which has the current used weight for the IP for all request rate limiters defined. - Each route has a
weight
which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavierweight
. - When a 429 is received, it's your obligation as an API to back off and not spam the API.
- Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418).
- IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days.
- A
Retry-After
header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 418, to prevent a ban, or, in the case of a 429, until the ban is over. - The limits on the API are based on the IPs, not the API keys.
We recommend using the websocket for getting data as much as possible, as this will not count to the request rate limit.
Order Rate Limits
- Every successful order response will contain a
X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter)
header which has the current order count for the account for all order rate limiters defined. - Rejected/unsuccessful orders are not guaranteed to have
X-MBX-ORDER-COUNT-**
headers in the response. - The order rate limit is counted against each account.
Endpoint security type
- Each endpoint has a security type that determines the how you will interact with it. This is stated next to the NAME of the endpoint.
- If no security type is stated, assume the security type is NONE.
- API-keys are passed into the Rest API via the
X-MBX-APIKEY
header. - API-keys and secret-keys are case sensitive.
- API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for SIGNED only, while another API-key can access everything except for SIGNED routes.
- By default, API-keys can access all secure routes.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
USER_STREAM | Endpoint requires sending a valid API-Key. |
SIGNED | Endpoint requires sending a valid API-Key and signature. |
SIGNED Endpoint security
SIGNED
endpoints require an additional parameter,signature
, to be sent in thequery string
orrequest body
.- Endpoints use
HMAC SHA256
signatures. TheHMAC SHA256 signature
is a keyedHMAC SHA256
operation. Use yoursecretKey
as the key andtotalParams
as the value for the HMAC operation. - The
signature
is not case sensitive. totalParams
is defined as thequery string
concatenated with therequest body
.
Timing security
- A
SIGNED
endpoint also requires a parameter,timestamp
, to be sent which should be the millisecond timestamp of when the request was created and sent. - An additional parameter,
recvWindow
, may be sent to specify the number of milliseconds aftertimestamp
the request is valid for. IfrecvWindow
is not sent, it defaults to 5000. - The logic is as follows:
The logic is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
// process request
} else {
// reject request
}
Serious trading is about timing. Networks can be unstable and unreliable,
which can lead to requests taking varying amounts of time to reach the
servers. With recvWindow
, you can specify that the request must be
processed within a certain number of milliseconds or be rejected by the
server.
It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000!
SIGNED Endpoint Examples for POST /api/v1/order
Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo
, openssl
, and curl
.
Key | Value |
---|---|
apiKey | vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A |
secretKey | NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j |
Parameter | Value |
---|---|
symbol | LTCBTC |
side | BUY |
type | LIMIT |
timeInForce | GTC |
quantity | 1 |
price | 0.1 |
recvWindow | 5000 |
timestamp | 1499827319559 |
Example 1: As a request body
- requestBody:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 1: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
Example 1: curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.th/api/v1/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Example 2: As a query string
- queryString:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 2: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
Example 2: curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.th/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Example 3: Mixed query string and request body
- queryString:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
- requestBody:
quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
Example 3: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= 0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77
curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.th/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77'
Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1".
Public API Definitions
Terminology
base asset
refers to the asset that is thequantity
of a symbol.quote asset
refers to the asset that is theprice
of a symbol.
ENUM definitions
Order status (status):
Status | Description |
---|---|
NEW | The order has been accepted by the engine. |
PARTIALLY_FILLED | A part of the order has been filled. |
FILLED | The order has been completed. |
CANCELED | The order has been canceled by the user. |
REJECTED | The order was not accepted by the engine and not processed. |
EXPIRED | The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance) |
Order types (orderTypes, type):
- LIMIT
- MARKET
- STOP_LOSS(*)
- STOP_LOSS_LIMIT
- TAKE_PROFIT(*)
- TAKE_PROFIT_LIMIT
- LIMIT_MAKER(*)
Order Response Type (newOrderRespType):
- ACK
- RESULT
- FULL
Order side (side):
- BUY
- SELL
Time in force (timeInForce):
Status | Description |
---|---|
GTC | Good Til Canceled. An order will be on the book unless the order is canceled. |
IOC | Immediate Or Cancel. An order will try to fill the order as much as it can before the order expires. |
FOK | Fill or Kill. An order will expire if the full order cannot be filled upon execution. |
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
- 1m
- 3m
- 5m
- 15m
- 30m
- 1h
- 2h
- 4h
- 6h
- 8h
- 12h
- 1d
- 3d
- 1w
- 1M
Rate limiters (rateLimitType)
REQUEST_WEIGHT
ORDERS
RAW_REQUESTS
Rate limit intervals (interval)
- SECOND
- MINUTE
- DAY
Filters
Filters define trading rules on a symbol or an exchange.
Filters come in two forms: symbol filters
and exchange filters
.
Symbol Filters
PRICE_FILTER
The PRICE_FILTER
defines the price
rules for a symbol. There are 3 parts:
minPrice
defines the minimumprice
/stopPrice
allowed; disabled onminPrice
== 0.maxPrice
defines the maximumprice
/stopPrice
allowed; disabled onmaxPrice
== 0.tickSize
defines the intervals that aprice
/stopPrice
can be increased/decreased by; disabled ontickSize
== 0.
Any of the above variables can be set to 0, which disables that rule in the price filter
. In order to pass the price filter
, the following must be true for price
/stopPrice
of the enabled rules:
price
>=minPrice
price
<=maxPrice
- (
price
-minPrice
) %tickSize
== 0
/exchangeInfo format:
{
"filterType": "PRICE_FILTER",
"minPrice": "0.00000100",
"maxPrice": "100000.00000000",
"tickSize": "0.00000100"
}
PERCENT_PRICE
The PERCENT_PRICE
filter defines valid range for a price based on the average of the previous trades.
avgPriceMins
is the number of minutes the average price is calculated over. 0 means the last price is used.
In order to pass the percent price
, the following must be true for price
:
price
<=weightedAveragePrice
*multiplierUp
price
>=weightedAveragePrice
*multiplierDown
/exchangeInfo format:
{
"filterType": "PERCENT_PRICE",
"multiplierUp": "1.3000",
"multiplierDown": "0.7000",
"avgPriceMins": 5
}
LOT_SIZE
The LOT_SIZE
filter defines the quantity
(aka "lots" in auction terms) rules for a symbol. There are 3 parts:
minQty
defines the minimumquantity
/icebergQty
allowed.maxQty
defines the maximumquantity
/icebergQty
allowed.stepSize
defines the intervals that aquantity
/icebergQty
can be increased/decreased by.
In order to pass the lot size
, the following must be true for quantity
/icebergQty
:
quantity
>=minQty
quantity
<=maxQty
- (
quantity
-minQty
) %stepSize
== 0
/exchangeInfo format:
{
"filterType": "LOT_SIZE",
"minQty": "0.00100000",
"maxQty": "100000.00000000",
"stepSize": "0.00100000"
}
MIN_NOTIONAL
The MIN_NOTIONAL
filter defines the minimum notional value allowed for an order on a symbol.
An order's notional value is the price
* quantity
.
applyToMarket
determines whether or not the MIN_NOTIONAL
filter will also be applied to MARKET
orders.
Since MARKET
orders have no price, the average price is used over the last avgPriceMins
minutes.
avgPriceMins
is the number of minutes the average price is calculated over. 0 means the last price is used.
/exchangeInfo format:
{
"filterType": "MIN_NOTIONAL",
"minNotional": "0.00100000",
"applyToMarket": true,
"avgPriceMins": 5
}
ICEBERG_PARTS
The ICEBERG_PARTS
filter defines the maximum parts an iceberg order can have. The number of ICEBERG_PARTS
is defined as CEIL(qty / icebergQty)
.
/exchangeInfo format:
{
"filterType": "ICEBERG_PARTS",
"limit": 10
}
MARKET_LOT_SIZE
The MARKET_LOT_SIZE
filter defines the quantity
(aka "lots" in auction terms) rules for MARKET
orders on a symbol. There are 3 parts:
minQty
defines the minimumquantity
allowed.maxQty
defines the maximumquantity
allowed.stepSize
defines the intervals that aquantity
can be increased/decreased by.
In order to pass the market lot size
, the following must be true for quantity
:
quantity
>=minQty
quantity
<=maxQty
- (
quantity
-minQty
) %stepSize
== 0
/exchangeInfo format:
{
"filterType": "MARKET_LOT_SIZE",
"minQty": "0.00100000",
"maxQty": "100000.00000000",
"stepSize": "0.00100000"
}
MAX_NUM_ORDERS
The MAX_NUM_ORDERS
filter defines the maximum number of orders an account is allowed to have open on a symbol.
Note that both "algo" orders and normal orders are counted for this filter.
/exchangeInfo format:
{
"filterType": "MAX_NUM_ORDERS",
"limit": 25
}
MAX_NUM_ALGO_ORDERS(*)
The MAX_NUM_ALGO_ORDERS
filter defines the maximum number of "algo" orders an account is allowed to have open on a symbol.
"Algo" orders are STOP_LOSS
, STOP_LOSS_LIMIT
, TAKE_PROFIT
, and TAKE_PROFIT_LIMIT
orders.
/exchangeInfo format:
{
"filterType": "MAX_NUM_ALGO_ORDERS",
"maxNumAlgoOrders": 5
}
MAX_NUM_ICEBERG_ORDERS(*)
The MAX_NUM_ICEBERG_ORDERS
filter defines the maximum number of ICEBERG
orders an account is allowed to have open on a symbol.
An ICEBERG
order is any order where the icebergQty
is > 0.
/exchangeInfo format:
{
"filterType": "MAX_NUM_ICEBERG_ORDERS",
"maxNumIcebergOrders": 5
}
Exchange Filters
EXCHANGE_MAX_NUM_ORDERS
The MAX_NUM_ORDERS
filter defines the maximum number of orders an account is allowed to have open on the exchange.
Note that both "algo" orders and normal orders are counted for this filter.
EXCHANGE_MAX_NUM_ALGO_ORDERS(*)
The MAX_ALGO_ORDERS
filter defines the maximum number of "algo" orders an account is allowed to have open on the exchange.
"Algo" orders are STOP_LOSS
, STOP_LOSS_LIMIT
, TAKE_PROFIT
, and TAKE_PROFIT_LIMIT
orders.
Tips
The above are marked with "(*)" may NOT be supported by SITE
symbols.
General endpoints
Check Server Time
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/time \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/time HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/time", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/time',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/time', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/time', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/time");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/time", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/time
Test connectivity to the Rest API and get the current server time.
Weight(IP): 1
Example responses
200 Response
{ "serverTime": 1655374964469 }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Exchange Information
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/exchangeInfo \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/exchangeInfo HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/exchangeInfo", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/exchangeInfo',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/exchangeInfo', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/exchangeInfo', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/exchangeInfo");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/exchangeInfo", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/exchangeInfo
Current exchange trading rules and symbol information.
Weight(IP): 10
Example responses
200 Response
{
"timezone": "UTC",
"serverTime": 1565246363776,
"rateLimits": [{}],
"exchangeFilters": [],
"symbols": [
{
"symbol": "ETHBTC",
"status": "TRADING",
"baseAsset": "ETH",
"baseAssetPrecision": 8,
"quoteAsset": "BTC",
"quotePrecision": 8,
"quoteAssetPrecision": 8,
"baseCommissionPrecision": 8,
"quoteCommissionPrecision": 8,
"type": "GLOBAL",
"orderTypes": [
"LIMIT",
"LIMIT_MAKER",
"MARKET",
"STOP_LOSS_LIMIT",
"TAKE_PROFIT_LIMIT"
],
"filters": []
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Check Symbol Type
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/symbolType \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/symbolType HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/symbolType", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/symbolType',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/symbolType', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/symbolType', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/symbolType");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/symbolType", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/symbolType
Check Symbol Type, type will be GLOBAL or SITE.
Weight(IP): 1
Example responses
200 Response
[
{ "symbol": "BTCBUSD", "type": "GLOBAL" },
{ "symbol": "BTCUSDT", "type": "SITE" }
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Market Data endpoints
Symbol Order Book Ticker
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/ticker/bookTicker?symbol=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/ticker/bookTicker?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/ticker/bookTicker?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/ticker/bookTicker',
params: {
'symbol' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/ticker/bookTicker', params={
'symbol': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/ticker/bookTicker', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/ticker/bookTicker?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/ticker/bookTicker", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/ticker/bookTicker
Best price/qty on the order book for a symbol or symbols.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
Example responses
200 Response
{
"symbol": "ETHBTC",
"bidPrice": "0.07946700",
"bidQty": "9.00000000",
"askPrice": "100000.00000000",
"askQty": "1000.00000000"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Kline/Candlestick Data
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/klines?symbol=string&interval=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/klines?symbol=string&interval=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/klines?symbol=string&interval=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/klines',
params: {
'symbol' => 'string',
'interval' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/klines', params={
'symbol': 'string', 'interval': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/klines', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/klines?symbol=string&interval=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/klines", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/klines
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
interval | query | string | true | none |
startTime | query | long | false | none |
endTime | query | long | false | none |
limit | query | integer | false | Default 500; max 1000. |
Example responses
200 Response
[
[
1499040000000, // Open time
"0.01634790", // Open
"0.80000000", // High
"0.01575800", // Low
"0.01577100", // Close
"148976.11427815", // Volume
1499644799999, // Close time
"2434.19055334", // Quote asset volume
308, // Number of trades
"1756.87402397", // Taker buy base asset volume
"28.46694368" // Taker buy quote asset volume
]
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
24hr Ticker Price Change Statistics
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/ticker/24hr?symbol=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/ticker/24hr?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/ticker/24hr?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/ticker/24hr',
params: {
'symbol' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/ticker/24hr', params={
'symbol': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/ticker/24hr', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/ticker/24hr?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/ticker/24hr", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/ticker/24hr
24 hour rolling window price change statistics.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
Example responses
200 Response
{
"symbol": "BNBBTC",
"priceChange": "-94.99999800",
"priceChangePercent": "-95.960",
"weightedAvgPrice": "0.29628482",
"prevClosePrice": "0.10002000",
"lastPrice": "4.00000200",
"lastQty": "200.00000000",
"bidPrice": "4.00000000",
"bidQty": "100.00000000",
"askPrice": "4.00000200",
"askQty": "100.00000000",
"openPrice": "99.00000000",
"highPrice": "100.00000000",
"lowPrice": "0.10000000",
"volume": "8913.30000000",
"quoteVolume": "15.30000000",
"openTime": 1499783499040,
"closeTime": 1499869899040,
"firstId": 28385,
"lastId": 28460,
"count": 76
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Order Book
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/depth?symbol=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/depth?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/depth?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/depth',
params: {
'symbol' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/depth', params={
'symbol': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/depth', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/depth?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/depth", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/depth
Get Order Book.
Weight(IP):
Adjusted based on the limit:
Limit | Weight |
---|---|
1-100 | 1 |
101-500 | 5 |
501-1000 | 10 |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
limit | query | integer | false | Default 500; max 1000. |
Detailed descriptions
limit: Default 500; max 1000. If limit > 1000, then the response will truncate to 1000.
Example responses
200 Response
{
"lastUpdateId": 1027024,
"bids": [["4.00000000", "431.00000000"]],
"asks": [["4.00000200", "12.00000000"]]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Recent Trades List
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/trades?symbol=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/trades?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/trades?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/trades',
params: {
'symbol' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/trades', params={
'symbol': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/trades', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/trades?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/trades", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/trades
Get recent trades.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
limit | query | integer | false | Default 500; max 1000. |
Example responses
200 Response
[
{
"id": 28457,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"time": 1499865549590,
"isBuyerMaker": true,
"isBestMatch": true
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Compressed/Aggregate Trades List
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/aggTrades?symbol=string \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/aggTrades?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/aggTrades?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/aggTrades',
params: {
'symbol' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/aggTrades', params={
'symbol': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/aggTrades', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/aggTrades?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/aggTrades", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/aggTrades
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
fromId | query | long | false | id to get aggregate trades from INCLUSIVE. |
startTime | query | long | false | Timestamp in ms to get aggregate trades from INCLUSIVE. |
endTime | query | long | false | Timestamp in ms to get aggregate trades until INCLUSIVE. |
limit | query | integer | false | Default 500; max 1000. |
Example responses
200 Response
[
{
"a": 26129, // Aggregate tradeId
"p": "0.01633102", // Price
"q": "4.70443515", // Quantity
"f": 27781, // First tradeId
"l": 27781, // First tradeId
"T": 1498793709153, // Timestamp
"m": true // Was the buyer the maker?
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Symbol Price Ticker
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/ticker/price \
-H 'Accept: application/json'
GET https://api.binance.th/api/v1/ticker/price HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/ticker/price", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.binance.th/api/v1/ticker/price',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.binance.th/api/v1/ticker/price', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/ticker/price', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/ticker/price");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/ticker/price", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/ticker/price
Latest price for a symbol or symbols.
Weight(IP):
Parameter | Symbols Provided | Weight |
---|---|---|
symbol | 1 | 1 |
symbol parameter is omitted | 2 |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | false | none |
Example responses
200 Response
{ "symbol": "LTCBTC", "price": "4.01380200" }
OR
[
{
"symbol": "LTCBTC",
"price": "4.01380200"
},
{
"symbol": "ETHBTC",
"price": "0.07946600"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Account Endpoints
Account Information
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/account \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/account HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/account", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/account',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/account', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/account', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/account");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/account", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/account
Get current account information.
Weight(IP): 10
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"makerCommission": 15,
"takerCommission": 15,
"buyerCommission": 0,
"sellerCommission": 0,
"canTrade": true,
"canWithdraw": true,
"canDeposit": true,
"updateTime": 123456789,
"balances": [
{ "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" },
{ "asset": "LTC", "free": "4763368.68006011", "locked": "0.00000000" }
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Account Trade List
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/userTrades?symbol=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/userTrades?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/userTrades?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/userTrades',
params: {
'symbol' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/userTrades', params={
'symbol': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/userTrades', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/userTrades?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/userTrades", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/userTrades
Get trades for a specific account and symbol.
Weight(IP): 10
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
orderId | query | long | false | This can only be used in combination with symbol . |
startTime | query | long | false | none |
endTime | query | long | false | none |
fromId | query | long | false | TradeId to fetch from. Default gets most recent trades. |
limit | query | integer | false | Default 500; max 1000. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"symbol": "BNBBTC",
"id": 28457,
"orderId": 100234,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"commission": "10.10000000",
"commissionAsset": "BNB",
"time": 1499865549590,
"isBuyer": true,
"isMaker": false,
"isBestMatch": true
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Trade Fee
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/asset/tradeFee \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/asset/tradeFee HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/asset/tradeFee", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/asset/tradeFee',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/asset/tradeFee', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/asset/tradeFee', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/asset/tradeFee");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/asset/tradeFee", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/asset/tradeFee
Fetch trade fee.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | false | none |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"symbol": "ADABNB",
"makerCommission": "0.001",
"takerCommission": "0.001"
},
{ "symbol": "BNBBTC", "makerCommission": "0.001", "takerCommission": "0.001" }
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Order Endpoints
Query Order
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/order?symbol=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/order?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/order?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/order',
params: {
'symbol' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/order', params={
'symbol': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/order', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/order?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/order", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/order
Check an order's status.
Weight(IP): 2
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
orderId | query | long | false | none |
origClientOrderId | query | string | false | none |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"symbol": "LTCBTC",
"orderId": 1,
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cumulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"origQuoteOrderQty": "0.000000"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
New Order
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/order?symbol=string&side=string&type=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.binance.th/api/v1/order?symbol=string&side=string&type=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.binance.th/api/v1/order?symbol=string&side=string&type=string",
{
method: "POST",
headers: headers,
}
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.binance.th/api/v1/order',
params: {
'symbol' => 'string',
'side' => 'string',
'type' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.binance.th/api/v1/order', params={
'symbol': 'string', 'side': 'string', 'type': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/order', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/order?symbol=string&side=string&type=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/order", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/order
Send in a new order.
Weight(UID): 1 Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
side | query | string | true | none |
type | query | string | true | none |
timeInForce | query | string | false | none |
quantity | query | number | false | none |
quoteOrderQty | query | number | false | none |
price | query | number | false | none |
newClientOrderId | query | string | false | A unique id among open orders. Automatically generated if not sent. |
stopPrice | query | number | false | Used with STOP_LOSS , STOP_LOSS_LIMIT , TAKE_PROFIT , and TAKE_PROFIT_LIMIT orders. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"transactTime": 1507725176595,
"price": "0.00000000",
"origQty": "10.00000000",
"executedQty": "10.00000000",
"cumulativeQuoteQty": "10.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "SELL",
"fills": [
{
"price": "4000.00000000",
"qty": "1.00000000",
"commission": "4.00000000",
"commissionAsset": "USDT",
"tradeId": 56
},
{
"price": "3999.00000000",
"qty": "5.00000000",
"commission": "19.99500000",
"commissionAsset": "USDT",
"tradeId": 57
},
{
"price": "3998.00000000",
"qty": "2.00000000",
"commission": "7.99600000",
"commissionAsset": "USDT",
"tradeId": 58
},
{
"price": "3997.00000000",
"qty": "1.00000000",
"commission": "3.99700000",
"commissionAsset": "USDT",
"tradeId": 59
},
{
"price": "3995.00000000",
"qty": "1.00000000",
"commission": "3.99500000",
"commissionAsset": "USDT",
"tradeId": 60
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Delete order
Code samples
# You can also use wget
curl -X DELETE https://api.binance.th/api/v1/order?symbol=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
DELETE https://api.binance.th/api/v1/order?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/order?symbol=string", {
method: "DELETE",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.delete 'https://api.binance.th/api/v1/order',
params: {
'symbol' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.delete('https://api.binance.th/api/v1/order', params={
'symbol': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.binance.th/api/v1/order', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/order?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.binance.th/api/v1/order", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /api/v1/order
Cancel an active order.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
orderId | query | long | false | none |
origClientOrderId | query | string | false | none |
timestamp | query | long | true | none |
recvWindow | query | long | false | none |
signature | query | string | false | none |
Example responses
200 Response
{
"symbol": "LTCBTC",
"origClientOrderId": "myOrder1",
"orderId": 4,
"price": "2.00000000",
"origQty": "1.00000000",
"executedQty": "0.00000000",
"cumulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
All Orders
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/allOrders?symbol=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/allOrders?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/allOrders?symbol=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/allOrders',
params: {
'symbol' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/allOrders', params={
'symbol': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/allOrders', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/allOrders?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/allOrders", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/allOrders
Get all account orders; active, canceled, or filled.
Weight(IP): 10 with symbol
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | none |
orderId | query | long | false | none |
startTime | query | long | false | none |
endTime | query | long | false | none |
limit | query | integer | false | Default 500; max 1000. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"symbol": "LTCBTC",
"orderId": 1,
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cumulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"origQuoteOrderQty": "0.000000"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Current Open Orders
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/openOrders \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/openOrders HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/openOrders", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/openOrders',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/openOrders', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/openOrders', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/openOrders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/openOrders", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/openOrders
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight(IP): 3 for a single symbol; 40 when the symbol parameter is omitted;
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | false | none |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"symbol": "LTCBTC",
"orderId": 1,
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cumulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"origQuoteOrderQty": "0.000000"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Cancel all Open Orders on Symbols
Code samples
# You can also use wget
curl -X DELETE https://api.binance.th/api/v1/openOrders?symbol=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
DELETE https://api.binance.th/api/v1/openOrders?symbol=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/openOrders?symbol=string", {
method: "DELETE",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.delete 'https://api.binance.th/api/v1/openOrders',
params: {
'symbol' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.delete('https://api.binance.th/api/v1/openOrders', params={
'symbol': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.binance.th/api/v1/openOrders', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/openOrders?symbol=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.binance.th/api/v1/openOrders", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /api/v1/openOrders
Cancels all active orders on a symbol or symbols.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
symbol | query | string | true | symbols, eg: BTCUSDT,BTCBUSD |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "code": 200, "msg": "The operation of cancel all open order is done." }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Wallet Endpoints
Withdraw
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/capital/withdraw?coin=string&address=string&amount=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.binance.th/api/v1/capital/withdraw?coin=string&address=string&amount=0 HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.binance.th/api/v1/capital/withdraw?coin=string&address=string&amount=0",
{
method: "POST",
headers: headers,
}
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.binance.th/api/v1/capital/withdraw',
params: {
'coin' => 'string',
'address' => 'string',
'amount' => 'number',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.binance.th/api/v1/capital/withdraw', params={
'coin': 'string', 'address': 'string', 'amount': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/capital/withdraw', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/capital/withdraw?coin=string&address=string&amount=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/capital/withdraw", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/capital/withdraw
Submit a withdraw request.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
coin | query | string | true | none |
withdrawOrderId | query | string | false | Client's custom ID for withdraw order, Server does not check it's uniqueness. Automatically generated if not sent. |
network | query | string | false | none |
address | query | string | true | none |
addressTag | query | string | false | Secondary address identifier for coins like XRP,XMR etc. |
amount | query | number | true | none |
transactionFeeFlag | query | boolean | false | When making internal transfer, true for returning the fee to the destination account; false for returning the fee back to the departure account. Default false . |
name | query | string | false | Description of the address. Space in name should be encoded into %20 . |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "id": "7213fea8e94b4a5593d507237e5a555b" }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
User deposit address
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/capital/deposit/address?coin=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/capital/deposit/address?coin=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/capital/deposit/address?coin=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/capital/deposit/address',
params: {
'coin' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/capital/deposit/address', params={
'coin': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/capital/deposit/address', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/capital/deposit/address?coin=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/capital/deposit/address", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/capital/deposit/address
Fetch deposit address with network.
Weight(IP): 10
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
coin | query | string | true | none |
network | query | string | false | none |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv",
"coin": "BTC",
"tag": "",
"url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
User deposit history
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/capital/deposit/history \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/capital/deposit/history HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/capital/deposit/history", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/capital/deposit/history',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/capital/deposit/history', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/capital/deposit/history', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/capital/deposit/history");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/capital/deposit/history", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/capital/deposit/history
Fetch deposit history.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
coin | query | string | false | none |
txId | query | string | false | none |
status | query | integer | false | 0(0:pending,6: credited but cannot withdraw, 1:success) |
startTime | query | long | false | Default: 90 days from current timestamp |
endTime | query | long | false | Default: present timestamp |
offset | query | integer | false | Default:0 |
limit | query | integer | false | Default 100; max 1000. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"id": "1",
"amount": "0.00999800",
"coin": "PAXG",
"network": "ETH",
"status": 1,
"address": "0x788cabe9236ce061e5a892e1a59395a81fc8d62c",
"addressTag": "",
"txId": "0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3",
"insertTime": 1599621997000,
"transferType": 0,
"confirmTimes": "12/12"
},
{
"id": "2",
"amount": "0.50000000",
"coin": "IOTA",
"network": "IOTA",
"status": 1,
"address": "SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW",
"addressTag": "",
"txId": "ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999",
"insertTime": 1599620082000,
"transferType": 0,
"confirmTimes": "1/1"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
User withdraw history
Code samples
# You can also use wget
curl -X GET https://api.binance.th/api/v1/capital/withdraw/history \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.binance.th/api/v1/capital/withdraw/history HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/capital/withdraw/history", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.binance.th/api/v1/capital/withdraw/history',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.binance.th/api/v1/capital/withdraw/history', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.binance.th/api/v1/capital/withdraw/history', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/capital/withdraw/history");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.binance.th/api/v1/capital/withdraw/history", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/capital/withdraw/history
Fetch withdraw history.
Weight(IP): 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
coin | query | string | false | none |
withdrawOrderId | query | string | false | client id for withdraw |
status | query | integer | false | 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed) |
offset | query | integer | false | none |
limit | query | integer | false | Default 100; max 1000. |
startTime | query | long | false | Default: 90 days from current timestamp |
endTime | query | long | false | Default: present timestamp |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60",
"amount": "8.91000000",
"applyTime": "2019-10-12 11:12:02",
"coin": "USDT",
"id": "1",
"withdrawOrderId": "WITHDRAWtest123",
"network": "ETH",
"transferType": 0,
"status": 6,
"transactionFee": "0.004",
"confirmNo": 3,
"info": "The address is not valid. Please confirm with the recipient",
"txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"
},
{
"address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB",
"amount": "0.00150000",
"applyTime": "2019-09-24 12:43:45",
"coin": "BTC",
"id": "2",
"withdrawOrderId": "WITHDRAWtest123",
"network": "BTC",
"status": 6,
"transactionFee": "0.004",
"transferType": 0,
"confirmNo": 2,
"info": "",
"txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Websocket Market Streams
General WSS information
- There are two base endpoints,
symbols with typeGLOBAL
: wss://www.binance.th/stream
symbols with typeSITE
: wss://stream-th.2meta.app/stream - To find symbol type, either by
Check Symbol Type(GET /api/v1/symbolType)
orExchange Information(GET /api/v1/exchangeInfo)
- Streams can be accessed in a combined stream
- Combined streams are accessed at ?streams=<streamName1>/<streamName2>/<streamName3>
- Combined stream events are wrapped as follows: {"stream":"<streamName>","data":<rawPayload>}
- All symbols for streams are lowercase
- A single connection to either of the base endpoints is only valid for 24 hours; expect to be disconnected at the 24 hour mark
- The websocket server will send a
ping frame
every 3 minutes. If the websocket server does not receive apong frame
back from the connection within a 10 minute period, the connection will be disconnected. Unsolicitedpong frames
are allowed.
Websocket Limits
- WebSocket connections have a limit of 5 incoming messages per second. A message is considered:
- A PING frame
- A PONG frame
- A JSON controlled message (e.g. subscribe, unsubscribe)
- A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned.
- A single connection can listen to a maximum of 1024 streams.
Live Subscribing/Unsubscribing to streams
- The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below.
- The
id
used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. - In the response, if the
result
received isnull
this means the request sent was a success for non-query requests (e.g. Subscribing/Unsubscribing).
Subscribe to a stream
Request
{
"method": "SUBSCRIBE",
"params": [
"btcusdt@aggTrade",
"btcusdt@depth"
],
"id": 1
}
Response
{
"result": null,
"id": 1
}
Unsubscribe to a stream
Request
{
"method": "UNSUBSCRIBE",
"params": [
"btcusdt@depth"
],
"id": 312
}
Response
{
"result": null,
"id": 312
}
Listing Subscriptions
Request
{
"method": "LIST_SUBSCRIPTIONS",
"id": 3
}
Response
{
"result": [
"btcusdt@aggTrade"
],
"id": 3
}
Setting Properties
Currently, the only property that can be set is whether combined
stream payloads are enabled or not.
The combined property is set to true
when connecting using ?streams=
.
Request
{
"method": "SET_PROPERTY",
"params": [
"combined",
true
],
"id": 5
}
Response
{
"result": null,
"id": 5
}
Retrieving Properties
Request
{
"method": "GET_PROPERTY",
"params": [
"combined"
],
"id": 2
}
Response
{
"result": true, // Indicates that combined is set to true.
"id": 2
}
Error Messages
Error Message | Description |
---|---|
{"code": 0, "msg": "Unknown property","id": %s} | Parameter used in the SET_PROPERTY or GET_PROPERTY was invalid |
{"code": 1, "msg": "Invalid value type: expected Boolean"} | Value should only be true or false |
{"code": 2, "msg": "Invalid request: property name must be a string"} | Property name provided was invalid |
{"code": 2, "msg": "Invalid request: request ID must be an unsigned integer"} | Parameter id had to be provided or the value provided in the id parameter is an unsupported type |
{"code": 2, "msg": "Invalid request: unknown variant %s, expected one of SUBSCRIBE , UNSUBSCRIBE , LIST_SUBSCRIPTIONS , SET_PROPERTY , GET_PROPERTY at line 1 column 28"} |
Possible typo in the provided method or provided method was neither of the expected values |
{"code": 2, "msg": "Invalid request: too many parameters"} | Unnecessary parameters provided in the data |
{"code": 2, "msg": "Invalid request: property name must be a string"} | Property name was not provided |
{"code": 2, "msg": "Invalid request: missing field method at line 1 column 73"} |
method was not provided in the data |
{"code":3,"msg":"Invalid JSON: expected value at line %s column %s"} | JSON data sent has incorrect syntax. |
Aggregate Trade Streams
The Aggregate Trade Streams push trade information that is aggregated for a single taker order.
Stream Name: <symbol>@aggTrade
Update Speed: Real-time
Payload:
{
"e": "aggTrade", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"a": 12345, // Aggregate trade ID
"p": "0.001", // Price
"q": "100", // Quantity
"f": 100, // First trade ID
"l": 105, // Last trade ID
"T": 123456785, // Trade time
"m": true, // Is the buyer the market maker?
"M": true // Ignore
}
Trade Streams
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
Stream Name: <symbol>@trade
Update Speed: Real-time
Payload:
{
"e": "trade", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"t": 12345, // Trade ID
"p": "0.001", // Price
"q": "100", // Quantity
"b": 88, // Buyer order ID
"a": 50, // Seller order ID
"T": 123456785, // Trade time
"m": true, // Is the buyer the market maker?
"M": true // Ignore
}
Kline/Candlestick Streams
The Kline/Candlestick Stream push updates to the current klines/candlestick every second.
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
- 1m
- 3m
- 5m
- 15m
- 30m
- 1h
- 2h
- 4h
- 6h
- 8h
- 12h
- 1d
- 3d
- 1w
- 1M
Stream Name: <symbol>@kline_<interval>
Update Speed: 2000ms
Payload:
{
"e": "kline", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"k": {
"t": 123400000, // Kline start time
"T": 123460000, // Kline close time
"s": "BNBBTC", // Symbol
"i": "1m", // Interval
"f": 100, // First trade ID
"L": 200, // Last trade ID
"o": "0.0010", // Open price
"c": "0.0020", // Close price
"h": "0.0025", // High price
"l": "0.0015", // Low price
"v": "1000", // Base asset volume
"n": 100, // Number of trades
"x": false, // Is this kline closed?
"q": "1.0000", // Quote asset volume
"V": "500", // Taker buy base asset volume
"Q": "0.500", // Taker buy quote asset volume
"B": "123456" // Ignore
}
}
Individual Symbol Mini Ticker Stream
24hr rolling window mini-ticker statistics. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
Stream Name: <symbol>@miniTicker
Update Speed: 1000ms
Payload:
{
"e": "24hrMiniTicker", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"c": "0.0025", // Close price
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"v": "10000", // Total traded base asset volume
"q": "18" // Total traded quote asset volume
}
All Market Mini Tickers Stream
24hr rolling window mini-ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: !miniTicker@arr
Update Speed: 1000ms
Payload:
[
{
// Same as <symbol>@miniTicker payload
},
];
Individual Symbol Ticker Streams
24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
Stream Name: <symbol>@ticker
Update Speed: 1000ms
Payload:
{
"e": "24hrTicker", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"p": "0.0015", // Price change
"P": "250.00", // Price change percent
"w": "0.0018", // Weighted average price
"x": "0.0009", // First trade(F)-1 price (first trade before the 24hr rolling window)
"c": "0.0025", // Last price
"Q": "10", // Last quantity
"b": "0.0024", // Best bid price
"B": "10", // Best bid quantity
"a": "0.0026", // Best ask price
"A": "100", // Best ask quantity
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"v": "10000", // Total traded base asset volume
"q": "18", // Total traded quote asset volume
"O": 0, // Statistics open time
"C": 86400000, // Statistics close time
"F": 0, // First trade ID
"L": 18150, // Last trade Id
"n": 18151 // Total number of trades
}
All Market Tickers Stream
24hr rolling window ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: !ticker@arr
Update Speed: 1000ms
Payload:
[
{
// Same as <symbol>@ticker payload
},
];
Individual Symbol Rolling Window Statistics Streams
Rolling window ticker statistics for a single symbol, computed over multiple windows.
Stream Name: <symbol>@ticker_<window_size>
Window Sizes: 1h,4h
Update Speed: 1000ms
Note: This stream is different from the <symbol>@ticker stream.
The open time "O"
always starts on a minute, while the closing time "C"
is the current time of the update.
As such, the effective window might be up to 59999ms wider that <window_size>.
Payload:
{
"e": "1hTicker", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"p": "0.0015", // Price change
"P": "250.00", // Price change percent
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"c": "0.0025", // Last price
"w": "0.0018", // Weighted average price
"v": "10000", // Total traded base asset volume
"q": "18", // Total traded quote asset volume
"O": 0, // Statistics open time
"C": 86400000, // Statistics close time
"F": 0, // First trade ID
"L": 18150, // Last trade Id
"n": 18151 // Total number of trades
}
All Market Rolling Window Statistics Streams
Rolling window ticker statistics for all market symbols, computed over multiple windows. Note that only tickers that have changed will be present in the array.
Stream Name: !ticker_<window-size>@arr
Window Size: 1h,4h
Update Speed: 1000ms
Payload:
[
{
// Same as <symbol>@ticker_<window-size> payload,
// one for each symbol updated within the interval.
},
];
Individual Symbol Book Ticker Streams
Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.
Stream Name: <symbol>@bookTicker
Update Speed: Real-time
Payload:
{
"u":400900217, // order book updateId
"s":"BNBUSDT", // symbol
"b":"25.35190000", // best bid price
"B":"31.21000000", // best bid qty
"a":"25.36520000", // best ask price
"A":"40.66000000" // best ask qty
}
All Book Tickers Stream
Pushes any update to the best bid or ask's price or quantity in real-time for all symbols.
Stream Name: !bookTicker
Update Speed: Real-time
Payload:
{
// Same as <symbol>@bookTicker payload
}
Partial Book Depth Streams
Top <levels> bids and asks, pushed every second. Valid <levels> are 5, 10, or 20.
Stream Names: <symbol>@depth<levels> OR <symbol>@depth<levels>@100ms
Update Speed: 1000ms or 100ms
Payload:
{
"lastUpdateId": 160, // Last update ID
"bids": [ // Bids to be updated
[
"0.0024", // Price level to be updated
"10" // Quantity
]
],
"asks": [ // Asks to be updated
[
"0.0026", // Price level to be updated
"100" // Quantity
]
]
}
Diff. Depth Stream
Order book price and quantity depth updates used to locally manage an order book.
Stream Name: <symbol>@depth OR <symbol>@depth@100ms
Update Speed: 1000ms or 100ms
Payload:
{
"e": "depthUpdate", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"U": 157, // First update ID in event
"u": 160, // Final update ID in event
"b": [ // Bids to be updated
[
"0.0024", // Price level to be updated
"10" // Quantity
]
],
"a": [ // Asks to be updated
[
"0.0026", // Price level to be updated
"100" // Quantity
]
]
}
How to manage a local order book correctly
- Open a stream to wss://www.binance.th/stream?streams=bnbbtc@depth.
- Buffer the events you receive from the stream.
- Get a depth snapshot from https://api.binance.th/api/v1/depth?symbol=BNBBTC&limit=1000.
- Drop any event where
u
is <=lastUpdateId
in the snapshot. - The first processed event should have
U
<=lastUpdateId
+1 ANDu
>=lastUpdateId
+1. - While listening to the stream, each new event's
U
should be equal to the previous event'su
+1. - The data in each event is the absolute quantity for a price level.
- If the quantity is 0, remove the price level.
- Receiving an event that removes a price level that is not in your local order book can happen and is normal.
Note: Due to depth snapshots having a limit on the number of price levels, a price level outside of the initial snapshot that doesn't have a quantity change won't have an update in the Diff. Depth Stream. Consequently, those price levels will not be visible in the local order book even when applying all updates from the Diff. Depth Stream correctly and cause the local order book to have some slight differences with the real order book. However, for most use cases the depth limit of 5000 is enough to understand the market and trade effectively.
User Data Streams
- The base API endpoint is: https://api.binance.th
- A User Data Stream
listenKey
is valid for 60 minutes after creation. - Doing a
PUT
on an activelistenKey
will extend its validity for 60 minutes. - Doing a
DELETE
on an activelistenKey
will close the stream and invalidate thelistenKey
. - Doing a
POST
on an account with an activelistenKey
will return the currently activelistenKey
and extend its validity for 60 minutes. - The base websocket endpoint is: wss://www.binance.th/stream or wss://stream-th.2meta.app/stream.
- User Data Streams are accessed at ?streams=<listenKey>.
- A single connection to websocket endpoint is only valid for 24 hours; expect to be disconnected at the 24 hour mark.
Payload: Account Update
outboundAccountPosition
is sent any time an account balance has changed and contains the assets that were possibly changed by the event that generated the balance change.
Payload
{
"e": "outboundAccountPosition", //Event type
"E": 1564034571105, //Event Time
"u": 1564034571073, //Time of last account update
"B": [ //Balances Array
{
"a": "ETH", //Asset
"f": "10000.000000", //Free
"l": "0.000000" //Locked
}
]
}
Payload: Balance Update
Balance Update occurs during the following: * Deposits or withdrawals from the account * Transfer of funds between accounts (e.g. Spot to Margin)
Payload
{
"e": "balanceUpdate", //Event Type
"E": 1573200697110, //Event Time
"a": "BTC", //Asset
"d": "100.00000000", //Balance Delta
"T": 1573200697068 //Clear Time
}
Payload: Order Update
Orders are updated with the executionReport
event.
Check the Rest API Documentation and below for relevant enum definitions.
Average price can be found by doing Z
divided by z
.
Payload
{
"e": "executionReport", // Event type
"E": 1499405658658, // Event time
"s": "ETHBTC", // Symbol
"c": "mUvoqJxFIILMdfAW5iGSOW", // Client order ID
"S": "BUY", // Side
"o": "LIMIT", // Order type
"f": "GTC", // Time in force
"q": "1.00000000", // Order quantity
"p": "0.10264410", // Order price
"P": "0.00000000", // Stop price
"d": 4, // Trailing Delta; This is only visible if the order was a trailing stop order.
"F": "0.00000000", // Iceberg quantity
"g": -1, // OrderListId
"C": null, // Original client order ID; This is the ID of the order being canceled
"x": "NEW", // Current execution type
"X": "NEW", // Current order status
"r": "NONE", // Order reject reason; will be an error code.
"i": 4293153, // Order ID
"l": "0.00000000", // Last executed quantity
"z": "0.00000000", // Cumulative filled quantity
"L": "0.00000000", // Last executed price
"n": "0", // Commission amount
"N": null, // Commission asset
"T": 1499405658657, // Transaction time
"t": -1, // Trade ID
"I": 8641984, // Ignore
"w": true, // Is the order on the book?
"m": false, // Is this trade the maker side?
"M": false, // Ignore
"O": 1499405658657, // Order creation time
"Z": "0.00000000", // Cumulative quote asset transacted quantity
"Y": "0.00000000", // Last quote asset transacted quantity (i.e. lastPrice * lastQty)
"Q": "0.00000000" // Quote Order Qty
}
Execution types:
- NEW - The order has been accepted into the engine.
- CANCELED - The order has been canceled by the user.
- REPLACED (currently unused)
- REJECTED - The order has been rejected and was not processed. (This is never pushed into the User Data Stream)
- TRADE - Part of the order or all of the order's quantity has filled.
- EXPIRED - The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance)
If the order is an OCO, an event will be displayed named ListStatus
in addition to the executionReport
event.
Payload
{
"e": "listStatus", //Event Type
"E": 1564035303637, //Event Time
"s": "ETHBTC", //Symbol
"g": 2, //OrderListId
"c": "OCO", //Contingency Type
"l": "EXEC_STARTED", //List Status Type
"L": "EXECUTING", //List Order Status
"r": "NONE", //List Reject Reason
"C": "F4QN4G8DlFATFlIUQ0cjdD", //List Client Order ID
"T": 1564035303625, //Transaction Time
"O": [ //An array of objects
{
"s": "ETHBTC", //Symbol
"i": 17, // orderId
"c": "AJYsMjErWJesZvqlJCTUgL" //ClientOrderId
},
{
"s": "ETHBTC",
"i": 18,
"c": "bfYPSQdLoqAJeNrOr9adzq"
}
]
}
Ping/Keep-alive a ListenKey (USER_STREAM)
Code samples
# You can also use wget
curl -X PUT https://api.binance.th/api/v1/listenKey?listenKey=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
PUT https://api.binance.th/api/v1/listenKey?listenKey=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/listenKey?listenKey=string", {
method: "PUT",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.put 'https://api.binance.th/api/v1/listenKey',
params: {
'listenKey' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.put('https://api.binance.th/api/v1/listenKey', params={
'listenKey': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','https://api.binance.th/api/v1/listenKey', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/listenKey?listenKey=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://api.binance.th/api/v1/listenKey", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /api/v1/listenKey
Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes.
Weight: 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
listenKey | query | string | true | listenKey for type GLOBAL, do NOT send SITE listenKey. |
Example responses
200 Response
{}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Create a ListenKey (USER_STREAM)
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/listenKey \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.binance.th/api/v1/listenKey HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/listenKey", {
method: "POST",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.binance.th/api/v1/listenKey',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.binance.th/api/v1/listenKey', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/listenKey', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/listenKey");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/listenKey", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/listenKey
Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
Weight: 1
Example responses
200 Response
[
{
"listenKey": "lLBRlEH3xXdarJHdAk3kq7yCjaLsA82eAvuYUUxVTHuJkE8bBQHcz6gOKlmQ",
"type": "GLOBAL"
},
{
"listenKey": "QCUKUrYt7LflXQbi9bG6M1NxIaEPe4OhFNTgEYdfACyeutE81zGofPHw2BMrFGEl",
"type": "SITE"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Close a ListenKey (USER_STREAM)
Code samples
# You can also use wget
curl -X DELETE https://api.binance.th/api/v1/listenKey?listenKey=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
DELETE https://api.binance.th/api/v1/listenKey?listenKey=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.binance.th/api/v1/listenKey?listenKey=string", {
method: "DELETE",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.delete 'https://api.binance.th/api/v1/listenKey',
params: {
'listenKey' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.delete('https://api.binance.th/api/v1/listenKey', params={
'listenKey': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.binance.th/api/v1/listenKey', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/listenKey?listenKey=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.binance.th/api/v1/listenKey", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /api/v1/listenKey
Close out a user data stream.
Weight: 1
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
listenKey | query | string | true | listenKey for type GLOBAL, do NOT send SITE listenKey. |
Example responses
200 Response
{}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Kyc Endpoints
Cloud user bind info
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo?openId=string&bizEntityKey=string \
-H 'Accept: application/json'
POST https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo?openId=string&bizEntityKey=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch(
"https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo?openId=string&bizEntityKey=string",
{
method: "POST",
headers: headers,
}
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post 'https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo',
params: {
'openId' => 'string',
'bizEntityKey' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo', params={
'openId': 'string', 'bizEntityKey': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo?openId=string&bizEntityKey=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/inner/oauth/queryOauthBindInfo", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/inner/oauth/queryOauthBindInfo
Get the user bind info of site and cloud.
Weight(IP): 10
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
openId | query | string | true | The openId of .com oauth |
bizEntityKey | query | string | true | The userId of cloud |
Example responses
200 Response
{\n "brokerAccountId": "123",\n "openId": "A456"\n "userId": "789"\n}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Kyc status
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/inner/getCloudKycStatus?openId=string&bizEntityKey=string \
-H 'Accept: application/json'
POST https://api.binance.th/api/v1/inner/getCloudKycStatus?openId=string&bizEntityKey=string HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch(
"https://api.binance.th/api/v1/inner/getCloudKycStatus?openId=string&bizEntityKey=string",
{
method: "POST",
headers: headers,
}
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post 'https://api.binance.th/api/v1/inner/getCloudKycStatus',
params: {
'openId' => 'string',
'bizEntityKey' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('https://api.binance.th/api/v1/inner/getCloudKycStatus', params={
'openId': 'string', 'bizEntityKey': 'string'
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/inner/getCloudKycStatus', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/inner/getCloudKycStatus?openId=string&bizEntityKey=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/inner/getCloudKycStatus", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/inner/getCloudKycStatus
Get current account kyc status.
Weight(IP): 10
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
openId | query | string | true | The openId of .com oauth |
bizEntityKey | query | string | true | The userId of cloud |
Example responses
200 Response
{\n"kycPass":true\n}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
get all asset
Code samples
# You can also use wget
curl -X POST https://api.binance.th/api/v1/inner/getAllAsset \
-H 'Accept: application/json'
POST https://api.binance.th/api/v1/inner/getAllAsset HTTP/1.1
Host: api.binance.th
Accept: application/json
const headers = {
Accept: "application/json",
};
fetch("https://api.binance.th/api/v1/inner/getAllAsset", {
method: "POST",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post 'https://api.binance.th/api/v1/inner/getAllAsset',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('https://api.binance.th/api/v1/inner/getAllAsset', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.binance.th/api/v1/inner/getAllAsset', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.binance.th/api/v1/inner/getAllAsset");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.binance.th/api/v1/inner/getAllAsset", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/inner/getAllAsset
get all asset.
Weight(IP): 10
Example responses
200 Response
{\n"assetCode":"BNB"\n"assetName":"BNB"}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |