Public API

BonsBit provides HTTP APIs for interacting with the exchange only for public market data.

 

 

The HTTP API allows read access to public market data through the public endpoint -

Public HTTP Endpoint:https://yourdomain.com/api/public

 

returnTicker

Retrieves summary information for each currency/coin pair listed on the exchange.

Ticker Endpoint:https://yourdomain.com/api/public?command=returnTicker

Field Description
last Execution price for the most recent trade for this pair.
change Price change percentage.
high24hr The highest execution price for this pair within thec last 24 hours.
low24hr The lowest execution price for this pair within the last 24 hours.
baseVolume Base units traded in the last 24 hours.
tradeVolume trade units traded in the last 24 hours.
 
 
 
 
Example:
 { "BTC_USD": { "last": "8180.000000000", "low24hr": "8183.00000000", "high24hr": "10369.00000000", "change": "5.99", "tradeVolume": "614.24470018", "baseVolume": "5694762.62500284" }, "DOGE_BTC": { "last": "0.000000200", "low24hr": "0.000000190", "high24hr": "0.000000210", "change": "10.58", "tradeVolume": "1614.24470018", "baseVolume": "4694762.62500284" } }

 

 

Retrieving summary information for a specified currency/coin pair listed on the exchange -

 

Request Parameter Description
tradePair A pair like BTC_USD

 

Ticker Endpoint:https://yourdomain.com/api/public?command=returnTicker&tradePair=BTC_USD

 

 

 
 
Example:
 { "last": "8180.000000000", "low24hr": "8183.00000000", "high24hr": "10369.00000000", "change": "5.99", "tradeVolume": "614.24470018", "baseVolume": "5694762.62500284" }

 

returnOrderBook

Retrieves the latest 50 order book of each order type information for a specified currency/coin pair listed on the exchange

Order book Endpoint:https://yourdomain.com/public?command=returnOrderBook&tradePair=BTC_USD

 

 
Input Fields:
tradePair A pair like BTC_ETH
 
 
Out Fields:
Field Description
asks An array of price aggregated offers in the book ordered from low to high price.
bids An array of price aggregated bids in the book ordered from high to low price.
 
 
Example:
 { "asks": [ { "price": "0.09000000", "amount": "500.00000000", "total": "45.00000000" }, { "price": "0.11000000", "amount": "700.00000000", "total": "77.00000000" } ... ], "bids": [ { "price": "0.10000000", "amount": "700.00000000", "total": "70.00000000" }, { "price": "0.09000000", "amount": "500.00000000", "total": "45.00000000" } ... ] }

 

returnTradeHistory

Returns the past 100 trades for a given market, You may set a range specified in UNIX timestamps by the “start” and “end” GET parameters.

Trade History Endpoint:https://yourdomain.com/public?command=returnTradeHistory&tradePair=BTC_USD

Trade History Endpoint:https://yourdomain.com/public?command=returnTradeHistory&tradePair=BTC_USD&start=1593419220&end=1593423660

 
 
 
Input Fields:
Request Parameter Description
tradePair A pair like BTC_ETH
start (optional) The start of the window in seconds since the unix epoch.
end (optional) The end of the window in seconds since the unix epoch.
 
 
 
Out Fields:
Field Description
date The UTC date and time of the trade execution.
type Designates this trade as a buy or a sell from the side of the taker.
price The price in base currency for this asset.
amount The number of units transacted in this trade.
total The total price in base units for this trade.
 
 
 
Example:
 [ { "price": "9860.86031280", "amount": "0.85441089", "total": "8425.22643602", "type": "buy", "date": "2020-06-29 10:03:00" }, { "price": "9862.25325181", "amount": "0.15549235", "total": "1533.50493441", "type": "sell", "date": "2020-06-29 10:02:00" }, ... ]

 

returnChartData

Returns candlestick chart data. Required GET parameters are tradePair, (candlestick period in seconds; valid values are 300, 900, 1800, 7200, 14400, and 86400), start, and end. Start and end are given in UNIX timestamp format and used to specify the date range for the data returned. Fields include:

Chart Data Endpoint:https://yourdomain.com/public?command=returnChartData&tradePair=BTC_USD&interval=900&start=1546300800&end=1546646400

 
Input Fields:
Request Parameter Description
tradePair The currency pair of the market being requested.
interval Candlestick period/interval in seconds. Valid values are 300, 900, 1800, 7200, 14400, and 86400.
start The start of the window in seconds since the unix epoch.
end The end of the window in seconds since the unix epoch.
 
 
 
Out Fields:
Field Description
date The UTC date for this candle in miliseconds since the Unix epoch.
high The highest price for this asset within this candle.
low The lowest price for this asset within this candle.
open The price for this asset at the start of the candle.
close The price for this asset at the end of the candle.
volume The total amount of this asset transacted within this candle.
 
 
 
Example:
 [ { "date": 1593396900, "low": "10112.27439575", "high": "10115.44996344", "volume": "1.54063724", "open": "10115.44996344", "close": "10112.27439575" }, { "date": 1593397800, "low": "10061.35948383", "high": "10112.27439575", "volume": "6.88096652", "open": "10112.27439575", "close": "10061.35948383" }, ... ]