monaco.api.positions
Source: protos/api/positions.proto
Use PositionsService for isolated-margin position management.
Notes
- Position RPCs are authenticated.
- TP/SL can be attached to existing positions through
AttachPositionTpSl. ListPositions,GetPositionandGetPositionRiskread each market’s index price from the matching engine and returnUNAVAILABLEwhen that read fails transiently (retry); any other failure of that read isINTERNAL.ClosePositiondraws one item from the per-account risk-reduction order budget it shares with cancels;BatchCloseAlldraws one item per open position it closes (an empty call draws one): the first 100 are charged before anything is sent and over budget the whole call is refused, while positions past 100 that the budget does not cover are not sent and come back inresultswithRATE_LIMIT_EXCEEDED. Both returnRESOURCE_EXHAUSTEDwith agoogle.rpc.RetryInfodetail when the budget is enforced and spent, before anything reaches the matching engine. See Rate Limits.Position.cum_fees, when present, is the whole-life fee total on open and terminal rows. The matching engine records it as it charges each fee, for every position opened since it began recording it, so for such a position it,net_realized_pnlandrealized_roeare present as soon as the position closes. An older position has no recorded total: itscum_feesis absent while fee history is unavailable or incomplete — before the position’s first PnL sample, after retention, or on a terminal row until the final close is recorded. On a terminal row,exit_price,funding_paid,fees_paid(closing-side only),net_realized_pnlandrealized_roecome from the reducing executions when they reconcile withrealized_pnl, andsize/isolated_margincarry the lifetime closed quantity and allocated initial margin.Position.funding_paidis the lifetime funding since the position opened (signed; negative means received). On an open row it is the funding accrued on the open size plus the funding its partial closes settled, so the last open value equals the terminal value; it is absent wheneverlifetime_totals_statusis not COMPLETE, rather than understated.Position.estimated_next_funding_payment(and the same field onGetPositionResponse) is the estimated funding payment at the market’s next funding settlement, in quote-asset units: signed size ×mark_price× the market’s estimated next funding rate (asMarketService.GetFundingStateserves it). Positive means the position pays and negative means it receives, asfunding_paidcounts. It is set onOPENandLIQUIDATINGrows only, and absent on terminal rows and while the market has no estimate. It is an estimate at read time: settlement prices at the mark at the window boundary, a window with too few samples settles at zero, and a window is not pro-rated.ListPositionsandListPositionHistoryare 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.Position.opened_at(RFC 3339) is the fill that took the position’s exposure from zero to non-zero; it never changes for the position id and is absent when unknown.

