ccxt 4.1.1 → 4.1.2

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.
@@ -19,9 +19,11 @@ class coinbasepro extends coinbasepro$1 {
19
19
  'watchTickers': true,
20
20
  'watchTrades': true,
21
21
  'watchTradesForSymbols': true,
22
+ 'watchMyTradesForSymbols': true,
22
23
  'watchBalance': false,
23
24
  'watchStatus': false,
24
25
  'watchOrders': true,
26
+ 'watchOrdersForSymbols': true,
25
27
  'watchMyTrades': true,
26
28
  },
27
29
  'urls': {
@@ -209,6 +211,54 @@ class coinbasepro extends coinbasepro$1 {
209
211
  }
210
212
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
211
213
  }
214
+ async watchMyTradesForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
215
+ /**
216
+ * @method
217
+ * @name coinbasepro#watchMyTradesForSymbols
218
+ * @description watches information on multiple trades made by the user
219
+ * @param {string[]} symbols unified symbol of the market to fetch trades for
220
+ * @param {int} [since] the earliest time in ms to fetch trades for
221
+ * @param {int} [limit] the maximum number of trade structures to retrieve
222
+ * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
223
+ * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure
224
+ */
225
+ symbols = this.marketSymbols(symbols, undefined, false);
226
+ await this.loadMarkets();
227
+ const name = 'user';
228
+ const messageHash = 'multipleMyTrades::';
229
+ const authentication = this.authenticate();
230
+ const trades = await this.subscribeMultiple(name, symbols, messageHash, this.extend(params, authentication));
231
+ if (this.newUpdates) {
232
+ const first = this.safeValue(trades, 0);
233
+ const tradeSymbol = this.safeString(first, 'symbol');
234
+ limit = trades.getLimit(tradeSymbol, limit);
235
+ }
236
+ return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
237
+ }
238
+ async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
239
+ /**
240
+ * @method
241
+ * @name coinbasepro#watchOrdersForSymbols
242
+ * @description watches information on multiple orders made by the user
243
+ * @param {string[]} symbols unified symbol of the market to fetch orders for
244
+ * @param {int} [since] the earliest time in ms to fetch orders for
245
+ * @param {int} [limit] the maximum number of trade structures to retrieve
246
+ * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
247
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
248
+ */
249
+ symbols = this.marketSymbols(symbols, undefined, false);
250
+ await this.loadMarkets();
251
+ const name = 'user';
252
+ const messageHash = 'multipleOrders::';
253
+ const authentication = this.authenticate();
254
+ const orders = await this.subscribeMultiple(name, symbols, messageHash, this.extend(params, authentication));
255
+ if (this.newUpdates) {
256
+ const first = this.safeValue(orders, 0);
257
+ const tradeSymbol = this.safeString(first, 'symbol');
258
+ limit = orders.getLimit(tradeSymbol, limit);
259
+ }
260
+ return this.filterBySinceLimit(orders, since, limit, 'timestamp', true);
261
+ }
212
262
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
213
263
  /**
214
264
  * @method
@@ -348,6 +398,7 @@ class coinbasepro extends coinbasepro$1 {
348
398
  const marketId = this.safeString(message, 'product_id');
349
399
  if (marketId !== undefined) {
350
400
  const trade = this.parseWsTrade(message);
401
+ const symbol = trade['symbol'];
351
402
  const type = 'myTrades';
352
403
  const messageHash = type + ':' + marketId;
353
404
  let tradesArray = this.myTrades;
@@ -358,6 +409,7 @@ class coinbasepro extends coinbasepro$1 {
358
409
  }
359
410
  tradesArray.append(trade);
360
411
  client.resolve(tradesArray, messageHash);
412
+ this.resolvePromiseIfMessagehashMatches(client, 'multipleMyTrades::', symbol, tradesArray);
361
413
  }
362
414
  return message;
363
415
  }
@@ -414,14 +466,25 @@ class coinbasepro extends coinbasepro$1 {
414
466
  // }
415
467
  const parsed = super.parseTrade(trade);
416
468
  let feeRate = undefined;
469
+ let isMaker = false;
417
470
  if ('maker_fee_rate' in trade) {
471
+ isMaker = true;
418
472
  parsed['takerOrMaker'] = 'maker';
419
473
  feeRate = this.safeNumber(trade, 'maker_fee_rate');
420
474
  }
421
475
  else {
422
476
  parsed['takerOrMaker'] = 'taker';
423
477
  feeRate = this.safeNumber(trade, 'taker_fee_rate');
424
- }
478
+ // side always represents the maker side of the trade
479
+ // so if we're taker, we invert it
480
+ const currentSide = parsed['side'];
481
+ parsed['side'] = this.safeString({
482
+ 'buy': 'sell',
483
+ 'sell': 'buy',
484
+ }, currentSide, currentSide);
485
+ }
486
+ const idKey = isMaker ? 'maker_order_id' : 'taker_order_id';
487
+ parsed['order'] = this.safeString(trade, idKey);
425
488
  market = this.market(parsed['symbol']);
426
489
  const feeCurrency = market['quote'];
427
490
  let feeCost = undefined;
@@ -547,6 +610,7 @@ class coinbasepro extends coinbasepro$1 {
547
610
  const parsed = this.parseWsOrder(message);
548
611
  orders.append(parsed);
549
612
  client.resolve(orders, messageHash);
613
+ this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
550
614
  }
551
615
  else {
552
616
  const sequence = this.safeInteger(message, 'sequence');
@@ -590,6 +654,7 @@ class coinbasepro extends coinbasepro$1 {
590
654
  // update the newUpdates count
591
655
  orders.append(previousOrder);
592
656
  client.resolve(orders, messageHash);
657
+ this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
593
658
  }
594
659
  else if ((type === 'received') || (type === 'done')) {
595
660
  const info = this.extend(previousOrder['info'], message);
@@ -605,6 +670,7 @@ class coinbasepro extends coinbasepro$1 {
605
670
  // update the newUpdates count
606
671
  orders.append(previousOrder);
607
672
  client.resolve(orders, messageHash);
673
+ this.resolvePromiseIfMessagehashMatches(client, 'multipleOrders::', symbol, orders);
608
674
  }
609
675
  }
610
676
  }
@@ -635,11 +701,7 @@ class coinbasepro extends coinbasepro$1 {
635
701
  remaining = amount - filled;
636
702
  }
637
703
  }
638
- let cost = undefined;
639
- if ((price !== undefined) && (amount !== undefined)) {
640
- cost = price * amount;
641
- }
642
- return {
704
+ return this.safeOrder({
643
705
  'info': order,
644
706
  'symbol': symbol,
645
707
  'id': id,
@@ -655,14 +717,14 @@ class coinbasepro extends coinbasepro$1 {
655
717
  'stopPrice': undefined,
656
718
  'triggerPrice': undefined,
657
719
  'amount': amount,
658
- 'cost': cost,
720
+ 'cost': undefined,
659
721
  'average': undefined,
660
722
  'filled': filled,
661
723
  'remaining': remaining,
662
724
  'status': status,
663
725
  'fee': undefined,
664
726
  'trades': undefined,
665
- };
727
+ });
666
728
  }
667
729
  handleTicker(client, message) {
668
730
  //
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.0";
7
+ declare const version = "4.1.1";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.1';
41
+ const version = '4.1.2';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -11,6 +11,7 @@ interface coinbasepro {
11
11
  publicGetProductsIdTrades(params?: {}): Promise<implicitReturnType>;
12
12
  publicGetTime(params?: {}): Promise<implicitReturnType>;
13
13
  publicGetProductsSparkLines(params?: {}): Promise<implicitReturnType>;
14
+ privateGetAddressBook(params?: {}): Promise<implicitReturnType>;
14
15
  privateGetAccounts(params?: {}): Promise<implicitReturnType>;
15
16
  privateGetAccountsId(params?: {}): Promise<implicitReturnType>;
16
17
  privateGetAccountsIdHolds(params?: {}): Promise<implicitReturnType>;
@@ -11,6 +11,7 @@ interface Exchange {
11
11
  publicGetProductsIdTrades(params?: {}): Promise<implicitReturnType>;
12
12
  publicGetTime(params?: {}): Promise<implicitReturnType>;
13
13
  publicGetProductsSparkLines(params?: {}): Promise<implicitReturnType>;
14
+ privateGetAddressBook(params?: {}): Promise<implicitReturnType>;
14
15
  privateGetAccounts(params?: {}): Promise<implicitReturnType>;
15
16
  privateGetAccountsId(params?: {}): Promise<implicitReturnType>;
16
17
  privateGetAccountsIdHolds(params?: {}): Promise<implicitReturnType>;
@@ -535,6 +535,8 @@ export default class Exchange {
535
535
  fetchTradesWs(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
536
536
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
537
537
  watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
538
+ watchMyTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
539
+ watchOrdersForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
538
540
  watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<Dictionary<Dictionary<OHLCV[]>>>;
539
541
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
540
542
  fetchDepositAddresses(codes?: string[], params?: {}): Promise<any>;
@@ -1304,6 +1304,12 @@ export default class Exchange {
1304
1304
  async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
1305
1305
  throw new NotSupported(this.id + ' watchTradesForSymbols() is not supported yet');
1306
1306
  }
1307
+ async watchMyTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
1308
+ throw new NotSupported(this.id + ' watchMyTradesForSymbols() is not supported yet');
1309
+ }
1310
+ async watchOrdersForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
1311
+ throw new NotSupported(this.id + ' watchOrdersForSymbols() is not supported yet');
1312
+ }
1307
1313
  async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
1308
1314
  throw new NotSupported(this.id + ' watchOHLCVForSymbols() is not supported yet');
1309
1315
  }
package/js/src/binance.js CHANGED
@@ -3309,6 +3309,14 @@ export default class binance extends Exchange {
3309
3309
  * @method
3310
3310
  * @name binance#fetchOHLCV
3311
3311
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
3312
+ * @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
3313
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#kline-candlestick-data
3314
+ * @see https://binance-docs.github.io/apidocs/futures/en/#index-price-kline-candlestick-data
3315
+ * @see https://binance-docs.github.io/apidocs/futures/en/#mark-price-kline-candlestick-data
3316
+ * @see https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data
3317
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-kline-candlestick-data
3318
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#mark-price-kline-candlestick-data
3319
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#kline-candlestick-data
3312
3320
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
3313
3321
  * @param {string} timeframe the length of time each candle represents
3314
3322
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -4624,6 +4632,11 @@ export default class binance extends Exchange {
4624
4632
  * @method
4625
4633
  * @name binance#fetchOrder
4626
4634
  * @description fetches information on an order made by the user
4635
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
4636
+ * @see https://binance-docs.github.io/apidocs/futures/en/#query-order-user_data
4637
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#query-order-user_data
4638
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-single-order-trade
4639
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data
4627
4640
  * @param {string} symbol unified symbol of the market the order was made in
4628
4641
  * @param {object} [params] extra parameters specific to the binance api endpoint
4629
4642
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
@@ -4675,6 +4688,11 @@ export default class binance extends Exchange {
4675
4688
  * @method
4676
4689
  * @name binance#fetchOrders
4677
4690
  * @description fetches information on multiple orders made by the user
4691
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
4692
+ * @see https://binance-docs.github.io/apidocs/futures/en/#all-orders-user_data
4693
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
4694
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
4695
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
4678
4696
  * @param {string} symbol unified market symbol of the market orders were made in
4679
4697
  * @param {int} [since] the earliest time in ms to fetch orders for
4680
4698
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4795,6 +4813,11 @@ export default class binance extends Exchange {
4795
4813
  * @method
4796
4814
  * @name binance#fetchOpenOrders
4797
4815
  * @description fetch all unfilled currently open orders
4816
+ * @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
4817
+ * @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
4818
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
4819
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
4820
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data
4798
4821
  * @param {string} symbol unified market symbol
4799
4822
  * @param {int} [since] the earliest time in ms to fetch open orders for
4800
4823
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -4862,6 +4885,11 @@ export default class binance extends Exchange {
4862
4885
  * @method
4863
4886
  * @name binance#fetchClosedOrders
4864
4887
  * @description fetches information on multiple closed orders made by the user
4888
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
4889
+ * @see https://binance-docs.github.io/apidocs/futures/en/#all-orders-user_data
4890
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
4891
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
4892
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
4865
4893
  * @param {string} symbol unified market symbol of the market orders were made in
4866
4894
  * @param {int} [since] the earliest time in ms to fetch orders for
4867
4895
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4901,6 +4929,11 @@ export default class binance extends Exchange {
4901
4929
  * @method
4902
4930
  * @name binance#cancelOrder
4903
4931
  * @description cancels an open order
4932
+ * @see https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
4933
+ * @see https://binance-docs.github.io/apidocs/futures/en/#cancel-order-trade
4934
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-order-trade
4935
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#cancel-option-order-trade
4936
+ * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
4904
4937
  * @param {string} id order id
4905
4938
  * @param {string} symbol unified symbol of the market the order was made in
4906
4939
  * @param {object} [params] extra parameters specific to the binance api endpoint
@@ -5003,6 +5036,7 @@ export default class binance extends Exchange {
5003
5036
  * @name binance#cancelOrders
5004
5037
  * @description cancel multiple orders
5005
5038
  * @see https://binance-docs.github.io/apidocs/futures/en/#cancel-multiple-orders-trade
5039
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-multiple-orders-trade
5006
5040
  * @param {[string]} ids order ids
5007
5041
  * @param {string} [symbol] unified market symbol
5008
5042
  * @param {object} [params] extra parameters specific to the bingx api endpoint
@@ -5071,6 +5105,10 @@ export default class binance extends Exchange {
5071
5105
  * @method
5072
5106
  * @name binance#fetchOrderTrades
5073
5107
  * @description fetch all the trades made from a single order
5108
+ * @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
5109
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data
5110
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-trade-list-user_data
5111
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
5074
5112
  * @param {string} id order id
5075
5113
  * @param {string} symbol unified market symbol
5076
5114
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -5098,6 +5136,10 @@ export default class binance extends Exchange {
5098
5136
  * @method
5099
5137
  * @name binance#fetchMyTrades
5100
5138
  * @description fetch all trades made by the user
5139
+ * @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
5140
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data
5141
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-trade-list-user_data
5142
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
5101
5143
  * @param {string} symbol unified market symbol
5102
5144
  * @param {int} [since] the earliest time in ms to fetch trades for
5103
5145
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -5237,6 +5279,7 @@ export default class binance extends Exchange {
5237
5279
  * @method
5238
5280
  * @name binance#fetchMyDustTrades
5239
5281
  * @description fetch all dust trades made by the user
5282
+ * @see https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
5240
5283
  * @param {string} symbol not used by binance fetchMyDustTrades ()
5241
5284
  * @param {int} [since] the earliest time in ms to fetch my dust trades for
5242
5285
  * @param {int} [limit] the maximum number of dust trades to retrieve
@@ -5375,6 +5418,8 @@ export default class binance extends Exchange {
5375
5418
  * @method
5376
5419
  * @name binance#fetchDeposits
5377
5420
  * @description fetch all deposits made to an account
5421
+ * @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
5422
+ * @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
5378
5423
  * @param {string} code unified currency code
5379
5424
  * @param {int} [since] the earliest time in ms to fetch deposits for
5380
5425
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -5479,6 +5524,8 @@ export default class binance extends Exchange {
5479
5524
  * @method
5480
5525
  * @name binance#fetchWithdrawals
5481
5526
  * @description fetch all withdrawals made from an account
5527
+ * @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
5528
+ * @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
5482
5529
  * @param {string} code unified currency code
5483
5530
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
5484
5531
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -5943,6 +5990,7 @@ export default class binance extends Exchange {
5943
5990
  * @method
5944
5991
  * @name binance#fetchTransfers
5945
5992
  * @description fetch a history of internal transfers made on an account
5993
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
5946
5994
  * @param {string} code unified currency code of the currency transferred
5947
5995
  * @param {int} [since] the earliest time in ms to fetch transfers for
5948
5996
  * @param {int} [limit] the maximum number of transfers structures to retrieve
@@ -6006,6 +6054,7 @@ export default class binance extends Exchange {
6006
6054
  * @method
6007
6055
  * @name binance#fetchDepositAddress
6008
6056
  * @description fetch the deposit address for a currency associated with this account
6057
+ * @see https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
6009
6058
  * @param {string} code unified currency code
6010
6059
  * @param {object} [params] extra parameters specific to the binance api endpoint
6011
6060
  * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
@@ -6081,6 +6130,7 @@ export default class binance extends Exchange {
6081
6130
  * @name binance#fetchTransactionFees
6082
6131
  * @deprecated
6083
6132
  * @description please use fetchDepositWithdrawFees instead
6133
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
6084
6134
  * @param {string[]|undefined} codes not used by binance fetchTransactionFees ()
6085
6135
  * @param {object} [params] extra parameters specific to the binance api endpoint
6086
6136
  * @returns {object[]} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
@@ -6194,6 +6244,7 @@ export default class binance extends Exchange {
6194
6244
  * @method
6195
6245
  * @name binance#fetchDepositWithdrawFees
6196
6246
  * @description fetch deposit and withdraw fees
6247
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
6197
6248
  * @param {string[]|undefined} codes not used by binance fetchDepositWithdrawFees ()
6198
6249
  * @param {object} [params] extra parameters specific to the binance api endpoint
6199
6250
  * @returns {object[]} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
@@ -6317,6 +6368,7 @@ export default class binance extends Exchange {
6317
6368
  * @method
6318
6369
  * @name binance#withdraw
6319
6370
  * @description make a withdrawal
6371
+ * @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
6320
6372
  * @param {string} code unified currency code
6321
6373
  * @param {float} amount the amount to withdraw
6322
6374
  * @param {string} address the address to withdraw to
@@ -6372,6 +6424,7 @@ export default class binance extends Exchange {
6372
6424
  * @method
6373
6425
  * @name binance#fetchTradingFee
6374
6426
  * @description fetch the trading fees for a market
6427
+ * @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
6375
6428
  * @param {string} symbol unified market symbol
6376
6429
  * @param {object} [params] extra parameters specific to the binance api endpoint
6377
6430
  * @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
@@ -6399,6 +6452,9 @@ export default class binance extends Exchange {
6399
6452
  * @method
6400
6453
  * @name binance#fetchTradingFees
6401
6454
  * @description fetch the trading fees for multiple markets
6455
+ * @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
6456
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
6457
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
6402
6458
  * @param {object} [params] extra parameters specific to the binance api endpoint
6403
6459
  * @returns {object} a dictionary of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure} indexed by market symbols
6404
6460
  */
