Skip to main content
A Node API token is required. Without one, requests return 401 Unauthorized.

Purpose

  • Fetch market data (prices, depth, trades, candlesticks) and account views (orders, positions, Trading Accounts).
  • Works over REST and Aptos views. No signing or private keys required.

When to use

  • Use for dashboards, analytics, and read-heavy server/frontend use cases.
  • Do not use for submitting transactions; use the Write SDK instead.

Initialization

Main readers

  • Markets: read.markets.getAll(), getAllSpot(), getByName()
  • Spot asset contexts (24h stats + live mid per spot market): read.spotAssetContexts.getAll()
  • Prices: read.marketPrices.getAll(), getByName(), subscribeByName(), subscribeAllSpotMids()
  • Market contexts (24h volume/change + OI per market): read.marketContexts.getAll(), subscribeAll() (server may have the topic disabled; keep polling getAll())
  • Depth: read.marketDepth.subscribeByName(), subscribeByAddr(), getAggregationSizes()
  • Trades: read.marketTrades.getByName(), getByAddr(), subscribeByName(), subscribeByAddr()
  • Candlesticks: read.candlesticks.getByName(), getByAddr(), subscribeByName(), subscribeByAddr()
  • Accounts and orders:
    • read.accountOverview.getByAddr()
    • read.userFees.getByAddr()
    • read.userOpenOrders.getByAddr()
    • read.userOrderHistory.getByAddr() / subscribeByAddr()
    • read.userOrders.getOrder() (single order by orderId / clientOrderId)
    • read.userBulkOrders.getByAddr() / getStatus() / getFills()
    • read.userPositions.getByAddr()
    • read.userActiveTwaps.getByAddr()
    • read.userTradeHistory.getByAddr() / subscribeByAddr()
    • read.userSubaccounts.getByAddr()
  • Portfolio and leaderboard:
    • read.portfolioChart.getByAddr()
    • read.leaderboard.getLeaderboard()
  • Vaults and delegations:
    • read.vaults.getUserOwnedVaults() / getVaults()
    • read.vaults.getUserUnlockedShares() — shares a holder can redeem right now. Not the share token balance: it excludes shares still inside the contribution lockup, shares reserved by a pending redemption, and shares pledged as cross-margin collateral.
    • read.delegations.getAll()
  • Campaign rewards: read.campaigns.getActive(), getSummary({ accountAddress, limit?, offset? })
  • Funded First Trade:
    • read.fundedFirstTrade.getEligibility() / getActiveTrial()
    • read.fundedFirstTrade.getTrialHistory() / getCampaignLocks() (count-based pagination)
    • read.fundedFirstTrade.subscribeByAddr()
  • Chain views: read.tokenBalance(), read.fungibleAssetMetadata() (symbol/decimals/name for any fungible-asset address, e.g. secondary_collateral entries), read.spotMarketAssets() (a spot market’s base/quote asset addresses — not exposed by /markets)

Examples

Markets

Spot on the shared order endpoints

The order endpoints serve perp and spot on shared routes, with each row tagged asset_type ("perp" | "spot"). The account-scoped list readers (userOpenOrders, userOrderHistory, userTradeHistory, userBulkOrders, and userBulkOrders.getFills) default to assetType: "perp", so existing perp consumers keep their exact pre-spot responses and pagination. Pass "spot" to scope to spot, or "all" to receive both products merged (server-side union pagination):
Spot trade rows also carry fee_asset, the FA address fee_amount is denominated in (base asset for the buyer, quote for the seller); it is absent on perp rows, where fees are implicitly USDC.

Bounded account reads

Each getByAddr() makes one bounded HTTP request; increasing limit does not guarantee a complete account snapshot. Positions and TWAPs return arrays without offset support. Positions default to 10 rows in the SDK; TWAPs use the API default of 10. Open orders return { items, total_count? } with the API count unchanged and support limit/offset. Their assetType defaults to "perp"; "all" includes both products within the requested page. Position filters marketAddr and includeDeleted (default false), plus each reader’s fetchOptions, are forwarded. TWAP status filtering only covers returned rows; subscribeByAddr() provides live account snapshots.

Prices and candlesticks

Name-based market-data methods (candlesticks, marketDepth, marketTrades) derive the market address from the name, which differs between perp and spot markets even when they share a name. They accept an optional assetType ("perp" default, or "spot"):

Account views

Campaign rewards

Campaign metadata, summary.claims, and summary.breakdownByType use campaignType: "fee_rebate", "maker_incentive", "liquidation_rebate", "volume_milestone", "first_funded_trial", "affiliate", or "discretionary". campaignType and status are extensible: values newer than the SDK come through as raw strings, so narrow with isKnownCampaignType / isKnownCampaignStatus before switching on them. The SDK opts in to those values by sending Prefer: include-unknown-enum-members. Amounts are raw token units; divide USDC amounts by 10 ** 6. Claim rows include hasAllocation, readyToClaim, claimedAmount, claimedAtTsSec, and claimTxHash. The optional limit and offset paginate summary.claims.

User fees

BASE_FEE_RATES and SPOT_BASE_FEE_RATES export the tier-0 perp and spot { taker, maker } rates, a fallback for when this read fails.

User positions

History reconciliation

read.userTradeHistory.subscribeByAddr(subAddr, onData, onSubscribed?) and read.userOrderHistory.subscribeByAddr(subAddr, onData, onSubscribed?) accept an optional readiness callback. It runs after the server acknowledges the initial subscription and each resubscription, including reconnects, or immediately when joining an acknowledged topic. Consumers share the topic and socket. Use read.onWsDisconnect(listener) to track interrupted live updates, including explicit SDK close. read.onWsReconnect(listener) runs after the replacement socket opens and subscribe frames are sent; it does not mean the server has acknowledged a topic. Both methods return an unregister function. Start HTTP reconciliation from onSubscribed, buffer events while loading, and merge and deduplicate both sources. The streams do not replay missed events, and the acknowledgement provides no snapshot sequence boundary. HTTP history can lag the stream, so this does not guarantee a gap-free snapshot.

Notes

  • For raw REST/WS endpoints, see the API Reference tabs.