@0xmonaco/types 1.0.15 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,8 +33,10 @@ export declare const SimulateFeeResponseSchema: z.ZodObject<{
33
33
  makerTotalReceipt: z.ZodString;
34
34
  monacoMakerRebate: z.ZodString;
35
35
  monacoMakerRebateBps: z.ZodNumber;
36
+ monacoMakerRebateBpsExact: z.ZodString;
36
37
  monacoTakerFee: z.ZodString;
37
38
  monacoTakerFeeBps: z.ZodNumber;
39
+ monacoTakerFeeBpsExact: z.ZodString;
38
40
  notional: z.ZodString;
39
41
  takerTotalPayment: z.ZodString;
40
42
  totalTakerFees: z.ZodString;
@@ -65,12 +65,30 @@ export const SimulateFeeResponseSchema = z.object({
65
65
  makerTotalReceipt: z.string(),
66
66
  /** Monaco protocol maker rebate (negative = rebate) */
67
67
  monacoMakerRebate: z.string(),
68
- /** Monaco maker rebate in basis points */
68
+ /**
69
+ * Monaco maker rebate in basis points.
70
+ * @deprecated Integer field cannot represent fractional tiered rebates (e.g. -1.15); it
71
+ * echoes the flat trading-pair column, not the tier-resolved rate. Use monacoMakerRebateBpsExact.
72
+ */
69
73
  monacoMakerRebateBps: z.number(),
74
+ /**
75
+ * Tier-resolved Monaco maker rebate as a decimal basis-points string (negative is a
76
+ * rebate), e.g. "-1" — the exact rate the ledger credits this caller.
77
+ */
78
+ monacoMakerRebateBpsExact: z.string(),
70
79
  /** Monaco protocol taker fee */
71
80
  monacoTakerFee: z.string(),
72
- /** Monaco taker fee in basis points */
81
+ /**
82
+ * Monaco taker fee in basis points.
83
+ * @deprecated Integer field cannot represent fractional tiered rates (e.g. 6.5); it echoes
84
+ * the flat trading-pair column, not the tier-resolved rate. Use monacoTakerFeeBpsExact.
85
+ */
73
86
  monacoTakerFeeBps: z.number(),
87
+ /**
88
+ * Tier-resolved Monaco taker fee as a decimal basis-points string, e.g. "6.5" — the exact
89
+ * rate the ledger charges this caller (equals monacoTakerFee / notional).
90
+ */
91
+ monacoTakerFeeBpsExact: z.string(),
74
92
  /** Notional value (price * quantity) */
75
93
  notional: z.string(),
76
94
  /** Total amount taker must pay */
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./fees";
14
14
  export * from "./margin-accounts";
15
15
  export * from "./market";
16
16
  export * from "./pitpass";
17
+ export * from "./portfolio";
17
18
  export * from "./positions";
18
19
  export * from "./profile";
19
20
  export * from "./sdk";
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export * from "./fees";
15
15
  export * from "./margin-accounts";
16
16
  export * from "./market";
17
17
  export * from "./pitpass";
18
+ export * from "./portfolio";
18
19
  export * from "./positions";
19
20
  export * from "./profile";
20
21
  export * from "./sdk";
@@ -0,0 +1,162 @@
1
+ import type { BaseAPI } from "../api";
2
+ /** Closed rolling windows supported by the authoritative portfolio APIs. */
3
+ export type PortfolioAnalyticsPeriod = "1d" | "1w" | "1m" | "all";
4
+ export type PortfolioCoverage = "complete" | "partial" | "none";
5
+ export type PortfolioValuationStatus = "complete" | "partial";
6
+ export type PortfolioDisplayInterval = "5m" | "1h" | "4h" | "1d";
7
+ export type PortfolioCalculationInterval = "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
8
+ export interface PortfolioPeriodParams {
9
+ /** Defaults to `all` when omitted. */
10
+ period?: PortfolioAnalyticsPeriod;
11
+ }
12
+ export interface PortfolioWindow {
13
+ period: PortfolioAnalyticsPeriod;
14
+ asOf: string;
15
+ dataThrough?: string;
16
+ requestedStartsAt?: string;
17
+ effectiveStartsAt?: string;
18
+ historyStartsAt?: string;
19
+ coverage: PortfolioCoverage;
20
+ }
21
+ export interface PortfolioSeriesWindow extends PortfolioWindow {
22
+ displayInterval: PortfolioDisplayInterval;
23
+ calculationInterval: PortfolioCalculationInterval;
24
+ }
25
+ export interface PortfolioSummaryCurrent {
26
+ totalEquity?: string;
27
+ spotEquity?: string;
28
+ perpsEquity: string;
29
+ unrealizedPnl?: string;
30
+ availableValue?: string;
31
+ }
32
+ export interface PortfolioSummaryActivity {
33
+ volume: string;
34
+ tradeCount: number;
35
+ orderCount: number;
36
+ feesPaid: string;
37
+ }
38
+ export interface PortfolioSummary {
39
+ window: PortfolioWindow;
40
+ valuationStatus: PortfolioValuationStatus;
41
+ current: PortfolioSummaryCurrent;
42
+ activity: PortfolioSummaryActivity;
43
+ }
44
+ export interface PortfolioPerformanceDrawdown {
45
+ /** Positive transfer-neutral loss magnitude. */
46
+ amount: string;
47
+ /** Peak-to-trough sampled-TWR percentage. */
48
+ pct: string;
49
+ peakAt: string;
50
+ troughAt: string;
51
+ }
52
+ export interface PortfolioPerformancePoint {
53
+ timestamp: string;
54
+ equity: string;
55
+ cumulativePnl: string;
56
+ cumulativeReturnPct?: string;
57
+ }
58
+ export interface PortfolioPerformance {
59
+ window: PortfolioSeriesWindow;
60
+ calculationMethod: "sampled_twr";
61
+ valuationStatus: PortfolioValuationStatus;
62
+ startingEquity?: string;
63
+ endingEquity?: string;
64
+ deposits: string;
65
+ withdrawals: string;
66
+ netExternalFlows: string;
67
+ pnl?: string;
68
+ returnPct?: string;
69
+ maxDrawdown?: PortfolioPerformanceDrawdown;
70
+ points: PortfolioPerformancePoint[];
71
+ }
72
+ export interface PortfolioRealizedTotals {
73
+ perpsClosedPnl: string;
74
+ spotTradePnl: string;
75
+ fundingPnl: string;
76
+ feesPaid: string;
77
+ netRealizedPnl: string;
78
+ }
79
+ export interface PortfolioClosedTradeStats {
80
+ count: number;
81
+ winners: number;
82
+ losers: number;
83
+ breakEven: number;
84
+ winRatePct?: string;
85
+ }
86
+ export interface PortfolioBestDay {
87
+ /** UTC calendar date in YYYY-MM-DD form. */
88
+ date: string;
89
+ netRealizedPnl: string;
90
+ }
91
+ export interface PortfolioRealizedPnlPoint extends PortfolioRealizedTotals {
92
+ timestamp: string;
93
+ }
94
+ export interface PortfolioRealizedPnl {
95
+ window: PortfolioSeriesWindow;
96
+ bucketInterval: "1h" | "1d";
97
+ totals: PortfolioRealizedTotals;
98
+ closedTrades: PortfolioClosedTradeStats;
99
+ bestDay?: PortfolioBestDay;
100
+ points: PortfolioRealizedPnlPoint[];
101
+ }
102
+ export interface PortfolioAssetsPerformance {
103
+ pnl?: string;
104
+ returnPct?: string;
105
+ calculationMethod: "sampled_twr";
106
+ }
107
+ export interface PortfolioAssetRow {
108
+ assetId: string;
109
+ symbol: string;
110
+ totalBalance: string;
111
+ availableBalance: string;
112
+ lockedBalance: string;
113
+ markPrice?: string;
114
+ value?: string;
115
+ allocationPct?: string;
116
+ priceAsOf?: string;
117
+ pricingStatus: "priced" | "unpriced";
118
+ }
119
+ export interface PortfolioAssets {
120
+ window: PortfolioSeriesWindow;
121
+ valuationStatus: PortfolioValuationStatus;
122
+ totalSpotEquity?: string;
123
+ performance: PortfolioAssetsPerformance;
124
+ assets: PortfolioAssetRow[];
125
+ }
126
+ export interface PortfolioMarginTotal {
127
+ equity: string;
128
+ collateralBalance: string;
129
+ /** Free collateral in the parent account only; risk-bucket free collateral is not added. */
130
+ parentAvailableCollateral: string;
131
+ initialMarginRequired: string;
132
+ maintenanceMarginRequired: string;
133
+ unrealizedPnl: string;
134
+ }
135
+ export interface PortfolioMarginPositionCounts {
136
+ total: number;
137
+ cross: number;
138
+ isolated: number;
139
+ }
140
+ export interface PortfolioRiskBucket {
141
+ riskBucketId: string;
142
+ collateral: string;
143
+ freeCollateral: string;
144
+ initialMarginRequired: string;
145
+ maintenanceMarginRequired: string;
146
+ unrealizedPnl: string;
147
+ positionCount: number;
148
+ }
149
+ export interface PortfolioMargin {
150
+ asOf: string;
151
+ total: PortfolioMarginTotal;
152
+ positions: PortfolioMarginPositionCounts;
153
+ riskBuckets: PortfolioRiskBucket[];
154
+ }
155
+ /** Authoritative, application-scoped portfolio analytics. */
156
+ export interface PortfolioAPI extends BaseAPI {
157
+ getSummary(params?: PortfolioPeriodParams): Promise<PortfolioSummary>;
158
+ getPerformance(params?: PortfolioPeriodParams): Promise<PortfolioPerformance>;
159
+ getRealizedPnl(params?: PortfolioPeriodParams): Promise<PortfolioRealizedPnl>;
160
+ getAssets(params?: PortfolioPeriodParams): Promise<PortfolioAssets>;
161
+ getMargin(): Promise<PortfolioMargin>;
162
+ }
File without changes
@@ -7,6 +7,7 @@ import type { FeesAPI } from "../fees";
7
7
  import type { MarginAccountsAPI } from "../margin-accounts";
8
8
  import type { Interval, MarketAPI } from "../market";
9
9
  import type { PitpassAPI } from "../pitpass";
10
+ import type { PortfolioAPI } from "../portfolio";
10
11
  import type { PositionsAPI } from "../positions";
11
12
  import type { ProfileAPI } from "../profile";
12
13
  import type { SubAccountsAPI } from "../sub-accounts";
@@ -80,6 +81,8 @@ export interface MonacoSDK {
80
81
  marginAccounts: MarginAccountsAPI;
81
82
  /** Perp position operations API */
82
83
  positions: PositionsAPI;
84
+ /** Authoritative portfolio analytics API */
85
+ portfolio: PortfolioAPI;
83
86
  /** Sub-account management API */
84
87
  subAccounts: SubAccountsAPI;
85
88
  /** PitPass TraderCode referral and rewards API */
@@ -12,8 +12,8 @@ export declare const IntervalSchema: z.ZodEnum<{
12
12
  "1h": "1h";
13
13
  "4h": "4h";
14
14
  "1d": "1d";
15
- "30m": "30m";
16
15
  "1w": "1w";
16
+ "30m": "30m";
17
17
  "1M": "1M";
18
18
  }>;
19
19
  /**
@@ -80,8 +80,8 @@ export declare const GetCandlesticksSchema: z.ZodObject<{
80
80
  "1h": "1h";
81
81
  "4h": "4h";
82
82
  "1d": "1d";
83
- "30m": "30m";
84
83
  "1w": "1w";
84
+ "30m": "30m";
85
85
  "1M": "1M";
86
86
  }>;
87
87
  startTime: z.ZodNumber;
@@ -164,8 +164,8 @@ export declare const GetCandlesticksByPairIdSchema: z.ZodObject<{
164
164
  "1h": "1h";
165
165
  "4h": "4h";
166
166
  "1d": "1d";
167
- "30m": "30m";
168
167
  "1w": "1w";
168
+ "30m": "30m";
169
169
  "1M": "1M";
170
170
  }>;
171
171
  startTime: z.ZodOptional<z.ZodNumber>;
@@ -184,8 +184,8 @@ export declare const GetCandlesticksBySymbolSchema: z.ZodObject<{
184
184
  "1h": "1h";
185
185
  "4h": "4h";
186
186
  "1d": "1d";
187
- "30m": "30m";
188
187
  "1w": "1w";
188
+ "30m": "30m";
189
189
  "1M": "1M";
190
190
  }>;
191
191
  startTime: z.ZodOptional<z.ZodNumber>;
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_conditional_order", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_pnl_history", "get_position_risk", "get_rewards_balance", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_conditional_order", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_rewards_balance", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -13,7 +13,6 @@
13
13
  export const OPERATION_IDS = [
14
14
  "add_position_margin",
15
15
  "attach_position_tp_sl",
16
- "authenticate_backend",
17
16
  "batch_cancel_all",
18
17
  "batch_cancel_all_by_pair",
19
18
  "batch_cancel_orders",
@@ -50,8 +49,13 @@ export const OPERATION_IDS = [
50
49
  "get_parent_margin_account_summary",
51
50
  "get_perp_market_config",
52
51
  "get_perp_market_summary",
52
+ "get_portfolio_assets",
53
53
  "get_portfolio_chart",
54
+ "get_portfolio_margin",
55
+ "get_portfolio_performance",
56
+ "get_portfolio_realized_pnl",
54
57
  "get_portfolio_stats",
58
+ "get_portfolio_summary",
55
59
  "get_position",
56
60
  "get_position_pnl_history",
57
61
  "get_position_risk",
@@ -121,6 +121,26 @@ export interface paths {
121
121
  patch?: never;
122
122
  trace?: never;
123
123
  };
124
+ "/api/v1/accounts/me/portfolio/assets": {
125
+ parameters: {
126
+ query?: never;
127
+ header?: never;
128
+ path?: never;
129
+ cookie?: never;
130
+ };
131
+ /**
132
+ * Get portfolio assets
133
+ * @description Get authoritative spot asset values and spot-subportfolio performance.
134
+ */
135
+ get: operations["get_portfolio_assets"];
136
+ put?: never;
137
+ post?: never;
138
+ delete?: never;
139
+ options?: never;
140
+ head?: never;
141
+ patch?: never;
142
+ trace?: never;
143
+ };
124
144
  "/api/v1/accounts/me/portfolio/chart": {
125
145
  parameters: {
126
146
  query?: never;
@@ -144,6 +164,86 @@ export interface paths {
144
164
  patch?: never;
145
165
  trace?: never;
146
166
  };
167
+ "/api/v1/accounts/me/portfolio/margin": {
168
+ parameters: {
169
+ query?: never;
170
+ header?: never;
171
+ path?: never;
172
+ cookie?: never;
173
+ };
174
+ /**
175
+ * Get portfolio margin
176
+ * @description Get the current authoritative parent margin and risk-bucket projection.
177
+ */
178
+ get: operations["get_portfolio_margin"];
179
+ put?: never;
180
+ post?: never;
181
+ delete?: never;
182
+ options?: never;
183
+ head?: never;
184
+ patch?: never;
185
+ trace?: never;
186
+ };
187
+ "/api/v1/accounts/me/portfolio/performance": {
188
+ parameters: {
189
+ query?: never;
190
+ header?: never;
191
+ path?: never;
192
+ cookie?: never;
193
+ };
194
+ /**
195
+ * Get portfolio performance
196
+ * @description Get transfer-neutral portfolio performance and sampled-TWR history.
197
+ */
198
+ get: operations["get_portfolio_performance"];
199
+ put?: never;
200
+ post?: never;
201
+ delete?: never;
202
+ options?: never;
203
+ head?: never;
204
+ patch?: never;
205
+ trace?: never;
206
+ };
207
+ "/api/v1/accounts/me/portfolio/realized-pnl": {
208
+ parameters: {
209
+ query?: never;
210
+ header?: never;
211
+ path?: never;
212
+ cookie?: never;
213
+ };
214
+ /**
215
+ * Get portfolio realized PnL
216
+ * @description Get bucketed closed-trade, funding, and fee PnL.
217
+ */
218
+ get: operations["get_portfolio_realized_pnl"];
219
+ put?: never;
220
+ post?: never;
221
+ delete?: never;
222
+ options?: never;
223
+ head?: never;
224
+ patch?: never;
225
+ trace?: never;
226
+ };
227
+ "/api/v1/accounts/me/portfolio/summary": {
228
+ parameters: {
229
+ query?: never;
230
+ header?: never;
231
+ path?: never;
232
+ cookie?: never;
233
+ };
234
+ /**
235
+ * Get portfolio summary
236
+ * @description Get authoritative portfolio summary and activity for one rolling period.
237
+ */
238
+ get: operations["get_portfolio_summary"];
239
+ put?: never;
240
+ post?: never;
241
+ delete?: never;
242
+ options?: never;
243
+ head?: never;
244
+ patch?: never;
245
+ trace?: never;
246
+ };
147
247
  "/api/v1/accounts/movements": {
148
248
  parameters: {
149
249
  query?: never;
@@ -431,29 +531,6 @@ export interface paths {
431
531
  patch?: never;
432
532
  trace?: never;
433
533
  };
434
- "/api/v1/auth/backend": {
435
- parameters: {
436
- query?: never;
437
- header?: never;
438
- path?: never;
439
- cookie?: never;
440
- };
441
- get?: never;
442
- put?: never;
443
- /**
444
- * Backend service authentication
445
- * @description Backend service authentication.
446
- *
447
- * Authenticate a backend service using a secret key. Returns a long-lived
448
- * access token for server-to-server API access.
449
- */
450
- post: operations["authenticate_backend"];
451
- delete?: never;
452
- options?: never;
453
- head?: never;
454
- patch?: never;
455
- trace?: never;
456
- };
457
534
  "/api/v1/auth/challenge": {
458
535
  parameters: {
459
536
  query?: never;
@@ -2213,30 +2290,6 @@ export interface components {
2213
2290
  status?: string | null;
2214
2291
  message?: string | null;
2215
2292
  };
2216
- BackendAuthRequest: {
2217
- /**
2218
- * @description Backend secret key (sk_xxx)
2219
- * @example sk_live_abc123def456
2220
- */
2221
- secretKey: string;
2222
- };
2223
- BackendAuthResponse: {
2224
- /**
2225
- * @description Application UUID
2226
- * @example 123e4567-e89b-12d3-a456-426614174000
2227
- */
2228
- appId?: string | null;
2229
- /**
2230
- * @description Application client identifier
2231
- * @example monaco-frontend
2232
- */
2233
- clientId?: string | null;
2234
- /**
2235
- * @description Application display name
2236
- * @example Monaco Trading Frontend
2237
- */
2238
- name?: string | null;
2239
- };
2240
2293
  BatchCancelAllResponse: {
2241
2294
  /**
2242
2295
  * Format: int32
@@ -3871,6 +3924,14 @@ export interface components {
3871
3924
  marketRegime?: string | null;
3872
3925
  updatedAt?: string | null;
3873
3926
  };
3927
+ GetPortfolioAssetsResponse: {
3928
+ window?: components["schemas"]["PortfolioSeriesWindow"];
3929
+ /** @enum {string|null} */
3930
+ valuationStatus?: "complete" | "partial" | null;
3931
+ totalSpotEquity?: string | null;
3932
+ performance?: components["schemas"]["PortfolioAssetsPerformance"];
3933
+ assets?: components["schemas"]["PortfolioAssetRow"][] | null;
3934
+ };
3874
3935
  GetPortfolioChartResponse: {
3875
3936
  /**
3876
3937
  * @description Metric used for this query
@@ -3884,6 +3945,37 @@ export interface components {
3884
3945
  period?: string | null;
3885
3946
  data?: components["schemas"]["ChartDataPoint"][] | null;
3886
3947
  };
3948
+ GetPortfolioMarginResponse: {
3949
+ asOf?: string | null;
3950
+ total?: components["schemas"]["PortfolioMarginTotal"];
3951
+ positions?: components["schemas"]["PortfolioMarginPositionCounts"];
3952
+ riskBuckets?: components["schemas"]["PortfolioRiskBucket"][] | null;
3953
+ };
3954
+ GetPortfolioPerformanceResponse: {
3955
+ window?: components["schemas"]["PortfolioSeriesWindow"];
3956
+ /** @enum {string|null} */
3957
+ calculationMethod?: "sampled_twr" | null;
3958
+ /** @enum {string|null} */
3959
+ valuationStatus?: "complete" | "partial" | null;
3960
+ startingEquity?: string | null;
3961
+ endingEquity?: string | null;
3962
+ deposits?: string | null;
3963
+ withdrawals?: string | null;
3964
+ netExternalFlows?: string | null;
3965
+ pnl?: string | null;
3966
+ returnPct?: string | null;
3967
+ maxDrawdown?: components["schemas"]["PortfolioPerformanceDrawdown"];
3968
+ points?: components["schemas"]["PortfolioPerformancePoint"][] | null;
3969
+ };
3970
+ GetPortfolioRealizedPnlResponse: {
3971
+ window?: components["schemas"]["PortfolioSeriesWindow"];
3972
+ /** @enum {string|null} */
3973
+ bucketInterval?: "1h" | "1d" | null;
3974
+ totals?: components["schemas"]["PortfolioRealizedTotals"];
3975
+ closedTrades?: components["schemas"]["PortfolioClosedTradeStats"];
3976
+ bestDay?: components["schemas"]["PortfolioBestDay"];
3977
+ points?: components["schemas"]["PortfolioRealizedPnlPoint"][] | null;
3978
+ };
3887
3979
  GetPortfolioStatsResponse: {
3888
3980
  /**
3889
3981
  * @description Period used for this query
@@ -3953,6 +4045,13 @@ export interface components {
3953
4045
  totalPnl?: string | null;
3954
4046
  pnlBreakdown?: components["schemas"]["PnlBreakdown"];
3955
4047
  };
4048
+ GetPortfolioSummaryResponse: {
4049
+ window?: components["schemas"]["PortfolioWindow"];
4050
+ /** @enum {string|null} */
4051
+ valuationStatus?: "complete" | "partial" | null;
4052
+ current?: components["schemas"]["PortfolioSummaryCurrent"];
4053
+ activity?: components["schemas"]["PortfolioSummaryActivity"];
4054
+ };
3956
4055
  GetPositionPnlHistoryResponse: {
3957
4056
  /**
3958
4057
  * Format: uuid
@@ -4070,13 +4169,15 @@ export interface components {
4070
4169
  createdAt?: string | null;
4071
4170
  /**
4072
4171
  * Format: int32
4073
- * @description Base maker fee in basis points from active trading pair
4172
+ * @deprecated
4173
+ * @description DEPRECATED: legacy flat maker fee in bps echoed from the trading pair. Does NOT reflect the tiered fee actually charged, which is per-user and fractional. Call GET /api/v1/fees/tier for the caller's real rate.
4074
4174
  * @example -1
4075
4175
  */
4076
4176
  makerFeeBps?: number | null;
4077
4177
  /**
4078
4178
  * Format: int32
4079
- * @description Base taker fee in basis points from active trading pair
4179
+ * @deprecated
4180
+ * @description DEPRECATED: legacy flat taker fee in bps echoed from the trading pair. Does NOT reflect the tiered fee actually charged, which is per-user and fractional. Call GET /api/v1/fees/tier for the caller's real rate.
4080
4181
  * @example 5
4081
4182
  */
4082
4183
  takerFeeBps?: number | null;
@@ -4882,6 +4983,152 @@ export interface components {
4882
4983
  */
4883
4984
  fees?: string | null;
4884
4985
  };
4986
+ PortfolioAssetRow: {
4987
+ /** Format: uuid */
4988
+ assetId?: string | null;
4989
+ symbol?: string | null;
4990
+ totalBalance?: string | null;
4991
+ availableBalance?: string | null;
4992
+ lockedBalance?: string | null;
4993
+ markPrice?: string | null;
4994
+ value?: string | null;
4995
+ allocationPct?: string | null;
4996
+ priceAsOf?: string | null;
4997
+ /** @enum {string|null} */
4998
+ pricingStatus?: "priced" | "unpriced" | null;
4999
+ };
5000
+ PortfolioAssetsPerformance: {
5001
+ pnl?: string | null;
5002
+ returnPct?: string | null;
5003
+ /** @enum {string|null} */
5004
+ calculationMethod?: "sampled_twr" | null;
5005
+ };
5006
+ PortfolioBestDay: {
5007
+ /**
5008
+ * Format: date
5009
+ * @description UTC calendar date
5010
+ */
5011
+ date?: string | null;
5012
+ netRealizedPnl?: string | null;
5013
+ };
5014
+ PortfolioClosedTradeStats: {
5015
+ count?: string | null;
5016
+ winners?: string | null;
5017
+ losers?: string | null;
5018
+ breakEven?: string | null;
5019
+ winRatePct?: string | null;
5020
+ };
5021
+ PortfolioMarginPositionCounts: {
5022
+ total?: string | null;
5023
+ cross?: string | null;
5024
+ isolated?: string | null;
5025
+ };
5026
+ PortfolioMarginTotal: {
5027
+ equity?: string | null;
5028
+ collateralBalance?: string | null;
5029
+ parentAvailableCollateral?: string | null;
5030
+ initialMarginRequired?: string | null;
5031
+ maintenanceMarginRequired?: string | null;
5032
+ unrealizedPnl?: string | null;
5033
+ };
5034
+ PortfolioPerformanceDrawdown: {
5035
+ /** @description Positive transfer-neutral loss magnitude */
5036
+ amount?: string | null;
5037
+ /** @description Peak-to-trough sampled-TWR percentage */
5038
+ pct?: string | null;
5039
+ peakAt?: string | null;
5040
+ troughAt?: string | null;
5041
+ };
5042
+ PortfolioPerformancePoint: {
5043
+ timestamp?: string | null;
5044
+ equity?: string | null;
5045
+ cumulativePnl?: string | null;
5046
+ cumulativeReturnPct?: string | null;
5047
+ };
5048
+ PortfolioRealizedPnlPoint: {
5049
+ timestamp?: string | null;
5050
+ perpsClosedPnl?: string | null;
5051
+ spotTradePnl?: string | null;
5052
+ fundingPnl?: string | null;
5053
+ feesPaid?: string | null;
5054
+ netRealizedPnl?: string | null;
5055
+ };
5056
+ PortfolioRealizedTotals: {
5057
+ perpsClosedPnl?: string | null;
5058
+ spotTradePnl?: string | null;
5059
+ fundingPnl?: string | null;
5060
+ feesPaid?: string | null;
5061
+ netRealizedPnl?: string | null;
5062
+ };
5063
+ PortfolioRiskBucket: {
5064
+ /** Format: uuid */
5065
+ riskBucketId?: string | null;
5066
+ collateral?: string | null;
5067
+ freeCollateral?: string | null;
5068
+ initialMarginRequired?: string | null;
5069
+ maintenanceMarginRequired?: string | null;
5070
+ unrealizedPnl?: string | null;
5071
+ positionCount?: string | null;
5072
+ };
5073
+ PortfolioSeriesWindow: {
5074
+ /**
5075
+ * @description Closed portfolio period token
5076
+ * @enum {string|null}
5077
+ */
5078
+ period?: "1d" | "1w" | "1m" | "all" | null;
5079
+ asOf?: string | null;
5080
+ dataThrough?: string | null;
5081
+ requestedStartsAt?: string | null;
5082
+ effectiveStartsAt?: string | null;
5083
+ historyStartsAt?: string | null;
5084
+ /** @enum {string|null} */
5085
+ coverage?: "complete" | "partial" | "none" | null;
5086
+ /**
5087
+ * @description Interval of returned chart points
5088
+ * @enum {string|null}
5089
+ */
5090
+ displayInterval?: "5m" | "1h" | "4h" | "1d" | null;
5091
+ /**
5092
+ * @description Finest retained interval used before display downsampling
5093
+ * @enum {string|null}
5094
+ */
5095
+ calculationInterval?: "1m" | "5m" | "15m" | "1h" | "4h" | "1d" | null;
5096
+ };
5097
+ PortfolioSummaryActivity: {
5098
+ volume?: string | null;
5099
+ tradeCount?: string | null;
5100
+ orderCount?: string | null;
5101
+ feesPaid?: string | null;
5102
+ };
5103
+ PortfolioSummaryCurrent: {
5104
+ totalEquity?: string | null;
5105
+ spotEquity?: string | null;
5106
+ perpsEquity?: string | null;
5107
+ unrealizedPnl?: string | null;
5108
+ availableValue?: string | null;
5109
+ };
5110
+ PortfolioWindow: {
5111
+ /**
5112
+ * @description Closed portfolio period token
5113
+ * @enum {string|null}
5114
+ */
5115
+ period?: "1d" | "1w" | "1m" | "all" | null;
5116
+ /** @description Exclusive response query cutoff (RFC3339) */
5117
+ asOf?: string | null;
5118
+ /** @description Newest underlying observation used (RFC3339) */
5119
+ dataThrough?: string | null;
5120
+ /** @description Requested rolling-window start; null for all (RFC3339) */
5121
+ requestedStartsAt?: string | null;
5122
+ /** @description Actual calculation start after retained-history constraints (RFC3339) */
5123
+ effectiveStartsAt?: string | null;
5124
+ /** @description First observation with complete endpoint semantics (RFC3339) */
5125
+ historyStartsAt?: string | null;
5126
+ /**
5127
+ * @description History coverage for the requested period
5128
+ * @enum {string|null}
5129
+ */
5130
+ coverage?: "complete" | "partial" | "none" | null;
5131
+ };
4885
5132
  Position: {
4886
5133
  positionId?: string | null;
4887
5134
  /** @description Margin account UUID for the isolated bucket that owns this position. */
@@ -5312,13 +5559,15 @@ export interface components {
5312
5559
  buyOrderLockAmount?: string | null;
5313
5560
  /**
5314
5561
  * Format: int32
5315
- * @description Monaco taker fee rate in basis points
5562
+ * @deprecated
5563
+ * @description DEPRECATED: whole-basis-points taker rate. An integer cannot represent fractional tiered rates (e.g. 6.5), so this echoes the flat trading_pairs column, NOT the tier-resolved rate the ledger charges. Kept for backward compatibility. Use monaco_taker_fee_bps_exact (or GET /api/v1/fees/tier).
5316
5564
  * @example 10
5317
5565
  */
5318
5566
  monacoTakerFeeBps?: number | null;
5319
5567
  /**
5320
5568
  * Format: int32
5321
- * @description Monaco maker rebate rate in bps (negative)
5569
+ * @deprecated
5570
+ * @description DEPRECATED: whole-basis-points maker rebate. An integer cannot represent fractional tiered rebates (e.g. -1.15), so this echoes the flat trading_pairs column, NOT the tier-resolved rate. Kept for backward compatibility. Use monaco_maker_rebate_bps_exact (or GET /api/v1/fees/tier).
5322
5571
  * @example -2
5323
5572
  */
5324
5573
  monacoMakerRebateBps?: number | null;
@@ -5349,6 +5598,16 @@ export interface components {
5349
5598
  * @example 500
5350
5599
  */
5351
5600
  slippageToleranceBps?: number | null;
5601
+ /**
5602
+ * @description Tier-resolved Monaco taker fee rate as a decimal basis-points string — the exact rate the ledger charges this caller (equals monaco_taker_fee / notional). Fractional and per-tier, e.g. "6.5". Prefer this over the deprecated integer monaco_taker_fee_bps.
5603
+ * @example 6.5
5604
+ */
5605
+ monacoTakerFeeBpsExact?: string | null;
5606
+ /**
5607
+ * @description Tier-resolved Monaco maker rebate as a decimal basis-points string (negative is a rebate) — the exact rate the ledger credits this caller. Fractional and per-tier, e.g. "-1". Prefer this over the deprecated integer monaco_maker_rebate_bps.
5608
+ * @example -1
5609
+ */
5610
+ monacoMakerRebateBpsExact?: string | null;
5352
5611
  };
5353
5612
  SimulateOrderRiskRequest: {
5354
5613
  /** @description Margin account UUID for the isolated bucket being simulated. */
@@ -5644,7 +5903,8 @@ export interface components {
5644
5903
  isActive?: boolean | null;
5645
5904
  /**
5646
5905
  * Format: int32
5647
- * @description Maker fee in bps (negative = rebate)
5906
+ * @deprecated
5907
+ * @description DEPRECATED: legacy flat maker fee in bps (negative = rebate). This is the pre-tiered pair-level rate and does NOT reflect the tiered fee actually charged, which is per-user and fractional. Do not display this as the user's fee — call GET /api/v1/fees/tier for the caller's real rate.
5648
5908
  * @example -2
5649
5909
  */
5650
5910
  makerFeeBps?: number | null;
@@ -5697,7 +5957,8 @@ export interface components {
5697
5957
  symbol?: string | null;
5698
5958
  /**
5699
5959
  * Format: int32
5700
- * @description Taker fee (bps)
5960
+ * @deprecated
5961
+ * @description DEPRECATED: legacy flat taker fee in bps. This is the pre-tiered pair-level rate and does NOT reflect the tiered fee actually charged, which is per-user and fractional. Do not display this as the user's fee — call GET /api/v1/fees/tier for the caller's real rate.
5701
5962
  * @example 10
5702
5963
  */
5703
5964
  takerFeeBps?: number | null;
@@ -6274,6 +6535,56 @@ export interface operations {
6274
6535
  };
6275
6536
  };
6276
6537
  };
6538
+ get_portfolio_assets: {
6539
+ parameters: {
6540
+ query?: {
6541
+ period?: string;
6542
+ };
6543
+ header?: never;
6544
+ path?: never;
6545
+ cookie?: never;
6546
+ };
6547
+ requestBody?: never;
6548
+ responses: {
6549
+ /** @description OK */
6550
+ 200: {
6551
+ headers: {
6552
+ [name: string]: unknown;
6553
+ };
6554
+ content: {
6555
+ "application/json": components["schemas"]["GetPortfolioAssetsResponse"];
6556
+ };
6557
+ };
6558
+ /** @description Invalid period parameter */
6559
+ 400: {
6560
+ headers: {
6561
+ [name: string]: unknown;
6562
+ };
6563
+ content?: never;
6564
+ };
6565
+ /** @description Authentication required */
6566
+ 401: {
6567
+ headers: {
6568
+ [name: string]: unknown;
6569
+ };
6570
+ content?: never;
6571
+ };
6572
+ /** @description Internal server error */
6573
+ 500: {
6574
+ headers: {
6575
+ [name: string]: unknown;
6576
+ };
6577
+ content?: never;
6578
+ };
6579
+ /** @description Portfolio data unavailable */
6580
+ 503: {
6581
+ headers: {
6582
+ [name: string]: unknown;
6583
+ };
6584
+ content?: never;
6585
+ };
6586
+ };
6587
+ };
6277
6588
  get_portfolio_chart: {
6278
6589
  parameters: {
6279
6590
  query?: {
@@ -6318,6 +6629,197 @@ export interface operations {
6318
6629
  };
6319
6630
  };
6320
6631
  };
6632
+ get_portfolio_margin: {
6633
+ parameters: {
6634
+ query?: never;
6635
+ header?: never;
6636
+ path?: never;
6637
+ cookie?: never;
6638
+ };
6639
+ requestBody?: never;
6640
+ responses: {
6641
+ /** @description OK */
6642
+ 200: {
6643
+ headers: {
6644
+ [name: string]: unknown;
6645
+ };
6646
+ content: {
6647
+ "application/json": components["schemas"]["GetPortfolioMarginResponse"];
6648
+ };
6649
+ };
6650
+ /** @description Authentication required */
6651
+ 401: {
6652
+ headers: {
6653
+ [name: string]: unknown;
6654
+ };
6655
+ content?: never;
6656
+ };
6657
+ /** @description Internal server error */
6658
+ 500: {
6659
+ headers: {
6660
+ [name: string]: unknown;
6661
+ };
6662
+ content?: never;
6663
+ };
6664
+ /** @description Portfolio data unavailable */
6665
+ 503: {
6666
+ headers: {
6667
+ [name: string]: unknown;
6668
+ };
6669
+ content?: never;
6670
+ };
6671
+ };
6672
+ };
6673
+ get_portfolio_performance: {
6674
+ parameters: {
6675
+ query?: {
6676
+ period?: string;
6677
+ };
6678
+ header?: never;
6679
+ path?: never;
6680
+ cookie?: never;
6681
+ };
6682
+ requestBody?: never;
6683
+ responses: {
6684
+ /** @description OK */
6685
+ 200: {
6686
+ headers: {
6687
+ [name: string]: unknown;
6688
+ };
6689
+ content: {
6690
+ "application/json": components["schemas"]["GetPortfolioPerformanceResponse"];
6691
+ };
6692
+ };
6693
+ /** @description Invalid period parameter */
6694
+ 400: {
6695
+ headers: {
6696
+ [name: string]: unknown;
6697
+ };
6698
+ content?: never;
6699
+ };
6700
+ /** @description Authentication required */
6701
+ 401: {
6702
+ headers: {
6703
+ [name: string]: unknown;
6704
+ };
6705
+ content?: never;
6706
+ };
6707
+ /** @description Internal server error */
6708
+ 500: {
6709
+ headers: {
6710
+ [name: string]: unknown;
6711
+ };
6712
+ content?: never;
6713
+ };
6714
+ /** @description Portfolio data or flow reconciliation unavailable */
6715
+ 503: {
6716
+ headers: {
6717
+ [name: string]: unknown;
6718
+ };
6719
+ content?: never;
6720
+ };
6721
+ };
6722
+ };
6723
+ get_portfolio_realized_pnl: {
6724
+ parameters: {
6725
+ query?: {
6726
+ period?: string;
6727
+ };
6728
+ header?: never;
6729
+ path?: never;
6730
+ cookie?: never;
6731
+ };
6732
+ requestBody?: never;
6733
+ responses: {
6734
+ /** @description OK */
6735
+ 200: {
6736
+ headers: {
6737
+ [name: string]: unknown;
6738
+ };
6739
+ content: {
6740
+ "application/json": components["schemas"]["GetPortfolioRealizedPnlResponse"];
6741
+ };
6742
+ };
6743
+ /** @description Invalid period parameter */
6744
+ 400: {
6745
+ headers: {
6746
+ [name: string]: unknown;
6747
+ };
6748
+ content?: never;
6749
+ };
6750
+ /** @description Authentication required */
6751
+ 401: {
6752
+ headers: {
6753
+ [name: string]: unknown;
6754
+ };
6755
+ content?: never;
6756
+ };
6757
+ /** @description Internal server error */
6758
+ 500: {
6759
+ headers: {
6760
+ [name: string]: unknown;
6761
+ };
6762
+ content?: never;
6763
+ };
6764
+ /** @description Portfolio data unavailable */
6765
+ 503: {
6766
+ headers: {
6767
+ [name: string]: unknown;
6768
+ };
6769
+ content?: never;
6770
+ };
6771
+ };
6772
+ };
6773
+ get_portfolio_summary: {
6774
+ parameters: {
6775
+ query?: {
6776
+ period?: string;
6777
+ };
6778
+ header?: never;
6779
+ path?: never;
6780
+ cookie?: never;
6781
+ };
6782
+ requestBody?: never;
6783
+ responses: {
6784
+ /** @description OK */
6785
+ 200: {
6786
+ headers: {
6787
+ [name: string]: unknown;
6788
+ };
6789
+ content: {
6790
+ "application/json": components["schemas"]["GetPortfolioSummaryResponse"];
6791
+ };
6792
+ };
6793
+ /** @description Invalid period parameter */
6794
+ 400: {
6795
+ headers: {
6796
+ [name: string]: unknown;
6797
+ };
6798
+ content?: never;
6799
+ };
6800
+ /** @description Authentication required */
6801
+ 401: {
6802
+ headers: {
6803
+ [name: string]: unknown;
6804
+ };
6805
+ content?: never;
6806
+ };
6807
+ /** @description Internal server error */
6808
+ 500: {
6809
+ headers: {
6810
+ [name: string]: unknown;
6811
+ };
6812
+ content?: never;
6813
+ };
6814
+ /** @description Portfolio data unavailable */
6815
+ 503: {
6816
+ headers: {
6817
+ [name: string]: unknown;
6818
+ };
6819
+ content?: never;
6820
+ };
6821
+ };
6822
+ };
6321
6823
  get_user_movements: {
6322
6824
  parameters: {
6323
6825
  query?: {
@@ -7018,51 +7520,6 @@ export interface operations {
7018
7520
  };
7019
7521
  };
7020
7522
  };
7021
- authenticate_backend: {
7022
- parameters: {
7023
- query?: never;
7024
- header?: never;
7025
- path?: never;
7026
- cookie?: never;
7027
- };
7028
- requestBody: {
7029
- content: {
7030
- "application/json": components["schemas"]["BackendAuthRequest"];
7031
- };
7032
- };
7033
- responses: {
7034
- /** @description OK */
7035
- 200: {
7036
- headers: {
7037
- [name: string]: unknown;
7038
- };
7039
- content: {
7040
- "application/json": components["schemas"]["BackendAuthResponse"];
7041
- };
7042
- };
7043
- /** @description Invalid request parameters */
7044
- 400: {
7045
- headers: {
7046
- [name: string]: unknown;
7047
- };
7048
- content?: never;
7049
- };
7050
- /** @description Invalid secret key or inactive application */
7051
- 401: {
7052
- headers: {
7053
- [name: string]: unknown;
7054
- };
7055
- content?: never;
7056
- };
7057
- /** @description Internal server error */
7058
- 500: {
7059
- headers: {
7060
- [name: string]: unknown;
7061
- };
7062
- content?: never;
7063
- };
7064
- };
7065
- };
7066
7523
  create_challenge: {
7067
7524
  parameters: {
7068
7525
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.0.15",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "lint": "biome lint ."
21
21
  },
22
22
  "dependencies": {
23
- "@0xmonaco/contracts": "1.0.15",
23
+ "@0xmonaco/contracts": "1.0.21",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {