@0xmonaco/core 1.1.5-develop.129b2c6 → 1.1.5

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.
@@ -56,7 +56,7 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
56
56
  *
57
57
  * @param params - Pagination and filter options
58
58
  * @returns Promise resolving to a paginated list of orders
59
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
59
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
60
60
  */
61
61
  listApplicationOrders(params: ListAppOrdersParams): Promise<ListAppOrdersResponse>;
62
62
  /**
@@ -74,7 +74,7 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
74
74
  *
75
75
  * @param params - Pagination and filter options
76
76
  * @returns Promise resolving to a paginated list of users
77
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
77
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
78
78
  */
79
79
  listApplicationUsers(params: ListAppUsersParams): Promise<ListAppUsersResponse>;
80
80
  /**
@@ -92,7 +92,7 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
92
92
  *
93
93
  * @param params - Pagination and filter options
94
94
  * @returns Promise resolving to a paginated list of movements
95
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
95
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
96
96
  */
97
97
  listApplicationMovements(params: ListAppMovementsParams): Promise<ListAppMovementsResponse>;
98
98
  /**
@@ -110,7 +110,7 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
110
110
  *
111
111
  * @param params - Pagination and filter options
112
112
  * @returns Promise resolving to a paginated list of balances
113
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
113
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
114
114
  */
115
115
  listApplicationBalances(params: ListAppBalancesParams): Promise<ListAppBalancesResponse>;
116
116
  /**
@@ -121,7 +121,7 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
121
121
  *
122
122
  * @param params - Optional `since` filter
123
123
  * @returns Promise resolving to the application stats
124
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
124
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
125
125
  */
126
126
  getApplicationStats(params: GetAppStatsParams): Promise<GetAppStatsResponse>;
127
127
  }
