Skip to content

Market Service

Igor Sazonov edited this page Mar 9, 2026 · 1 revision

The MarketService is your gateway to the vast amount of market data available through the BingX API. It provides a comprehensive set of methods for retrieving real-time and historical data for both futures and spot markets.

Accessing the Service

To begin using the MarketService, you first need to access it through your BingXClient instance:

from bingx import BingXClient

client = BingXClient(api_key="YOUR_API_KEY", api_secret="YOUR_API_SECRET")
market_service = client.market()

Core Functionalities

The MarketService is organized into several key functionalities, each providing access to a specific type of market data.

Symbol and Price Information

This set of methods allows you to retrieve information about trading pairs and their current prices.

Method Description
get_futures_symbols() Retrieves all available futures/swap symbols.
get_spot_symbols() Retrieves all available spot trading symbols.
get_latest_price(symbol) Gets the latest price for a futures symbol.
get_spot_latest_price(symbol) Gets the latest price for a spot symbol.
get_24hr_ticker(symbol) Retrieves 24-hour ticker statistics for futures.
get_spot_24hr_ticker(symbol) Retrieves 24-hour ticker statistics for spot.

Order Book and Candlestick Data

These methods provide access to the order book and historical candlestick data, which are essential for technical analysis and trading strategy development.

Method Description
get_depth(symbol, limit) Retrieves the market depth for futures.
get_spot_depth(symbol, limit) Retrieves the market depth for spot.
get_klines(symbol, interval, ...) Retrieves candlestick data for futures.
get_spot_klines(symbol, interval, ...) Retrieves candlestick data for spot.

Advanced Market Data

For more advanced analysis, the MarketService provides access to a variety of other market data points.

Method Description
get_funding_rate_history(symbol, limit) Retrieves the historical funding rates.
get_mark_price(symbol) Gets the current mark price.
get_aggregate_trades(symbol, limit) Retrieves recent aggregate trades for futures.
get_recent_trades(symbol, limit) Retrieves recent individual trades for futures.
get_top_long_short_ratio(symbol, period) Gets the top trader long/short ratio.

Quote API

The Quote API provides a set of optimized endpoints for retrieving market data with lower latency.

Method Description
get_contracts() Retrieves all contract specifications.
get_quote_depth(symbol, limit) Gets the order book via the optimized Quote API.
get_book_ticker(symbol) Retrieves the best bid/ask prices.
get_quote_ticker(symbol) Retrieves the 24-hour ticker via the Quote API.
get_quote_funding_rate(symbol) Retrieves the funding rate via the Quote API.
get_quote_open_interest(symbol) Retrieves open interest via the Quote API.

Clone this wiki locally