ccxt 4.2.26 → 4.2.28

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 (41) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.js +2382 -337
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +4 -1
  5. package/dist/cjs/src/abstract/coinmetro.js +9 -0
  6. package/dist/cjs/src/base/Exchange.js +3 -0
  7. package/dist/cjs/src/bingx.js +4 -0
  8. package/dist/cjs/src/bit2c.js +1 -0
  9. package/dist/cjs/src/bitbank.js +1 -0
  10. package/dist/cjs/src/bitbns.js +1 -0
  11. package/dist/cjs/src/bitfinex2.js +49 -1
  12. package/dist/cjs/src/bitflyer.js +1 -0
  13. package/dist/cjs/src/bitforex.js +29 -0
  14. package/dist/cjs/src/coinbase.js +6 -1
  15. package/dist/cjs/src/coinmetro.js +1909 -0
  16. package/dist/cjs/src/kucoinfutures.js +4 -0
  17. package/dist/cjs/src/upbit.js +21 -11
  18. package/js/ccxt.d.ts +5 -2
  19. package/js/ccxt.js +4 -2
  20. package/js/src/abstract/coinmetro.d.ts +36 -0
  21. package/js/src/abstract/coinmetro.js +11 -0
  22. package/js/src/base/Exchange.js +3 -0
  23. package/js/src/bingx.d.ts +4 -0
  24. package/js/src/bingx.js +4 -0
  25. package/js/src/bit2c.js +1 -0
  26. package/js/src/bitbank.js +1 -0
  27. package/js/src/bitbns.js +1 -0
  28. package/js/src/bitfinex2.d.ts +16 -0
  29. package/js/src/bitfinex2.js +49 -1
  30. package/js/src/bitflyer.js +1 -0
  31. package/js/src/bitforex.d.ts +1 -0
  32. package/js/src/bitforex.js +29 -0
  33. package/js/src/coinbase.js +6 -1
  34. package/js/src/coinmetro.d.ts +79 -0
  35. package/js/src/coinmetro.js +1910 -0
  36. package/js/src/kucoinfutures.d.ts +4 -0
  37. package/js/src/kucoinfutures.js +4 -0
  38. package/js/src/upbit.d.ts +3 -3
  39. package/js/src/upbit.js +21 -11
  40. package/package.json +1 -1
  41. package/skip-tests.json +7 -0
@@ -7,6 +7,10 @@ var kucoinfutures$1 = require('./abstract/kucoinfutures.js');
7
7
 
8
8
  // ---------------------------------------------------------------------------
9
9
  // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class kucoinfutures
12
+ * @augments Exchange
13
+ */
10
14
  class kucoinfutures extends kucoinfutures$1 {
11
15
  describe() {
12
16
  return this.deepExtend(super.describe(), {
@@ -1635,22 +1635,24 @@ class upbit extends upbit$1 {
1635
1635
  }
1636
1636
  parseDepositAddress(depositAddress, currency = undefined) {
1637
1637
  //
1638
- // {
1639
- // "currency": "BTC",
1640
- // "deposit_address": "3EusRwybuZUhVDeHL7gh3HSLmbhLcy7NqD",
1641
- // "secondary_address": null
1642
- // }
1638
+ // {
1639
+ // currency: 'XRP',
1640
+ // net_type: 'XRP',
1641
+ // deposit_address: 'raQwCVAJVqjrVm1Nj5SFRcX8i22BhdC9WA',
1642
+ // secondary_address: '167029435'
1643
+ // }
1643
1644
  //
1644
1645
  const address = this.safeString(depositAddress, 'deposit_address');
1645
1646
  const tag = this.safeString(depositAddress, 'secondary_address');
1646
1647
  const currencyId = this.safeString(depositAddress, 'currency');
1647
1648
  const code = this.safeCurrencyCode(currencyId);
1649
+ const networkId = this.safeString(depositAddress, 'net_type');
1648
1650
  this.checkAddress(address);
1649
1651
  return {
1650
1652
  'currency': code,
1651
1653
  'address': address,
1652
1654
  'tag': tag,
1653
- 'network': undefined,
1655
+ 'network': this.networkIdToCode(networkId),
1654
1656
  'info': depositAddress,
1655
1657
  };
1656
1658
  }
@@ -1662,19 +1664,27 @@ class upbit extends upbit$1 {
1662
1664
  * @description fetch the deposit address for a currency associated with this account
1663
1665
  * @param {string} code unified currency code
1664
1666
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1667
+ * @param {string} params.network deposit chain, can view all chains via this.publicGetWalletAssets, default is eth, unless the currency has a default chain within this.options['networks']
1665
1668
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1666
1669
  */
1667
1670
  await this.loadMarkets();
1668
1671
  const currency = this.currency(code);
1672
+ let networkCode = undefined;
1673
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
1674
+ if (networkCode === undefined) {
1675
+ throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress requires params["network"]');
1676
+ }
1669
1677
  const response = await this.privateGetDepositsCoinAddress(this.extend({
1670
1678
  'currency': currency['id'],
1679
+ 'net_type': this.networkCodeToId(networkCode, currency['code']),
1671
1680
  }, params));
1672
1681
  //
1673
- // {
1674
- // "currency": "BTC",
1675
- // "deposit_address": "3EusRwybuZUhVDeHL7gh3HSLmbhLcy7NqD",
1676
- // "secondary_address": null
1677
- // }
1682
+ // {
1683
+ // currency: 'XRP',
1684
+ // net_type: 'XRP',
1685
+ // deposit_address: 'raQwCVAJVqjrVm1Nj5SFRcX8i22BhdC9WA',
1686
+ // secondary_address: '167029435'
1687
+ // }
1678
1688
  //
1679
1689
  return this.parseDepositAddress(response);
1680
1690
  }
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 type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } 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.2.25";
7
+ declare const version = "4.2.27";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -49,6 +49,7 @@ import coincheck from './src/coincheck.js';
49
49
  import coinex from './src/coinex.js';
50
50
  import coinlist from './src/coinlist.js';
51
51
  import coinmate from './src/coinmate.js';
52
+ import coinmetro from './src/coinmetro.js';
52
53
  import coinone from './src/coinone.js';
53
54
  import coinsph from './src/coinsph.js';
54
55
  import coinspot from './src/coinspot.js';
@@ -209,6 +210,7 @@ declare const exchanges: {
209
210
  coinex: typeof coinex;
210
211
  coinlist: typeof coinlist;
211
212
  coinmate: typeof coinmate;
213
+ coinmetro: typeof coinmetro;
212
214
  coinone: typeof coinone;
213
215
  coinsph: typeof coinsph;
214
216
  coinspot: typeof coinspot;
@@ -439,6 +441,7 @@ declare const ccxt: {
439
441
  coinex: typeof coinex;
440
442
  coinlist: typeof coinlist;
441
443
  coinmate: typeof coinmate;
444
+ coinmetro: typeof coinmetro;
442
445
  coinone: typeof coinone;
443
446
  coinsph: typeof coinsph;
444
447
  coinspot: typeof coinspot;
@@ -495,5 +498,5 @@ declare const ccxt: {
495
498
  zaif: typeof zaif;
496
499
  zonda: typeof zonda;
497
500
  } & typeof functions & typeof errors;
498
- export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
501
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
499
502
  export default ccxt;
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.2.26';
41
+ const version = '4.2.28';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -85,6 +85,7 @@ import coincheck from './src/coincheck.js';
85
85
  import coinex from './src/coinex.js';
86
86
  import coinlist from './src/coinlist.js';
87
87
  import coinmate from './src/coinmate.js';
88
+ import coinmetro from './src/coinmetro.js';
88
89
  import coinone from './src/coinone.js';
89
90
  import coinsph from './src/coinsph.js';
90
91
  import coinspot from './src/coinspot.js';
@@ -246,6 +247,7 @@ const exchanges = {
246
247
  'coinex': coinex,
247
248
  'coinlist': coinlist,
248
249
  'coinmate': coinmate,
250
+ 'coinmetro': coinmetro,
249
251
  'coinone': coinone,
250
252
  'coinsph': coinsph,
251
253
  'coinspot': coinspot,
@@ -376,6 +378,6 @@ pro.exchanges = Object.keys(pro);
376
378
  pro['Exchange'] = Exchange; // now the same for rest and ts
377
379
  //-----------------------------------------------------------------------------
378
380
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
379
- export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
381
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
380
382
  export default ccxt;
381
383
  //-----------------------------------------------------------------------------
@@ -0,0 +1,36 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ publicGetDemoTemp(params?: {}): Promise<implicitReturnType>;
5
+ publicGetExchangeCandlesPairTimeframeFromTo(params?: {}): Promise<implicitReturnType>;
6
+ publicGetExchangePrices(params?: {}): Promise<implicitReturnType>;
7
+ publicGetExchangeTicksPairFrom(params?: {}): Promise<implicitReturnType>;
8
+ publicGetAssets(params?: {}): Promise<implicitReturnType>;
9
+ publicGetMarkets(params?: {}): Promise<implicitReturnType>;
10
+ publicGetExchangeBookPair(params?: {}): Promise<implicitReturnType>;
11
+ publicGetExchangeBookUpdatesPairFrom(params?: {}): Promise<implicitReturnType>;
12
+ privateGetUsersBalances(params?: {}): Promise<implicitReturnType>;
13
+ privateGetUsersWalletsHistorySince(params?: {}): Promise<implicitReturnType>;
14
+ privateGetExchangeOrdersStatusOrderID(params?: {}): Promise<implicitReturnType>;
15
+ privateGetExchangeOrdersActive(params?: {}): Promise<implicitReturnType>;
16
+ privateGetExchangeOrdersHistorySince(params?: {}): Promise<implicitReturnType>;
17
+ privateGetExchangeFillsSince(params?: {}): Promise<implicitReturnType>;
18
+ privateGetExchangeMargin(params?: {}): Promise<implicitReturnType>;
19
+ privatePostJwt(params?: {}): Promise<implicitReturnType>;
20
+ privatePostJwtDevice(params?: {}): Promise<implicitReturnType>;
21
+ privatePostDevices(params?: {}): Promise<implicitReturnType>;
22
+ privatePostJwtReadOnly(params?: {}): Promise<implicitReturnType>;
23
+ privatePostExchangeOrdersCreate(params?: {}): Promise<implicitReturnType>;
24
+ privatePostExchangeOrdersModifyOrderID(params?: {}): Promise<implicitReturnType>;
25
+ privatePostExchangeSwap(params?: {}): Promise<implicitReturnType>;
26
+ privatePostExchangeSwapConfirmSwapId(params?: {}): Promise<implicitReturnType>;
27
+ privatePostExchangeOrdersCloseOrderID(params?: {}): Promise<implicitReturnType>;
28
+ privatePostExchangeOrdersHedge(params?: {}): Promise<implicitReturnType>;
29
+ privatePutJwt(params?: {}): Promise<implicitReturnType>;
30
+ privatePutExchangeOrdersCancelOrderID(params?: {}): Promise<implicitReturnType>;
31
+ privatePutUsersMarginCollateral(params?: {}): Promise<implicitReturnType>;
32
+ privatePutUsersMarginPrimaryCurrency(params?: {}): Promise<implicitReturnType>;
33
+ }
34
+ declare abstract class Exchange extends _Exchange {
35
+ }
36
+ export default Exchange;
@@ -0,0 +1,11 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // -------------------------------------------------------------------------------
8
+ import { Exchange as _Exchange } from '../base/Exchange.js';
9
+ class Exchange extends _Exchange {
10
+ }
11
+ export default Exchange;
@@ -4074,6 +4074,9 @@ export default class Exchange {
4074
4074
  return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
4075
4075
  }
4076
4076
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4077
+ if (this.has['fetchOpenOrders'] && this.has['fetchClosedOrders']) {
4078
+ throw new NotSupported(this.id + ' fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead');
4079
+ }
4077
4080
  throw new NotSupported(this.id + ' fetchOrders() is not supported yet');
4078
4081
  }
4079
4082
  async fetchOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import Exchange from './abstract/bingx.js';
2
2
  import type { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
3
+ /**
4
+ * @class bingx
5
+ * @augments Exchange
6
+ */
3
7
  export default class bingx extends Exchange {
4
8
  describe(): any;
5
9
  fetchTime(params?: {}): Promise<number>;
package/js/src/bingx.js CHANGED
@@ -11,6 +11,10 @@ import { Precise } from './base/Precise.js';
11
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
12
12
  import { DECIMAL_PLACES } from './base/functions/number.js';
13
13
  // ---------------------------------------------------------------------------
14
+ /**
15
+ * @class bingx
16
+ * @augments Exchange
17
+ */
14
18
  export default class bingx extends Exchange {
15
19
  describe() {
16
20
  return this.deepExtend(super.describe(), {
package/js/src/bit2c.js CHANGED
@@ -31,6 +31,7 @@ export default class bit2c extends Exchange {
31
31
  'future': false,
32
32
  'option': false,
33
33
  'addMargin': false,
34
+ 'cancelAllOrders': false,
34
35
  'cancelOrder': true,
35
36
  'closeAllPositions': false,
36
37
  'closePosition': false,
package/js/src/bitbank.js CHANGED
@@ -29,6 +29,7 @@ export default class bitbank extends Exchange {
29
29
  'future': false,
30
30
  'option': false,
31
31
  'addMargin': false,
32
+ 'cancelAllOrders': false,
32
33
  'cancelOrder': true,
33
34
  'closeAllPositions': false,
34
35
  'closePosition': false,
package/js/src/bitbns.js CHANGED
@@ -32,6 +32,7 @@ export default class bitbns extends Exchange {
32
32
  'swap': false,
33
33
  'future': false,
34
34
  'option': undefined,
35
+ 'cancelAllOrders': false,
35
36
  'cancelOrder': true,
36
37
  'createOrder': true,
37
38
  'fetchBalance': true,
@@ -161,4 +161,20 @@ export default class bitfinex2 extends Exchange {
161
161
  parseOpenInterest(interest: any, market?: Market): OpenInterest;
162
162
  fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
163
163
  parseLiquidation(liquidation: any, market?: Market): Liquidation;
164
+ setMargin(symbol: string, amount: any, params?: {}): Promise<{
165
+ info: any;
166
+ type: any;
167
+ amount: any;
168
+ code: any;
169
+ symbol: any;
170
+ status: string;
171
+ }>;
172
+ parseMarginModification(data: any, market?: any): {
173
+ info: any;
174
+ type: any;
175
+ amount: any;
176
+ code: any;
177
+ symbol: any;
178
+ status: string;
179
+ };
164
180
  }
@@ -72,6 +72,7 @@ export default class bitfinex2 extends Exchange {
72
72
  'fetchTradingFees': true,
73
73
  'fetchTransactionFees': undefined,
74
74
  'fetchTransactions': 'emulated',
75
+ 'setMargin': true,
75
76
  'withdraw': true,
76
77
  },
77
78
  'timeframes': {
@@ -822,6 +823,11 @@ export default class bitfinex2 extends Exchange {
822
823
  const result = { 'info': response };
823
824
  for (let i = 0; i < response.length; i++) {
824
825
  const balance = response[i];
826
+ const account = this.account();
827
+ const interest = this.safeString(balance, 3);
828
+ if (interest !== '0') {
829
+ account['debt'] = interest;
830
+ }
825
831
  const type = this.safeString(balance, 0);
826
832
  const currencyId = this.safeStringLower(balance, 1, '');
827
833
  const start = currencyId.length - 2;
@@ -830,7 +836,6 @@ export default class bitfinex2 extends Exchange {
830
836
  const derivativeCondition = (!isDerivative || isDerivativeCode);
831
837
  if ((accountType === type) && derivativeCondition) {
832
838
  const code = this.safeCurrencyCode(currencyId);
833
- const account = this.account();
834
839
  account['total'] = this.safeString(balance, 2);
835
840
  account['free'] = this.safeString(balance, 4);
836
841
  result[code] = account;
@@ -3265,4 +3270,47 @@ export default class bitfinex2 extends Exchange {
3265
3270
  'datetime': this.iso8601(timestamp),
3266
3271
  });
3267
3272
  }
3273
+ async setMargin(symbol, amount, params = {}) {
3274
+ /**
3275
+ * @method
3276
+ * @name bitfinex2#setMargin
3277
+ * @description either adds or reduces margin in a swap position in order to set the margin to a specific value
3278
+ * @see https://docs.bitfinex.com/reference/rest-auth-deriv-pos-collateral-set
3279
+ * @param {string} symbol unified market symbol of the market to set margin in
3280
+ * @param {float} amount the amount to set the margin to
3281
+ * @param {object} [params] parameters specific to the exchange API endpoint
3282
+ * @returns {object} A [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure}
3283
+ */
3284
+ await this.loadMarkets();
3285
+ const market = this.market(symbol);
3286
+ if (!market['swap']) {
3287
+ throw new NotSupported(this.id + ' setMargin() only support swap markets');
3288
+ }
3289
+ const request = {
3290
+ 'symbol': market['id'],
3291
+ 'collateral': this.parseToNumeric(amount),
3292
+ };
3293
+ const response = await this.privatePostAuthWDerivCollateralSet(this.extend(request, params));
3294
+ //
3295
+ // [
3296
+ // [
3297
+ // 1
3298
+ // ]
3299
+ // ]
3300
+ //
3301
+ const data = this.safeValue(response, 0);
3302
+ return this.parseMarginModification(data, market);
3303
+ }
3304
+ parseMarginModification(data, market = undefined) {
3305
+ const marginStatusRaw = data[0];
3306
+ const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
3307
+ return {
3308
+ 'info': data,
3309
+ 'type': undefined,
3310
+ 'amount': undefined,
3311
+ 'code': undefined,
3312
+ 'symbol': market['symbol'],
3313
+ 'status': marginStatus,
3314
+ };
3315
+ }
3268
3316
  }
@@ -31,6 +31,7 @@ export default class bitflyer extends Exchange {
31
31
  'swap': undefined,
32
32
  'future': undefined,
33
33
  'option': false,
34
+ 'cancelAllOrders': undefined,
34
35
  'cancelOrder': true,
35
36
  'createOrder': true,
36
37
  'fetchBalance': true,
@@ -20,6 +20,7 @@ export default class bitforex extends Exchange {
20
20
  parseOrderStatus(status: any): any;
21
21
  parseSide(sideId: any): "buy" | "sell";
22
22
  parseOrder(order: any, market?: Market): Order;
23
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
23
24
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
24
25
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
25
26
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -30,6 +30,7 @@ export default class bitforex extends Exchange {
30
30
  'future': false,
31
31
  'option': false,
32
32
  'addMargin': false,
33
+ 'cancelAllOrders': true,
33
34
  'cancelOrder': true,
34
35
  'createOrder': true,
35
36
  'createReduceOnlyOrder': false,
@@ -683,6 +684,34 @@ export default class bitforex extends Exchange {
683
684
  'trades': undefined,
684
685
  }, market);
685
686
  }
687
+ async cancelAllOrders(symbol = undefined, params = {}) {
688
+ /**
689
+ * @method
690
+ * @name bitforex#cancelAllOrders
691
+ * @see https://github.com/githubdev2020/API_Doc_en/wiki/Cancle-all-orders
692
+ * @description cancel all open orders in a market
693
+ * @param {string} symbol unified market symbol of the market to cancel orders in
694
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
695
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
696
+ */
697
+ if (symbol === undefined) {
698
+ throw new ArgumentsRequired(this.id + ' cancelAllOrders () requires a symbol argument');
699
+ }
700
+ await this.loadMarkets();
701
+ const market = this.market(symbol);
702
+ const request = {
703
+ 'symbol': market['id'],
704
+ };
705
+ const response = await this.privatePostApiV1TradeCancelAllOrder(this.extend(request, params));
706
+ //
707
+ // {
708
+ // 'data': True,
709
+ // 'success': True,
710
+ // 'time': '1706542995252'
711
+ // }
712
+ //
713
+ return response;
714
+ }
686
715
  async fetchOrder(id, symbol = undefined, params = {}) {
687
716
  /**
688
717
  * @method
@@ -3340,11 +3340,16 @@ export default class coinbase extends Exchange {
3340
3340
  'Content-Type': 'application/json',
3341
3341
  };
3342
3342
  }
3343
- else if (this.token) {
3343
+ else if (this.token && !this.checkRequiredCredentials(false)) {
3344
3344
  headers = {
3345
3345
  'Authorization': 'Bearer ' + this.token,
3346
3346
  'Content-Type': 'application/json',
3347
3347
  };
3348
+ if (method !== 'GET') {
3349
+ if (Object.keys(query).length) {
3350
+ body = this.json(query);
3351
+ }
3352
+ }
3348
3353
  }
3349
3354
  else {
3350
3355
  this.checkRequiredCredentials();
@@ -0,0 +1,79 @@
1
+ import Exchange from './abstract/coinmetro.js';
2
+ import { Balances, Currency, IndexType, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
3
+ /**
4
+ * @class coinmetro
5
+ * @augments Exchange
6
+ */
7
+ export default class coinmetro extends Exchange {
8
+ describe(): any;
9
+ fetchCurrencies(params?: {}): Promise<{}>;
10
+ fetchMarkets(params?: {}): Promise<import("./base/types.js").MarketInterface[]>;
11
+ parseMarket(market: any): Market;
12
+ parseMarketId(marketId: any): {
13
+ baseId: any;
14
+ quoteId: any;
15
+ };
16
+ parseMarketPrecisionAndLimits(currencyId: any): {
17
+ precision: number;
18
+ minLimit: number;
19
+ };
20
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
21
+ parseOHLCV(ohlcv: any, market?: Market): OHLCV;
22
+ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
23
+ fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
24
+ parseTrade(trade: any, market?: Market): Trade;
25
+ fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
26
+ parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
27
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
28
+ fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
29
+ parseTicker(ticker: any, market?: Market): Ticker;
30
+ fetchBalance(params?: {}): Promise<Balances>;
31
+ parseBalance(response: any): Balances;
32
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
33
+ parseLedgerEntry(item: any, currency?: Currency): {
34
+ id: string;
35
+ timestamp: number;
36
+ datetime: string;
37
+ direction: string;
38
+ account: string;
39
+ referenceId: string;
40
+ referenceAccount: string;
41
+ type: string;
42
+ currency: string;
43
+ amount: number;
44
+ before: number;
45
+ after: number;
46
+ status: string;
47
+ fee: any;
48
+ info: any;
49
+ };
50
+ parseLedgerEntryDescription(description: any): any[];
51
+ parseLedgerEntryType(type: any): string;
52
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
53
+ handleCreateOrderSide(sellingCurrency: any, buyingCurrency: any, sellingQty: any, buyingQty: any, request?: {}): {};
54
+ encodeOrderTimeInForce(timeInForce: any): any;
55
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
56
+ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
57
+ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
58
+ fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
59
+ fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
60
+ parseOrder(order: any, market?: Market): Order;
61
+ parseOrderTimeInForce(timeInForce: any): any;
62
+ borrowCrossMargin(code: string, amount: any, params?: {}): Promise<any>;
63
+ parseMarginLoan(info: any, currency?: Currency): {
64
+ id: any;
65
+ currency: string;
66
+ amount: any;
67
+ symbol: any;
68
+ timestamp: any;
69
+ datetime: any;
70
+ info: any;
71
+ };
72
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
73
+ url: string;
74
+ method: string;
75
+ body: any;
76
+ headers: any;
77
+ };
78
+ handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
79
+ }