Monaco Protocol SDK v0.8.16
This release corrects portfolio statistics:pnl now reports true realized PnL (previously it was net trading cash-flow), account equity now includes perpetuals, and the stats response gains a spot/perps equity breakdown. Affects GET /api/v1/accounts/me/portfolio (sdk.profile.getPortfolioStats) and the pnl metric of the portfolio chart (sdk.profile.getPortfolioChart(period, "pnl")).
Fixed
Realized PnL
getPortfolioStats().pnl and getPortfolioChart(period, "pnl") now return average-cost realized PnL — gains and losses are booked only when a position is reduced or closed, net of fees, across spot and perps (including funding), and exclude unrealized PnL on open positions.
Previously pnl summed the quote-currency (USDC) leg of trade ledger entries — i.e. net trading cash-flow — so buying and holding an asset showed as a loss and selling deposited inventory showed as pure profit. The response shape is unchanged; only the values (and the field documentation) change.
winLossRatio type
PortfolioStats.winLossRatio is now typed number | null (previously string), matching the value the API actually returns. It is null when the period has no closed trades.
Added
Spot / perps equity breakdown
PortfolioStats gains two additive fields alongside totalEquity:
spotEquity— spot account equity (quote-normalized string).perpsEquity— perpetuals (margin) account equity: collateral + realized − funding + unrealized PnL (quote-normalized string). Previously this was effectively0.
Changed
totalEquity now includes perpetuals
totalEquity now reflects spot balances plus perpetuals (margin) account equity, not spot balances alone.
maxDrawdown nullable
PortfolioStats.maxDrawdown is now string | null — null when the period has no closed trades.
Upgrade
spotEquity / perpsEquity fields and the winLossRatio / maxDrawdown type refinements, request and response shapes are unchanged — most callers only see corrected values and need no code changes.
