@0xmonaco/types 1.0.28 → 1.0.29

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.
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./pitpass";
17
17
  export * from "./portfolio";
18
18
  export * from "./positions";
19
19
  export * from "./profile";
20
+ export * from "./pulse";
20
21
  export * from "./sdk";
21
22
  export * from "./sub-accounts";
22
23
  export * from "./trading";
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export * from "./pitpass";
18
18
  export * from "./portfolio";
19
19
  export * from "./positions";
20
20
  export * from "./profile";
21
+ export * from "./pulse";
21
22
  export * from "./sdk";
22
23
  export * from "./sub-accounts";
23
24
  export * from "./trading";
@@ -213,6 +213,17 @@ export interface ScreenerItem {
213
213
  totalQuoteVolumeLtd: string;
214
214
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
215
215
  totalTradeCountLtd: number;
216
+ /**
217
+ * Latest settled funding rate as a decimal fraction per funding window (the
218
+ * capped settled value); null for spot pairs and margin pairs with no
219
+ * settled funding window yet
220
+ */
221
+ latestFundingRate: string | null;
222
+ /**
223
+ * Close time of the latest settled funding window (ms since epoch, as string);
224
+ * null for spot pairs and margin pairs with no settled funding window yet
225
+ */
226
+ lastFundingTime: string | null;
216
227
  }
217
228
  /**
218
229
  * Paginated screener response, sorted by quoteVolume24h desc (nulls last)
@@ -344,12 +355,16 @@ export interface FundingRecord {
344
355
  tradingPairId: string;
345
356
  fundingRate: string;
346
357
  cumulativeFundingPerUnit?: string;
358
+ /** True when the window settled at the carried last rate (sparse-sample rule). */
359
+ carried?: boolean;
347
360
  }
348
361
  export interface ListFundingHistoryParams {
349
362
  startTime?: string;
350
363
  endTime?: string;
351
364
  page?: number;
352
365
  pageSize?: number;
366
+ /** Sort direction for epoch: "ASC" or "DESC" (default DESC). */
367
+ orderBy?: "ASC" | "DESC";
353
368
  }
