Skip to content

Commit c788ac3

Browse files
authored
Add optional symbol parameter to futuresPrices (#608)
* Add optional symbol parameter to futuresPrices * Revert README.md change
1 parent 6e9e3e2 commit c788ac3

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,12 +829,16 @@ console.log(await client.futuresDailyStats({ symbol: 'ETHBTC' }))
829829

830830
#### futures prices
831831

832-
Latest price for all symbols.
832+
Latest price for symbol, not providing a symbol will return latest price for all symbols and is resource-expensive.
833833

834834
```js
835835
console.log(await client.futuresPrices())
836836
```
837837

838+
| Param | Type | Required |
839+
| ------ | ------ | -------- |
840+
| symbol | String | false |
841+
838842
<details>
839843
<summary>Output</summary>
840844

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ declare module 'binance-api-node' {
591591
limit?: number
592592
}): Promise<FuturesUserTradeResult[]>
593593
futuresDailyStats(options?: { symbol: string }): Promise<DailyStatsResult | DailyStatsResult[]>
594-
futuresPrices(): Promise<{ [index: string]: string }>
594+
futuresPrices(options?: { symbol: string }): Promise<{ [index: string]: string }>
595595
futuresAllBookTickers(): Promise<{ [key: string]: Ticker }>
596596
futuresMarkPrice(): Promise<MarkPriceResult[]>
597597
futuresAllForceOrders(options?: {

src/http-client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ export default opts => {
469469
futuresTrades: payload =>
470470
checkParams('trades', payload, ['symbol']) && pubCall('/fapi/v1/trades', payload),
471471
futuresDailyStats: payload => pubCall('/fapi/v1/ticker/24hr', payload),
472-
futuresPrices: () =>
473-
pubCall('/fapi/v1/ticker/price').then(r =>
472+
futuresPrices: payload =>
473+
pubCall('/fapi/v1/ticker/price', payload).then(r =>
474474
(Array.isArray(r) ? r : [r]).reduce((out, cur) => ((out[cur.symbol] = cur.price), out), {}),
475475
),
476476
futuresAllBookTickers: () =>

0 commit comments

Comments
 (0)