Exchange Module
8.1 Get All Tickers
get_all_tickersfrom crypto_com_developer_platform_client import Exchange tickers = Exchange.get_all_tickers() print(tickers)
A list of all available tickers and their information.ValueError: If the Exchange class is not initialized with a Client instance.{'status': 'Success', 'data': [{'instrumentName': 'example-intrument-name', 'high': example-high, 'low': example-low, 'lastPrice': example-last-price, 'volume': example-volume, 'volumeValue': example-volume-value, 'priceChange': example-price-change, 'bestBid': example-best-bid, 'bestAsk': example-best-ask, 'openInterest': example-open-interest, 'timestamp': example-timestamp}, ...]}
getAllTickersimport { Exchange } from '@crypto.com/developer-platform-client'; try { const tickers = await Exchange.getAllTickers(); console.log(tickers); } catch(err) { console.log(err); }
{Promise<ApiResponse<TickerResponse>>}: A promise that resolves to all available tickers.{Error}: Throws an error if the request fails.{ status: 'Success', data: [ { instrumentName: example-name, high: example-high, low: example-low, lastPrice: example-last-price, volume: example-volume, volumeValue: example-volume-value, priceChange: example-price-change, bestBid: example-best-bit, bestAsk: example-best-ask, openInterest: example-open-interest, timestamp: example-timestamp } ... ] }
8.2 Get Ticker By Instrument
get_ticker_by_instrumentinstrument_name (str): The name of the instrument to get ticker information for.from crypto_com_developer_platform_client import Exchange ticker = Exchange.get_ticker_by_instrument('example-instrument') print(ticker)
Ticker information for the specified instrument.ValueError: If instrument_name is None or empty.{'status': 'Success', 'data': {'instrumentName': 'example-intrument-name', 'high': example-high, 'low': example-low, 'lastPrice': example-last-price, 'volume': example-volume, 'volumeValue': example-volume-value, 'priceChange': example-price-change, 'bestBid': example-best-bid, 'bestAsk': example-best-ask, 'openInterest': example-open-interest, 'timestamp': example-timestamp}}
getTickerByInstrument{string} instrumentName: The name of the trading instrument (e.g., 'BTC_USDT')import { Exchange } from '@crypto.com/developer-platform-client'; try { const btcTicker = await Exchange.getTickerByInstrument('BTC_USDT'); console.log(btcTicker); } catch(err) { console.log(err); }
{Promise<ApiResponse<TickerData>>}: A promise that resolves to the ticker information.{Error}: Throws an error if the request fails.{ status: 'Success', data: { instrumentName: example-name, high: example-high, low: example-low, lastPrice: example-last-price, volume: example-volume, volumeValue: example-volume-value, priceChange: example-price-change, bestBid: example-best-bid, bestAsk: example-best-ask, openInterest: example-open-interest, timestamp: example-timestamp } }
Last updated
Was this helpful?