Skip to main content
Package: 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.
  • GetPortfolioMargin describes the default margin account unless GetPortfolioMarginRequest.margin_account_id names another of the caller’s margin accounts (a sub-account), in which case total, positions and risk_buckets are that account’s own. GetPortfolioMarginResponse.margin_account_id names the account described and is absent before the caller has a margin account. With include_accounts, the response also carries accounts — one PortfolioMarginAccount (margin_account_id, subaccount_key, total) per open margin account, the default one first, then sub-accounts by key — and owner_total, their sum. A malformed margin_account_id is INVALID_ARGUMENT; one that is not the caller’s is NOT_FOUND; past the read budget it is RESOURCE_EXHAUSTED with a RetryInfo detail, and UNAVAILABLE when portfolio data is unavailable.
  • GetUserTrades returns UserTrade.fee as 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 twins monaco_fee_raw and builder_fee_raw beside fee_raw; builder_fee is "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. SelfTradePreventionDefaultResponse carries mode and is_custom, where is_custom is false when the platform default CANCEL_MAKER is being inherited.
  • SetSelfTradePreventionDefaultRequest.mode accepts CANCEL_MAKER, CANCEL_TAKER, CANCEL_BOTH or SKIP, case-insensitively on the wire. An unknown mode is INVALID_ARGUMENT.
  • Both RPCs also return INVALID_ARGUMENT when 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.
  • GetSelfTradePreventionDefault is classified as an authenticated read, so it draws the per-account read budget and can return RESOURCE_EXHAUSTED with a RetryInfo detail 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 returns RESOURCE_EXHAUSTED with a RetryInfo detail past it, enforced from the first request. The setter also returns UNAVAILABLE when the matching engine is unreachable or the sequenced write fails transiently. That is not proof the setting is unchanged — DeadlineExceeded and Cancelled map to it too, so the write may have committed before the response was lost. Re-read with the getter, or retry the same mode: 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_mode on OrdersService always overrides this default.
  • GetBalances, GetMovements and ListFundingPayments are cursor-paginated: send an empty page_token to start, then each response’s next_page_token until it comes back empty; page_size is 1 to 1000. There is no page field: 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.