@@ -69,7 +69,7 @@ export class ApplicationsAPIImpl extends BaseAPI {
69
69
  *
70
70
  * @param params - Pagination and filter options
71
71
  * @returns Promise resolving to a paginated list of orders
72
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
72
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
73
73
  */
74
74
  async listApplicationOrders(params) {
75
75
  validate(ListAppOrdersSchema, params);
@@ -99,7 +99,7 @@ export class ApplicationsAPIImpl extends BaseAPI {
99
99
  *
100
100
  * @param params - Pagination and filter options
101
101
  * @returns Promise resolving to a paginated list of users
102
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
102
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
103
103
  */
104
104
  async listApplicationUsers(params) {
105
105
  validate(ListAppUsersSchema, params);
@@ -127,7 +127,7 @@ export class ApplicationsAPIImpl extends BaseAPI {
127
127
  *
128
128
  * @param params - Pagination and filter options
129
129
  * @returns Promise resolving to a paginated list of movements
130
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
130
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
131
131
  */
132
132
  async listApplicationMovements(params) {
133
133
  validate(ListAppMovementsSchema, params);
@@ -156,7 +156,7 @@ export class ApplicationsAPIImpl extends BaseAPI {
156
156
  *
157
157
  * @param params - Pagination and filter options
158
158
  * @returns Promise resolving to a paginated list of balances
159
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
159
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
160
160
  */
161
161
  async listApplicationBalances(params) {
162
162
  validate(ListAppBalancesSchema, params);
@@ -176,7 +176,7 @@ export class ApplicationsAPIImpl extends BaseAPI {
176
176
  *
177
177
  * @param params - Optional `since` filter
178
178
  * @returns Promise resolving to the application stats
179
- * @throws {APIError} When the request fails (404 for an unknown, inactive or hidden client ID, 429 when rate limited)
179
+ * @throws {APIError} When the request fails (404 for an unknown client ID, 429 when rate limited)
180
180
  */
181
181
  async getApplicationStats(params) {
182
182
  return await this.makePublicRequest(perpRoutes.applications.stats({ clientId: params.clientId, since: params.since }));
@@ -14,7 +14,6 @@
14
14
  * const result = await sdk.buildercodes.claimBuildercodeRewards({
15
15
  * token: "0x0000000000000000000000000000000000000002",
16
16
  * amount: "1000000",
17
- * idempotencyKey: crypto.randomUUID(), // keep it across retries of this claim
18
17
  * });
19
18
  * console.log(`Payout remaining: ${result.payoutBalance}`);
20
19
  * console.log(`Now tradeable: ${result.tradingBalance}`);
@@ -79,24 +78,18 @@ export declare class BuildercodesAPIImpl extends BaseAPI implements Buildercodes
79
78
  * Throws 503 when the matching engine is unreachable, restarting, or slow to
80
79
  * answer. Treat that as an UNKNOWN outcome rather than a rejection: the claim
81
80
  * is admitted to the sequencer before its reply is sent, so it may still
82
- * commit.
81
+ * commit, and there is no idempotency key — a blind retry can claim twice.
82
+ * Do not retry automatically, and do not settle it with a balance read: an
83
+ * admitted claim can still be queued, so an unchanged balance does not prove
84
+ * it will not commit. Treat the claim as pending and reconcile first.
83
85
  *
84
- * Pass `idempotencyKey` to make that retry safe: the same key and claim
85
- * retried within 15 minutes returns the first claim's result without moving
86
- * money again, so a keyed claim's 5xx keeps the SDK's usual `retryable`
87
- * flag. The same key with a different claim throws 409
88
- * `IDEMPOTENCY_KEY_CONFLICT`.
89
- *
90
- * Without a key a blind retry can claim twice. Do not retry automatically,
91
- * and do not settle it with a balance read: an admitted claim can still be
92
- * queued, so an unchanged balance does not prove it will not commit. Treat
93
- * the claim as pending and reconcile first. Because that warning has to hold
94
- * for code as well as readers, an unkeyed claim's ambiguous failure (any 5xx,
95
- * or a network error with no response at all) is thrown with
96
- * `retryable: false`, against the SDK's usual "every 5xx is retryable" rule.
97
- * A pre-admission rejection is exempt and stays retryable: a maintenance
98
- * block, and a sequencer overload (`code: "OVERLOADED"`), both of which are
99
- * refused before the claim is queued and so committed nothing.
86
+ * Because that warning has to hold for code as well as readers, an ambiguous
87
+ * failure (any 5xx, or a network error with no response at all) is thrown
88
+ * with `retryable: false`, against the SDK's usual "every 5xx is retryable"
89
+ * rule, so a caller driving retries off that flag cannot claim twice. A
90
+ * pre-admission rejection is exempt and stays retryable: a maintenance block,
91
+ * and a sequencer overload (`code: "OVERLOADED"`), both of which are refused
92
+ * before the claim is queued and so committed nothing.
100
93
  */
101
94
  claimBuildercodeRewards(params: ClaimBuildercodeRewardsParams): Promise<ClaimBuildercodeRewardsResponse>;
102
95
  }
@@ -14,7 +14,6 @@
14
14
  * const result = await sdk.buildercodes.claimBuildercodeRewards({
15
15
  * token: "0x0000000000000000000000000000000000000002",
16
16
  * amount: "1000000",
17
- * idempotencyKey: crypto.randomUUID(), // keep it across retries of this claim
18
17
  * });
19
18
  * console.log(`Payout remaining: ${result.payoutBalance}`);
20
19
  * console.log(`Now tradeable: ${result.tradingBalance}`);
@@ -37,9 +36,9 @@ const MAINTENANCE_BLOCK_ERROR = "OPERATIONS_BLOCKED";
37
36
  */
38
37
  const OVERLOADED_ENGINE_CODE = "OVERLOADED";
39
38
  /**
40
- * Clear `retryable` on an unkeyed claim failure whose outcome is UNKNOWN.
39
+ * Clear `retryable` on a claim failure whose outcome is UNKNOWN.
41
40
  *
42
- * An unkeyed claim is not idempotent and is admitted to the sequencer before its reply
41
+ * A claim is not idempotent and is admitted to the sequencer before its reply
43
42
  * is sent, so a 5xx or a dropped connection can arrive after the claim already
44
43
  * committed. `APIError` classifies every 5xx and every network failure as
45
44
  * `retryable: true`, and the documented consumer pattern retries whenever that
@@ -72,7 +71,7 @@ function markAmbiguousOutcomeNonRetryable(error) {
72
71
  }
73
72
  error.retryable = false;
74
73
  error.suggestion =
75
- "The claim's outcome is unknown: it may have committed after this failure. Do not retry automatically, and do not rely on a balance read to decide — an admitted claim can still be queued, so an unchanged balance does not prove it will not commit. Treat the claim as pending and reconcile before issuing another; this claim carried no idempotencyKey, so a retry can claim a second time. Send one to make retries safe.";
74
+ "The claim's outcome is unknown: it may have committed after this failure. Do not retry automatically, and do not rely on a balance read to decide — an admitted claim can still be queued, so an unchanged balance does not prove it will not commit. Treat the claim as pending and reconcile before issuing another; this endpoint has no idempotency key, so a retry can claim a second time.";
76
75
  return error;
77
76
  }
78
77
  /**
@@ -193,43 +192,28 @@ export class BuildercodesAPIImpl extends BaseAPI {
193
192
  * Throws 503 when the matching engine is unreachable, restarting, or slow to
194
193
  * answer. Treat that as an UNKNOWN outcome rather than a rejection: the claim
195
194
  * is admitted to the sequencer before its reply is sent, so it may still
196
- * commit.
195
+ * commit, and there is no idempotency key — a blind retry can claim twice.
196
+ * Do not retry automatically, and do not settle it with a balance read: an
197
+ * admitted claim can still be queued, so an unchanged balance does not prove
198
+ * it will not commit. Treat the claim as pending and reconcile first.
197
199
  *
198
- * Pass `idempotencyKey` to make that retry safe: the same key and claim
199
- * retried within 15 minutes returns the first claim's result without moving
200
- * money again, so a keyed claim's 5xx keeps the SDK's usual `retryable`
201
- * flag. The same key with a different claim throws 409
202
- * `IDEMPOTENCY_KEY_CONFLICT`.
203
- *
204
- * Without a key a blind retry can claim twice. Do not retry automatically,
205
- * and do not settle it with a balance read: an admitted claim can still be
206
- * queued, so an unchanged balance does not prove it will not commit. Treat
207
- * the claim as pending and reconcile first. Because that warning has to hold
208
- * for code as well as readers, an unkeyed claim's ambiguous failure (any 5xx,
209
- * or a network error with no response at all) is thrown with
210
- * `retryable: false`, against the SDK's usual "every 5xx is retryable" rule.
211
- * A pre-admission rejection is exempt and stays retryable: a maintenance
212
- * block, and a sequencer overload (`code: "OVERLOADED"`), both of which are
213
- * refused before the claim is queued and so committed nothing.
200
+ * Because that warning has to hold for code as well as readers, an ambiguous
201
+ * failure (any 5xx, or a network error with no response at all) is thrown
202
+ * with `retryable: false`, against the SDK's usual "every 5xx is retryable"
203
+ * rule, so a caller driving retries off that flag cannot claim twice. A
204
+ * pre-admission rejection is exempt and stays retryable: a maintenance block,
205
+ * and a sequencer overload (`code: "OVERLOADED"`), both of which are refused
206
+ * before the claim is queued and so committed nothing.
214
207
  */
215
208
  async claimBuildercodeRewards(params) {
216
209
  const validated = validate(ClaimBuildercodeRewardsParamsSchema, params);
217
- const body = validated.idempotencyKey === undefined
218
- ? { token: validated.token, amount: validated.amount }
219
- : { token: validated.token, amount: validated.amount, idempotencyKey: validated.idempotencyKey };
220
210
  try {
221
211
  return await this.makeAuthenticatedRequest("/api/v1/buildercodes/rewards/claim", {
222
212
  method: "POST",
223
- body: JSON.stringify(body),
213
+ body: JSON.stringify({ token: validated.token, amount: validated.amount }),
224
214
  });
225
215
  }
226
216
  catch (error) {
227
- // A keyed claim retried under the same key returns the first claim's
228
- // result instead of claiming again, so its 5xx keeps the flag `APIError`
229
- // gave it.
230
- if (validated.idempotencyKey !== undefined) {
231
- throw error;
232
- }
233
217
  throw markAmbiguousOutcomeNonRetryable(error);
234
218
  }
235
219
  }
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * This module exports the new simplified APIs for the Monaco SDK.
5
5
  */
6
- export * from "./analytics";
7
6
  export * from "./applications/index";
8
7
  export * from "./base";
9
8
  export * from "./buildercodes";
package/dist/api/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * This module exports the new simplified APIs for the Monaco SDK.
5
5
  */
6
- export * from "./analytics";
7
6
  export * from "./applications/index";
8
7
  export * from "./base";
9
8
  export * from "./buildercodes";
@@ -1,10 +1,7 @@
1
1
  import type { OrderbookEvent, OrderbookQuotationMode, TradingMode } from "@0xmonaco/types";
2
2
  import { BaseAPI } from "../base";
3
3
  export interface GetOrderbookOptions {
4
- /**
5
- * Number of price levels per side (max 1000). Defaults to 10. Above 100 the
6
- * snapshot comes from the market-data book and carries `bookSeq`.
7
- */
4
+ /** Number of price levels to return (max 100). Defaults to 10. */
8
5
  depth?: number;
9
6
  /** Trading mode: 'Spot' or 'Margin'. Defaults to 'Spot'. */
10
7
  tradingMode?: TradingMode;
@@ -33,8 +33,6 @@ export class OrderbookAPIImpl extends BaseAPI {
33
33
  quoteDecimals: response.quoteDecimals,
34
34
  timestamp: response.timestamp,
35
35
  sequence: response.sequenceNumber,
36
- // Kept as the wire's decimal string: a u64 can exceed Number.MAX_SAFE_INTEGER.
37
- ...(response.bookSeq != null ? { bookSeq: response.bookSeq } : {}),
38
36
  };
39
37
  }
40
38
  }
@@ -1,59 +1,4 @@
1
1
  export declare const perpRoutes: {
2
- readonly analytics: {
3
- readonly protocolTotals: (params?: {
4
- window?: string;
5
- startTime?: number;
6
- endTime?: number;
7
- }) => string;
8
- readonly protocolSeries: (params?: {
9
- window?: string;
10
- startTime?: number;
11
- endTime?: number;
12
- }) => string;
13
- readonly marketVolumes: (params?: {
14
- window?: string;
15
- startTime?: number;
16
- endTime?: number;
17
- limit?: number;
18
- }) => string;
19
- readonly treasuryNetFees: () => string;
20
- readonly builders: () => string;
21
- readonly builder: (builder: string) => string;
22
- readonly builderTotals: (builder: string, params?: {
23
- window?: string;
24
- startTime?: number;
25
- endTime?: number;
26
- }) => string;
27
- readonly builderSeries: (builder: string, params?: {
28
- window?: string;
29
- startTime?: number;
30
- endTime?: number;
31
- }) => string;
32
- readonly builderLeaderboard: (params?: {
33
- window?: string;
34
- startTime?: number;
35
- endTime?: number;
36
- limit?: number;
37
- }) => string;
38
- readonly walletLeaderboard: (params?: {
39
- limit?: number;
40
- }) => string;
41
- readonly walletSummary: (wallet: string) => string;
42
- readonly walletLiquidations: (wallet: string, params?: {
43
- pageSize?: number;
44
- pageToken?: string;
45
- }) => string;
46
- readonly tokenCustody: () => string;
47
- readonly tokenCustodyDetail: (token: string) => string;
48
- readonly vaultDeposits: (params?: {
49
- pageSize?: number;
50
- pageToken?: string;
51
- }) => string;
52
- readonly vaultWithdrawals: (params?: {
53
- pageSize?: number;
54
- pageToken?: string;
55
- }) => string;
56
- };
57
2
  readonly orders: {
58
3
  readonly create: () => string;
59
4
  readonly list: (params?: {
@@ -15,24 +15,6 @@ function withQuery(path, params) {
15
15
  return query ? `${path}?${query}` : path;
16
16
  }
17
17
  export const perpRoutes = {
18
- analytics: {
19
- protocolTotals: (params) => withQuery(`${API_V1}/analytics/protocol/totals`, params),
20
- protocolSeries: (params) => withQuery(`${API_V1}/analytics/protocol/series`, params),
21
- marketVolumes: (params) => withQuery(`${API_V1}/analytics/markets/volume`, params),
22
- treasuryNetFees: () => `${API_V1}/analytics/treasury/net-fees`,
23
- builders: () => `${API_V1}/analytics/builders`,
24
- builder: (builder) => `${API_V1}/analytics/builders/${encodeURIComponent(builder)}`,
25
- builderTotals: (builder, params) => withQuery(`${API_V1}/analytics/builders/${encodeURIComponent(builder)}/totals`, params),
26
- builderSeries: (builder, params) => withQuery(`${API_V1}/analytics/builders/${encodeURIComponent(builder)}/series`, params),
27
- builderLeaderboard: (params) => withQuery(`${API_V1}/analytics/builder-leaderboard`, params),
28
- walletLeaderboard: (params) => withQuery(`${API_V1}/analytics/wallet-leaderboard`, params),
29
- walletSummary: (wallet) => `${API_V1}/analytics/wallets/${encodeSegment(wallet)}`,
30
- walletLiquidations: (wallet, params) => withQuery(`${API_V1}/analytics/wallets/${encodeSegment(wallet)}/liquidations`, params),
31
- tokenCustody: () => `${API_V1}/analytics/tokens`,
32
- tokenCustodyDetail: (token) => `${API_V1}/analytics/tokens/${encodeSegment(token)}`,
33
- vaultDeposits: (params) => withQuery(`${API_V1}/analytics/deposits`, params),
34
- vaultWithdrawals: (params) => withQuery(`${API_V1}/analytics/withdrawals`, params),
35
- },
36
18
  orders: {
37
19
  create: () => `${API_V1}/orders`,
38
20
  list: (params) => withQuery(`${API_V1}/orders`, params),
@@ -41,7 +41,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
41
41
  * @param quantity - The order quantity as string
42
42
  * @param price - The limit price as string
43
43
  * @param options - Optional parameters for the limit order
44
- * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
44
+ * @param options.tradingMode - Trading mode (e.g., "SPOT")
45
45
  * @param options.useMasterBalance - Whether to use master balance for sub-accounts
46
46
  * @param options.expirationDate - Optional expiration date for GTC orders (ISO 8601 format)
47
47
  * @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
@@ -115,7 +115,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
115
115
  * @param side - The order side ("BUY" or "SELL")
116
116
  * @param quantity - The order quantity as string
117
117
  * @param options - Optional parameters for the market order
118
- * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
118
+ * @param options.tradingMode - Trading mode (e.g., "SPOT")
119
119
  * @param options.slippageTolerance - Tightens the mandatory 1,000 bps price band, as a decimal (e.g., 0.01 for 1%; 0 for best price only). It can only tighten the band, never widen it; omitting it applies the full 1,000 bps band.
120
120
  * @returns Promise resolving to CreateOrderResponse with order details
121
121
  *
@@ -77,7 +77,7 @@ export class TradingAPIImpl extends BaseAPI {
77
77
  * @param quantity - The order quantity as string
78
78
  * @param price - The limit price as string
79
79
  * @param options - Optional parameters for the limit order
80
- * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
80
+ * @param options.tradingMode - Trading mode (e.g., "SPOT")
81
81
  * @param options.useMasterBalance - Whether to use master balance for sub-accounts
82
82
  * @param options.expirationDate - Optional expiration date for GTC orders (ISO 8601 format)
83
83
  * @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
@@ -131,7 +131,7 @@ export class TradingAPIImpl extends BaseAPI {
131
131
  side,
132
132
  price,
133
133
  quantity,
134
- tradingMode: options?.tradingMode,
134
+ tradingMode: options?.tradingMode || "SPOT",
135
135
  useMasterBalance: options?.useMasterBalance,
136
136
  expirationDate: options?.expirationDate,
137
137
  timeInForce: options?.timeInForce,
@@ -165,7 +165,7 @@ export class TradingAPIImpl extends BaseAPI {
165
165
  * @param side - The order side ("BUY" or "SELL")
166
166
  * @param quantity - The order quantity as string
167
167
  * @param options - Optional parameters for the market order
168
- * @param options.tradingMode - Trading mode ("SPOT" or "MARGIN"). Omit it to use the trading pair market type.
168
+ * @param options.tradingMode - Trading mode (e.g., "SPOT")
169
169
  * @param options.slippageTolerance - Tightens the mandatory 1,000 bps price band, as a decimal (e.g., 0.01 for 1%; 0 for best price only). It can only tighten the band, never widen it; omitting it applies the full 1,000 bps band.
170
170
  * @returns Promise resolving to CreateOrderResponse with order details
171
171
  *
@@ -211,7 +211,7 @@ export class TradingAPIImpl extends BaseAPI {
211
211
  slippageToleranceBps: options?.slippageTolerance !== undefined ? Math.round(options.slippageTolerance * 10000) : undefined,
212
212
  price: null, // Market orders don't need price
213
213
  quantity,
214
- tradingMode: options?.tradingMode,
214
+ tradingMode: options?.tradingMode || "SPOT",
215
215
  marginAccountId: options?.marginAccountId,
216
216
  marginMode: options?.marginMode,
217
217
  riskBucketId: options?.riskBucketId,
@@ -460,7 +460,7 @@ export class TradingAPIImpl extends BaseAPI {
460
460
  side: order.side,
461
461
  price: order.price,
462
462
  quantity: order.quantity,
463
- tradingMode: order.tradingMode,
463
+ tradingMode: order.tradingMode || "SPOT",
464
464
  slippageToleranceBps: order.slippageTolerance !== undefined ? Math.round(order.slippageTolerance * 10000) : undefined,
465
465
  useMasterBalance: order.useMasterBalance,
466
466
  expirationDate: order.expirationDate,
@@ -761,7 +761,7 @@ export class TradingAPIImpl extends BaseAPI {
761
761
  slippageToleranceBps: options.slippageToleranceBps,
762
762
  randomize: options.randomize,
763
763
  reduceOnly: options.reduceOnly,
764
- tradingMode: options.tradingMode,
764
+ tradingMode: options.tradingMode || "SPOT",
765
765
  marginAccountId: options.marginAccountId,
766
766
  riskBucketId: options.riskBucketId,
767
767
  marginMode: options.marginMode,