List Order Book
The method GET /order_book/
enables you to retrieve a list of all open orders in the specified book. The value of the aggregate
query parameter determines the response returned:
- True: The service aggregates the orders by price, and the response includes only the top 50 orders for each side of the book. It is the default behavior.
- False: The response consists of the whole order book.
HTTP Request
Query Parameters
You can use the following query parameters in your request:
Parameter | Description | Required | Default Value |
---|---|---|---|
aggregate | Specifies whether the response should aggregate orders by price. | No | true |
book | Specifies the book to use. | Yes |
JSON Response Payload
The endpoint returns a JSON object with Asks and Bids. Each of these is a JSON array of open orders, and each open order is represented as a JSON object. The response fields are as follows:
Field Name | Description | Type |
---|---|---|
asks | The list of open asks. | JSON array |
bids | The list of open bids. | JSON array |
sequence | An increasing integer value for each order book update. | Long |
updated_at | The date and time when the service last updated the order. | ISO 8601 timestamp |
Asks and Bids in the aggregated order books are JSON dictionaries with the following fields:
Field Name | Descriptiion | Type | Units |
---|---|---|---|
amount | The major amount in the order. | String | Major |
book | The order book symbol. | String | Major_Minor |
price | The price per unit of major. | String | Minor |
Asks and Bids in the unaggregated (whole) order books are JSON dictionaries with the following fields:
Field Name | Descriptiion | Type | Units |
---|---|---|---|
amount | The major amount in the order. | String | Major |
book | The order book symbol. | String | Major_Minor |
oid | The order's ID. | String | |
price | The price per unit of major. | String | Minor |
The following response objects exemplify the JSON objects returned:
curl https://api-stage.bitso.com/api/v3/order_book?book=btc_mxn
{
"success": true,
"payload": {
"asks": [{
"book": "btc_mxn",
"price": "5632.24",
"amount": "1.34491802"
},{
"book": "btc_mxn",
"price": "5633.44",
"amount": "0.4259"
},{
"book": "btc_mxn",
"price": "5642.14",
"amount": "1.21642"
}],
"bids": [{
"book": "btc_mxn",
"price": "6123.55",
"amount": "1.12560000"
},{
"book": "btc_mxn",
"price": "6121.55",
"amount": "2.23976"
}],
"updated_at": "2016-04-08T17:52:31.000+00:00",
"sequence": "27214"
}
}
curl "https://sandbox.bitso.com/api/v3/order_book/?book=btc_mxn&aggregate=false"
{
"success": true,
"payload": {
"asks": [{
"book": "btc_mxn",
"price": "5632.24",
"amount": "1.34491802",
"oid": "VN5lVpgXf02o6vJ6"
},{
"book": "btc_mxn",
"price": "5633.44",
"amount": "0.4259",
"oid": "RP8lVpgXf04o6vJ6"
},{
"book": "btc_mxn",
"price": "5642.14",
"amount": "1.21642",
"oid": "46efbiv72drbphig"
}],
"bids": [{
"book": "btc_mxn",
"price": "6123.55",
"amount": "1.12560000",
"oid": "11brtiv72drbphig"
},{
"book": "btc_mxn",
"price": "6121.55",
"amount": "2.23976",
"oid": "1ywri0yg8miihs80"
}],
"updated_at": "2016-04-08T17:52:31.000+00:00",
"sequence": "27214"
}
}
Updated 2 months ago