ccxt 4.1.50 → 4.1.52

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 (183) hide show
  1. package/README.md +110 -113
  2. package/dist/ccxt.browser.js +1377 -2931
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -7
  5. package/dist/cjs/src/alpaca.js +62 -64
  6. package/dist/cjs/src/ascendex.js +3 -1
  7. package/dist/cjs/src/base/Exchange.js +10 -0
  8. package/dist/cjs/src/bigone.js +60 -77
  9. package/dist/cjs/src/binance.js +1 -0
  10. package/dist/cjs/src/bingx.js +4 -11
  11. package/dist/cjs/src/bitbank.js +58 -59
  12. package/dist/cjs/src/bitbns.js +1 -0
  13. package/dist/cjs/src/bitfinex.js +1 -0
  14. package/dist/cjs/src/bitfinex2.js +1 -0
  15. package/dist/cjs/src/bitflyer.js +1 -0
  16. package/dist/cjs/src/bitget.js +3 -8
  17. package/dist/cjs/src/bithumb.js +1 -0
  18. package/dist/cjs/src/bitmart.js +10 -1
  19. package/dist/cjs/src/bitmex.js +114 -119
  20. package/dist/cjs/src/bitopro.js +63 -65
  21. package/dist/cjs/src/bitpanda.js +60 -60
  22. package/dist/cjs/src/bitrue.js +67 -71
  23. package/dist/cjs/src/bitso.js +1 -0
  24. package/dist/cjs/src/bitstamp.js +1 -0
  25. package/dist/cjs/src/bittrex.js +57 -57
  26. package/dist/cjs/src/bitvavo.js +10 -2
  27. package/dist/cjs/src/blockchaincom.js +2 -2
  28. package/dist/cjs/src/btcalpha.js +59 -60
  29. package/dist/cjs/src/btcmarkets.js +68 -69
  30. package/dist/cjs/src/btcturk.js +72 -74
  31. package/dist/cjs/src/bybit.js +3 -1
  32. package/dist/cjs/src/coinbase.js +7 -2
  33. package/dist/cjs/src/coinbasepro.js +1 -0
  34. package/dist/cjs/src/coincheck.js +1 -0
  35. package/dist/cjs/src/coinex.js +4 -0
  36. package/dist/cjs/src/coinlist.js +60 -60
  37. package/dist/cjs/src/coinmate.js +1 -0
  38. package/dist/cjs/src/coinsph.js +2 -4
  39. package/dist/cjs/src/cryptocom.js +1 -0
  40. package/dist/cjs/src/currencycom.js +2 -2
  41. package/dist/cjs/src/deribit.js +2 -0
  42. package/dist/cjs/src/digifinex.js +5 -2
  43. package/dist/cjs/src/exmo.js +1 -0
  44. package/dist/cjs/src/gate.js +2 -0
  45. package/dist/cjs/src/gemini.js +2 -0
  46. package/dist/cjs/src/hitbtc.js +4 -0
  47. package/dist/cjs/src/hollaex.js +2 -0
  48. package/dist/cjs/src/htx.js +4 -0
  49. package/dist/cjs/src/huobijp.js +2 -0
  50. package/dist/cjs/src/idex.js +2 -0
  51. package/dist/cjs/src/indodax.js +1 -0
  52. package/dist/cjs/src/kraken.js +10 -13
  53. package/dist/cjs/src/kucoin.js +6 -5
  54. package/dist/cjs/src/kuna.js +3 -1
  55. package/dist/cjs/src/latoken.js +1 -0
  56. package/dist/cjs/src/lbank.js +1 -0
  57. package/dist/cjs/src/lykke.js +2 -0
  58. package/dist/cjs/src/mercado.js +1 -0
  59. package/dist/cjs/src/mexc.js +2 -0
  60. package/dist/cjs/src/ndax.js +2 -0
  61. package/dist/cjs/src/novadax.js +1 -0
  62. package/dist/cjs/src/okcoin.js +2 -0
  63. package/dist/cjs/src/okx.js +2 -0
  64. package/dist/cjs/src/phemex.js +2 -0
  65. package/dist/cjs/src/poloniex.js +1 -0
  66. package/dist/cjs/src/pro/binance.js +5 -3
  67. package/dist/cjs/src/pro/coinbase.js +12 -3
  68. package/dist/cjs/src/pro/cryptocom.js +17 -17
  69. package/dist/cjs/src/pro/krakenfutures.js +24 -3
  70. package/dist/cjs/src/probit.js +4 -2
  71. package/dist/cjs/src/tidex.js +1 -0
  72. package/dist/cjs/src/timex.js +2 -0
  73. package/dist/cjs/src/upbit.js +2 -0
  74. package/dist/cjs/src/wavesexchange.js +2 -1
  75. package/dist/cjs/src/whitebit.js +1 -0
  76. package/dist/cjs/src/woo.js +1 -0
  77. package/dist/cjs/src/zaif.js +1 -0
  78. package/dist/cjs/src/zonda.js +1 -0
  79. package/js/ccxt.d.ts +2 -8
  80. package/js/ccxt.js +2 -6
  81. package/js/src/abstract/kraken.d.ts +0 -5
  82. package/js/src/alpaca.d.ts +3 -2
  83. package/js/src/alpaca.js +62 -64
  84. package/js/src/ascendex.js +3 -1
  85. package/js/src/base/Exchange.d.ts +2 -0
  86. package/js/src/base/Exchange.js +10 -0
  87. package/js/src/base/types.d.ts +6 -3
  88. package/js/src/bigone.d.ts +3 -3
  89. package/js/src/bigone.js +60 -77
  90. package/js/src/binance.js +1 -0
  91. package/js/src/bingx.d.ts +2 -2
  92. package/js/src/bingx.js +4 -11
  93. package/js/src/bitbank.d.ts +3 -2
  94. package/js/src/bitbank.js +58 -59
  95. package/js/src/bitbns.js +1 -0
  96. package/js/src/bitfinex.js +1 -0
  97. package/js/src/bitfinex2.js +1 -0
  98. package/js/src/bitflyer.js +1 -0
  99. package/js/src/bitget.d.ts +1 -2
  100. package/js/src/bitget.js +3 -8
  101. package/js/src/bithumb.js +1 -0
  102. package/js/src/bitmart.js +10 -1
  103. package/js/src/bitmex.d.ts +3 -2
  104. package/js/src/bitmex.js +114 -119
  105. package/js/src/bitopro.d.ts +3 -2
  106. package/js/src/bitopro.js +63 -65
  107. package/js/src/bitpanda.d.ts +3 -2
  108. package/js/src/bitpanda.js +60 -60
  109. package/js/src/bitrue.d.ts +3 -2
  110. package/js/src/bitrue.js +67 -71
  111. package/js/src/bitso.js +1 -0
  112. package/js/src/bitstamp.js +1 -0
  113. package/js/src/bittrex.d.ts +3 -2
  114. package/js/src/bittrex.js +57 -57
  115. package/js/src/bitvavo.js +10 -2
  116. package/js/src/blockchaincom.js +2 -2
  117. package/js/src/btcalpha.d.ts +3 -2
  118. package/js/src/btcalpha.js +59 -60
  119. package/js/src/btcmarkets.d.ts +3 -2
  120. package/js/src/btcmarkets.js +68 -69
  121. package/js/src/btcturk.d.ts +3 -2
  122. package/js/src/btcturk.js +72 -74
  123. package/js/src/bybit.js +3 -1
  124. package/js/src/coinbase.js +7 -2
  125. package/js/src/coinbasepro.js +1 -0
  126. package/js/src/coincheck.js +1 -0
  127. package/js/src/coinex.js +4 -0
  128. package/js/src/coinlist.d.ts +3 -2
  129. package/js/src/coinlist.js +60 -60
  130. package/js/src/coinmate.js +1 -0
  131. package/js/src/coinsph.js +2 -4
  132. package/js/src/cryptocom.js +1 -0
  133. package/js/src/currencycom.js +2 -2
  134. package/js/src/deribit.js +2 -0
  135. package/js/src/digifinex.js +5 -2
  136. package/js/src/exmo.js +1 -0
  137. package/js/src/gate.js +2 -0
  138. package/js/src/gemini.js +2 -0
  139. package/js/src/hitbtc.js +4 -0
  140. package/js/src/hollaex.js +2 -0
  141. package/js/src/htx.js +4 -0
  142. package/js/src/huobijp.js +2 -0
  143. package/js/src/idex.js +2 -0
  144. package/js/src/indodax.js +1 -0
  145. package/js/src/kraken.js +10 -13
  146. package/js/src/kucoin.js +6 -5
  147. package/js/src/kuna.js +3 -1
  148. package/js/src/latoken.js +1 -0
  149. package/js/src/lbank.js +1 -0
  150. package/js/src/lykke.js +2 -0
  151. package/js/src/mercado.js +1 -0
  152. package/js/src/mexc.js +2 -0
  153. package/js/src/ndax.js +2 -0
  154. package/js/src/novadax.js +1 -0
  155. package/js/src/okcoin.js +2 -0
  156. package/js/src/okx.js +2 -0
  157. package/js/src/phemex.js +2 -0
  158. package/js/src/poloniex.js +1 -0
  159. package/js/src/pro/binance.js +5 -3
  160. package/js/src/pro/coinbase.js +12 -3
  161. package/js/src/pro/cryptocom.js +17 -17
  162. package/js/src/pro/krakenfutures.js +24 -3
  163. package/js/src/probit.js +4 -2
  164. package/js/src/tidex.js +1 -0
  165. package/js/src/timex.js +2 -0
  166. package/js/src/upbit.js +2 -0
  167. package/js/src/wavesexchange.js +2 -1
  168. package/js/src/whitebit.js +1 -0
  169. package/js/src/woo.js +1 -0
  170. package/js/src/zaif.js +1 -0
  171. package/js/src/zonda.js +1 -0
  172. package/package.json +1 -1
  173. package/skip-tests.json +2 -3
  174. package/dist/cjs/src/btctradeua.js +0 -571
  175. package/dist/cjs/src/coinfalcon.js +0 -1012
  176. package/js/src/abstract/btctradeua.d.ts +0 -20
  177. package/js/src/abstract/btctradeua.js +0 -11
  178. package/js/src/abstract/coinfalcon.d.ts +0 -26
  179. package/js/src/abstract/coinfalcon.js +0 -11
  180. package/js/src/btctradeua.d.ts +0 -30
  181. package/js/src/btctradeua.js +0 -572
  182. package/js/src/coinfalcon.d.ts +0 -53
  183. package/js/src/coinfalcon.js +0 -1013
@@ -1,572 +0,0 @@
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 from './abstract/btctradeua.js';
9
- import { ExchangeError } from './base/errors.js';
10
- import { Precise } from './base/Precise.js';
11
- import { TICK_SIZE } from './base/functions/number.js';
12
- import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
- // ---------------------------------------------------------------------------
14
- /**
15
- * @class btctradeua
16
- * @extends Exchange
17
- */
18
- export default class btctradeua extends Exchange {
19
- describe() {
20
- return this.deepExtend(super.describe(), {
21
- 'id': 'btctradeua',
22
- 'name': 'BTC Trade UA',
23
- 'countries': ['UA'],
24
- 'rateLimit': 3000,
25
- 'pro': false,
26
- 'has': {
27
- 'CORS': undefined,
28
- 'spot': true,
29
- 'margin': false,
30
- 'swap': false,
31
- 'future': false,
32
- 'option': false,
33
- 'addMargin': false,
34
- 'cancelOrder': true,
35
- 'createMarketOrder': false,
36
- 'createOrder': true,
37
- 'createReduceOnlyOrder': false,
38
- 'fetchBalance': true,
39
- 'fetchBorrowRate': false,
40
- 'fetchBorrowRateHistories': false,
41
- 'fetchBorrowRateHistory': false,
42
- 'fetchBorrowRates': false,
43
- 'fetchBorrowRatesPerSymbol': false,
44
- 'fetchFundingHistory': false,
45
- 'fetchFundingRate': false,
46
- 'fetchFundingRateHistory': false,
47
- 'fetchFundingRates': false,
48
- 'fetchIndexOHLCV': false,
49
- 'fetchLeverage': false,
50
- 'fetchMarginMode': false,
51
- 'fetchMarkOHLCV': false,
52
- 'fetchOpenInterestHistory': false,
53
- 'fetchOpenOrders': true,
54
- 'fetchOrderBook': true,
55
- 'fetchPosition': false,
56
- 'fetchPositionMode': false,
57
- 'fetchPositions': false,
58
- 'fetchPositionsRisk': false,
59
- 'fetchPremiumIndexOHLCV': false,
60
- 'fetchTicker': true,
61
- 'fetchTrades': true,
62
- 'fetchTradingFee': false,
63
- 'fetchTradingFees': false,
64
- 'reduceMargin': false,
65
- 'setLeverage': false,
66
- 'setMarginMode': false,
67
- 'setPositionMode': false,
68
- 'signIn': true,
69
- 'ws': false,
70
- },
71
- 'urls': {
72
- 'referral': 'https://btc-trade.com.ua/registration/22689',
73
- 'logo': 'https://user-images.githubusercontent.com/1294454/27941483-79fc7350-62d9-11e7-9f61-ac47f28fcd96.jpg',
74
- 'api': {
75
- 'rest': 'https://btc-trade.com.ua/api',
76
- },
77
- 'www': 'https://btc-trade.com.ua',
78
- 'doc': 'https://docs.google.com/document/d/1ocYA0yMy_RXd561sfG3qEPZ80kyll36HUxvCRe5GbhE/edit',
79
- },
80
- 'api': {
81
- 'public': {
82
- 'get': [
83
- 'deals/{symbol}',
84
- 'trades/sell/{symbol}',
85
- 'trades/buy/{symbol}',
86
- 'japan_stat/high/{symbol}',
87
- ],
88
- },
89
- 'private': {
90
- 'post': [
91
- 'auth',
92
- 'ask/{symbol}',
93
- 'balance',
94
- 'bid/{symbol}',
95
- 'buy/{symbol}',
96
- 'my_orders/{symbol}',
97
- 'order/status/{id}',
98
- 'remove/order/{id}',
99
- 'sell/{symbol}',
100
- ],
101
- },
102
- },
103
- 'precisionMode': TICK_SIZE,
104
- 'markets': {
105
- 'BCH/UAH': this.safeMarketStructure({ 'id': 'bch_uah', 'symbol': 'BCH/UAH', 'base': 'BCH', 'quote': 'UAH', 'baseId': 'bch', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
106
- 'BTC/UAH': this.safeMarketStructure({ 'id': 'btc_uah', 'symbol': 'BTC/UAH', 'base': 'BTC', 'quote': 'UAH', 'baseId': 'btc', 'quoteId': 'uah', 'precision': { 'price': this.parseNumber('1e-1') }, 'limits': { 'amount': { 'min': this.parseNumber('1e-10') } }, 'type': 'spot', 'spot': true }),
107
- 'DASH/BTC': this.safeMarketStructure({ 'id': 'dash_btc', 'symbol': 'DASH/BTC', 'base': 'DASH', 'quote': 'BTC', 'baseId': 'dash', 'quoteId': 'btc', 'type': 'spot', 'spot': true }),
108
- 'DASH/UAH': this.safeMarketStructure({ 'id': 'dash_uah', 'symbol': 'DASH/UAH', 'base': 'DASH', 'quote': 'UAH', 'baseId': 'dash', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
109
- 'DOGE/BTC': this.safeMarketStructure({ 'id': 'doge_btc', 'symbol': 'DOGE/BTC', 'base': 'DOGE', 'quote': 'BTC', 'baseId': 'doge', 'quoteId': 'btc', 'type': 'spot', 'spot': true }),
110
- 'DOGE/UAH': this.safeMarketStructure({ 'id': 'doge_uah', 'symbol': 'DOGE/UAH', 'base': 'DOGE', 'quote': 'UAH', 'baseId': 'doge', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
111
- 'ETH/UAH': this.safeMarketStructure({ 'id': 'eth_uah', 'symbol': 'ETH/UAH', 'base': 'ETH', 'quote': 'UAH', 'baseId': 'eth', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
112
- 'ITI/UAH': this.safeMarketStructure({ 'id': 'iti_uah', 'symbol': 'ITI/UAH', 'base': 'ITI', 'quote': 'UAH', 'baseId': 'iti', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
113
- 'KRB/UAH': this.safeMarketStructure({ 'id': 'krb_uah', 'symbol': 'KRB/UAH', 'base': 'KRB', 'quote': 'UAH', 'baseId': 'krb', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
114
- 'LTC/BTC': this.safeMarketStructure({ 'id': 'ltc_btc', 'symbol': 'LTC/BTC', 'base': 'LTC', 'quote': 'BTC', 'baseId': 'ltc', 'quoteId': 'btc', 'type': 'spot', 'spot': true }),
115
- 'LTC/UAH': this.safeMarketStructure({ 'id': 'ltc_uah', 'symbol': 'LTC/UAH', 'base': 'LTC', 'quote': 'UAH', 'baseId': 'ltc', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
116
- 'NVC/BTC': this.safeMarketStructure({ 'id': 'nvc_btc', 'symbol': 'NVC/BTC', 'base': 'NVC', 'quote': 'BTC', 'baseId': 'nvc', 'quoteId': 'btc', 'type': 'spot', 'spot': true }),
117
- 'NVC/UAH': this.safeMarketStructure({ 'id': 'nvc_uah', 'symbol': 'NVC/UAH', 'base': 'NVC', 'quote': 'UAH', 'baseId': 'nvc', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
118
- 'PPC/BTC': this.safeMarketStructure({ 'id': 'ppc_btc', 'symbol': 'PPC/BTC', 'base': 'PPC', 'quote': 'BTC', 'baseId': 'ppc', 'quoteId': 'btc', 'type': 'spot', 'spot': true }),
119
- 'SIB/UAH': this.safeMarketStructure({ 'id': 'sib_uah', 'symbol': 'SIB/UAH', 'base': 'SIB', 'quote': 'UAH', 'baseId': 'sib', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
120
- 'XMR/UAH': this.safeMarketStructure({ 'id': 'xmr_uah', 'symbol': 'XMR/UAH', 'base': 'XMR', 'quote': 'UAH', 'baseId': 'xmr', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
121
- 'ZEC/UAH': this.safeMarketStructure({ 'id': 'zec_uah', 'symbol': 'ZEC/UAH', 'base': 'ZEC', 'quote': 'UAH', 'baseId': 'zec', 'quoteId': 'uah', 'type': 'spot', 'spot': true }),
122
- },
123
- 'fees': {
124
- 'trading': {
125
- 'maker': this.parseNumber('0.001'),
126
- 'taker': this.parseNumber('0.001'),
127
- },
128
- },
129
- });
130
- }
131
- async signIn(params = {}) {
132
- /**
133
- * @method
134
- * @name btctradeua#signIn
135
- * @description sign in, must be called prior to using other authenticated methods
136
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
137
- * @returns response from exchange
138
- */
139
- return await this.privatePostAuth(params);
140
- }
141
- parseBalance(response) {
142
- const result = { 'info': response };
143
- const balances = this.safeValue(response, 'accounts', []);
144
- for (let i = 0; i < balances.length; i++) {
145
- const balance = balances[i];
146
- const currencyId = this.safeString(balance, 'currency');
147
- const code = this.safeCurrencyCode(currencyId);
148
- const account = this.account();
149
- account['total'] = this.safeString(balance, 'balance');
150
- result[code] = account;
151
- }
152
- return this.safeBalance(result);
153
- }
154
- async fetchBalance(params = {}) {
155
- /**
156
- * @method
157
- * @name btctradeua#fetchBalance
158
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
159
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
160
- * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
161
- */
162
- await this.loadMarkets();
163
- const response = await this.privatePostBalance(params);
164
- return this.parseBalance(response);
165
- }
166
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
167
- /**
168
- * @method
169
- * @name btctradeua#fetchOrderBook
170
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
171
- * @param {string} symbol unified symbol of the market to fetch the order book for
172
- * @param {int} [limit] the maximum amount of order book entries to return
173
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
174
- * @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
175
- */
176
- await this.loadMarkets();
177
- const market = this.market(symbol);
178
- const request = {
179
- 'symbol': market['id'],
180
- };
181
- const bids = await this.publicGetTradesBuySymbol(this.extend(request, params));
182
- const asks = await this.publicGetTradesSellSymbol(this.extend(request, params));
183
- const orderbook = {
184
- 'bids': [],
185
- 'asks': [],
186
- };
187
- if (bids) {
188
- if ('list' in bids) {
189
- orderbook['bids'] = bids['list'];
190
- }
191
- }
192
- if (asks) {
193
- if ('list' in asks) {
194
- orderbook['asks'] = asks['list'];
195
- }
196
- }
197
- return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'currency_trade');
198
- }
199
- parseTicker(ticker, market = undefined) {
200
- //
201
- // [
202
- // [1640789101000, 1292663.0, 1311823.61303, 1295794.252, 1311823.61303, 0.030175],
203
- // [1640790902000, 1311823.61303, 1310820.96, 1290000.0, 1290000.0, 0.042533],
204
- // ],
205
- //
206
- const symbol = this.safeSymbol(undefined, market);
207
- const timestamp = this.milliseconds();
208
- const result = {
209
- 'symbol': symbol,
210
- 'timestamp': timestamp,
211
- 'datetime': this.iso8601(timestamp),
212
- 'high': undefined,
213
- 'low': undefined,
214
- 'bid': undefined,
215
- 'bidVolume': undefined,
216
- 'ask': undefined,
217
- 'askVolume': undefined,
218
- 'vwap': undefined,
219
- 'open': undefined,
220
- 'close': undefined,
221
- 'last': undefined,
222
- 'previousClose': undefined,
223
- 'change': undefined,
224
- 'percentage': undefined,
225
- 'average': undefined,
226
- 'baseVolume': undefined,
227
- 'quoteVolume': undefined,
228
- 'info': ticker,
229
- };
230
- const tickerLength = ticker.length;
231
- if (tickerLength > 0) {
232
- const start = Math.max(tickerLength - 48, 0);
233
- for (let i = start; i < ticker.length; i++) {
234
- const candle = ticker[i];
235
- if (result['open'] === undefined) {
236
- result['open'] = this.safeString(candle, 1);
237
- }
238
- const high = this.safeString(candle, 2);
239
- if ((result['high'] === undefined) || ((high !== undefined) && Precise.stringLt(result['high'], high))) {
240
- result['high'] = high;
241
- }
242
- const low = this.safeString(candle, 3);
243
- if ((result['low'] === undefined) || ((low !== undefined) && Precise.stringLt(result['low'], low))) {
244
- result['low'] = low;
245
- }
246
- const baseVolume = this.safeString(candle, 5);
247
- if (result['baseVolume'] === undefined) {
248
- result['baseVolume'] = baseVolume;
249
- }
250
- else {
251
- result['baseVolume'] = Precise.stringAdd(result['baseVolume'], baseVolume);
252
- }
253
- }
254
- const last = tickerLength - 1;
255
- result['last'] = this.safeString(ticker[last], 4);
256
- result['close'] = result['last'];
257
- }
258
- return this.safeTicker(result, market);
259
- }
260
- async fetchTicker(symbol, params = {}) {
261
- /**
262
- * @method
263
- * @name btctradeua#fetchTicker
264
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
265
- * @param {string} symbol unified symbol of the market to fetch the ticker for
266
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
267
- * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
268
- */
269
- await this.loadMarkets();
270
- const market = this.market(symbol);
271
- const request = {
272
- 'symbol': market['id'],
273
- };
274
- const response = await this.publicGetJapanStatHighSymbol(this.extend(request, params));
275
- const ticker = this.safeValue(response, 'trades');
276
- //
277
- // {
278
- // "status": true,
279
- // "volume_trade": "0.495703",
280
- // "trades": [
281
- // [1640789101000, 1292663.0, 1311823.61303, 1295794.252, 1311823.61303, 0.030175],
282
- // [1640790902000, 1311823.61303, 1310820.96, 1290000.0, 1290000.0, 0.042533],
283
- // ],
284
- // }
285
- //
286
- return this.parseTicker(ticker, market);
287
- }
288
- convertMonthNameToString(cyrillic) {
289
- const months = {
290
- 'Jan': '01',
291
- 'January': '01',
292
- 'Feb': '02',
293
- 'February': '02',
294
- 'Mar': '03',
295
- 'March': '03',
296
- 'Apr': '04',
297
- 'April': '04',
298
- 'May': '05',
299
- 'Jun': '06',
300
- 'June': '06',
301
- 'Jul': '07',
302
- 'July': '07',
303
- 'Aug': '08',
304
- 'August': '08',
305
- 'Sept': '09',
306
- 'September': '09',
307
- 'Oct': '10',
308
- 'October': '10',
309
- 'Nov': '11',
310
- 'November': '11',
311
- 'Dec': '12',
312
- 'December': '12',
313
- };
314
- return this.safeString(months, cyrillic);
315
- }
316
- parseExchangeSpecificDatetime(cyrillic) {
317
- const parts = cyrillic.split(' ');
318
- let month = parts[0];
319
- let day = parts[1].replace(',', '');
320
- if (day.length < 2) {
321
- day = '0' + day;
322
- }
323
- const year = parts[2].replace(',', '');
324
- month = month.replace(',', '');
325
- month = month.replace('.', '');
326
- month = this.convertMonthNameToString(month);
327
- if (!month) {
328
- throw new ExchangeError(this.id + ' parseTrade() unrecognized month name: ' + cyrillic);
329
- }
330
- const hms = parts[3];
331
- const hmsParts = hms.split(':');
332
- let h = this.safeString(hmsParts, 0);
333
- let m = '00';
334
- const ampm = this.safeString(parts, 4);
335
- if (h === 'noon') {
336
- h = '12';
337
- }
338
- else {
339
- let intH = parseInt(h);
340
- if ((ampm !== undefined) && (ampm[0] === 'p')) {
341
- intH = 12 + intH;
342
- if (intH > 23) {
343
- intH = 0;
344
- }
345
- }
346
- h = intH.toString();
347
- if (h.length < 2) {
348
- h = '0' + h;
349
- }
350
- m = this.safeString(hmsParts, 1, '00');
351
- if (m.length < 2) {
352
- m = '0' + m;
353
- }
354
- }
355
- const ymd = [year, month, day].join('-');
356
- const ymdhms = ymd + 'T' + h + ':' + m + ':00';
357
- const timestamp = this.parse8601(ymdhms);
358
- // server reports local time, adjust to UTC
359
- // a special case for DST
360
- // subtract 2 hours during winter
361
- const intM = parseInt(m);
362
- if (intM < 11 || intM > 2) {
363
- return timestamp - 7200000;
364
- }
365
- // subtract 3 hours during summer
366
- return timestamp - 10800000;
367
- }
368
- parseTrade(trade, market = undefined) {
369
- //
370
- // fetchTrades
371
- //
372
- // {
373
- // "amnt_base": "2220.1204701750",
374
- // "order_id": 247644861,
375
- // "unixtime": 1694340398,
376
- // "price": "1019739.3229211044",
377
- // "amnt_trade": "0.0021771451",
378
- // "user": "Vasily1989",
379
- // "type": "sell",
380
- // "pub_date": "Sept. 10, 2023, 1:06 p.m.",
381
- // "id": 7498807
382
- // }
383
- //
384
- const timestamp = this.parseExchangeSpecificDatetime(this.safeString(trade, 'pub_date'));
385
- const id = this.safeString(trade, 'id');
386
- const type = 'limit';
387
- const side = this.safeString(trade, 'type');
388
- const priceString = this.safeString(trade, 'price');
389
- const amountString = this.safeString(trade, 'amnt_trade');
390
- market = this.safeMarket(undefined, market);
391
- return this.safeTrade({
392
- 'id': id,
393
- 'info': trade,
394
- 'timestamp': timestamp,
395
- 'datetime': this.iso8601(timestamp),
396
- 'symbol': market['symbol'],
397
- 'type': type,
398
- 'side': side,
399
- 'order': undefined,
400
- 'takerOrMaker': undefined,
401
- 'price': priceString,
402
- 'amount': amountString,
403
- 'cost': undefined,
404
- 'fee': undefined,
405
- }, market);
406
- }
407
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
408
- /**
409
- * @method
410
- * @name btctradeua#fetchTrades
411
- * @description get the list of most recent trades for a particular symbol
412
- * @param {string} symbol unified symbol of the market to fetch trades for
413
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
414
- * @param {int} [limit] the maximum amount of trades to fetch
415
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
416
- * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
417
- */
418
- await this.loadMarkets();
419
- const market = this.market(symbol);
420
- const request = {
421
- 'symbol': market['id'],
422
- };
423
- const response = await this.publicGetDealsSymbol(this.extend(request, params));
424
- //
425
- // [
426
- // {
427
- // "amnt_base": "2220.1204701750",
428
- // "order_id": 247644861,
429
- // "unixtime": 1694340398,
430
- // "price": "1019739.3229211044",
431
- // "amnt_trade": "0.0021771451",
432
- // "user": "Vasily1989",
433
- // "type": "sell",
434
- // "pub_date": "Sept. 10, 2023, 1:06 p.m.",
435
- // "id": 7498807
436
- // },
437
- // ]
438
- //
439
- // they report each trade twice (once for both of the two sides of the fill)
440
- // deduplicate trades for that reason
441
- const trades = [];
442
- for (let i = 0; i < response.length; i++) {
443
- const id = this.safeInteger(response[i], 'id');
444
- if (id % 2) {
445
- trades.push(response[i]);
446
- }
447
- }
448
- return this.parseTrades(trades, market, since, limit);
449
- }
450
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
451
- /**
452
- * @method
453
- * @name btctradeua#createOrder
454
- * @description create a trade order
455
- * @param {string} symbol unified symbol of the market to create an order in
456
- * @param {string} type must be 'limit'
457
- * @param {string} side 'buy' or 'sell'
458
- * @param {float} amount how much of currency you want to trade in units of base currency
459
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
460
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
461
- * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
462
- */
463
- if (type === 'market') {
464
- throw new ExchangeError(this.id + ' createOrder() allows limit orders only');
465
- }
466
- await this.loadMarkets();
467
- const market = this.market(symbol);
468
- const method = 'privatePost' + this.capitalize(side) + 'Id';
469
- const request = {
470
- 'count': amount,
471
- 'currency1': market['quoteId'],
472
- 'currency': market['baseId'],
473
- 'price': price,
474
- };
475
- return this[method](this.extend(request, params));
476
- }
477
- async cancelOrder(id, symbol = undefined, params = {}) {
478
- /**
479
- * @method
480
- * @name btctradeua#cancelOrder
481
- * @description cancels an open order
482
- * @param {string} id order id
483
- * @param {string} symbol not used by btctradeua cancelOrder ()
484
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
485
- * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
486
- */
487
- const request = {
488
- 'id': id,
489
- };
490
- return await this.privatePostRemoveOrderId(this.extend(request, params));
491
- }
492
- parseOrder(order, market = undefined) {
493
- const timestamp = this.milliseconds();
494
- const symbol = this.safeSymbol(undefined, market);
495
- const side = this.safeString(order, 'type');
496
- const price = this.safeString(order, 'price');
497
- const amount = this.safeString(order, 'amnt_trade');
498
- const remaining = this.safeString(order, 'amnt_trade');
499
- return this.safeOrder({
500
- 'id': this.safeString(order, 'id'),
501
- 'clientOrderId': undefined,
502
- 'timestamp': timestamp,
503
- 'datetime': this.iso8601(timestamp),
504
- 'lastTradeTimestamp': undefined,
505
- 'status': 'open',
506
- 'symbol': symbol,
507
- 'type': undefined,
508
- 'timeInForce': undefined,
509
- 'postOnly': undefined,
510
- 'side': side,
511
- 'price': price,
512
- 'stopPrice': undefined,
513
- 'triggerPrice': undefined,
514
- 'amount': amount,
515
- 'filled': undefined,
516
- 'remaining': remaining,
517
- 'trades': undefined,
518
- 'info': order,
519
- 'cost': undefined,
520
- 'average': undefined,
521
- 'fee': undefined,
522
- }, market);
523
- }
524
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
525
- /**
526
- * @method
527
- * @name btctradeua#fetchOpenOrders
528
- * @description fetch all unfilled currently open orders
529
- * @param {string} symbol unified market symbol
530
- * @param {int} [since] the earliest time in ms to fetch open orders for
531
- * @param {int} [limit] the maximum number of open order structures to retrieve
532
- * @param {object} [params] extra parameters specific to the btctradeua api endpoint
533
- * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
534
- */
535
- this.checkRequiredSymbol('fetchOpenOrders', symbol);
536
- await this.loadMarkets();
537
- const market = this.market(symbol);
538
- const request = {
539
- 'symbol': market['id'],
540
- };
541
- const response = await this.privatePostMyOrdersSymbol(this.extend(request, params));
542
- const orders = this.safeValue(response, 'your_open_orders');
543
- return this.parseOrders(orders, market, since, limit);
544
- }
545
- nonce() {
546
- return this.milliseconds();
547
- }
548
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
549
- let url = this.urls['api']['rest'] + '/' + this.implodeParams(path, params);
550
- const query = this.omit(params, this.extractParams(path));
551
- if (api === 'public') {
552
- if (Object.keys(query).length) {
553
- url += this.implodeParams(path, query);
554
- }
555
- }
556
- else {
557
- this.checkRequiredCredentials();
558
- const nonce = this.nonce();
559
- body = this.urlencode(this.extend({
560
- 'out_order_id': nonce,
561
- 'nonce': nonce,
562
- }, query));
563
- const auth = body + this.secret;
564
- headers = {
565
- 'public-key': this.apiKey,
566
- 'api-sign': this.hash(this.encode(auth), sha256),
567
- 'Content-Type': 'application/x-www-form-urlencoded',
568
- };
569
- }
570
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
571
- }
572
- }
@@ -1,53 +0,0 @@
1
- import Exchange from './abstract/coinfalcon.js';
2
- import { Balances, Int, Order, OrderBook, OrderSide, OrderType, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
- /**
4
- * @class coinfalcon
5
- * @extends Exchange
6
- */
7
- export default class coinfalcon extends Exchange {
8
- describe(): any;
9
- fetchMarkets(params?: {}): Promise<any[]>;
10
- parseTicker(ticker: any, market?: any): Ticker;
11
- fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
12
- fetchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
13
- fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
14
- parseTrade(trade: any, market?: any): Trade;
15
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
16
- fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
17
- fetchTradingFees(params?: {}): Promise<{}>;
18
- parseBalance(response: any): Balances;
19
- fetchBalance(params?: {}): Promise<Balances>;
20
- parseDepositAddress(depositAddress: any, currency?: any): {
21
- currency: any;
22
- address: string;
23
- tag: string;
24
- network: any;
25
- info: any;
26
- };
27
- fetchDepositAddress(code: string, params?: {}): Promise<{
28
- currency: any;
29
- address: string;
30
- tag: string;
31
- network: any;
32
- info: any;
33
- }>;
34
- parseOrderStatus(status: any): string;
35
- parseOrder(order: any, market?: any): Order;
36
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
37
- cancelOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
38
- fetchOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
39
- fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
40
- fetchDeposits(code?: string, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
41
- fetchWithdrawals(code?: string, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
42
- withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<Transaction>;
43
- parseTransactionStatus(status: any): string;
44
- parseTransaction(transaction: any, currency?: any): Transaction;
45
- nonce(): number;
46
- sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
47
- url: string;
48
- method: string;
49
- body: any;
50
- headers: any;
51
- };
52
- handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
53
- }