@@ -6576,6 +6632,7 @@ export default class binance extends Exchange {
6576
6632
  * @method
6577
6633
  * @name binance#futuresTransfer
6578
6634
  * @description transfer between futures account
6635
+ * @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
6579
6636
  * @param {string} code unified currency code
6580
6637
  * @param {float} amount the amount to transfer
6581
6638
  * @param {string} type 1 - transfer from spot account to USDT-Ⓜ futures account, 2 - transfer from USDT-Ⓜ futures account to spot account, 3 - transfer from spot account to COIN-Ⓜ futures account, 4 - transfer from COIN-Ⓜ futures account to spot account
@@ -6606,6 +6663,8 @@ export default class binance extends Exchange {
6606
6663
  * @method
6607
6664
  * @name binance#fetchFundingRate
6608
6665
  * @description fetch the current funding rate
6666
+ * @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
6667
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
6609
6668
  * @param {string} symbol unified market symbol
6610
6669
  * @param {object} [params] extra parameters specific to the binance api endpoint
6611
6670
  * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
@@ -6648,6 +6707,8 @@ export default class binance extends Exchange {
6648
6707
  * @method
6649
6708
  * @name binance#fetchFundingRateHistory
6650
6709
  * @description fetches historical funding rate prices
6710
+ * @see https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-history
6711
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#get-funding-rate-history-of-perpetual-futures
6651
6712
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
6652
6713
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
6653
6714
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
@@ -6718,6 +6779,8 @@ export default class binance extends Exchange {
6718
6779
  * @method
6719
6780
  * @name binance#fetchFundingRates
6720
6781
  * @description fetch the funding rate for multiple markets
6782
+ * @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
6783
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
6721
6784
  * @param {string[]|undefined} symbols list of unified market symbols
6722
6785
  * @param {object} [params] extra parameters specific to the binance api endpoint
6723
6786
  * @returns {object} a dictionary of [funding rates structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure}, indexe by market symbols
@@ -7246,6 +7309,8 @@ export default class binance extends Exchange {
7246
7309
  * @method
7247
7310
  * @name binance#fetchLeverageTiers
7248
7311
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
7312
+ * @see https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-user_data
7313
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#notional-bracket-for-symbol-user_data
7249
7314
  * @param {string[]|undefined} symbols list of unified market symbols
7250
7315
  * @param {object} [params] extra parameters specific to the binance api endpoint
7251
7316
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
@@ -7534,6 +7599,8 @@ export default class binance extends Exchange {
7534
7599
  * @method
7535
7600
  * @name binance#fetchAccountPositions
7536
7601
  * @description fetch account positions
7602
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
7603
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
7537
7604
  * @param {string[]|undefined} symbols list of unified market symbols
7538
7605
  * @param {object} [params] extra parameters specific to the binance api endpoint
7539
7606
  * @returns {object} data on account positions
@@ -7571,6 +7638,7 @@ export default class binance extends Exchange {
7571
7638
  * @name binance#fetchPositionsRisk
7572
7639
  * @description fetch positions risk
7573
7640
  * @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
7641
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
7574
7642
  * @param {string[]|undefined} symbols list of unified market symbols
7575
7643
  * @param {object} [params] extra parameters specific to the binance api endpoint
7576
7644
  * @returns {object} data on the positions risk
@@ -7667,6 +7735,8 @@ export default class binance extends Exchange {
7667
7735
  * @method
7668
7736
  * @name binance#fetchFundingHistory
7669
7737
  * @description fetch the history of funding payments paid and received on this account
7738
+ * @see https://binance-docs.github.io/apidocs/futures/en/#get-income-history-user_data
7739
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#get-income-history-user_data
7670
7740
  * @param {string} symbol unified market symbol
7671
7741
  * @param {int} [since] the earliest time in ms to fetch funding history for
7672
7742
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -7714,6 +7784,8 @@ export default class binance extends Exchange {
7714
7784
  * @method
7715
7785
  * @name binance#setLeverage
7716
7786
  * @description set the level of leverage for a market
7787
+ * @see https://binance-docs.github.io/apidocs/futures/en/#change-initial-leverage-trade
7788
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#change-initial-leverage-trade
7717
7789
  * @param {float} leverage the rate of leverage
7718
7790
  * @param {string} symbol unified market symbol
7719
7791
  * @param {object} [params] extra parameters specific to the binance api endpoint
@@ -7750,6 +7822,8 @@ export default class binance extends Exchange {
7750
7822
  * @method
7751
7823
  * @name binance#setMarginMode
7752
7824
  * @description set margin mode to 'cross' or 'isolated'
7825
+ * @see https://binance-docs.github.io/apidocs/futures/en/#change-margin-type-trade
7826
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#change-margin-type-trade
7753
7827
  * @param {string} marginMode 'cross' or 'isolated'
7754
7828
  * @param {string} symbol unified market symbol
7755
7829
  * @param {object} [params] extra parameters specific to the binance api endpoint
@@ -7818,6 +7892,8 @@ export default class binance extends Exchange {
7818
7892
  * @method
7819
7893
  * @name binance#setPositionMode
7820
7894
  * @description set hedged to true or false for a market
7895
+ * @see https://binance-docs.github.io/apidocs/futures/en/#change-position-mode-trade
7896
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#change-position-mode-trade
7821
7897
  * @param {bool} hedged set to true to use dualSidePosition
7822
7898
  * @param {string} symbol not used by binance setPositionMode ()
7823
7899
  * @param {object} [params] extra parameters specific to the binance api endpoint
@@ -8506,6 +8582,7 @@ export default class binance extends Exchange {
8506
8582
  * @method
8507
8583
  * @name binance#fetchBorrowRate
8508
8584
  * @description fetch the rate of interest to borrow a currency for margin trading
8585
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
8509
8586
  * @param {string} code unified currency code
8510
8587
  * @param {object} [params] extra parameters specific to the binance api endpoint
8511
8588
  * @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
@@ -8535,6 +8612,7 @@ export default class binance extends Exchange {
8535
8612
  * @method
8536
8613
  * @name binance#fetchBorrowRateHistory
8537
8614
  * @description retrieves a history of a currencies borrow interest rate at specific time slots
8615
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
8538
8616
  * @param {string} code unified currency code
8539
8617
  * @param {int} [since] timestamp for the earliest borrow rate
8540
8618
  * @param {int} [limit] the maximum number of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} to retrieve
@@ -8608,6 +8686,7 @@ export default class binance extends Exchange {
8608
8686
  * @method
8609
8687
  * @name binance#createGiftCode
8610
8688
  * @description create gift code
8689
+ * @see https://binance-docs.github.io/apidocs/spot/en/#create-a-single-token-gift-card-user_data
8611
8690
  * @param {string} code gift code
8612
8691
  * @param {float} amount amount of currency for the gift
8613
8692
  * @param {object} [params] extra parameters specific to the binance api endpoint
@@ -8645,6 +8724,7 @@ export default class binance extends Exchange {
8645
8724
  * @method
8646
8725
  * @name binance#redeemGiftCode
8647
8726
  * @description redeem gift code
8727
+ * @see https://binance-docs.github.io/apidocs/spot/en/#redeem-a-binance-gift-card-user_data
8648
8728
  * @param {string} giftcardCode
8649
8729
  * @param {object} [params] extra parameters specific to the binance api endpoint
8650
8730
  * @returns {object} response from the exchange
@@ -8671,6 +8751,7 @@ export default class binance extends Exchange {
8671
8751
  * @method
8672
8752
  * @name binance#verifyGiftCode
8673
8753
  * @description verify gift code
8754
+ * @see https://binance-docs.github.io/apidocs/spot/en/#verify-binance-gift-card-by-gift-card-number-user_data
8674
8755
  * @param {string} id reference number id
8675
8756
  * @param {object} [params] extra parameters specific to the binance api endpoint
8676
8757
  * @returns {object} response from the exchange
@@ -8694,6 +8775,7 @@ export default class binance extends Exchange {
8694
8775
  * @method
8695
8776
  * @name binance#fetchBorrowInterest
8696
8777
  * @description fetch the interest owed by the user for borrowing currency for margin trading
8778
+ * @see https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data
8697
8779
  * @param {string} code unified currency code
8698
8780
  * @param {string} symbol unified market symbol when fetch interest in isolated markets
8699
8781
  * @param {int} [since] the earliest time in ms to fetch borrrow interest for
@@ -8846,6 +8928,8 @@ export default class binance extends Exchange {
8846
8928
  * @method
8847
8929
  * @name binance#fetchOpenInterestHistory
8848
8930
  * @description Retrieves the open interest history of a currency
8931
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#open-interest-statistics
8932
+ * @see https://binance-docs.github.io/apidocs/futures/en/#open-interest-statistics
8849
8933
  * @param {string} symbol Unified CCXT market symbol
8850
8934
  * @param {string} timeframe "5m","15m","30m","1h","2h","4h","6h","12h", or "1d"
8851
8935
  * @param {int} [since] the time(ms) of the earliest record to retrieve as a unix timestamp
package/js/src/bitrue.js CHANGED
@@ -832,7 +832,7 @@ export default class bitrue extends Exchange {
832
832
  'last': last,
833
833
  'previousClose': undefined,
834
834
  'change': undefined,
835
- 'percentage': this.safeString(ticker, 'percentChange'),
835
+ 'percentage': Precise.stringMul(this.safeString(ticker, 'percentChange'), '10000'),
836
836
  'average': undefined,
837
837
  'baseVolume': this.safeString(ticker, 'baseVolume'),
838
838
  'quoteVolume': this.safeString(ticker, 'quoteVolume'),
package/js/src/bybit.js CHANGED
@@ -4011,6 +4011,16 @@ export default class bybit extends Exchange {
4011
4011
  * @param {float} amount how much of currency you want to trade in units of base currency
4012
4012
  * @param {float} price the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
4013
4013
  * @param {object} [params] extra parameters specific to the bybit api endpoint
4014
+ * @param {float} [params.triggerPrice] The price that a trigger order is triggered at
4015
+ * @param {float} [params.stopLossPrice] The price that a stop loss order is triggered at
4016
+ * @param {float} [params.takeProfitPrice] The price that a take profit order is triggered at
4017
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
4018
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
4019
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
4020
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
4021
+ * @param {string} [params.triggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
4022
+ * @param {string} [params.slTriggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
4023
+ * @param {string} [params.tpTriggerby] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
4014
4024
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4015
4025
  */
4016
4026
  this.checkRequiredSymbol('editOrder', symbol);
@@ -4053,9 +4063,9 @@ export default class bybit extends Exchange {
4053
4063
  if (amount !== undefined) {
4054
4064
  request['qty'] = this.amountToPrecision(symbol, amount);
4055
4065
  }
4056
- let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
4057
- const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
4058
- const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
4066
+ let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
4067
+ const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
4068
+ const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
4059
4069
  const stopLoss = this.safeValue(params, 'stopLoss');
4060
4070
  const takeProfit = this.safeValue(params, 'takeProfit');
4061
4071
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
@@ -4066,16 +4076,25 @@ export default class bybit extends Exchange {
4066
4076
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
4067
4077
  }
4068
4078
  if (triggerPrice !== undefined) {
4069
- request['triggerPrice'] = triggerPrice;
4079
+ const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.priceToPrecision(symbol, triggerPrice);
4080
+ request['triggerPrice'] = triggerPriceRequest;
4081
+ const triggerBy = this.safeString(params, 'triggerBy', 'LastPrice');
4082
+ request['triggerBy'] = triggerBy;
4070
4083
  }
4071
4084
  if (isStopLoss || isTakeProfit) {
4072
4085
  if (isStopLoss) {
4073
- const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4074
- request['stopLoss'] = slTriggerPrice;
4086
+ const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4087
+ const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.priceToPrecision(symbol, slTriggerPrice);
4088
+ request['stopLoss'] = stopLossRequest;
4089
+ const slTriggerBy = this.safeString(params, 'slTriggerBy', 'LastPrice');
4090
+ request['slTriggerBy'] = slTriggerBy;
4075
4091
  }
4076
4092
  if (isTakeProfit) {
4077
- const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4078
- request['takeProfit'] = tpTriggerPrice;
4093
+ const tpTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4094
+ const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.priceToPrecision(symbol, tpTriggerPrice);
4095
+ request['takeProfit'] = takeProfitRequest;
4096
+ const tpTriggerBy = this.safeString(params, 'tpTriggerBy', 'LastPrice');
4097
+ request['tpTriggerBy'] = tpTriggerBy;
4079
4098
  }
4080
4099
  }
4081
4100
  const clientOrderId = this.safeString(params, 'clientOrderId');