ccxt 4.2.70 → 4.2.71

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.
@@ -13,7 +13,7 @@ export interface Dictionary<T> {
13
13
  }
14
14
  export declare type Dict = Dictionary<any>;
15
15
  export declare type NullableDict = Dict | undefined;
16
- export declare type List = Array<any> | undefined;
16
+ export declare type List = Array<any>;
17
17
  export declare type NullableList = List | undefined;
18
18
  /** Request parameters */
19
19
  export interface MinMax {
@@ -83,24 +83,24 @@ export interface Trade {
83
83
  price: number;
84
84
  timestamp: Int;
85
85
  type: Str;
86
- side: 'buy' | 'sell' | string;
86
+ side: 'buy' | 'sell' | Str;
87
87
  symbol: Str;
88
- takerOrMaker: 'taker' | 'maker' | string;
88
+ takerOrMaker: 'taker' | 'maker' | Str;
89
89
  cost: Num;
90
90
  fee: Fee;
91
91
  }
92
92
  export interface Order {
93
93
  id: string;
94
- clientOrderId: string;
94
+ clientOrderId: Str;
95
95
  datetime: string;
96
96
  timestamp: number;
97
97
  lastTradeTimestamp: number;
98
98
  lastUpdateTimestamp?: number;
99
- status: 'open' | 'closed' | 'canceled' | string;
99
+ status: 'open' | 'closed' | 'canceled' | Str;
100
100
  symbol: string;
101
- type: string;
102
- timeInForce?: string;
103
- side: 'buy' | 'sell' | string;
101
+ type: Str;
102
+ timeInForce?: Str;
103
+ side: 'buy' | 'sell' | Str;
104
104
  price: number;
105
105
  average?: number;
106
106
  amount: number;
@@ -156,10 +156,10 @@ export interface Transaction {
156
156
  tag: Str;
157
157
  tagFrom: Str;
158
158
  tagTo: Str;
159
- type: 'deposit' | 'withdrawal' | string;
159
+ type: 'deposit' | 'withdrawal' | Str;
160
160
  amount: Num;
161
161
  currency: Str;
162
- status: 'pending' | 'ok' | string;
162
+ status: 'pending' | 'ok' | Str;
163
163
  updated: Int;
164
164
  fee: Fee;
165
165
  network: Str;
@@ -193,9 +193,9 @@ export interface Balances extends Dictionary<Balance> {
193
193
  datetime?: any;
194
194
  }
195
195
  export interface DepositAddress {
196
- currency: string;
196
+ currency: Str;
197
197
  address: string;
198
- status: string;
198
+ status: Str;
199
199
  info: any;
200
200
  }
201
201
  export interface WithdrawalResponse {
@@ -203,10 +203,10 @@ export interface WithdrawalResponse {
203
203
  id: string;
204
204
  }
205
205
  export interface DepositAddressResponse {
206
- currency: string;
206
+ currency: Str;
207
207
  address: string;
208
208
  info: any;
209
- tag?: string;
209
+ tag?: Str;
210
210
  }
211
211
  export interface FundingRate {
212
212
  symbol: string;
@@ -229,13 +229,13 @@ export interface FundingRate {
229
229
  }
230
230
  export interface Position {
231
231
  symbol: string;
232
- id?: string;
232
+ id?: Str;
233
233
  info: any;
234
234
  timestamp?: number;
235
235
  datetime?: string;
236
236
  contracts?: number;
237
237
  contractSize?: number;
238
- side: string;
238
+ side: Str;
239
239
  notional?: number;
240
240
  leverage?: number;
241
241
  unrealizedPnl?: number;
@@ -244,7 +244,7 @@ export interface Position {
244
244
  entryPrice?: number;
245
245
  markPrice?: number;
246
246
  liquidationPrice?: number;
247
- marginMode?: string;
247
+ marginMode?: Str;
248
248
  hedged?: boolean;
249
249
  maintenenceMargin?: number;
250
250
  maintenanceMarginPercentage?: number;
@@ -258,19 +258,19 @@ export interface Position {
258
258
  percentage?: number;
259
259
  }
260
260
  export interface BorrowInterest {
261
- account?: string;
262
- currency?: string;
261
+ account?: Str;
262
+ currency?: Str;
263
263
  interest?: number;
264
264
  interestRate?: number;
265
265
  amountBorrowed?: number;
266
- marginMode?: string;
266
+ marginMode?: Str;
267
267
  timestamp?: number;
268
- datetime?: string;
268
+ datetime?: Str;
269
269
  info: any;
270
270
  }
271
271
  export interface LeverageTier {
272
272
  tier?: number;
273
- currency?: string;
273
+ currency?: Str;
274
274
  minNotional?: number;
275
275
  maxNotional?: number;
276
276
  maintenanceMarginRate?: number;
@@ -278,20 +278,20 @@ export interface LeverageTier {
278
278
  info: any;
279
279
  }
280
280
  export interface LedgerEntry {
281
- id?: string;
281
+ id?: Str;
282
282
  info: any;
283
283
  timestamp?: number;
284
- datetime?: string;
285
- direction?: string;
286
- account?: string;
287
- referenceId?: string;
288
- referenceAccount?: string;
289
- type?: string;
290
- currency?: string;
284
+ datetime?: Str;
285
+ direction?: Str;
286
+ account?: Str;
287
+ referenceId?: Str;
288
+ referenceAccount?: Str;
289
+ type?: Str;
290
+ currency?: Str;
291
291
  amount?: number;
292
292
  before?: number;
293
293
  after?: number;
294
- status?: string;
294
+ status?: Str;
295
295
  fee?: Fee;
296
296
  }
297
297
  export interface DepositWithdrawFeeNetwork {
@@ -306,21 +306,21 @@ export interface DepositWithdrawFee {
306
306
  }
307
307
  export interface TransferEntry {
308
308
  info?: any;
309
- id?: string;
309
+ id?: Str;
310
310
  timestamp?: number;
311
- datetime?: string;
312
- currency?: string;
311
+ datetime?: Str;
312
+ currency?: Str;
313
313
  amount?: number;
314
- fromAccount?: string;
315
- toAccount?: string;
316
- status?: string;
314
+ fromAccount?: Str;
315
+ toAccount?: Str;
316
+ status?: Str;
317
317
  }
318
318
  export interface BorrowRate {
319
- currency?: string;
319
+ currency?: Str;
320
320
  rate?: number;
321
321
  period?: number;
322
322
  timestamp?: number;
323
- datetime?: string;
323
+ datetime?: Str;
324
324
  info: any;
325
325
  }
326
326
  export interface FundingRateHistory {
@@ -328,7 +328,7 @@ export interface FundingRateHistory {
328
328
  symbol: string;
329
329
  fundingRate: number;
330
330
  timestamp?: number;
331
- datetime?: string;
331
+ datetime?: Str;
332
332
  }
333
333
  export interface OpenInterest {
334
334
  symbol: string;
@@ -337,22 +337,22 @@ export interface OpenInterest {
337
337
  baseVolume?: number;
338
338
  quoteVolume?: number;
339
339
  timestamp?: number;
340
- datetime?: string;
340
+ datetime?: Str;
341
341
  info: any;
342
342
  }
343
343
  export interface Liquidation {
344
344
  info: any;
345
345
  symbol: string;
346
346
  timestamp?: number;
347
- datetime?: string;
347
+ datetime?: Str;
348
348
  price: number;
349
349
  baseValue?: number;
350
350
  quoteValue?: number;
351
351
  }
352
352
  export interface OrderRequest {
353
353
  symbol: string;
354
- type: string;
355
- side: string;
354
+ type: Str;
355
+ side: Str;
356
356
  amount?: number;
357
357
  price?: number | undefined;
358
358
  params?: any;
@@ -362,19 +362,19 @@ export interface FundingHistory {
362
362
  symbol: string;
363
363
  code: string;
364
364
  timestamp?: number;
365
- datetime?: string;
365
+ datetime?: Str;
366
366
  id: string;
367
367
  amount: number;
368
368
  }
369
369
  export interface MarginMode {
370
370
  info: any;
371
371
  symbol: string;
372
- marginMode: 'isolated' | 'cross' | string;
372
+ marginMode: 'isolated' | 'cross' | Str;
373
373
  }
374
374
  export interface Greeks {
375
375
  symbol: string;
376
376
  timestamp?: number;
377
- datetime?: string;
377
+ datetime?: Str;
378
378
  delta: number;
379
379
  gamma: number;
380
380
  theta: number;
@@ -395,7 +395,7 @@ export interface Greeks {
395
395
  export interface Leverage {
396
396
  info: any;
397
397
  symbol: string;
398
- marginMode: 'isolated' | 'cross' | string;
398
+ marginMode: 'isolated' | 'cross' | Str;
399
399
  longLeverage: number;
400
400
  shortLeverage: number;
401
401
  }
package/js/src/bitget.js CHANGED
@@ -6311,11 +6311,13 @@ export default class bitget extends Exchange {
6311
6311
  * @description fetch all open positions
6312
6312
  * @see https://www.bitget.com/api-doc/contract/position/get-all-position
6313
6313
  * @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
6314
- * @param {string[]|undefined} symbols list of unified market symbols
6314
+ * @param {string[]} [symbols] list of unified market symbols
6315
6315
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6316
6316
  * @param {string} [params.marginCoin] the settle currency of the positions, needs to match the productType
6317
6317
  * @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6318
6318
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6319
+ * @param {boolean} [params.useHistoryEndpoint] default false, when true will use the historic endpoint to fetch positions
6320
+ * @param {string} [params.method] either (default) 'privateMixGetV2MixPositionAllPosition' or 'privateMixGetV2MixPositionHistoryPosition'
6319
6321
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
6320
6322
  */
6321
6323
  await this.loadMarkets();
@@ -6324,8 +6326,14 @@ export default class bitget extends Exchange {
6324
6326
  if (paginate) {
6325
6327
  return await this.fetchPaginatedCallCursor('fetchPositions', undefined, undefined, undefined, params, 'endId', 'idLessThan');
6326
6328
  }
6327
- const fetchPositionsOptions = this.safeValue(this.options, 'fetchPositions', {});
6328
- const method = this.safeString(fetchPositionsOptions, 'method', 'privateMixGetV2MixPositionAllPosition');
6329
+ let method = undefined;
6330
+ const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
6331
+ if (useHistoryEndpoint) {
6332
+ method = 'privateMixGetV2MixPositionHistoryPosition';
6333
+ }
6334
+ else {
6335
+ [method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateMixGetV2MixPositionAllPosition');
6336
+ }
6329
6337
  let market = undefined;
6330
6338
  if (symbols !== undefined) {
6331
6339
  const first = this.safeString(symbols, 0);
@@ -6441,11 +6449,11 @@ export default class bitget extends Exchange {
6441
6449
  //
6442
6450
  let position = [];
6443
6451
  if (!isHistory) {
6444
- position = this.safeValue(response, 'data', []);
6452
+ position = this.safeList(response, 'data', []);
6445
6453
  }
6446
6454
  else {
6447
- const data = this.safeValue(response, 'data', {});
6448
- position = this.safeValue(data, 'list', []);
6455
+ const data = this.safeDict(response, 'data', {});
6456
+ position = this.safeList(data, 'list', []);
6449
6457
  }
6450
6458
  const result = [];
6451
6459
  for (let i = 0; i < position.length; i++) {
@@ -75,7 +75,7 @@ export default class coinbase extends Exchange {
75
75
  parseOrderStatus(status: any): string;
76
76
  parseOrderType(type: any): string;
77
77
  parseTimeInForce(timeInForce: any): string;
78
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
78
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
79
79
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
80
80
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
81
81
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;