MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / tickerPrice

Method tickerPrice

src/node-binance-api.ts:3927–3940  ·  view source on GitHub ↗

* 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 = {})

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

ensureWsApiConnectionMethod · 0.95
sendWsApiRequestMethod · 0.95

Tested by

no test coverage detected