Skip to content

Accounts

Python
account = indexer_client.account()

Get Subaccounts

Retrieves a list of subaccounts associated with a given address. Subaccounts are related addresses that fall under the authority or ownership of the primary address.

Method Declaration

Python
async def get_subaccounts(
    self,
    address: str,
    limit: Optional[int] = None,
) -> Any
Unification Plan
  • Rust implementation doesn't have optional parameters.

Parameters

ParameterLocationTypeRequiredDescription
addresspathAddresstrueThe primary address for which to retrieve associated subaccounts.
limitqueryu32falseMaximum number of subaccounts in the response.

Response

StatusMeaningSchemaDescription
200OKAddressResponseThe subaccounts data.
400Bad RequestThe request was malformed or invalid.
API Example

Get Subaccount

Retrieves a specific subaccount associated with a given address and subaccount number.

Method Declaration

Python
async def get_subaccount(
    self,
    address: str,
    subaccount_number: int,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe primary address to which the subaccount belongs.
subaccountNumberquerySubaccountNumbertrueThe specific subaccount number to retrieve.

Response

StatusMeaningSchemaDescription
200OKSubaccountResponseObjectThe subaccount data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.
API Example

List Positions

Retrieves perpetual positions for a specific subaccount. Both open and closed/historical positions can be queried.

Method Declaration

Python
async def get_subaccount_perpetual_positions(
    self,
    address: str,
    subaccount_number: int,
    status: Optional[PositionStatus] = None,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
statusqueryPerpetualPositionStatusfalseFilter to retrieve positions with a specific status. If not provided, all positions will be returned regardless of status.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTimefalseRestricts results to positions created at or before a specific timestamp (ISO 8601 format).

Response

StatusMeaningSchemaDescription
200OKPerpetualPositionResponseObjectThe perpetual positions data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.

API Example

Examples: Guide - List Positions

Get Asset Positions

Retrieves asset positions and respective details of a specific subaccount.

Method Declaration

Python
async def get_subaccount_asset_positions(
    self,
    address: str,
    subaccount_number: int,
    status: Optional[PositionStatus] = None,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan
  • Rename all methods to get_asset_positions - shorter is better.
  • Add a Subaccount pair to Python and JavaScript, since it's always a pair
  • Add options to the Rust version
  • Rename created_before_or_at_time parameter to created_before_or_at
  • Rename PerpetualPositionStatus to PositionStatus

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
statusqueryPerpetualPositionStatusfalseFilter to retrieve positions with a specific status. If not provided, all positions will be returned regardless of status.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTimefalseRestricts results to positions created at or before a specific timestamp (ISO 8601 format).

Response

A data structure containing the requested asset positions. Typically includes details such as asset ID, size, side (buy/sell), entry price, realized PnL, and other position-specific information.

StatusMeaningSchemaDescription
200OKAssetPositionResponseObjectThe asset positions data.
API Example

Get Transfers

Retrieves the transfer history for a specific subaccount.

Method Declaration

Python
async def get_subaccount_transfers(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccount_numberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of items in the response.
createdBeforeOrAtHeightqueryHeightfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTimefalseRestricts results to positions created at or before a specific timestamp.
pagequeryu32falseThe page number for paginated results.

Response

StatusMeaningSchemaDescription
200OKTransferResponseObjectThe transfers data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.
API Example

Get Transfers Between

Fetch information regarding a transfer between two subaccounts.

Method Declaration

Python
async def get_transfer_between(
    self,
    source_address: str,
    source_subaccount_number: int,
    recipient_address: str,
    recipient_subaccount_number: int,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan
  • Response object does not have defined structure in TypeScript client. Will have to work on it.

Parameters

ParameterLocationTypeRequiredDescription
sourceAddressquerystringtrueSender's wallet address
sourceSubaccountNumberquerystringtrueThe identifier for the specific subaccount within the sender wallet address.
recipientAddressquerystringtrueReceiver wallet address
recipientSubaccountNumberquerystringtrueThe identifier for the specific subaccount within the receiver wallet address.
createdBeforeOrAtHeightquerynumberfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtquerystringfalseRestricts results to positions created at or before a specific timestamp (ISO 8601 format).

Response

List Orders

Retrieves orders for a specific subaccount, with various filtering options to narrow down the results based on order characteristics.

Method Declaration

Python
async def get_subaccount_orders(
    self,
    address: str,
    subaccount_number: int,
    ticker: Optional[str] = None,
    ticker_type: TickerType = TickerType.PERPETUAL,
    side: Optional[OrderSide] = None,
    status: Optional[OrderStatus] = None,
    type: Optional[OrderType] = None,
    limit: Optional[int] = None,
    good_til_block_before_or_at: Optional[int] = None,
    good_til_block_time_before_or_at: Optional[str] = None,
    return_latest_orders: Optional[bool] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of asset positions to return in the response.
tickerqueryTickerfalseThe ticker filter.
sidequeryOrderSidefalseThe order side filter.
statusqueryOrderStatusfalseThe order status filter.
typequeryOrderTypefalseThe order type filter.
goodTilBlockBeforeOrAtqueryHeightfalseThe block number filter for orders good until before or at.
goodTilBlockTimeBeforeOrAtqueryDateTime in UTCfalseThe timestamp filter for orders good until before or at.
returnLatestOrdersqueryboolfalseWhether to return only the latest orders.

Response

StatusMeaningSchemaDescription
200OKOrderResponseObjectThe orders data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.
API Example

Examples: Guide - List Orders

Get Order

Retrieves detailed information about a specific order based on its unique identifier (the order ID). To get the order ID, see how to create it or fetch the order history.

Method Declaration

Python
async def get_order(
    self,
    order_id: str,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
orderIdpathOrderIdtrueThe order ID.

Response

StatusMeaningSchemaDescription
200OKOrderResponseObjectThe order data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe order was not found.
API Example

Get Fills

Retrieves fill records for a specific subaccount on the exchange. A fill represents a trade that has been executed.

Method Declaration

Python
async def get_subaccount_fills(
    self,
    address: str,
    subaccount_number: int,
    ticker: Optional[str] = None,
    ticker_type: TickerType = TickerType.PERPETUAL,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan
  • Rename all methods to get_fills - shorter is better.
  • Add a Subaccount pair to Python and JavaScript, since it's always a pair
  • Rename created_before_or_at_time parameter to created_before_or_at
  • page optional parameter is missing in Python
  • page optional parameter is missing in Rust
  • In Rust market field of the options struct must be ticker
  • In Rust market_type field of the options struct must be ticker_type

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
tickerqueryTickerfalseThe market symbol to filter fills by (e.g., "BTC-USD"). If not provided, fills for all markets will be returned.
tickerTypequeryMarketTypefalseThe type of market to filter by.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseFilters results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTimefalseFilters results to positions created at or before a specific timestamp (ISO 8601 format).
pagequeryu32falseThe page number for paginated results.

Response

A promise that resolves to fill data containing details such as order ID, market, side (buy/sell), size, price, execution time, and other fill-specific information.

StatusMeaningSchemaDescription
200OKFillResponseObjectThe fills data.
API Example

Examples: Guide - Get Fills

Get Historical PNL

Retrieves historical profit and loss (PNL) data for a specific subaccount on the exchange. These records provide insights into the trading performance over time.

Method Declaration

Python
async def get_subaccount_historical_pnls(
    self,
    address: str,
    subaccount_number: int,
    effective_before_or_at: Optional[str] = None,
    effective_at_or_after: Optional[str] = None,
) -> Any
Unification Plan
  • Parameter created_on_or_after_height is missing
  • Parameter created_on_or_after is missing

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccount_numberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseFilters results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTime in UTCfalseFilters results to positions created at or before a specific timestamp (ISO 8601 format).
createdOnOrAfterHeightqueryHeightfalseFilters results to positions created on or after a specific blockchain height.
createdOnOrAfterqueryDateTime in UTCfalseFilters results to positions created on or after a specific timestamp (ISO 8601 format).
pagequeryu32falseThe page number for paginated results.

Response

StatusMeaningSchemaDescription
200OKPnlTicksResponseObjectThe historical PnLs data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.
API Example

Get Rewards

Retrieves historical block trading rewards for the specified address.

Method Declaration

Python
async def get_historical_block_trading_rewards(
    self,
    address: str,
    limit: Optional[int] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addresspathAddresstrueThe wallet address that owns the account.
limitqueryu32falseMaximum number of asset positions to return in the response.
startingBeforeOrAtHeightqueryHeightfalseThe timestamp filter for rewards starting before or at.
startingBeforeOrAtqueryDateTime in UTCfalseThe block height filter for rewards starting before or at.

Response

StatusMeaningSchemaDescription
200OKHistoricalBlockTradingRewardThe historical block trading rewards data.
400Bad RequestThe request was malformed or invalid.
API Example

Get Rewards Aggregated

Retrieves aggregated historical trading rewards for the specified address.

Method Declaration

Python
async def get_historical_trading_rewards_aggregated(
    self,
    address: str,
    period: TradingRewardAggregationPeriod = TradingRewardAggregationPeriod.DAILY,
    limit: Optional[int] = None,
    starting_before_or_at: Optional[str] = None,
    starting_before_or_at_height: Optional[int] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addresspathAddresstrueThe wallet address that owns the account.
periodqueryTradingRewardAggregationPeriodtrueThe aggregation period.
limitqueryu32falseThe maximum number of aggregated rewards to retrieve.
startingBeforeOrAtqueryDateTimefalseThe timestamp filter for rewards starting before or at.
startingBeforeOrAtHeightqueryHeightfalseThe block height filter for rewards starting before or at.

Response

StatusMeaningSchemaDescription
200OKHistoricalTradingRewardAggregationThe aggregated historical trading rewards data.
400Bad RequestThe request was malformed or invalid.
API Example

Get Parent Subaccount

Query for the parent subaccount, its child subaccounts, equity, collateral and margin. See more information on parent subaccounts here.

Method Declaration

Python
async def get_parent_subaccount(
    self,
    address: str,
    subaccount_number: int,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addresspathAddresstrueThe wallet address that owns the parent subaccount.
numberpath[SubaccountNumber]trueThe identifier for the specific subaccount within the wallet address.

Response

StatusMeaningSchemaDescription
200OKParentSubaccountResponseObjectThe parent subaccount data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe parent subaccount was not found.
API Example

List Parent Positions

List all positions of a parent subaccount.

Method Declaration

Python
async def list_parent_orders(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    ticker: Optional[str] = None,
    side: Optional[OrderSide] = None,
    status: Optional[OrderStatus] = None,
    order_type: Optional[OrderType] = None,
    good_til_block_before_or_at: Optional[int] = None,
    good_til_block_time_before_or_at: Optional[str] = None,
    return_latest_orders: Optional[bool] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
parentSubaccountNumberquerySubaccountNumbertrueSubaccount number of the parent subaccount.
limitqueryu32falseMaximum number of asset positions to return in the response.

Response

StatusMeaningSchemaDescription
200OKPerpetualPositionResponseObjectThe perpetual positions data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.

API Example

Get Parent Asset Positions

Query for asset positions (size, buy/sell etc) for a parent subaccount.

Method Declaration

Python
async def get_parent_subaccount_asset_positions(
    self,
    address: str,
    subaccount_number: int,
    status: Optional[PositionStatus] = None,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any:
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
parentSubaccountNumberquerySubaccountNumbertrueThe parent subaccount number of this wallet

Response

StatusMeaningSchemaDescription
200OKAssetPositionResponseObjectThe asset positions data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe parent subaccount was not found.
API Example

Get Parent Transfers

Query for transfers between subaccounts associated with a parent subaccount.

Method Declaration

Python
async def get_parent_transfers(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the parent subaccount.
parentSubaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTime in UTCfalseRestricts results to positions created at or before a specific timestamp (ISO 8601 format).

Response

StatusMeaningSchema
200OKTransferResponseObject
API Example

List Parent Orders

Query for orders filtered by order params of a parent subaccount.

Method Declaration

Python
async def list_parent_orders(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    ticker: Optional[str] = None,
    side: Optional[OrderSide] = None,
    status: Optional[OrderStatus] = None,
    order_type: Optional[OrderType] = None,
    good_til_block_before_or_at: Optional[int] = None,
    good_til_block_time_before_or_at: Optional[str] = None,
    return_latest_orders: Optional[bool] = None,
) -> Any
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
parentSubaccountNumberquerySubaccountNumbertrueParent subaccount number
limitqueryu32falseMaximum number of asset positions to return in the response.
tickerqueryTickerfalseThe ticker filter.
sidequeryOrderSidefalseThe order side filter.
statusqueryOrderStatusfalseThe order status filter.
typequeryOrderTypefalseThe order type filter.
goodTilBlockBeforeOrAtqueryHeightfalseThe block number filter for orders good until before or at.
goodTilBlockTimeBeforeOrAtqueryDateTime in UTCfalseThe timestamp filter for orders good until before or at.
returnLatestOrdersqueryboolfalseWhether to return only the latest orders.

Response

StatusMeaningSchemaDescription
200OKListOrdersResponseThe orders data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe subaccount was not found.
API Example

Get Parent Fills

Query for fills (i.e. filled orders data) for a parent subaccount.

Method Declaration

Python
async def get_parent_fills(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    market: Optional[str] = None,
    market_type: Optional[TickerType] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
) -> Any:
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the parent subaccount.
parentSubaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseFilters results to positions created at or before a specific blockchain height.
marketqueryTickerfalseMarket id like USD-BTC, ETH-USD
marketTypequeryMarketTypefalseMarket type of filled order Data

Response

StatusMeaningSchemaDescription
200OKFillResponseObjectThe fills data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe parent subaccount was not found.
API Example

Get Parent Historical Pnl

Query for profit and loss report for the specified time/block range of a parent subaccount.

Method Declaration

Python
async def get_parent_historical_pnls(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    created_before_or_at_height: Optional[int] = None,
    created_before_or_at: Optional[str] = None,
    created_on_or_after_height: Optional[int] = None,
    created_on_or_after: Optional[str] = None,
) -> Any:
Unification Plan

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the parent subaccount.
parentSubaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of asset positions to return in the response.
createdBeforeOrAtHeightqueryHeightfalseRestricts results to positions created at or before a specific blockchain height.
createdBeforeOrAtqueryDateTime in UTCfalseRestricts results to positions created at or before a specific timestamp (ISO 8601 format).
createdOnOrAfterHeightqueryHeightfalseRestricts results to positions created on or after a specific blockchain height.
createdOnOrAfterqueryDateTime in UTCfalseRestricts results to positions created on or after a specific timestamp (ISO 8601 format).

Response

StatusMeaningSchemaDescription
200OKPnlTicksResponseObjectThe historical PnLs data.
400Bad RequestThe request was malformed or invalid.
404Not FoundThe parent subaccount was not found.
API Example

Get Funding Payments

Retrieves funding payment history for a specific subaccount. Funding payments are periodic settlements that occur between long and short positions based on the funding rate.

Method Declaration

Python
async def get_funding_payments(
    self,
    address: str,
    subaccount_number: int,
    limit: Optional[int] = None,
    ticker: Optional[str] = None,
    after_or_at: Optional[str] = None,
    page: Optional[int] = None,
) -> Any
Unification Plan
  • Rename all methods to get_funding_payments - shorter is better.
  • Add a Subaccount pair to Python and JavaScript, since it's always a pair
  • page optional parameter is missing in Python
  • page optional parameter is missing in Rust

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
subaccountNumberquerySubaccountNumbertrueThe identifier for the specific subaccount within the wallet address.
limitqueryu32falseMaximum number of funding payments to return in the response.
tickerqueryTickerfalseThe market symbol to filter funding payments by (e.g., "BTC-USD"). If not provided, payments for all markets will be returned.
afterOrAtqueryDateTimefalseFilters results to funding payments created at or after a specific timestamp (ISO 8601 format).
pagequeryu32falseThe page number for paginated results.

Response

A promise that resolves to funding payment data containing details such as payment amount, funding rate, position size, market ticker, and timestamp information.

StatusMeaningSchemaDescription
200OKFundingPaymentsResponseObjectThe funding payments data.
API Example

Get Funding Payments for Parent Subaccount

Retrieves funding payment history for all subaccounts under a parent subaccount. This endpoint aggregates funding payments across all child subaccounts of a given parent subaccount.

Method Declaration

Python
async def get_funding_payments_for_parent_subaccount(
    self,
    address: str,
    parent_subaccount_number: int,
    limit: Optional[int] = None,
    after_or_at: Optional[str] = None,
    page: Optional[int] = None,
) -> Any
Unification Plan
  • Rename all methods to get_funding_payments_for_parent_subaccount - shorter is better.
  • Add a ParentSubaccount pair to Python and JavaScript, since it's always a pair
  • page optional parameter is missing in Python
  • page optional parameter is missing in Rust

Parameters

ParameterLocationTypeRequiredDescription
addressqueryAddresstrueThe wallet address that owns the account.
parentSubaccountNumberquerySubaccountNumbertrueThe identifier for the parent subaccount within the wallet address.
limitqueryu32falseMaximum number of funding payments to return in the response.
afterOrAtqueryDateTimefalseFilters results to funding payments created at or after a specific timestamp (ISO 8601 format).
pagequeryu32falseThe page number for paginated results.

Response

A promise that resolves to funding payment data containing details such as payment amount, funding rate, position size, market ticker, and timestamp information aggregated across all child subaccounts.

StatusMeaningSchemaDescription
200OKFundingPaymentsResponseObjectThe funding payments data.
API Example