@0xmonaco/types 1.0.80 → 1.0.82

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.
Files changed (35) hide show
  1. package/dist/auth/index.d.ts +2 -2
  2. package/dist/auth/responses.d.ts +1 -1
  3. package/dist/copy-trading/responses.d.ts +19 -19
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/margin-accounts/index.d.ts +10 -0
  7. package/dist/market/index.d.ts +19 -8
  8. package/dist/pitpass/index.d.ts +9 -137
  9. package/dist/pitpass/index.js +5 -3
  10. package/dist/positions/index.d.ts +18 -4
  11. package/dist/profile/index.d.ts +40 -25
  12. package/dist/sdk/index.d.ts +9 -1
  13. package/dist/tradercodes/index.d.ts +142 -0
  14. package/dist/tradercodes/index.js +6 -0
  15. package/dist/{pitpass → tradercodes}/responses.d.ts +2 -2
  16. package/dist/{pitpass → tradercodes}/responses.js +3 -3
  17. package/dist/trading/index.d.ts +24 -2
  18. package/dist/trading/orders.d.ts +24 -5
  19. package/dist/trading/responses.d.ts +38 -0
  20. package/dist/validation/positions.d.ts +6 -1
  21. package/dist/validation/positions.js +18 -2
  22. package/dist/validation/trading.d.ts +12 -2
  23. package/dist/validation/trading.js +9 -0
  24. package/dist/websocket/base.d.ts +34 -5
  25. package/dist/websocket/client.d.ts +31 -10
  26. package/dist/websocket/client.js +8 -6
  27. package/dist/websocket/events/copy-events.d.ts +1 -1
  28. package/dist/websocket/events/market-stats-events.d.ts +13 -9
  29. package/dist/websocket/events/position-events.d.ts +14 -0
  30. package/dist/websocket/snapshots.d.ts +21 -3
  31. package/dist/websocket/snapshots.js +5 -3
  32. package/dist/wire/operations.d.ts +1 -1
  33. package/dist/wire/operations.js +11 -0
  34. package/dist/wire/schema.d.ts +1104 -170
  35. package/package.json +2 -2
@@ -45,8 +45,9 @@ export interface MarketStatsData {
45
45
  /** Best ask price (decimal string) */
46
46
  bestAskPrice?: string;
47
47
  /**
48
- * Open interest (decimal string). Perp-only; omitted for spot, and omitted
49
- * (never zero) until the market's open interest is known.
48
+ * Gross open interest (longs plus shorts) in base units (decimal string).
49
+ * Perp-only; omitted for spot, and omitted (never zero) until the market's
50
+ * open interest is known.
50
51
  */
51
52
  openInterest?: string;
52
53
  /**
@@ -57,9 +58,10 @@ export interface MarketStatsData {
57
58
  openInterestLimit?: string;
58
59
  /**
59
60
  * What is left of `openInterestLimit` at the mark, in quote (USD) notional,
60
- * never below zero (decimal string). At zero, orders that open exposure are
61
- * refused until open interest or the mark falls. Perp-only; omitted for spot,
62
- * when there is no mark, and until open interest is known.
61
+ * never below zero (decimal string): the cap minus the gross `openInterest`
62
+ * × `markPrice`. At zero, orders that open exposure are refused until open
63
+ * interest or the mark falls. Perp-only; omitted for spot, when there is no
64
+ * mark, and until open interest is known.
63
65
  */
64
66
  openInterestHeadroom?: string;
65
67
  /** Last trade price (decimal string) */
@@ -145,8 +147,9 @@ export interface MarketStatsSummary {
145
147
  /** 24h low price (decimal string) */
146
148
  dailyPriceLow?: string;
147
149
  /**
148
- * Open interest (decimal string). Perp-only; omitted for spot, and omitted
149
- * (never zero) until the market's open interest is known.
150
+ * Gross open interest (longs plus shorts) in base units (decimal string).
151
+ * Perp-only; omitted for spot, and omitted (never zero) until the market's
152
+ * open interest is known.
150
153
  */
151
154
  openInterest?: string;
152
155
  /** Current (last settled) funding rate (decimal string). Perp-only; omitted for spot. */
@@ -166,8 +169,9 @@ export interface MarketStatsSummary {
166
169
  /** Funding premium (decimal string). Perp-only; omitted for spot. */
167
170
  premium?: string;
168
171
  /**
169
- * Open interest in quote notional (decimal string): `openInterest` priced at
170
- * the mark, falling back to the last trade price. Perp-only; omitted for spot,
172
+ * Gross open interest (longs plus shorts) in quote notional (decimal
173
+ * string): `openInterest` priced at the mark, falling back to the last trade
174
+ * price. Perp-only; omitted for spot,
171
175
  * and omitted (never zero) until both open interest and a price are known.
172
176
  */
173
177
  openInterestNotional?: string;
@@ -205,6 +205,20 @@ export interface PositionEventData {
205
205
  * released only after durable acknowledgement.
206
206
  */
207
207
  version?: number;
208
+ /**
209
+ * Lifetime funding since the position opened (decimal string; positive
210
+ * means paid, negative means received): the funding accrued on the size
211
+ * still open plus the funding its partial closes settled. A terminal frame
212
+ * carries the closed position's whole-life total, the same `fundingPaid` a
213
+ * REST read of the closed position returns. The subscribe-time snapshot
214
+ * carries the REST value for the same row.
215
+ *
216
+ * Absent means UNKNOWN, never zero: the server cannot account for every
217
+ * earlier reduction yet (a value would understate it), or a deployment
218
+ * older than this field sent the frame. Keep the last known value rather
219
+ * than clearing it.
220
+ */
221
+ fundingPaid?: string;
208
222
  }
209
223
  /**
210
224
  * Position event emitted when a user's position state changes.
@@ -5,9 +5,11 @@
5
5
  * `Subscribed` ack and before that subscription's first live diff. Its `data`
6
6
  * is the channel's COMPLETE current state as a flat array — a consumer that
7
7
  * applies it wholesale needs no REST baseline read for that channel. `trades`
8
- * is the exception: its array is the pair's newest trades, a recent-history
9
- * baseline rather than complete state, which can overlap the first live trades
10
- * or miss one executed just before the subscribe — dedupe on `tradeId`.
8
+ * and `ohlcv` are the exceptions: their arrays are recent history rather than
9
+ * complete state. `trades` is the pair's newest trades, which can overlap the
10
+ * first live trades or miss one executed just before the subscribe — dedupe on
11
+ * `tradeId`. `ohlcv` is the subscribed series' newest candles, whose newest
12
+ * candle can be partial or missing — upsert live candles by `T`.
11
13
  *
12
14
  * Two rules hold across every channel:
13
15
  *
@@ -27,6 +29,7 @@
27
29
  * frame, so its callback is never invoked. That is a silent no-op, never an
28
30
  * error.
29
31
  */
32
+ import type { Candlestick } from "../market";
30
33
  import type { OrderSide, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../trading";
31
34
  /**
32
35
  * Receives one channel's complete subscribe-time state.
@@ -45,6 +48,21 @@ import type { OrderSide, OrderType, SelfTradePreventionMode, TimeInForce, Tradin
45
48
  * see `MonacoWebSocket` for the full rule.
46
49
  */
47
50
  export type SnapshotHandler<T> = (items: T[]) => void;
51
+ /**
52
+ * One candle in an `ohlcv` channel snapshot: the live frame's candlestick
53
+ * without `s`.
54
+ *
55
+ * The channel fixes the pair, interval and price series, so a row carries no
56
+ * envelope and no symbol; `i` is the subscription's interval. `T` is the
57
+ * period start and `t` the period end (start plus the interval), as on a live
58
+ * candle.
59
+ *
60
+ * The snapshot is the series' newest candles, oldest first: recent history,
61
+ * not a gap-free replay. The newest candle can be partial or missing, so a
62
+ * consumer upserts live candles by `T` — a live candle replaces the snapshot
63
+ * candle with the same `T`, or appends a newer one.
64
+ */
65
+ export type OHLCVSnapshotCandle = Omit<Candlestick, "s">;
48
66
  /**
49
67
  * One resting order in an `orders` channel snapshot.
50
68
  *
@@ -5,9 +5,11 @@
5
5
  * `Subscribed` ack and before that subscription's first live diff. Its `data`
6
6
  * is the channel's COMPLETE current state as a flat array — a consumer that
7
7
  * applies it wholesale needs no REST baseline read for that channel. `trades`
8
- * is the exception: its array is the pair's newest trades, a recent-history
9
- * baseline rather than complete state, which can overlap the first live trades
10
- * or miss one executed just before the subscribe — dedupe on `tradeId`.
8
+ * and `ohlcv` are the exceptions: their arrays are recent history rather than
9
+ * complete state. `trades` is the pair's newest trades, which can overlap the
10
+ * first live trades or miss one executed just before the subscribe — dedupe on
11
+ * `tradeId`. `ohlcv` is the subscribed series' newest candles, whose newest
12
+ * candle can be partial or missing — upsert live candles by `T`.
11
13
  *
12
14
  * Two rules hold across every channel:
13
15
  *
@@ -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_follow_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", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "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_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "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_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["add_follow_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", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "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_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "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_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "mint_tokens", "pitpass_check_trader_code_availability", "pitpass_clear_trader_code", "pitpass_get_my_referral_downline", "pitpass_get_my_referral_position", "pitpass_get_my_referral_tree", "pitpass_get_my_trader_code", "pitpass_get_rewards_balance", "pitpass_get_trader_code_info", "pitpass_set_trader_code", "pitpass_transfer_rewards", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -125,8 +125,19 @@ export const OPERATION_IDS = [
125
125
  "list_positions",
126
126
  "list_sub_accounts_with_balances",
127
127
  "list_trading_pairs",
128
+ "list_twap_order_slices",
128
129
  "list_twap_orders",
129
130
  "mint_tokens",
131
+ "pitpass_check_trader_code_availability",
132
+ "pitpass_clear_trader_code",
133
+ "pitpass_get_my_referral_downline",
134
+ "pitpass_get_my_referral_position",
135
+ "pitpass_get_my_referral_tree",
136
+ "pitpass_get_my_trader_code",
137
+ "pitpass_get_rewards_balance",
138
+ "pitpass_get_trader_code_info",
139
+ "pitpass_set_trader_code",
140
+ "pitpass_transfer_rewards",
130
141
  "preview_follow",
131
142
  "refresh_managed_market_quotes",
132
143
  "refresh_session",