Skip to main content

Balances

GET /mm/v1/balances
That is 250,000 USDC available, 15,000 reserved and 265,000 in total. All amounts are USDC atoms (decimals: 6). The endpoint takes no parameters. available is what D1 lets you trade with. It can differ from what you would see in a wallet or on-chain, because D1 tracks your obligations, such as funds set aside for resting orders, as part of your account. Use this endpoint, not an outside balance, to size orders.

Positions

GET /mm/v1/positions
boolean
default:"true"
true returns only non-zero positions. false also returns flat positions in instruments you have held.
integer
default:"50"
1–200.
string
nextCursor from the previous page. See Pagination.
Results are sorted by instrumentId.

How fills change positions

While a market is trading, every fill on /executions changes your position in that market by its quantity: up for BUY, down for SELL. If you apply executions in sequence, your own position for a trading market should match GET /mm/v1/positions. Because SELL is sell-to-close, the API never takes you below zero in a market. You can hold long positions and reduce them to flat. You cannot create a short position through this API. SHORT is part of the general position format; you should not see it from trading through this API. quantity is your full position, including any contracts set aside for resting SELL orders. To work out how much you can still sell, subtract the remainingQuantity of your resting SELL orders in that market.
The API does not return cost basis, P&L, Greeks, margin or risk figures. Calculate these in your own system from positions, fills and market data.

Reconciling account state

Your execution feed is the record of what happened. Positions and balances are a snapshot of where that left you. Check them against each other regularly:
  • after startup, once you have caught up on /executions;
  • after any period where you were not sure what happened, such as timeouts or a lost connection;
  • on a fixed schedule, for example every few minutes.
If they disagree, trust D1’s values, find the executions you are missing, and alert.