354
369
  export interface ListFundingHistoryResponse {
355
370
  records: FundingRecord[];
@@ -357,6 +372,20 @@ export interface ListFundingHistoryResponse {
357
372
  page: number;
358
373
  pageSize: number;
359
374
  }
375
+ export interface ListAllFundingHistoryParams {
376
+ startTime?: string;
377
+ endTime?: string;
378
+ page?: number;
379
+ pageSize?: number;
380
+ /** Sort direction for settledAt (default DESC). */
381
+ orderBy?: "ASC" | "DESC";
382
+ }
383
+ export interface ListAllFundingHistoryResponse {
384
+ records: FundingRecord[];
385
+ total: number;
386
+ page: number;
387
+ pageSize: number;
388
+ }
360
389
  export interface OpenInterest {
361
390
  tradingPairId: string;
362
391
  openInterest?: string;
@@ -431,5 +460,14 @@ export interface MarketAPI extends BaseAPI {
431
460
  getIndexPrice(tradingPairId: string): Promise<IndexPrice>;
432
461
  getFundingState(tradingPairId: string): Promise<FundingState>;
433
462
  listFundingHistory(tradingPairId: string, params?: ListFundingHistoryParams): Promise<ListFundingHistoryResponse>;
463
+ /**
464
+ * Fetch settled funding history across every market in one call, so clients
465
+ * don't have to fan out one listFundingHistory request per trading pair.
466
+ * Each record carries its tradingPairId; sorted by settledAt (default DESC).
467
+ * @param params - Optional time bounds (ms-epoch strings, inclusive on
468
+ * settledAt), pagination, and orderBy (ASC or DESC)
469
+ * @returns Promise resolving to the paginated all-markets funding history
470
+ */
471
+ listAllFundingHistory(params?: ListAllFundingHistoryParams): Promise<ListAllFundingHistoryResponse>;
434
472
  getOpenInterest(tradingPairId: string): Promise<OpenInterest>;
435
473
  }
@@ -77,10 +77,17 @@ export interface PortfolioRealizedTotals {
77
77
  netRealizedPnl: string;
78
78
  }
79
79
  export interface PortfolioClosedTradeStats {
80
+ /** Fill-based: closing fills in the window (partial fills each counted). */
80
81
  count: number;
82
+ /**
83
+ * Position-level: each position (one flat -> open -> flat round-trip) is
84
+ * classified once by its net realized PnL after all fees.
85
+ */
81
86
  winners: number;
82
87
  losers: number;
83
88
  breakEven: number;
89
+ /** Total classified positions (= winners + losers + breakEven). */
90
+ positions: number;
84
91
  winRatePct?: string;
85
92
  }
86
93
  export interface PortfolioBestDay {
@@ -10,12 +10,23 @@ export interface Position {
10
10
  marginMode?: MarginMode;
11
11
  tradingPairId: string;
12
12
  side: PositionSide;
13
+ /**
14
+ * Open rows: current absolute position quantity. Terminal rows
15
+ * (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
16
+ * life, summed from its reducing executions when available.
17
+ */
13
18
  size: string;
14
19
  entryPrice: string;
15
20
  markPrice: string;
16
21
  indexPrice?: string;
17
22
  unrealizedPnl: string;
18
23
  realizedPnl: string;
24
+ /**
25
+ * Open rows: current isolated collateral for this position's risk bucket.
26
+ * Terminal rows: total initial margin allocated across the position's
27
+ * reducing executions when available — the margin basis for lifetime
28
+ * realized return.
29
+ */
19
30
  isolatedMargin: string;
20
31
  leverage?: string;
21
32
  /**
@@ -39,6 +50,16 @@ export interface Position {
39
50
  liquidationPrice: string;
40
51
  status: PositionStatus;
41
52
  updatedAt: string;
53
+ /**
54
+ * Lifetime realized PnL net of trading fees and funding. Terminal rows
55
+ * only; absent when the position's reducing executions are unavailable.
56
+ */
57
+ netRealizedPnl?: string;
58
+ /**
59
+ * Lifetime realized return on the total allocated initial margin, as a
60
+ * percentage. Terminal rows only; absent when unavailable.
61
+ */
62
+ realizedRoe?: string;
42
63
  }
43
64
  export interface ListPositionsParams {
44
65
  marginAccountId?: string;
@@ -427,7 +427,12 @@ export interface PortfolioStats {
427
427
  totalTrades: number;
428
428
  /** Total fees paid */
429
429
  feesPaid: string;
430
- /** Ratio of profitable trades to total trades. Null when there are no closed trades in the period. */
430
+ /**
431
+ * Position-level win rate: winning positions over winning + losing positions
432
+ * (break-even excluded). Each position (one flat→open→flat round-trip) is
433
+ * classified once by its net realized PnL after all fees, not per fill. Null
434
+ * when the period has no closed positions.
435
+ */
431
436
  winLossRatio: number | null;
432
437
  /** Total equity in USDC terms (spot balances plus perps account equity) */
433
438
  totalEquity: string;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Pulse Types
3
+ *
4
+ * Types for the public market-pulse news feed: AI-synthesized, per-asset
5
+ * headlines served from the backend's hourly-refreshed cache.
6
+ *
7
+ * NOTE: This endpoint is **public (unauthenticated)** and ETag-cacheable.
8
+ * It returns 503 while the backend cache is cold.
9
+ */
10
+ import type { BaseAPI } from "../api";
11
+ /** Provenance for one pulse item, for attribution links. */
12
+ export interface PulseSource {
13
+ /** Source article or post URL. */
14
+ url: string;
15
+ /** Source author or publication name. */
16
+ author: string;
17
+ /** Source channel: "twitter" or "news". */
18
+ source: string;
19
+ /** Source publication time, ISO-8601. */
20
+ createdAt: string;
21
+ /** Relevance score, 1 (low) to 5 (high). */
22
+ relevance: number;
23
+ }
24
+ /** One synthesized market-pulse headline. */
25
+ export interface PulseItem {
26
+ /** Watchlist ticker (e.g. "BTC") or "MARKET" for a cross-asset story. */
27
+ asset: string;
28
+ /** Sentiment tag: "Bullish", "Neutral", or "Bearish". */
29
+ sentiment: string;
30
+ /** Synthesized 1-2 sentence summary (at most 240 characters). */
31
+ summary: string;
32
+ /** Timestamp of the most recent source; render relative time client-side. */
33
+ updatedAt: string;
34
+ /** Provenance for the item. */
35
+ sources: PulseSource[];
36
+ }
37
+ /** The latest pulse snapshot. */
38
+ export interface GetPulseResponse {
39
+ /** When this snapshot was produced upstream (ISO-8601 UTC); also the ETag value. */
40
+ generatedAt: string;
41
+ /** Asset universe the snapshot was synthesized against. */
42
+ watchlist: string[];
43
+ /** Pulse items, pre-sorted (watchlist order, MARKET last, newest first per asset). */
44
+ items: PulseItem[];
45
+ }
46
+ /**
47
+ * Pulse API interface. The endpoint is public (no auth required).
48
+ */
49
+ export interface PulseAPI extends BaseAPI {
50
+ /**
51
+ * Get the latest market pulse news feed snapshot.
52
+ *
53
+ * Public/unauthenticated; served from the backend cache (refreshed hourly).
54
+ * Items whose figures could not be verified upstream are removed
55
+ * server-side before caching.
56
+ *
57
+ * @returns Promise resolving to the latest snapshot
58
+ * @throws 503 while the backend cache is cold
59
+ */
60
+ getPulse(): Promise<GetPulseResponse>;
61
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Pulse Types
3
+ *
4
+ * Types for the public market-pulse news feed: AI-synthesized, per-asset
5
+ * headlines served from the backend's hourly-refreshed cache.
6
+ *
7
+ * NOTE: This endpoint is **public (unauthenticated)** and ETag-cacheable.
8
+ * It returns 503 while the backend cache is cold.
9
+ */
@@ -10,6 +10,7 @@ import type { PitpassAPI } from "../pitpass";
10
10
  import type { PortfolioAPI } from "../portfolio";
11
11
  import type { PositionsAPI } from "../positions";
12
12
  import type { ProfileAPI } from "../profile";
13
+ import type { PulseAPI } from "../pulse";
13
14
  import type { SubAccountsAPI } from "../sub-accounts";
14
15
  import type { TradingAPI, TradingMode } from "../trading";
15
16
  import type { VaultAPI } from "../vault";
@@ -101,6 +102,8 @@ export interface MonacoSDK {
101
102
  whitelist: WhitelistAPI;
102
103
  /** Profile operations API */
103
104
  profile: ProfileAPI;
105
+ /** Public market-pulse news feed API (cached, hourly-refreshed) */
106
+ pulse: PulseAPI;
104
107
  /** Orderbook REST API for fetching orderbook snapshots */
105
108
  orderbook: {
106
109
  getOrderbook: (tradingPairId: string, options?: {
@@ -38,9 +38,7 @@ export interface TradingAPI extends BaseAPI {
38
38
  positionSide?: PositionSide;
39
39
  leverage?: string;
40
40
  reduceOnly?: boolean;
41
- /** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
42
41
  takeProfit?: ParentTpSlLegParams;
43
- /** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
44
42
  stopLoss?: ParentTpSlLegParams;
45
43
  }): Promise<CreateOrderResponse>;
46
44
  /**
@@ -65,9 +63,7 @@ export interface TradingAPI extends BaseAPI {
65
63
  positionSide?: PositionSide;
66
64
  leverage?: string;
67
65
  reduceOnly?: boolean;
68
- /** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
69
66
  takeProfit?: ParentTpSlLegParams;
70
- /** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
71
67
  stopLoss?: ParentTpSlLegParams;
72
68
  }): Promise<CreateOrderResponse>;
73
69
  /**
@@ -38,8 +38,6 @@ export interface MatchResult {
38
38
  } | null;
39
39
  }
40
40
  /**
41
- * @deprecated Entry-attached TP/SL is rejected. Use position-associated TP/SL.
42
- *
43
41
  * Parent TP/SL follows the parent order quantity and becomes active once the
44
42
  * parent order creates or extends a position.
45
43
  */
@@ -141,8 +141,12 @@ export const PlaceLimitOrderSchema = z
141
141
  message: "leverage is required for normal MARGIN orders",
142
142
  path: ["options", "leverage"],
143
143
  })
144
- .refine((data) => !hasParentTpSl(data.options), {
145
- message: "Entry-attached TP/SL are no longer supported; create position TP/SL after the position opens",
144
+ .refine((data) => !hasParentTpSl(data.options) || data.options?.tradingMode === "MARGIN", {
145
+ message: "takeProfit/stopLoss are only supported for MARGIN orders",
146
+ path: ["options"],
147
+ })
148
+ .refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
149
+ message: "takeProfit/stopLoss cannot be attached to reduce-only orders",
146
150
  path: ["options"],
147
151
  })
148
152
  .refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
@@ -210,8 +214,12 @@ export const PlaceMarketOrderSchema = z
210
214
  message: "leverage is required for normal MARGIN orders",
211
215
  path: ["options", "leverage"],
212
216
  })
213
- .refine((data) => !hasParentTpSl(data.options), {
214
- message: "Entry-attached TP/SL are no longer supported; create position TP/SL after the position opens",
217
+ .refine((data) => !hasParentTpSl(data.options) || data.options?.tradingMode === "MARGIN", {
218
+ message: "takeProfit/stopLoss are only supported for MARGIN orders",
219
+ path: ["options"],
220
+ })
221
+ .refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
222
+ message: "takeProfit/stopLoss cannot be attached to reduce-only orders",
215
223
  path: ["options"],
216
224
  })
217
225
  .refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
@@ -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", "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_faucet_info", "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"];
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_faucet_info", "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_pulse", "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_all_funding_history", "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];
@@ -60,6 +60,7 @@ export const OPERATION_IDS = [
60
60
  "get_position",
61
61
  "get_position_pnl_history",
62
62
  "get_position_risk",
63
+ "get_pulse",
63
64
  "get_rewards_balance",
64
65
  "get_screener",
65
66
  "get_sub_account_limits",
@@ -75,6 +76,7 @@ export const OPERATION_IDS = [
75
76
  "get_withdrawal",
76
77
  "health_check",
77
78
  "initiate_withdrawal",
79
+ "list_all_funding_history",
78
80
  "list_application_balances",
79
81
  "list_application_movements",
80
82
  "list_application_orders",
@@ -1052,6 +1052,26 @@ export interface paths {
1052
1052
  patch?: never;
1053
1053
  trace?: never;
1054
1054
  };
1055
+ "/api/v1/market/funding/history": {
1056
+ parameters: {
1057
+ query?: never;
1058
+ header?: never;
1059
+ path?: never;
1060
+ cookie?: never;
1061
+ };
1062
+ /**
1063
+ * @description Historical funding settlements across all perp markets in one call, so
1064
+ * clients don't have to fan out one request per trading pair.
1065
+ */
1066
+ get: operations["list_all_funding_history"];
1067
+ put?: never;
1068
+ post?: never;
1069
+ delete?: never;
1070
+ options?: never;
1071
+ head?: never;
1072
+ patch?: never;
1073
+ trace?: never;
1074
+ };
1055
1075
  "/api/v1/market/pairs": {
1056
1076
  parameters: {
1057
1077
  query?: never;
@@ -1854,6 +1874,33 @@ export interface paths {
1854
1874
  patch?: never;
1855
1875
  trace?: never;
1856
1876
  };
1877
+ "/api/v1/pulse": {
1878
+ parameters: {
1879
+ query?: never;
1880
+ header?: never;
1881
+ path?: never;
1882
+ cookie?: never;
1883
+ };
1884
+ /**
1885
+ * Get the market pulse news feed
1886
+ * @description Get the market pulse news feed.
1887
+ *
1888
+ * Returns the latest cached snapshot of AI-synthesized, per-asset news
1889
+ * headlines with sentiment tags, refreshed hourly from the upstream
1890
+ * pipeline by a background poller. The request path never calls the
1891
+ * upstream. Public endpoint — no authentication required. Responses carry
1892
+ * an ETag (the snapshot's generatedAt); clients may send If-None-Match to
1893
+ * receive 304 when unchanged.
1894
+ */
1895
+ get: operations["get_pulse"];
1896
+ put?: never;
1897
+ post?: never;
1898
+ delete?: never;
1899
+ options?: never;
1900
+ head?: never;
1901
+ patch?: never;
1902
+ trace?: never;
1903
+ };
1857
1904
  "/api/v1/trades/by-id/{tradeId}": {
1858
1905
  parameters: {
1859
1906
  query?: never;
@@ -3270,19 +3317,48 @@ export interface components {
3270
3317
  */
3271
3318
  createdAt?: string | null;
3272
3319
  };
3320
+ /**
3321
+ * @description One settled funding window. Windows are fixed and epoch-aligned (hourly);
3322
+ * a boundary the engine was down for is skipped, never settled retroactively,
3323
+ * so consecutive records can legitimately be more than one interval apart.
3324
+ */
3273
3325
  FundingRecord: {
3274
3326
  /** Format: uuid */
3275
3327
  tradingPairId?: string | null;
3276
3328
  epoch?: string | null;
3329
+ /**
3330
+ * @description Final settled rate for the window as a decimal-string fraction per
3331
+ * funding interval (e.g. "0.0001" = 0.01%). The ±max-rate cap is applied
3332
+ * once to the window average at settlement; this is the capped value that
3333
+ * payments used.
3334
+ */
3277
3335
  fundingRate?: string | null;
3336
+ /**
3337
+ * @description Quote currency charged per unit of base position for this window:
3338
+ * funding_rate x reference_price. Positive means longs paid shorts.
3339
+ */
3278
3340
  fundingDeltaPerUnit?: string | null;
3341
+ /**
3342
+ * @description Running sum of funding_delta_per_unit across all settled windows;
3343
+ * position payments settle against deltas of this value.
3344
+ */
3279
3345
  cumulativeFundingPerUnit?: string | null;
3346
+ /**
3347
+ * @description Mark price at the window boundary — the payment basis for every
3348
+ * position settled in this window.
3349
+ */
3280
3350
  referencePrice?: string | null;
3281
3351
  /** Format: uint32 */
3282
3352
  sampleCount?: number | null;
3283
3353
  windowStartedAt?: string | null;
3284
3354
  windowClosedAt?: string | null;
3285
3355
  settledAt?: string | null;
3356
+ /**
3357
+ * @description True when the window held fewer than the minimum accepted samples and
3358
+ * settled at the carried last settled rate (zero if no rate was ever
3359
+ * settled) instead of a freshly computed average.
3360
+ */
3361
+ carried?: boolean | null;
3286
3362
  };
3287
3363
  GetAppStatsResponse: {
3288
3364
  /**
@@ -3459,11 +3535,31 @@ export interface components {
3459
3535
  GetFundingStateResponse: {
3460
3536
  /** Format: uuid */
3461
3537
  tradingPairId?: string | null;
3538
+ /**
3539
+ * @description Most recently SETTLED funding rate as a decimal-string fraction per funding interval; "0" when nothing has settled yet
3540
+ * @example 0.0001
3541
+ */
3462
3542
  currentFundingRate?: string | null;
3543
+ /**
3544
+ * @description Implied rate for the in-progress window. An estimate refreshed on each accepted premium sample (roughly every sample interval plus persistence lag), not a real-time stream; absent when the window has no samples
3545
+ * @example 0.00012
3546
+ */
3463
3547
  estimatedNextFundingRate?: string | null;
3548
+ /**
3549
+ * @description Scheduled end of the current funding window (ms epoch string). An estimate, not a guarantee: settlement lands at or shortly after this boundary when the market is alive, and boundaries that pass while the engine is down are skipped, never settled retroactively
3550
+ * @example 1754006400000
3551
+ */
3464
3552
  nextFundingTime?: string | null;
3465
- /** Format: uint32 */
3553
+ /**
3554
+ * Format: uint32
3555
+ * @description Length of a funding window in seconds, inferred from settlement history and market configuration
3556
+ * @example 3600
3557
+ */
3466
3558
  fundingIntervalSeconds?: number | null;
3559
+ /**
3560
+ * @description Close of the most recently settled window (ms epoch string); absent before the first settlement
3561
+ * @example 1754002800000
3562
+ */
3467
3563
  lastFundingTime?: string | null;
3468
3564
  updatedAt?: string | null;
3469
3565
  };
@@ -4114,7 +4210,7 @@ export interface components {
4114
4210
  perpsEquity?: string | null;
4115
4211
  /**
4116
4212
  * Format: double
4117
- * @description Ratio of profitable trades to total trades
4213
+ * @description Position-level win rate: winning positions over winning + losing positions (break-even excluded). Each position (one flat->open->flat round-trip) is classified once by its net realized PnL after all fees, not per fill. Null when the period has no closed positions.
4118
4214
  * @example 0.65
4119
4215
  */
4120
4216
  winLossRatio?: number | null;
@@ -4163,13 +4259,23 @@ export interface components {
4163
4259
  /** Format: uuid */
4164
4260
  tradingPairId?: string | null;
4165
4261
  side?: string | null;
4262
+ /**
4263
+ * @description Open rows: current absolute position quantity. Terminal rows
4264
+ * (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
4265
+ * life, summed from its reducing executions when available.
4266
+ */
4166
4267
  size?: string | null;
4167
4268
  entryPrice?: string | null;
4168
4269
  markPrice?: string | null;
4169
4270
  indexPrice?: string | null;
4170
4271
  unrealizedPnl?: string | null;
4171
4272
  realizedPnl?: string | null;
4172
- /** @description Current isolated collateral for this position's margin-account bucket. */
4273
+ /**
4274
+ * @description Open rows: current isolated collateral for this position's risk bucket.
4275
+ * Terminal rows: total initial margin allocated across the position's
4276
+ * reducing executions when available — the margin basis for lifetime
4277
+ * realized return.
4278
+ */
4173
4279
  isolatedMargin?: string | null;
4174
4280
  leverage?: string | null;
4175
4281
  /**
@@ -4196,6 +4302,21 @@ export interface components {
4196
4302
  updatedAt?: string | null;
4197
4303
  riskBucketId?: string | null;
4198
4304
  marginMode?: string | null;
4305
+ /**
4306
+ * @description Lifetime realized PnL net of trading fees and funding. Terminal rows
4307
+ * only; absent when the position's reducing executions are unavailable.
4308
+ */
4309
+ netRealizedPnl?: string | null;
4310
+ /**
4311
+ * @description Lifetime realized return on the total allocated initial margin, as a
4312
+ * percentage, computed from NET realized PnL (after trading fees and
4313
+ * funding). The denominator is initial margin only: fees and funding are
4314
+ * costs rather than posted collateral, and funding is signed, so folding it
4315
+ * into the denominator could drive it to zero or negative. Terminal rows
4316
+ * only; absent when unavailable, including when the position's reducing
4317
+ * executions do not account for its whole lifetime.
4318
+ */
4319
+ realizedRoe?: string | null;
4199
4320
  };
4200
4321
  GetPositionRiskResponse: {
4201
4322
  positionId?: string | null;
@@ -4284,6 +4405,26 @@ export interface components {
4284
4405
  */
4285
4406
  applicationMakerFeeBps?: number | null;
4286
4407
  };
4408
+ GetPulseResponse: {
4409
+ /**
4410
+ * @description When this snapshot was produced upstream, ISO-8601 UTC; also serves as the response ETag value
4411
+ * @example 2026-07-22T15:17:14Z
4412
+ */
4413
+ generatedAt?: string | null;
4414
+ /**
4415
+ * @description Asset universe this snapshot was synthesized against
4416
+ * @example [
4417
+ * "BTC",
4418
+ * "ETH",
4419
+ * "SOL",
4420
+ * "SEI",
4421
+ * "HYPE"
4422
+ * ]
4423
+ */
4424
+ watchlist?: string[] | null;
4425
+ /** @description Pulse items, pre-sorted: watchlist order first, MARKET last, most-recent-first within each asset. Items with unverified figures are removed server-side. */
4426
+ items?: components["schemas"]["PulseItem"][] | null;
4427
+ };
4287
4428
  GetRewardsBalanceResponse: {
4288
4429
  /** @description One entry per reward token that has a non-zero available balance. */
4289
4430
  balances?: components["schemas"]["RewardsBalanceEntry"][] | null;
@@ -4563,6 +4704,15 @@ export interface components {
4563
4704
  */
4564
4705
  balanceId?: string | null;
4565
4706
  };
4707
+ ListAllFundingHistoryResponse: {
4708
+ records?: components["schemas"]["FundingRecord"][] | null;
4709
+ /** Format: uint32 */
4710
+ total?: number | null;
4711
+ /** Format: uint32 */
4712
+ page?: number | null;
4713
+ /** Format: uint32 */
4714
+ pageSize?: number | null;
4715
+ };
4566
4716
  ListAppBalancesResponse: {
4567
4717
  balances?: components["schemas"]["ApplicationBalance"][] | null;
4568
4718
  /**
@@ -5133,12 +5283,23 @@ export interface components {
5133
5283
  date?: string | null;
5134
5284
  netRealizedPnl?: string | null;
5135
5285
  };
5286
+ /**
5287
+ * @description Win rate is position-level: winners/losers/break_even and win_rate_pct count
5288
+ * each position (one flat -> open -> flat round-trip) once, classified by its
5289
+ * net realized PnL after all fees. `count` stays fill-based (each partial
5290
+ * closing fill is counted).
5291
+ */
5136
5292
  PortfolioClosedTradeStats: {
5137
5293
  count?: string | null;
5138
5294
  winners?: string | null;
5139
5295
  losers?: string | null;
5140
5296
  breakEven?: string | null;
5141
5297
  winRatePct?: string | null;
5298
+ /**
5299
+ * @description Total classified positions (= winners + losers + break_even): the
5300
+ * position-level denominator, distinct from the fill-based `count`.
5301
+ */
5302
+ positions?: string | null;
5142
5303
  };
5143
5304
  PortfolioMarginPositionCounts: {
5144
5305
  total?: string | null;
@@ -5258,13 +5419,23 @@ export interface components {
5258
5419
  /** Format: uuid */
5259
5420
  tradingPairId?: string | null;
5260
5421
  side?: string | null;
5422
+ /**
5423
+ * @description Open rows: current absolute position quantity. Terminal rows
5424
+ * (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
5425
+ * life, summed from its reducing executions when available.
5426
+ */
5261
5427
  size?: string | null;
5262
5428
  entryPrice?: string | null;
5263
5429
  markPrice?: string | null;
5264
5430
  indexPrice?: string | null;
5265
5431
  unrealizedPnl?: string | null;
5266
5432
  realizedPnl?: string | null;
5267
- /** @description Current isolated collateral for this position's margin-account bucket. */
5433
+ /**
5434
+ * @description Open rows: current isolated collateral for this position's risk bucket.
5435
+ * Terminal rows: total initial margin allocated across the position's
5436
+ * reducing executions when available — the margin basis for lifetime
5437
+ * realized return.
5438
+ */
5268
5439
  isolatedMargin?: string | null;
5269
5440
  leverage?: string | null;
5270
5441
  /**
@@ -5291,6 +5462,21 @@ export interface components {
5291
5462
  updatedAt?: string | null;
5292
5463
  riskBucketId?: string | null;
5293
5464
  marginMode?: string | null;
5465
+ /**
5466
+ * @description Lifetime realized PnL net of trading fees and funding. Terminal rows
5467
+ * only; absent when the position's reducing executions are unavailable.
5468
+ */
5469
+ netRealizedPnl?: string | null;
5470
+ /**
5471
+ * @description Lifetime realized return on the total allocated initial margin, as a
5472
+ * percentage, computed from NET realized PnL (after trading fees and
5473
+ * funding). The denominator is initial margin only: fees and funding are
5474
+ * costs rather than posted collateral, and funding is signed, so folding it
5475
+ * into the denominator could drive it to zero or negative. Terminal rows
5476
+ * only; absent when unavailable, including when the position's reducing
5477
+ * executions do not account for its whole lifetime.
5478
+ */
5479
+ realizedRoe?: string | null;
5294
5480
  };
5295
5481
  PositionHistoryEvent: {
5296
5482
  id?: string | null;
@@ -5444,6 +5630,58 @@ export interface components {
5444
5630
  */
5445
5631
  tradingMode?: string | null;
5446
5632
  };
5633
+ PulseItem: {
5634
+ /**
5635
+ * @description Watchlist ticker (e.g. "BTC") or "MARKET" for a cross-asset story
5636
+ * @example SEI
5637
+ */
5638
+ asset?: string | null;
5639
+ /**
5640
+ * @description Sentiment tag: "Bullish", "Neutral", or "Bearish"
5641
+ * @example Bullish
5642
+ */
5643
+ sentiment?: string | null;
5644
+ /**
5645
+ * @description Synthesized 1-2 sentence summary, at most 240 characters
5646
+ * @example SEI gained 4% amid ecosystem growth.
5647
+ */
5648
+ summary?: string | null;
5649
+ /**
5650
+ * @description Timestamp of the most recent source in the cluster, ISO-8601; render relative time client-side
5651
+ * @example 2026-07-21T02:15:19
5652
+ */
5653
+ updatedAt?: string | null;
5654
+ /** @description Provenance for the item, for attribution links */
5655
+ sources?: components["schemas"]["PulseSource"][] | null;
5656
+ };
5657
+ PulseSource: {
5658
+ /**
5659
+ * @description Source article or post URL
5660
+ * @example https://coinmarketcap.com/top-stories/6a5f0c340787ae5558351f0f/
5661
+ */
5662
+ url?: string | null;
5663
+ /**
5664
+ * @description Source author or publication name
5665
+ * @example CoinMarketCap
5666
+ */
5667
+ author?: string | null;
5668
+ /**
5669
+ * @description Source channel: "twitter" or "news"
5670
+ * @example news
5671
+ */
5672
+ source?: string | null;
5673
+ /**
5674
+ * @description Source publication time, ISO-8601
5675
+ * @example 2026-07-21T02:15:19
5676
+ */
5677
+ createdAt?: string | null;
5678
+ /**
5679
+ * Format: uint32
5680
+ * @description Relevance score, 1 (low) to 5 (high)
5681
+ * @example 4
5682
+ */
5683
+ relevance?: number | null;
5684
+ };
5447
5685
  ReducePositionMarginRequest: {
5448
5686
  amount?: string | null;
5449
5687
  };
@@ -5625,6 +5863,16 @@ export interface components {
5625
5863
  * @example 482931
5626
5864
  */
5627
5865
  totalTradeCountLtd?: string | null;
5866
+ /**
5867
+ * @description Latest settled funding rate as a decimal fraction per funding window (the capped settled value); null for spot pairs and margin pairs with no settled funding window yet
5868
+ * @example 0.000125
5869
+ */
5870
+ latestFundingRate?: string | null;
5871
+ /**
5872
+ * @description Close time of the latest settled funding window (ms since epoch); null for spot pairs and margin pairs with no settled funding window yet
5873
+ * @example 1745308800000
5874
+ */
5875
+ lastFundingTime?: string | null;
5628
5876
  };
5629
5877
  /** @description One UTC-day bucket in a pair's 7-day snapshot. */
5630
5878
  ScreenerSnapshotPoint: {
@@ -8720,6 +8968,37 @@ export interface operations {
8720
8968
  };
8721
8969
  };
8722
8970
  };
8971
+ list_all_funding_history: {
8972
+ parameters: {
8973
+ query?: {
8974
+ /** @description Start time as Unix timestamp (milliseconds) */
8975
+ startTime?: number;
8976
+ /** @description End time as Unix timestamp (milliseconds) */
8977
+ endTime?: number;
8978
+ /** @description Page number (1-indexed) */
8979
+ page?: number;
8980
+ /** @description Items per page (max 100) */
8981
+ pageSize?: number;
8982
+ /** @description Sort direction for settledAt */
8983
+ orderBy?: "ASC" | "DESC";
8984
+ };
8985
+ header?: never;
8986
+ path?: never;
8987
+ cookie?: never;
8988
+ };
8989
+ requestBody?: never;
8990
+ responses: {
8991
+ /** @description OK */
8992
+ 200: {
8993
+ headers: {
8994
+ [name: string]: unknown;
8995
+ };
8996
+ content: {
8997
+ "application/json": components["schemas"]["ListAllFundingHistoryResponse"];
8998
+ };
8999
+ };
9000
+ };
9001
+ };
8723
9002
  list_trading_pairs: {
8724
9003
  parameters: {
8725
9004
  query?: {
@@ -8889,6 +9168,8 @@ export interface operations {
8889
9168
  page?: number;
8890
9169
  /** @description Items per page (max 100) */
8891
9170
  pageSize?: number;
9171
+ /** @description Sort direction for createdAt */
9172
+ orderBy?: "ASC" | "DESC";
8892
9173
  };
8893
9174
  header?: never;
8894
9175
  path: {
@@ -10245,6 +10526,33 @@ export interface operations {
10245
10526
  };
10246
10527
  };
10247
10528
  };
10529
+ get_pulse: {
10530
+ parameters: {
10531
+ query?: never;
10532
+ header?: never;
10533
+ path?: never;
10534
+ cookie?: never;
10535
+ };
10536
+ requestBody?: never;
10537
+ responses: {
10538
+ /** @description OK */
10539
+ 200: {
10540
+ headers: {
10541
+ [name: string]: unknown;
10542
+ };
10543
+ content: {
10544
+ "application/json": components["schemas"]["GetPulseResponse"];
10545
+ };
10546
+ };
10547
+ /** @description Pulse feed not yet available */
10548
+ 503: {
10549
+ headers: {
10550
+ [name: string]: unknown;
10551
+ };
10552
+ content?: never;
10553
+ };
10554
+ };
10555
+ };
10248
10556
  get_trade_by_id: {
10249
10557
  parameters: {
10250
10558
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
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.28",
23
+ "@0xmonaco/contracts": "1.0.29",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {