Table of Contents generated with DocToc
The base endpoint is: wss://apiws.p2pb2b.com/
Connection will be closed by server in cause of inactivity after 100 seconds.
JSON Structure of request message:
{"method":"method_name","params":[arg_1, arg_2, arg_n],"id":arbitrary_integer}
Params: None
Request example:
{"method":"server.ping","params":[],"id":1}
Response example:
{
"error":null,
"result":"pong",
"id":1
}
Request example:
{"method":"server.time","params":[],"id":1}
Response example:
{
"error": null,
"result": 1657618658, //time in seconds since 1970-01-01
"id": 2
}
Params: market, limit, interval
Name | Type | Mandatory | Description |
---|---|---|---|
market | String | Yes | Markets for subscribe |
limit | Integer | Yes | The value cannot be less than 1 and more than 100 |
interval | String | Yes | Valid values: 0, 0.00000001, 0.0000001, 0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1. Interval of precision for order. |
Request example:
{"method":"depth.subscribe","params":["BTC_USDT", 10, "0"],"id":1}
Update message example:
{
"method": "depth.update",
"params": [
false, // true - all records, false - new records
{
"asks": [ // side
[
"19509.81", // price
"0.277" // amount
]
]
},
"BTC_USDT"
],
"id": null
}
- the "true" flag sends each 60 seconds
- the "false" flag sends each 1 second
Params: none
Request example:
{"method":"depth.unsubscribe","params":[],"id":1}
Params: market1, market2, ...
Name | Type | Mandatory | Description |
---|---|---|---|
market | String | Yes | Markets for subscribe. Subscription is possible for several markets in single-stream |
Request example:
{"method":"price.subscribe","params":["ETH_BTC", "BTC_USDT", "ETH_BUSD"],"id":1}
Update message example:
{
"method": "price.update",
"params": [
"ETH_BTC", //market
"0.053836" //last price
],
"id": null
}
Params: none
Request example:
{"method":"price.unsubscribe","params":[],"id":1}
Params: market, period
Name | Type | Mandatory | Description |
---|---|---|---|
market | String | Yes | Market for subscribe. Subscription is possible for single market in single-stream |
period | Integer | Yes | Kline/Candlestick chart intervals: 900, 1800, 3600, 86400 in seconds |
Request example:
{"method":"kline.subscribe","params":["ETH_BTC", 3600],"id":1}
Update message example:
{
"method": "kline.update",
"params": [
[
1657648800, // Kline start time
"0.054146", // Kline open price
"0.053938", // Kline close price (current price)
"0.054146", // Kline high price
"0.053911", // Kline low price
"596.4674", // Volume for stock currency
"32.2298758767", // Volume for money currency
"ETH_BTC" // Market
]
],
"id": null
}
Params: none
Request example:
{"method":"kline.unsubscribe","params":[],"id":1}
Market statistic for last 24 hours
Params: market1, market2, ...
Name | Type | Mandatory | Description |
---|---|---|---|
market | String | Yes | Markets for subscribe. Subscription is possible for several markets in single-stream |
Request example:
{"method":"state.subscribe","params":["ETH_BTC", "BTC_USDT", "ETH_BUSD"],"id":1}
Update message example:
{
"method": "state.update",
"params": [
"ETH_BTC",
{
"high": "0.055774", // High price for the last 24h
"close": "0.053679", // Close price for the last 24h
"low": "0.053462", // Low price for the last 24h
"period": 86400, // Period 24h
"last": "0.053679", // Last price for the last 24h
"volume": "38463.6132", // Stock volume for the last 24h
"open": "0.055682", // Open price for the last 24h
"deal": "2091.0038055314" // Money volume for the last 24h
}
],
"id": null
}
Params: none
Request example:
{"method":"state.unsubscribe","params":[],"id":1}
Params: market1, market2, ...
Name | Type | Mandatory | Description |
---|---|---|---|
market | String | Yes | Markets for subscribe. |
Request example:
{"method":"deals.subscribe","params":["ETH_BTC", "BTC_USDT", "ETH_BUSD"],"id":1}
Update message example:
{
"method": "deals.update",
"params": [
"ETH_BTC",
[
{
"id": 4503032979, // Order_id
"amount": "0.103",
"type": "sell", // Side
"time": 1657661950.8487639, // Creation time
"price": "0.05361"
},
{
"id": 4503032978,
"amount": "0.522",
"type": "sell",
"time": 1657661950.8460829,
"price": "0.05361"
}
]
],
"id": null
}
Params: none
Request example:
{"method":"deals.unsubscribe","params":[],"id":1}