Skip to content

Commit

Permalink
Add exchangeInfo route
Browse files Browse the repository at this point in the history
Closes #16.
  • Loading branch information
balthazar committed Jan 3, 2018
1 parent 2641e8a commit a3b52e3
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Following examples will use the `await` form, but that's totally up to you.
- [Public REST Endpoints](#public-rest-endpoints)
- [ping](#ping)
- [time](#time)
- [exchangeInfo](#exchangeinfo)
- [book](#book)
- [candles](#candles)
- [aggTrades](#aggtrades)
Expand Down Expand Up @@ -92,6 +93,68 @@ console.log(await client.time())

</details>

#### exchangeInfo

Get the current exchange trading rules and symbol information.

```js
console.log(await client.exchangeInfo())
```

<details>
<summary>Output</summary>

```js
{
"timezone": "UTC",
"serverTime": 1508631584636,
"rateLimits": [
{
"rateLimitType": "REQUESTS",
"interval": "MINUTE",
"limit": 1200
},
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"limit": 10
},
{
"rateLimitType": "ORDERS",
"interval": "DAY",
"limit": 100000
}
],
"exchangeFilters": [],
"symbols": [{
"symbol": "ETHBTC",
"status": "TRADING",
"baseAsset": "ETH",
"baseAssetPrecision": 8,
"quoteAsset": "BTC",
"quotePrecision": 8,
"orderTypes": ["LIMIT", "MARKET"],
"icebergAllowed": false,
"filters": [{
"filterType": "PRICE_FILTER",
"minPrice": "0.00000100",
"maxPrice": "100000.00000000",
"tickSize": "0.00000100"
}, {
"filterType": "LOT_SIZE",
"minQty": "0.00100000",
"maxQty": "100000.00000000",
"stepSize": "0.00100000"
}, {
"filterType": "MIN_NOTIONAL",
"minNotional": "0.00100000"
}]
}]
}
```

</details>

#### book

Get the order book for a symbol.
Expand Down
1 change: 1 addition & 0 deletions src/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export default opts => {
return {
ping: () => publicCall('/v1/ping').then(() => true),
time: () => publicCall('/v1/time').then(r => r.serverTime),
exchangeInfo: () => publicCall('/v1/exchangeInfo'),

book,
aggTrades,
Expand Down
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ test.serial('[REST] time', async t => {
t.truthy(new Date(ts).getTime() > 0, 'The returned timestamp should be valid')
})

test.serial('[REST] exchangeInfo', async t => {
const res = await client.exchangeInfo()
checkFields(t, res, ['timezone', 'serverTime', 'rateLimits', 'symbols'])
})

test.serial('[REST] book', async t => {
try {
await client.book()
Expand Down

0 comments on commit a3b52e3

Please sign in to comment.