-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New route to retrieve last trades on Binance (ie: historical data)
- Loading branch information
1 parent
e3ed5fa
commit 07c02f7
Showing
4 changed files
with
260 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
= Trades | ||
|
||
== Retrieves last trades for a given pair | ||
|
||
*GET* _/exchanges/binance/trades/{pair}_ | ||
|
||
Uses Binance _aggTrades_ API | ||
|
||
=== Url parameters | ||
|
||
[cols="1,1a,3a", options="header"] | ||
|=== | ||
|
||
|Name | ||
|Type | ||
|Description | ||
|
||
|{pair} | ||
|string | ||
|Pair to retrieve last trades for (_X-Y_) | ||
|
||
|=== | ||
|
||
=== Optional query parameters | ||
|
||
[cols="1,1a,1a,3a", options="header"] | ||
|=== | ||
|
||
|Name | ||
|Type | ||
|Default | ||
|Description | ||
|
||
|outputFormat | ||
|string (_custom_,_exchange_) | ||
|custom | ||
|If value is _exchange_ result returned by remote exchange will be returned untouched | ||
|
||
|afterTradeId | ||
|integer | ||
| | ||
|Only retrieve trades with an _id_ > _afterTradeId_ (will be ignored if _outputFormat_ is set to _exchange_) | ||
|
||
|=== | ||
|
||
[NOTE] | ||
==== | ||
Binance only allows to retrieve a maximum of 500 trades at once | ||
==== | ||
|
||
=== Result | ||
|
||
[NOTE] | ||
==== | ||
This only applies when _outputFormat_ is set to _custom_ | ||
==== | ||
|
||
Result will be an array of trade object (*the first one being the newest*) | ||
|
||
[cols="1,1a,3a", options="header"] | ||
|=== | ||
|Name | ||
|Type | ||
|Description | ||
|
||
|id | ||
|integer | ||
|Unique identifier of the trade | ||
|
||
|quantity | ||
|float | ||
|Quantity bougth/sold during the trade | ||
|
||
|rate | ||
|float | ||
|Per-unit price | ||
|
||
|price | ||
|float | ||
|Total price (_quantity_ * _rate_) | ||
|
||
|timestamp | ||
|integer (unix timestamp) | ||
|Unix timestamp when trade was executed | ||
|
||
|=== | ||
|
||
.Examples | ||
|
||
Example for *GET* _/exchanges/binance/trades/BTC-ETH_ | ||
|
||
[source,json] | ||
---- | ||
[ | ||
{ | ||
"id":1132933, | ||
"quantity":0.95, | ||
"rate":0.072699, | ||
"price":0.06906405, | ||
"timestamp":1505731777 | ||
}, | ||
{ | ||
"id":1132932, | ||
"quantity":1, | ||
"rate":0.072602, | ||
"price":0.072602, | ||
"timestamp":1505731693 | ||
}, | ||
{ | ||
"id":1132931, | ||
"quantity":20, | ||
"rate":0.072684, | ||
"price":1.4536799999999999, | ||
"timestamp":1505731638 | ||
}, | ||
{ | ||
"id":1132930, | ||
"quantity":0.951, | ||
"rate":0.072615, | ||
"price":0.069056865, | ||
"timestamp":1505731450 | ||
} | ||
] | ||
---- |