* Gets the ticker price via WebSocket API (JSON-RPC) * @param {string} symbol - single symbol * @param {string[]} symbols - array of symbols * @param {object} options - additional options (e.g. symbolStatus) * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-
(symbol?: string, symbols?: string[], options: Dict = {})
| 3925 | * @return {promise} - resolves with ticker price data |
| 3926 | */ |
| 3927 | async tickerPrice(symbol?: string, symbols?: string[], options: Dict = {}): Promise<any> { |
| 3928 | if (symbol && symbols) { |
| 3929 | throw new Error('Cannot specify both symbol and symbols parameters'); |
| 3930 | } |
| 3931 | |
| 3932 | const connectionId = 'marketData'; |
| 3933 | await this.ensureWsApiConnection(connectionId); |
| 3934 | |
| 3935 | const params: Dict = { ...options }; |
| 3936 | if (symbol) params.symbol = symbol; |
| 3937 | if (symbols) params.symbols = symbols; |
| 3938 | |
| 3939 | return this.sendWsApiRequest(connectionId, 'ticker.price', params); |
| 3940 | } |
| 3941 | |
| 3942 | /** |
| 3943 | * Ensures a WebSocket API connection is open for the given connectionId |
no test coverage detected