@0xmonaco/types 0.8.7-develop.0e951a5 → 0.8.7-develop.0f12336

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 (63) hide show
  1. package/README.md +5 -3
  2. package/dist/api/index.d.ts +7 -0
  3. package/dist/applications/index.d.ts +47 -5
  4. package/dist/applications/index.js +2 -1
  5. package/dist/applications/requests.d.ts +78 -0
  6. package/dist/applications/requests.js +7 -0
  7. package/dist/applications/responses.d.ts +213 -2
  8. package/dist/applications/responses.js +3 -1
  9. package/dist/auth/index.d.ts +6 -12
  10. package/dist/auth/index.js +2 -2
  11. package/dist/auth/responses.d.ts +2 -12
  12. package/dist/contracts/balances.d.ts +1 -1
  13. package/dist/delegated-agents/index.d.ts +35 -18
  14. package/dist/faucet/index.d.ts +54 -0
  15. package/dist/faucet/index.js +10 -0
  16. package/dist/fees/index.d.ts +4 -4
  17. package/dist/fees/responses.d.ts +17 -17
  18. package/dist/fees/responses.js +20 -20
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.js +4 -0
  21. package/dist/margin-accounts/index.d.ts +91 -55
  22. package/dist/market/index.d.ts +214 -95
  23. package/dist/positions/index.d.ts +67 -44
  24. package/dist/profile/index.d.ts +156 -70
  25. package/dist/sdk/index.d.ts +24 -3
  26. package/dist/sub-accounts/index.d.ts +146 -0
  27. package/dist/sub-accounts/index.js +9 -0
  28. package/dist/trading/index.d.ts +8 -8
  29. package/dist/trading/orders.d.ts +20 -20
  30. package/dist/trading/responses.d.ts +81 -100
  31. package/dist/validation/margin-accounts.d.ts +53 -13
  32. package/dist/validation/margin-accounts.js +38 -14
  33. package/dist/validation/market.d.ts +1 -1
  34. package/dist/validation/market.js +1 -1
  35. package/dist/validation/positions.d.ts +11 -7
  36. package/dist/validation/positions.js +10 -6
  37. package/dist/validation/profile.d.ts +13 -6
  38. package/dist/validation/profile.js +13 -6
  39. package/dist/validation/trading.d.ts +17 -42
  40. package/dist/validation/trading.js +51 -42
  41. package/dist/validation/vault.d.ts +8 -0
  42. package/dist/validation/vault.js +3 -0
  43. package/dist/vault/index.d.ts +46 -13
  44. package/dist/vault/responses.d.ts +50 -12
  45. package/dist/websocket/events/balance-events.d.ts +2 -1
  46. package/dist/websocket/events/movement-events.d.ts +2 -1
  47. package/dist/whitelist/index.d.ts +44 -0
  48. package/dist/whitelist/index.js +10 -0
  49. package/dist/wire/assert.d.ts +54 -0
  50. package/dist/wire/assert.js +0 -0
  51. package/dist/wire/audit.d.ts +47 -0
  52. package/dist/wire/audit.js +43 -0
  53. package/dist/wire/coverage.d.ts +1 -0
  54. package/dist/wire/coverage.js +0 -0
  55. package/dist/wire/index.d.ts +21 -0
  56. package/dist/wire/index.js +2 -0
  57. package/dist/wire/operations.d.ts +15 -0
  58. package/dist/wire/operations.js +101 -0
  59. package/dist/wire/schema.d.ts +8930 -0
  60. package/dist/wire/schema.js +4 -0
  61. package/dist/withdrawals/index.d.ts +114 -0
  62. package/dist/withdrawals/index.js +0 -0
  63. package/package.json +6 -2
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * Types for market data operations including trading pair metadata and OHLCV data.
5
5
  */
6
+ import type { Address } from "viem";
6
7
  import type { BaseAPI } from "../api";
8
+ import type { TradingMode } from "../trading";
7
9
  /**
8
10
  * Trading pair metadata
9
11
  */
@@ -13,39 +15,45 @@ export interface TradingPair {
13
15
  /** Trading pair symbol e.g. BTC/USDC */
14
16
  symbol: string;
15
17
  /** Base token symbol */
16
- base_token: string;
18
+ baseToken: string;
17
19
  /** Quote token symbol */
18
- quote_token: string;
20
+ quoteToken: string;
19
21
  /** Base asset ID (UUID) */
20
- base_asset_id: string;
22
+ baseAssetId: string;
21
23
  /** Quote asset ID (UUID) */
22
- quote_asset_id: string;
24
+ quoteAssetId: string;
23
25
  /** Base token contract address */
24
- base_token_contract: string;
26
+ baseTokenContract: Address;
25
27
  /** Quote token contract address */
26
- quote_token_contract: string;
28
+ quoteTokenContract: Address;
27
29
  /** Base token decimals */
28
- base_decimals: number;
30
+ baseDecimals: number;
29
31
  /** Base token icon URL */
30
- base_icon_url: string;
32
+ baseIconUrl: string;
31
33
  /** Quote token decimals */
32
- quote_decimals: number;
34
+ quoteDecimals: number;
33
35
  /** Quote token icon URL */
34
- quote_icon_url: string;
35
- /** Market type (e.g. SPOT) */
36
- market_type: string;
36
+ quoteIconUrl: string;
37
+ /** Market type (SPOT or MARGIN) */
38
+ marketType: TradingMode;
39
+ /** Asset-class category: crypto, equities, commodities, or fx */
40
+ category: string;
37
41
  /** Whether the market is active */
38
- is_active: boolean;
42
+ isActive: boolean;
39
43
  /** Maker fee in basis points */
40
- maker_fee_bps: number;
44
+ makerFeeBps: number;
41
45
  /** Taker fee in basis points */
42
- taker_fee_bps: number;
46
+ takerFeeBps: number;
43
47
  /** Minimum order size */
44
- min_order_size: string;
48
+ minOrderSize: string;
45
49
  /** Maximum order size */
46
- max_order_size: string;
50
+ maxOrderSize: string;
47
51
  /** Tick size for price increments */
48
- tick_size: string;
52
+ tickSize: string;
53
+ /** Minimum supported leverage for margin markets (optional, margin only) */
54
+ minLeverage?: string | null;
55
+ /** Maximum supported leverage for margin markets (optional, margin only) */
56
+ maxLeverage?: string | null;
49
57
  }
50
58
  /**
51
59
  * OHLCV candlestick data point (matches API response format)
@@ -113,31 +121,106 @@ export interface GetTradingPairsParams {
113
121
  /** Page number (starts from 1) */
114
122
  page?: number;
115
123
  /** Number of items per page (max 100) */
116
- page_size?: number;
124
+ pageSize?: number;
117
125
  /** Filter by market type (SPOT, MARGIN) */
118
- market_type?: string;
126
+ marketType?: TradingMode;
119
127
  /** Filter by base token symbol */
120
- base_token?: string;
128
+ baseToken?: string;
121
129
  /** Filter by quote token symbol */
122
- quote_token?: string;
130
+ quoteToken?: string;
123
131
  /** Filter by active status */
124
- is_active?: boolean;
132
+ isActive?: boolean;
133
+ /** Filter by asset-class category (crypto, equities, commodities, fx) */
134
+ category?: string;
125
135
  }
126
136
  /**
127
137
  * Response for listing trading pairs with pagination
128
138
  */
129
139
  export interface GetTradingPairsResponse {
130
- trading_pairs: TradingPair[];
140
+ tradingPairs: TradingPair[];
131
141
  page: number;
132
- page_size: number;
142
+ pageSize: number;
133
143
  total: number;
134
- total_pages: number;
144
+ totalPages: number;
135
145
  }
136
146
  /**
137
147
  * Response for a single trading pair
138
148
  */
139
149
  export interface GetTradingPairResponse {
140
- trading_pair: TradingPair;
150
+ tradingPair: TradingPair;
151
+ }
152
+ /**
153
+ * Query parameters for the market screener
154
+ */
155
+ export interface GetScreenerParams {
156
+ /** Page number (min 1, default 1) */
157
+ page?: number;
158
+ /** Items per page (min 1, max 100, default 50) */
159
+ pageSize?: number;
160
+ /** Filter by market type: SPOT or MARGIN */
161
+ marketType?: TradingMode;
162
+ /** Filter by active status */
163
+ isActive?: boolean;
164
+ /** Filter by asset-class category (crypto, equities, commodities, fx) */
165
+ category?: string;
166
+ }
167
+ /**
168
+ * One UTC-day bucket in a pair's 7-day screener snapshot
169
+ */
170
+ export interface ScreenerSnapshotPoint {
171
+ /** UTC day boundary (ms since epoch, as string) */
172
+ bucketStart: string;
173
+ /** Quote-token volume for the day */
174
+ quoteVolume: string;
175
+ /** Percent price change (close - open) / open * 100 for the day */
176
+ priceChangePercent: string;
177
+ }
178
+ /**
179
+ * Per-pair screener row. Window fields are null when there is insufficient history.
180
+ */
181
+ export interface ScreenerItem {
182
+ /** Trading pair UUID */
183
+ tradingPairId: string;
184
+ /** Trading pair symbol (e.g. "BTC/USDC") */
185
+ symbol: string;
186
+ /** Base token icon URL */
187
+ baseIconUrl: string;
188
+ /** Quote token icon URL */
189
+ quoteIconUrl: string;
190
+ /** Most recent close price (null if no trades yet) */
191
+ lastPrice: string | null;
192
+ /** Timestamp of the last candle (ms since epoch, as string; null if no trades yet) */
193
+ lastPriceTimestamp: string | null;
194
+ /** Quote-token volume in the last 1 hour (null if <1h history) */
195
+ quoteVolume1h: string | null;
196
+ /** Quote-token volume in the last 24 hours (null if <24h history) */
197
+ quoteVolume24h: string | null;
198
+ /** Quote-token volume in the last 7 days (null if <7d history) */
199
+ quoteVolume7d: string | null;
200
+ /** Percent price change over the last 1 hour (null if <1h history) */
201
+ priceChangePercent1h: string | null;
202
+ /** Percent price change over the last 24 hours (null if <24h history) */
203
+ priceChangePercent24h: string | null;
204
+ /** Percent price change over the last 7 days (null if <7d history) */
205
+ priceChangePercent7d: string | null;
206
+ /** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
207
+ snapshot7d: ScreenerSnapshotPoint[];
208
+ /** Asset-class category: crypto, equities, commodities, or fx */
209
+ category: string;
210
+ /** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
211
+ totalQuoteVolumeLtd: string;
212
+ /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
213
+ totalTradeCountLtd: number;
214
+ }
215
+ /**
216
+ * Paginated screener response, sorted by quoteVolume24h desc (nulls last)
217
+ */
218
+ export interface GetScreenerResponse {
219
+ items: ScreenerItem[];
220
+ page: number;
221
+ pageSize: number;
222
+ total: number;
223
+ totalPages: number;
141
224
  }
142
225
  /**
143
226
  * API response wrapper for single trading pair
@@ -152,117 +235,131 @@ export interface MarketMetadata {
152
235
  /** Trading pair symbol (e.g., "BTC/USDC") */
153
236
  symbol: string;
154
237
  /** Base token icon URL */
155
- base_icon_url: string;
238
+ baseIconUrl: string;
156
239
  /** Quote token icon URL */
157
- quote_icon_url: string;
240
+ quoteIconUrl: string;
158
241
  /** Current price (8 decimal precision, null if no trades yet) */
159
- last_price: string | null;
242
+ lastPrice: string | null;
160
243
  /** Unix timestamp (ms) of latest price (null if no trades yet) */
161
- last_price_timestamp: number | null;
244
+ lastPriceTimestamp: number | null;
162
245
  /** 24h high price (null if <24h data) */
163
- high_24h: string | null;
246
+ high24h: string | null;
164
247
  /** 24h low price (null if <24h data) */
165
- low_24h: string | null;
248
+ low24h: string | null;
166
249
  /** 24h volume in base asset (null if <24h data) */
167
- volume_24h: string | null;
250
+ volume24h: string | null;
168
251
  /** Absolute price change in 24h (null if <24h data) */
169
- price_change_24h: string | null;
252
+ priceChange24h: string | null;
170
253
  /** Percentage price change in 24h (2 decimals, null if <24h data) */
171
- price_change_percent_24h: string | null;
254
+ priceChangePercent24h: string | null;
172
255
  /** Unix timestamp (ms) when market started trading (null if not available) */
173
- market_initialization_timestamp: number | null;
256
+ marketInitializationTimestamp: number | null;
257
+ /** Life-to-date cumulative base-token volume since inception ("0" if no trades yet) */
258
+ totalBaseVolumeLtd: string;
259
+ /** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
260
+ totalQuoteVolumeLtd: string;
261
+ /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
262
+ totalTradeCountLtd: number;
263
+ }
264
+ /**
265
+ * Exchange-wide life-to-date cumulative statistics across all trading pairs.
266
+ */
267
+ export interface MarketStats {
268
+ /** Life-to-date cumulative quote-token (notional) volume summed across all pairs */
269
+ totalQuoteVolumeLtd: string;
270
+ /** Life-to-date cumulative number of trades summed across all pairs */
271
+ totalTradeCountLtd: number;
174
272
  }
175
273
  export interface RiskTier {
176
274
  notional_floor: string;
177
275
  notional_cap?: string;
178
- initial_margin_ratio: string;
179
- maintenance_margin_ratio: string;
180
- max_leverage: string;
276
+ initialMarginRatio: string;
277
+ maintenanceMarginRatio: string;
278
+ maxLeverage: string;
181
279
  }
182
280
  export interface PerpMarketConfig {
183
- trading_pair_id: string;
281
+ tradingPairId: string;
184
282
  symbol: string;
185
- min_leverage: string;
186
- max_leverage: string;
187
- initial_margin_ratio: string;
188
- maintenance_margin_ratio: string;
189
- funding_interval_seconds: number;
190
- liquidation_fee_bps?: string;
191
- risk_tiers: RiskTier[];
192
- updated_at: string;
283
+ minLeverage: string;
284
+ maxLeverage: string;
285
+ initialMarginRatio: string;
286
+ maintenanceMarginRatio: string;
287
+ fundingIntervalSeconds: number;
288
+ liquidationFeeBps?: string;
289
+ riskTiers: RiskTier[];
290
+ updatedAt: string;
193
291
  }
194
292
  export interface PerpMarketSummary {
195
- trading_pair_id: string;
293
+ tradingPairId: string;
196
294
  symbol: string;
197
- last_price: string;
198
- mark_price: string;
199
- index_price: string;
200
- high_24h?: string;
201
- low_24h?: string;
202
- volume_24h?: string;
203
- price_change_24h?: string;
204
- price_change_percent_24h?: string;
205
- open_interest: string;
206
- current_funding_rate?: string;
207
- estimated_next_funding_rate?: string;
208
- next_funding_time?: string;
209
- market_status: string;
210
- market_regime: string;
211
- updated_at: string;
295
+ lastPrice: string;
296
+ markPrice: string;
297
+ indexPrice: string;
298
+ high24h?: string;
299
+ low24h?: string;
300
+ volume24h?: string;
301
+ priceChange24h?: string;
302
+ priceChangePercent24h?: string;
303
+ openInterest: string;
304
+ currentFundingRate?: string;
305
+ estimatedNextFundingRate?: string;
306
+ nextFundingTime?: string;
307
+ marketStatus: string;
308
+ marketRegime: string;
309
+ updatedAt: string;
212
310
  }
213
311
  export interface MarkPrice {
214
- trading_pair_id: string;
215
- mark_price: string;
216
- oracle_provider: string;
217
- oracle_epoch?: string;
218
- updated_at: string;
312
+ tradingPairId: string;
313
+ markPrice: string;
314
+ oracleProvider: string;
315
+ oracleEpoch?: string;
316
+ updatedAt: string;
219
317
  regime: string;
220
318
  }
221
319
  export interface IndexComponent {
222
320
  provider: string;
223
321
  price: string;
224
322
  weight?: string;
225
- updated_at?: string;
323
+ updatedAt?: string;
226
324
  }
227
325
  export interface IndexPrice {
228
- trading_pair_id: string;
229
- index_price: string;
326
+ tradingPairId: string;
327
+ indexPrice: string;
230
328
  components: IndexComponent[];
231
- updated_at: string;
329
+ updatedAt: string;
232
330
  }
233
331
  export interface FundingState {
234
- trading_pair_id: string;
235
- current_funding_rate: string;
236
- estimated_next_funding_rate?: string;
237
- next_funding_time: string;
238
- funding_interval_seconds: number;
239
- last_funding_time?: string;
240
- updated_at: string;
332
+ tradingPairId: string;
333
+ currentFundingRate: string;
334
+ estimatedNextFundingRate?: string;
335
+ nextFundingTime: string;
336
+ fundingIntervalSeconds: number;
337
+ lastFundingTime?: string;
338
+ updatedAt: string;
241
339
  }
242
340
  export interface FundingRecord {
243
- trading_pair_id: string;
244
- funding_rate: string;
245
- funding_time: string;
246
- cumulative_funding_per_unit?: string;
341
+ tradingPairId: string;
342
+ fundingRate: string;
343
+ cumulativeFundingPerUnit?: string;
247
344
  }
248
345
  export interface ListFundingHistoryParams {
249
- start_time?: string;
250
- end_time?: string;
346
+ startTime?: string;
347
+ endTime?: string;
251
348
  page?: number;
252
- page_size?: number;
349
+ pageSize?: number;
253
350
  }
254
351
  export interface ListFundingHistoryResponse {
255
352
  records: FundingRecord[];
256
353
  total: number;
257
354
  page: number;
258
- page_size: number;
355
+ pageSize: number;
259
356
  }
260
357
  export interface OpenInterest {
261
- trading_pair_id: string;
262
- open_interest?: string;
263
- open_interest_base: string;
264
- open_interest_notional: string;
265
- updated_at: string;
358
+ tradingPairId: string;
359
+ openInterest?: string;
360
+ openInterestBase: string;
361
+ openInterestNotional: string;
362
+ updatedAt: string;
266
363
  }
267
364
  /**
268
365
  * Market API interface.
@@ -275,12 +372,34 @@ export interface MarketAPI extends BaseAPI {
275
372
  * @returns Promise resolving to paginated response with trading pairs
276
373
  */
277
374
  getPaginatedTradingPairs(params?: GetTradingPairsParams): Promise<GetTradingPairsResponse>;
375
+ /**
376
+ * Fetch a single trading pair by its UUID.
377
+ * @param tradingPairId - Trading pair UUID
378
+ * @returns Promise resolving to the trading pair
379
+ * @throws {APIError} If the pair is not found
380
+ */
381
+ getTradingPair(tradingPairId: string): Promise<TradingPair>;
278
382
  /**
279
383
  * Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
280
384
  * @param symbol - Trading pair symbol
385
+ * @param marketType - Optional market type filter (e.g. "SPOT", "MARGIN") to
386
+ * disambiguate a symbol that exists in more than one market
281
387
  * @returns Promise resolving to trading pair or undefined if not found
282
388
  */
283
- getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
389
+ getTradingPairBySymbol(symbol: string, marketType?: TradingMode): Promise<TradingPair | undefined>;
390
+ /**
391
+ * Fetch the paginated market screener: per-pair price/volume/change windows
392
+ * (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
393
+ * @param params - Optional pagination and filter parameters
394
+ * @returns Promise resolving to the paginated screener response
395
+ */
396
+ getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
397
+ /**
398
+ * Fetch exchange-wide life-to-date cumulative statistics across all trading
399
+ * pairs: total quote-token (notional) volume and total number of trades.
400
+ * @returns Promise resolving to the global market stats
401
+ */
402
+ getMarketStats(): Promise<MarketStats>;
284
403
  /**
285
404
  * Fetch historical candlestick data for a trading pair.
286
405
  *
@@ -3,36 +3,37 @@ import type { OrderType, PositionSide, TimeInForce } from "../trading";
3
3
  export type PositionStatus = "OPEN" | "CLOSED" | "LIQUIDATING";
4
4
  export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
5
5
  export interface Position {
6
- position_id: string;
7
- margin_account_id: string;
8
- trading_pair_id: string;
6
+ positionId: string;
7
+ marginAccountId: string;
8
+ riskBucketId?: string;
9
+ tradingPairId: string;
9
10
  side: PositionSide;
10
11
  size: string;
11
- entry_price: string;
12
- mark_price: string;
13
- index_price?: string;
14
- unrealized_pnl: string;
15
- realized_pnl: string;
16
- isolated_margin: string;
12
+ entryPrice: string;
13
+ markPrice: string;
14
+ indexPrice?: string;
15
+ unrealizedPnl: string;
16
+ realizedPnl: string;
17
+ isolatedMargin: string;
17
18
  leverage?: string;
18
- maintenance_margin_required: string;
19
- initial_margin_required?: string;
20
- liquidation_price: string;
19
+ maintenanceMarginRequired: string;
20
+ initialMarginRequired?: string;
21
+ liquidationPrice: string;
21
22
  status: PositionStatus;
22
- updated_at: string;
23
+ updatedAt: string;
23
24
  }
24
25
  export interface ListPositionsParams {
25
- margin_account_id?: string;
26
- trading_pair_id?: string;
26
+ marginAccountId?: string;
27
+ tradingPairId?: string;
27
28
  status?: PositionStatus;
28
29
  page?: number;
29
- page_size?: number;
30
+ pageSize?: number;
30
31
  }
31
32
  export interface ListPositionsResponse {
32
33
  positions: Position[];
33
34
  total: number;
34
35
  page: number;
35
- page_size: number;
36
+ pageSize: number;
36
37
  }
37
38
  export type GetPositionResponse = Position;
38
39
  export interface ClosePositionRequest {
@@ -42,21 +43,42 @@ export interface ClosePositionRequest {
42
43
  quantity?: string;
43
44
  }
44
45
  export interface ClosePositionResponse {
45
- close_order_id: string;
46
+ closeOrderId: string;
46
47
  status: string;
47
48
  message: string;
48
- submitted_quantity: string;
49
+ submittedQuantity: string;
50
+ }
51
+ export interface BatchCloseAllRequest {
52
+ tradingPairId?: string;
53
+ slippageToleranceBps?: number;
54
+ }
55
+ export interface BatchCloseError {
56
+ code: string;
57
+ message: string;
58
+ }
59
+ export interface BatchCloseResult {
60
+ positionId: string;
61
+ closeOrderId?: string;
62
+ status?: string;
63
+ submittedQuantity?: string;
64
+ error?: BatchCloseError;
65
+ }
66
+ export interface BatchCloseAllResponse {
67
+ totalRequested: number;
68
+ totalClosed: number;
69
+ totalFailed: number;
70
+ results: BatchCloseResult[];
49
71
  }
50
72
  export interface PositionRisk {
51
- position_id: string;
52
- mark_price: string;
53
- index_price?: string;
54
- unrealized_pnl: string;
55
- liquidation_price: string;
56
- margin_ratio: string;
57
- maintenance_margin_required: string;
58
- initial_margin_required?: string;
59
- updated_at: string;
73
+ positionId: string;
74
+ markPrice: string;
75
+ indexPrice?: string;
76
+ unrealizedPnl: string;
77
+ liquidationPrice: string;
78
+ marginRatio: string;
79
+ maintenanceMarginRequired: string;
80
+ initialMarginRequired?: string;
81
+ updatedAt: string;
60
82
  }
61
83
  export interface AddPositionMarginRequest {
62
84
  amount: string;
@@ -66,9 +88,9 @@ export interface ReducePositionMarginRequest {
66
88
  amount: string;
67
89
  }
68
90
  export interface PositionMarginResponse {
69
- position_id: string;
70
- margin_account_id: string;
71
- new_isolated_margin: string;
91
+ positionId: string;
92
+ marginAccountId: string;
93
+ newIsolatedMargin: string;
72
94
  status: string;
73
95
  message: string;
74
96
  }
@@ -86,40 +108,41 @@ export interface AttachPositionTpSlRequest {
86
108
  stopLoss?: TpSlLeg;
87
109
  }
88
110
  export interface AttachPositionTpSlResponse {
89
- position_id: string;
90
- take_profit_order_id?: string;
91
- stop_loss_order_id?: string;
111
+ positionId: string;
112
+ takeProfitOrderId?: string;
113
+ stopLossOrderId?: string;
92
114
  status: "SUCCESS" | "FAILED";
93
115
  message: string;
94
116
  }
95
117
  export interface ListPositionHistoryParams {
96
- position_id?: string;
97
- margin_account_id?: string;
98
- trading_pair_id?: string;
118
+ positionId?: string;
119
+ marginAccountId?: string;
120
+ tradingPairId?: string;
99
121
  page?: number;
100
- page_size?: number;
122
+ pageSize?: number;
101
123
  }
102
124
  export interface PositionHistoryEvent {
103
125
  event_id: string;
104
- position_id?: string;
105
- margin_account_id?: string;
106
- trading_pair_id?: string;
107
- event_type: string;
126
+ positionId?: string;
127
+ marginAccountId?: string;
128
+ tradingPairId?: string;
129
+ eventType: string;
108
130
  quantity?: string;
109
131
  price?: string;
110
- realized_pnl?: string;
132
+ realizedPnl?: string;
111
133
  timestamp: string;
112
134
  }
113
135
  export interface ListPositionHistoryResponse {
114
136
  events: PositionHistoryEvent[];
115
137
  total: number;
116
138
  page: number;
117
- page_size: number;
139
+ pageSize: number;
118
140
  }
119
141
  export interface PositionsAPI extends BaseAPI {
120
142
  listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
121
143
  getPosition(positionId: string): Promise<GetPositionResponse>;
122
144
  closePosition(positionId: string, request: ClosePositionRequest): Promise<ClosePositionResponse>;
145
+ batchCloseAllPositions(request?: BatchCloseAllRequest): Promise<BatchCloseAllResponse>;
123
146
  getPositionRisk(positionId: string): Promise<PositionRisk>;
124
147
  addPositionMargin(positionId: string, request: AddPositionMarginRequest): Promise<PositionMarginResponse>;
125
148
  reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;