monaco.api.accounts
Source: protos/api/accounts.proto
Use AccountsService for authenticated account state, balances, movements, portfolio analytics, funding payments, and sub-account limits.
Notes
- Most RPCs are user-authenticated.
- Sub-account limit RPCs are for master/sub-account permission management.
GetUserTradestakes optionalmargin_account_idandorder_idfilters that match the caller’s own side of each fill, across hot and archived history. A self-trade is read as its maker side, so it matches through its maker order. Each row’sliquidity_roleis the caller’s role,MAKERorTAKER. Adding or changing a filter invalidates an existingpage_token: restart the walk with an empty token.TradesService.ListUserTradesis deprecated in favour of this RPC.GetUserTradesResponsecarriestotal,total_pagesandtotal_cappedon every page of an unfiltered walk: the number of trades the walk returns (both sides, hot and archived, a self-trade once), exact up to 10,000 and reported as 10,000 withtotal_cappedset past that. With any filter set no count runs:totalandtotal_pagesare unset andtotal_cappedis false. They are also unset when the count runs out of its server time budget, so treat unset as unknown, not zero.GetPortfolioMargindescribes the default margin account unlessGetPortfolioMarginRequest.margin_account_idnames another of the caller’s margin accounts (a sub-account), in which casetotal,positionsandrisk_bucketsare that account’s own.GetPortfolioMarginResponse.margin_account_idnames the account described and is absent before the caller has a margin account. Withinclude_accounts, the response also carriesaccounts— onePortfolioMarginAccount(margin_account_id,subaccount_key,total) per open margin account, the default one first, then sub-accounts by key — andowner_total, their sum. A malformedmargin_account_idisINVALID_ARGUMENT; one that is not the caller’s isNOT_FOUND; past the read budget it isRESOURCE_EXHAUSTEDwith aRetryInfodetail, andUNAVAILABLEwhen portfolio data is unavailable.GetUserTradesreturnsUserTrade.feeas the total fee paid: for a taker, Monaco’s taker fee plus the application’s builder fee; for a maker, the maker fee (negative for a rebate) plus the application’s maker add-on.monaco_fee+builder_fee=fee, with RAW twinsmonaco_fee_rawandbuilder_fee_rawbesidefee_raw; for a maker,builder_feeis the maker add-on.GetPortfolioChartRequest.trading_mode(optional,SPOTorMARGIN, any case) splits thevolumeseries into spot or perps volume; unset, the series sums both. It applies only tometric = "volume": set with any other metric, or set to another value, the call fails withINVALID_ARGUMENT.- The self-trade-prevention RPCs read and set one default per wallet family — every account sharing a wallet address, across applications — not per
users.id.SelfTradePreventionDefaultResponsecarriesmodeandis_custom, whereis_customisfalsewhen the platform defaultCANCEL_MAKERis being inherited. SetSelfTradePreventionDefaultRequest.modeacceptsCANCEL_MAKER,CANCEL_TAKER,CANCEL_BOTHorSKIP, case-insensitively on the wire. An unknown mode isINVALID_ARGUMENT.- Both RPCs also return
INVALID_ARGUMENTwhen the authenticated session’s wallet is not a canonical EVM address (0x+ 40 hex). The default is keyed by wallet, so a legacy non-EVM session has no wallet family for it to apply to — the shared handler validates the address before reading or writing. - Both RPCs are denied to delegated-agent sessions with
PERMISSION_DENIED— an agent can neither read nor set its owner’s default. GetSelfTradePreventionDefaultis classified as an authenticated read, so it draws the per-account read budget and can returnRESOURCE_EXHAUSTEDwith aRetryInfodetail once enforcement is enabled. The setter is a write: it draws the per-account settings-write budget (about one write per second, burst 10) and returnsRESOURCE_EXHAUSTEDwith aRetryInfodetail past it, enforced from the first request. The setter also returnsUNAVAILABLEwhen the matching engine is unreachable or the sequenced write fails transiently. That is not proof the setting is unchanged —DeadlineExceededandCancelledmap to it too, so the write may have committed before the response was lost. Re-read with the getter, or retry the samemode: the call sets an absolute value, so a replay cannot land a different one.- The setter is sequenced through the matching engine and returns only after the durable append, so the wallet’s next order already resolves the new mode. The getter serves an asynchronous projection, so a read issued immediately after a set can briefly lag the setter’s own response.
- A per-order
self_trade_prevention_modeonOrdersServicealways overrides this default. GetBalances,GetMovementsandListFundingPaymentsare cursor-paginated: send an emptypage_tokento start, then each response’snext_page_tokenuntil it comes back empty;page_sizeis 1 to 1000. There is nopagefield: a stub generated from an older proto that still sets it is not rejected (protobuf discards the unknown field) and reads the first page on every call, so regenerate stubs and walk the token.

