ccxt 4.2.25 → 4.2.27

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.
@@ -17,7 +17,7 @@ class bingx extends bingx$1 {
17
17
  'watchOHLCV': true,
18
18
  'watchOrders': true,
19
19
  'watchMyTrades': true,
20
- 'watchTicker': false,
20
+ 'watchTicker': true,
21
21
  'watchTickers': false,
22
22
  'watchBalance': true,
23
23
  },
@@ -72,6 +72,151 @@ class bingx extends bingx$1 {
72
72
  },
73
73
  });
74
74
  }
75
+ async watchTicker(symbol, params = {}) {
76
+ /**
77
+ * @method
78
+ * @name bingx#watchTicker
79
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
80
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20to%2024-hour%20price%20changes
81
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
82
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
83
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
84
+ */
85
+ await this.loadMarkets();
86
+ const market = this.market(symbol);
87
+ const [marketType, query] = this.handleMarketTypeAndParams('watchTrades', market, params);
88
+ const url = this.safeValue(this.urls['api']['ws'], marketType);
89
+ if (url === undefined) {
90
+ throw new errors.BadRequest(this.id + ' watchTrades is not supported for ' + marketType + ' markets.');
91
+ }
92
+ const messageHash = market['id'] + '@ticker';
93
+ const uuid = this.uuid();
94
+ const request = {
95
+ 'id': uuid,
96
+ 'dataType': messageHash,
97
+ };
98
+ if (marketType === 'swap') {
99
+ request['reqType'] = 'sub';
100
+ }
101
+ return await this.watch(url, messageHash, this.extend(request, query), messageHash);
102
+ }
103
+ handleTicker(client, message) {
104
+ //
105
+ // swap
106
+ //
107
+ // {
108
+ // "code": 0,
109
+ // "dataType": "BTC-USDT@ticker",
110
+ // "data": {
111
+ // "e": "24hTicker",
112
+ // "E": 1706498923556,
113
+ // "s": "BTC-USDT",
114
+ // "p": "346.4",
115
+ // "P": "0.82",
116
+ // "c": "42432.5",
117
+ // "L": "0.0529",
118
+ // "h": "42855.4",
119
+ // "l": "41578.3",
120
+ // "v": "64310.9754",
121
+ // "q": "2728360284.15",
122
+ // "o": "42086.1",
123
+ // "O": 1706498922655,
124
+ // "C": 1706498883023,
125
+ // "A": "42437.8",
126
+ // "a": "1.4160",
127
+ // "B": "42437.1",
128
+ // "b": "2.5747"
129
+ // }
130
+ // }
131
+ //
132
+ // spot
133
+ //
134
+ // {
135
+ // "code": 0,
136
+ // "timestamp": 1706506795473,
137
+ // "data": {
138
+ // "e": "24hTicker",
139
+ // "E": 1706506795472,
140
+ // "s": "BTC-USDT",
141
+ // "p": -372.12,
142
+ // "P": "-0.87%",
143
+ // "o": 42548.95,
144
+ // "h": 42696.1,
145
+ // "l": 41621.29,
146
+ // "c": 42176.83,
147
+ // "v": 4943.33,
148
+ // "q": 208842236.5,
149
+ // "O": 1706420395472,
150
+ // "C": 1706506795472,
151
+ // "A": 42177.23,
152
+ // "a": 5.14484,
153
+ // "B": 42176.38,
154
+ // "b": 5.36117
155
+ // }
156
+ // }
157
+ //
158
+ const data = this.safeValue(message, 'data', {});
159
+ const marketId = this.safeString(data, 's');
160
+ // const marketId = messageHash.split('@')[0];
161
+ const isSwap = client.url.indexOf('swap') >= 0;
162
+ const marketType = isSwap ? 'swap' : 'spot';
163
+ const market = this.safeMarket(marketId, undefined, undefined, marketType);
164
+ const symbol = market['symbol'];
165
+ const ticker = this.parseWsTicker(data, market);
166
+ this.tickers[symbol] = ticker;
167
+ const messageHash = market['id'] + '@ticker';
168
+ client.resolve(ticker, messageHash);
169
+ }
170
+ parseWsTicker(message, market = undefined) {
171
+ //
172
+ // {
173
+ // "e": "24hTicker",
174
+ // "E": 1706498923556,
175
+ // "s": "BTC-USDT",
176
+ // "p": "346.4",
177
+ // "P": "0.82",
178
+ // "c": "42432.5",
179
+ // "L": "0.0529",
180
+ // "h": "42855.4",
181
+ // "l": "41578.3",
182
+ // "v": "64310.9754",
183
+ // "q": "2728360284.15",
184
+ // "o": "42086.1",
185
+ // "O": 1706498922655,
186
+ // "C": 1706498883023,
187
+ // "A": "42437.8",
188
+ // "a": "1.4160",
189
+ // "B": "42437.1",
190
+ // "b": "2.5747"
191
+ // }
192
+ //
193
+ const timestamp = this.safeInteger(message, 'ts');
194
+ const marketId = this.safeString(message, 's');
195
+ market = this.safeMarket(marketId, market);
196
+ const close = this.safeString(message, 'c');
197
+ return this.safeTicker({
198
+ 'symbol': market['symbol'],
199
+ 'timestamp': timestamp,
200
+ 'datetime': this.iso8601(timestamp),
201
+ 'high': this.safeString(message, 'h'),
202
+ 'low': this.safeString(message, 'l'),
203
+ 'bid': this.safeString(message, 'B'),
204
+ 'bidVolume': this.safeString(message, 'b'),
205
+ 'ask': this.safeString(message, 'A'),
206
+ 'askVolume': this.safeString(message, 'a'),
207
+ 'vwap': undefined,
208
+ 'open': this.safeString(message, 'o'),
209
+ 'close': close,
210
+ 'last': close,
211
+ 'previousClose': undefined,
212
+ 'change': this.safeString(message, 'p'),
213
+ 'percentage': undefined,
214
+ 'average': undefined,
215
+ 'baseVolume': this.safeString(message, 'v'),
216
+ 'quoteVolume': this.safeString(message, 'q'),
217
+ 'info': message,
218
+ }, market);
219
+ }
75
220
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
76
221
  /**
77
222
  * @method
@@ -908,6 +1053,10 @@ class bingx extends bingx$1 {
908
1053
  this.handleOrderBook(client, message);
909
1054
  return;
910
1055
  }
1056
+ if (dataType.indexOf('@ticker') >= 0) {
1057
+ this.handleTicker(client, message);
1058
+ return;
1059
+ }
911
1060
  if (dataType.indexOf('@trade') >= 0) {
912
1061
  this.handleTrades(client, message);
913
1062
  return;
@@ -938,6 +1087,11 @@ class bingx extends bingx$1 {
938
1087
  this.handleMyTrades(client, message);
939
1088
  }
940
1089
  }
1090
+ const msgData = this.safeValue(message, 'data');
1091
+ const msgEvent = this.safeString(msgData, 'e');
1092
+ if (msgEvent === '24hTicker') {
1093
+ this.handleTicker(client, message);
1094
+ }
941
1095
  }
942
1096
  }
943
1097
 
@@ -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.24";
7
+ declare const version = "4.2.26";
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.25';
41
+ const version = '4.2.27';
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
  //-----------------------------------------------------------------------------
@@ -23,6 +23,7 @@ interface Exchange {
23
23
  spotV3PrivateGetCapitalWithdrawHistory(params?: {}): Promise<implicitReturnType>;
24
24
  spotV3PrivatePostPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
25
25
  swapV1PrivateGetPositionSideDual(params?: {}): Promise<implicitReturnType>;
26
+ swapV1PrivateGetMarketMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
26
27
  swapV1PrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
27
28
  swapV2PublicGetServerTime(params?: {}): Promise<implicitReturnType>;
28
29
  swapV2PublicGetQuoteContracts(params?: {}): Promise<implicitReturnType>;
@@ -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;
@@ -1246,15 +1246,13 @@ export default class Exchange {
1246
1246
  client.throttle(cost).then(() => {
1247
1247
  client.send(message);
1248
1248
  }).catch((e) => {
1249
- delete client.subscriptions[subscribeHash];
1250
- future.reject(e);
1249
+ client.onError(e);
1251
1250
  });
1252
1251
  }
1253
1252
  else {
1254
1253
  client.send(message)
1255
1254
  .catch((e) => {
1256
- delete client.subscriptions[subscribeHash];
1257
- future.reject(e);
1255
+ client.onError(e);
1258
1256
  });
1259
1257
  }
1260
1258
  }
@@ -4076,6 +4074,9 @@ export default class Exchange {
4076
4074
  return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
4077
4075
  }
4078
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
+ }
4079
4080
  throw new NotSupported(this.id + ' fetchOrders() is not supported yet');
4080
4081
  }
4081
4082
  async fetchOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -144,7 +144,10 @@ export default class Client {
144
144
  }
145
145
  else {
146
146
  if (this.ping) {
147
- this.send(this.ping(this));
147
+ this.send(this.ping(this))
148
+ .catch((error) => {
149
+ this.onError(error);
150
+ });
148
151
  }
149
152
  else if (isNode) {
150
153
  // can't do this inside browser
package/js/src/bingx.js CHANGED
@@ -58,6 +58,7 @@ export default class bingx extends Exchange {
58
58
  'fetchLeverage': true,
59
59
  'fetchLiquidations': false,
60
60
  'fetchMarkets': true,
61
+ 'fetchMarkOHLCV': true,
61
62
  'fetchMyLiquidations': true,
62
63
  'fetchOHLCV': true,
63
64
  'fetchOpenInterest': true,
@@ -162,6 +163,7 @@ export default class bingx extends Exchange {
162
163
  'private': {
163
164
  'get': {
164
165
  'positionSide/dual': 1,
166
+ 'market/markPriceKlines': 1,
165
167
  },
166
168
  'post': {
167
169
  'positionSide/dual': 1,
@@ -687,6 +689,7 @@ export default class bingx extends Exchange {
687
689
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
688
690
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
689
691
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
692
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
690
693
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
691
694
  * @param {string} timeframe the length of time each candle represents
692
695
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -723,7 +726,14 @@ export default class bingx extends Exchange {
723
726
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
724
727
  }
725
728
  else {
726
- response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
729
+ const price = this.safeString(params, 'price');
730
+ params = this.omit(params, 'price');
731
+ if (price === 'mark') {
732
+ response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
733
+ }
734
+ else {
735
+ response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
736
+ }
727
737
  }
728
738
  //
729
739
  // {
@@ -742,6 +752,24 @@ export default class bingx extends Exchange {
742
752
  // ]
743
753
  // }
744
754
  //
755
+ // fetchMarkOHLCV
756
+ //
757
+ // {
758
+ // "code": 0,
759
+ // "msg": "",
760
+ // "data": [
761
+ // {
762
+ // "open": "42191.7",
763
+ // "close": "42189.5",
764
+ // "high": "42196.5",
765
+ // "low": "42189.5",
766
+ // "volume": "0.00",
767
+ // "openTime": 1706508840000,
768
+ // "closeTime": 1706508840000
769
+ // }
770
+ // ]
771
+ // }
772
+ //
745
773
  let ohlcvs = this.safeValue(response, 'data', []);
746
774
  if (!Array.isArray(ohlcvs)) {
747
775
  ohlcvs = [ohlcvs];
@@ -758,6 +786,18 @@ export default class bingx extends Exchange {
758
786
  // "volume": "167.44",
759
787
  // "time": 1666584000000
760
788
  // }
789
+ //
790
+ // fetchMarkOHLCV
791
+ //
792
+ // {
793
+ // "open": "42191.7",
794
+ // "close": "42189.5",
795
+ // "high": "42196.5",
796
+ // "low": "42189.5",
797
+ // "volume": "0.00",
798
+ // "openTime": 1706508840000,
799
+ // "closeTime": 1706508840000
800
+ // }
761
801
  // spot
762
802
  // [
763
803
  // 1691402580000,
@@ -781,7 +821,7 @@ export default class bingx extends Exchange {
781
821
  ];
782
822
  }
783
823
  return [
784
- this.safeInteger(ohlcv, 'time'),
824
+ this.safeInteger2(ohlcv, 'time', 'closeTime'),
785
825
  this.safeNumber(ohlcv, 'open'),
786
826
  this.safeNumber(ohlcv, 'high'),
787
827
  this.safeNumber(ohlcv, 'low'),
@@ -2238,10 +2278,10 @@ export default class bingx extends Exchange {
2238
2278
  const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
2239
2279
  let stopLoss = this.safeValue(order, 'stopLoss');
2240
2280
  let stopLossPrice = undefined;
2241
- if (stopLoss !== undefined) {
2281
+ if ((stopLoss !== undefined) && (stopLoss !== '')) {
2242
2282
  stopLossPrice = this.safeNumber(stopLoss, 'stopLoss');
2243
2283
  }
2244
- if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
2284
+ if ((stopLoss !== undefined) && (typeof stopLoss !== 'number') && (stopLoss !== '')) {
2245
2285
  // stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
2246
2286
  if (typeof stopLoss === 'string') {
2247
2287
  stopLoss = this.parseJson(stopLoss);
@@ -2250,10 +2290,10 @@ export default class bingx extends Exchange {
2250
2290
  }
2251
2291
  let takeProfit = this.safeValue(order, 'takeProfit');
2252
2292
  let takeProfitPrice = undefined;
2253
- if (takeProfit !== undefined) {
2293
+ if (takeProfit !== undefined && (takeProfit !== '')) {
2254
2294
  takeProfitPrice = this.safeNumber(takeProfit, 'takeProfit');
2255
2295
  }
2256
- if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
2296
+ if ((takeProfit !== undefined) && (typeof takeProfit !== 'number') && (takeProfit !== '')) {
2257
2297
  // takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
2258
2298
  if (typeof takeProfit === 'string') {
2259
2299
  takeProfit = this.parseJson(takeProfit);
@@ -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
+ }