Skip to content

MarketOperations

MarketOperations

Info

Access via client.market property.

Market data queries.

Initialize market data queries.

Parameters:

Name Type Description Default
public_api PublicAPI

PublicAPI instance providing access to public APIs

required

Attributes

erc20_instruments_cache property

erc20_instruments_cache: dict[
    str, InstrumentPublicResponseSchema
]

Get cached ERC20 instruments.

option_instruments_cache property

option_instruments_cache: dict[
    str, InstrumentPublicResponseSchema
]

Get cached option instruments.

perp_instruments_cache property

perp_instruments_cache: dict[
    str, InstrumentPublicResponseSchema
]

Get cached perpetual instruments.

Functions

fetch_all_instruments

fetch_all_instruments(
    *, expired: bool = False
) -> dict[str, InstrumentPublicResponseSchema]

Fetch all instrument types from API.

Parameters:

Name Type Description Default
expired bool

If False (default), update all caches with active instruments. If True, return expired instruments without caching.

False

Returns:

Type Description
dict[str, InstrumentPublicResponseSchema]

Dictionary mapping instrument_name to instrument data for all types

fetch_instruments

fetch_instruments(
    *, instrument_type: AssetType, expired: bool = False
) -> dict[str, InstrumentPublicResponseSchema]

Fetch instruments for a specific instrument type from API.

Parameters:

Name Type Description Default
instrument_type AssetType

The type of instruments to fetch (erc20, perp, or option)

required
expired bool

If False (default), update cache with active instruments. If True, return expired instruments without caching.

False

Returns:

Type Description
dict[str, InstrumentPublicResponseSchema]

Dictionary mapping instrument_name to instrument data

get_all_currencies

get_all_currencies() -> (
    list[CurrencyDetailedResponseSchema]
)

Get all active currencies with their spot price, spot price 24hrs ago.

get_all_instruments

get_all_instruments(
    *,
    expired: bool,
    instrument_type: AssetType,
    currency: Optional[str] = None,
    page: int = 1,
    page_size: int = 100
) -> PublicGetAllInstrumentsResultSchema

Get a paginated history of all instruments.

get_currency

get_currency(
    *, currency: str
) -> PublicGetCurrencyResultSchema

Get currency related risk params, spot price 24hrs ago and lending details for a specific currency.

get_instrument

get_instrument(
    *, instrument_name: str
) -> PublicGetInstrumentResultSchema

Get single instrument by asset name.

get_instruments

get_instruments(
    *,
    currency: str,
    expired: bool,
    instrument_type: AssetType
) -> list[InstrumentPublicResponseSchema]

Get all active instruments for a given currency and type.

get_ticker

get_ticker(
    *, instrument_name: str
) -> PublicGetTickerResultSchema

Get ticker information (best bid / ask, instrument contraints, fees info, etc.) for a single instrument

DEPRECATION NOTICE: This RPC is deprecated in favor of get_tickers on Dec 1, 2025.

get_tickers

get_tickers(
    *,
    instrument_type: AssetType,
    currency: Optional[str] = None,
    expiry_date: Optional[str] = None
) -> dict[str, TickerSlimSchema]

Get tickers information (best bid / ask, stats, etc.) for multiple instruments.

For options: currency is required and expiry_date is required. For perps: currency is optional, expiry_date will throw an error. For erc20s: currency is optional, expiry_date will throw an error.