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.
- User trade history is also available through
TradesService.ListUserTrades. 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).monaco_fee+builder_fee=fee, with RAW twinsmonaco_fee_rawandbuilder_fee_rawbesidefee_raw;builder_feeis"0"for a maker.- 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 it shares with the copy trading lead trader and follow writes (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.

