Skip to content

Markets

TODO: How to access to the accounts space.

Python
market = indexer_client.markets()

Get Perpetual Markets

Retrieves perpetual markets.

Method Declaration

Python
def get_perpetual_markets(self, market: str = None) -> Response
Unification Plan
  • Add alias for the return type in Rust: PerpetualMarketsMap

Parameters

ParameterLocationTypeRequiredDescription
marketqueryTickerfalseThe specific market ticker to retrieve. If not provided, all markets are returned.
limitqueryu32falseMaximum number of asset positions to return in the response.

Response

StatusMeaningSchemaDescription
200OKPerpetualMarketMapThe perpetual markets data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe market was not found.
API Example

Get Perpetual Market Orderbook

Retrieves the orderbook for a specific perpetual market.

Method Declaration

Python
async def get_perpetual_market_orderbook(
    self,
    market: str,
) -> dict

Parameters

ParameterLocationTypeRequiredDescription
marketpathTickertrueThe market ticker.

Response

StatusMeaningSchemaDescription
200OKOrderBookResponseObjectThe orderbook data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe market was not found.

API Example

Get Trades

Retrieves trades for a specific perpetual market.

Method Declaration

Python
async def get_perpetual_market_trades(
    self,
    market: str,
    starting_before_or_at_height: Optional[int] = None,
    limit: Optional[int] = None,
) -> dict

Parameters

ParameterLocationTypeRequiredDescription
marketpathTickertrueThe market ticker.
limitqueryu32falseThe maximum number of trades to retrieve.
startingBeforeOrAtHeightqueryHeightfalseThe block height to start retrieving trades from.

Response

StatusMeaningSchemaDescription
200OKTradeResponseObjectThe trades data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe market was not found.

API Example

Get Candles

Retrieves candle data for a specific perpetual market.

Method Declaration

Python
async def get_perpetual_market_candles(
    self,
    market: str,
    resolution: str,
    from_iso: Optional[str] = None,
    to_iso: Optional[str] = None,
    limit: Optional[int] = None,
) -> dict

Parameters

ParameterLocationTypeRequiredDescription
marketpathTickertrueThe market ticker.
resolutionqueryCandleResolutiontrueThe candle resolution (e.g., "1DAY", "1HOUR", "1MIN").
limitqueryu32falseThe maximum number of candles to retrieve.
fromISOqueryDateTimefalseThe start timestamp in ISO format.
toISOqueryDateTimefalseThe end timestamp in ISO format.

Response

StatusMeaningSchemaDescription
200OKCandleResponseObjectThe candle data.
400Bad RequestThe request was malformed or invalid.

API Example

Get Historical Funding

Retrieves historical funding rates for a specific perpetual market.

Method Declaration

Python
async def get_perpetual_market_historical_funding(
    self,
    market: str,
    effective_before_or_at: Optional[str] = None,
    effective_before_or_at_height: Optional[int] = None,
    limit: Optional[int] = None,
) -> dict

Parameters

ParameterLocationTypeRequiredDescription
marketpathTickertrueThe market ticker.
limitqueryu32falseThe maximum number of funding rates to retrieve.
effectiveBeforeOrAtqueryDateTimefalseThe timestamp to retrieve funding rates effective before or at.
effectiveBeforeOrAtHeightqueryHeightfalseThe block height to retrieve funding rates effective before or at.

Response

StatusMeaningSchemaDescription
200OKHistoricalFundingResponseObjectThe historical funding rates data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe market was not found.

API Example

Get Sparklines

Retrieves sparkline data for perpetual markets.

Method Declaration

Python
async def get_perpetual_market_sparklines(
    self,
    period: str = TimePeriod.ONE_DAY
) -> dict

Parameters

ParameterLocationTypeRequiredDescription
timePeriodquerySparklineTimePeriodtrueThe time period for the sparkline data (e.g., "ONE_DAY", "SEVEN_DAYS").

Response

StatusMeaningSchemaDescription
200OKSparklineResponseObjectThe sparkline data.
400Bad RequestThe request was malformed or invalid.
API Example