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
200OKOrderBookResponseObject ⛁The 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
200OKTradeResponseObject ⛁The 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
200OKCandleResponseObject ⛁The 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
200OKHistoricalFundingResponseObject ⛁The 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
200OKSparklineResponseObject ⛁The sparkline data.
400Bad RequestThe request was malformed or invalid.
API Example

Get Spot Markets

Retrieves spot markets. See Spot Markets for how they differ from perpetual markets.

Method Declaration

TypeScript
async getSpotMarkets(market?: string, limit?: number | null): Promise<SpotMarketsResponse>

Parameters

ParameterLocationTypeRequiredDescription
tickerqueryTickerfalseThe spot market ticker (BASE-QUOTE) to retrieve. If not provided, all are returned.
marketqueryTickerfalseAlias of ticker. Only one of the two may be provided.
limitqueryu32falseMaximum number of markets to return.

Response

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

Get Spot Market Orderbook

Retrieves the orderbook for a specific spot market. The response has the same shape as the perpetual orderbook; prices are in the quote asset and sizes in the base asset.

Method Declaration

Parameters

ParameterLocationTypeRequiredDescription
tickerpathTickertrueThe spot market ticker, e.g. MARTI-USDC.

Response

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

API Example

Get Spot Trades

Retrieves trades for a specific spot market.

Method Declaration

Parameters

ParameterLocationTypeRequiredDescription
tickerpathTickertrueThe spot market ticker, e.g. MARTI-USDC.
limitqueryu32falseThe maximum number of trades to retrieve.
createdBeforeOrAtHeightqueryHeightfalseReturn trades created at or before this block height.
createdBeforeOrAtqueryDateTimefalseReturn trades created at or before this time.
pagequeryu32falsePage number for paginated results.

Response

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

API Example

Get Spot Candles

Retrieves candle data for a specific spot market. Prices are in the quote asset; usdVolume is normalised to USD; startingOpenInterest is always zero for spot.

Method Declaration

Parameters

ParameterLocationTypeRequiredDescription
tickerpathTickertrueThe spot market ticker, e.g. MARTI-USDC.
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
200OKCandleResponseObject ⛁The candle data.
400Bad RequestThe request was malformed or invalid.

API Example