Markets
TODO: How to access to the accounts space.
market = indexer_client.markets()Get Perpetual Markets
Retrieves perpetual markets.
Method Declaration
def get_perpetual_markets(self, market: str = None) -> ResponseUnification Plan
- Add alias for the return type in Rust:
PerpetualMarketsMap
Parameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
market | query | Ticker | false | The specific market ticker to retrieve. If not provided, all markets are returned. |
limit | query | u32 | false | Maximum number of asset positions to return in the response. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | PerpetualMarketMap | The perpetual markets data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
Get Perpetual Market Orderbook
Retrieves the orderbook for a specific perpetual market.
Method Declaration
async def get_perpetual_market_orderbook(
self,
market: str,
) -> dictParameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
market | path | Ticker | true | The market ticker. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | OrderBookResponseObject ⛁ | The orderbook data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
API Example
Get Trades
Retrieves trades for a specific perpetual market.
Method Declaration
async def get_perpetual_market_trades(
self,
market: str,
starting_before_or_at_height: Optional[int] = None,
limit: Optional[int] = None,
) -> dictParameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
market | path | Ticker | true | The market ticker. |
limit | query | u32 | false | The maximum number of trades to retrieve. |
startingBeforeOrAtHeight | query | Height | false | The block height to start retrieving trades from. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | TradeResponseObject ⛁ | The trades data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
API Example
Get Candles
Retrieves candle data for a specific perpetual market.
Method Declaration
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,
) -> dictParameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
market | path | Ticker | true | The market ticker. |
resolution | query | CandleResolution | true | The candle resolution (e.g., "1DAY", "1HOUR", "1MIN"). |
limit | query | u32 | false | The maximum number of candles to retrieve. |
fromISO | query | DateTime | false | The start timestamp in ISO format. |
toISO | query | DateTime | false | The end timestamp in ISO format. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | CandleResponseObject ⛁ | The candle data. |
400 | Bad Request | The request was malformed or invalid. |
API Example
Get Historical Funding
Retrieves historical funding rates for a specific perpetual market.
Method Declaration
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,
) -> dictParameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
market | path | Ticker | true | The market ticker. |
limit | query | u32 | false | The maximum number of funding rates to retrieve. |
effectiveBeforeOrAt | query | DateTime | false | The timestamp to retrieve funding rates effective before or at. |
effectiveBeforeOrAtHeight | query | Height | false | The block height to retrieve funding rates effective before or at. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | HistoricalFundingResponseObject ⛁ | The historical funding rates data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
API Example
Get Sparklines
Retrieves sparkline data for perpetual markets.
Method Declaration
async def get_perpetual_market_sparklines(
self,
period: str = TimePeriod.ONE_DAY
) -> dictParameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
timePeriod | query | SparklineTimePeriod | true | The time period for the sparkline data (e.g., "ONE_DAY", "SEVEN_DAYS"). |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | SparklineResponseObject ⛁ | The sparkline data. |
400 | Bad Request | The request was malformed or invalid. |
Get Spot Markets
Retrieves spot markets. See Spot Markets for how they differ from perpetual markets.
Method Declaration
async getSpotMarkets(market?: string, limit?: number | null): Promise<SpotMarketsResponse>Parameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
ticker | query | Ticker | false | The spot market ticker (BASE-QUOTE) to retrieve. If not provided, all are returned. |
market | query | Ticker | false | Alias of ticker. Only one of the two may be provided. |
limit | query | u32 | false | Maximum number of markets to return. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | SpotMarketMap | The spot markets data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
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
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
ticker | path | Ticker | true | The spot market ticker, e.g. MARTI-USDC. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | OrderBookResponseObject ⛁ | The orderbook data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The market was not found. |
API Example
Get Spot Trades
Retrieves trades for a specific spot market.
Method Declaration
Parameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
ticker | path | Ticker | true | The spot market ticker, e.g. MARTI-USDC. |
limit | query | u32 | false | The maximum number of trades to retrieve. |
createdBeforeOrAtHeight | query | Height | false | Return trades created at or before this block height. |
createdBeforeOrAt | query | DateTime | false | Return trades created at or before this time. |
page | query | u32 | false | Page number for paginated results. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | TradeResponseObject ⛁ | The trades data. |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The 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
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
ticker | path | Ticker | true | The spot market ticker, e.g. MARTI-USDC. |
resolution | query | CandleResolution | true | The candle resolution (e.g., "1DAY", "1HOUR", "1MIN"). |
limit | query | u32 | false | The maximum number of candles to retrieve. |
fromISO | query | DateTime | false | The start timestamp in ISO format. |
toISO | query | DateTime | false | The end timestamp in ISO format. |
Response
| Status | Meaning | Schema | Description |
|---|---|---|---|
200 | OK | CandleResponseObject ⛁ | The candle data. |
400 | Bad Request | The request was malformed or invalid. |
API Example