ccxt 4.4.82 → 4.4.86

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 (145) hide show
  1. package/README.md +6 -9
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +6 -17
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -1
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +15 -2
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/bitget.js +6 -7
  10. package/dist/cjs/src/bitmart.js +1 -1
  11. package/dist/cjs/src/bitrue.js +14 -35
  12. package/dist/cjs/src/bitso.js +33 -0
  13. package/dist/cjs/src/bitstamp.js +33 -0
  14. package/dist/cjs/src/bittrade.js +2049 -0
  15. package/dist/cjs/src/blofin.js +154 -13
  16. package/dist/cjs/src/btcbox.js +25 -5
  17. package/dist/cjs/src/bybit.js +16 -40
  18. package/dist/cjs/src/cex.js +2 -4
  19. package/dist/cjs/src/coinbase.js +58 -46
  20. package/dist/cjs/src/coinbaseexchange.js +142 -32
  21. package/dist/cjs/src/coincatch.js +14 -67
  22. package/dist/cjs/src/coinex.js +29 -32
  23. package/dist/cjs/src/coinlist.js +16 -15
  24. package/dist/cjs/src/coinmetro.js +22 -11
  25. package/dist/cjs/src/coinone.js +8 -10
  26. package/dist/cjs/src/coinsph.js +126 -1
  27. package/dist/cjs/src/cryptocom.js +111 -1
  28. package/dist/cjs/src/cryptomus.js +43 -89
  29. package/dist/cjs/src/delta.js +76 -36
  30. package/dist/cjs/src/deribit.js +4 -5
  31. package/dist/cjs/src/derive.js +46 -10
  32. package/dist/cjs/src/ellipx.js +175 -79
  33. package/dist/cjs/src/gate.js +1 -1
  34. package/dist/cjs/src/gemini.js +3 -5
  35. package/dist/cjs/src/hitbtc.js +56 -69
  36. package/dist/cjs/src/hollaex.js +107 -49
  37. package/dist/cjs/src/htx.js +20 -44
  38. package/dist/cjs/src/hyperliquid.js +6 -6
  39. package/dist/cjs/src/kraken.js +29 -24
  40. package/dist/cjs/src/kucoinfutures.js +6 -0
  41. package/dist/cjs/src/lbank.js +1 -1
  42. package/dist/cjs/src/mexc.js +2 -2
  43. package/dist/cjs/src/ndax.js +25 -24
  44. package/dist/cjs/src/okcoin.js +12 -31
  45. package/dist/cjs/src/okx.js +9 -0
  46. package/dist/cjs/src/onetrading.js +9 -6
  47. package/dist/cjs/src/oxfun.js +42 -114
  48. package/dist/cjs/src/paradex.js +124 -4
  49. package/dist/cjs/src/pro/binance.js +32 -33
  50. package/dist/cjs/src/pro/bithumb.js +5 -3
  51. package/dist/cjs/src/pro/bittrade.js +605 -0
  52. package/dist/cjs/src/pro/kraken.js +289 -79
  53. package/dist/cjs/src/pro/luno.js +6 -5
  54. package/dist/cjs/src/pro/mexc.js +304 -7
  55. package/dist/cjs/src/pro/poloniex.js +6 -2
  56. package/examples/js/cli.js +127 -13
  57. package/js/ccxt.d.ts +8 -20
  58. package/js/ccxt.js +6 -14
  59. package/js/src/abstract/blofin.d.ts +8 -0
  60. package/js/src/abstract/btcbox.d.ts +1 -0
  61. package/js/src/abstract/myokx.d.ts +2 -0
  62. package/js/src/abstract/okx.d.ts +2 -0
  63. package/js/src/apex.js +2 -1
  64. package/js/src/ascendex.d.ts +2 -0
  65. package/js/src/ascendex.js +189 -155
  66. package/js/src/base/Exchange.d.ts +15 -1
  67. package/js/src/base/Exchange.js +15 -2
  68. package/js/src/base/types.d.ts +3 -0
  69. package/js/src/bequant.js +1 -1
  70. package/js/src/bitget.js +6 -7
  71. package/js/src/bitmart.js +1 -1
  72. package/js/src/bitrue.js +14 -35
  73. package/js/src/bitso.js +33 -0
  74. package/js/src/bitstamp.js +33 -0
  75. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  76. package/js/src/{huobijp.js → bittrade.js} +35 -35
  77. package/js/src/blofin.d.ts +42 -2
  78. package/js/src/blofin.js +154 -13
  79. package/js/src/btcbox.js +25 -5
  80. package/js/src/bybit.js +16 -40
  81. package/js/src/cex.js +2 -4
  82. package/js/src/coinbase.js +58 -46
  83. package/js/src/coinbaseexchange.js +142 -32
  84. package/js/src/coincatch.js +14 -67
  85. package/js/src/coinex.js +28 -29
  86. package/js/src/coinlist.js +16 -15
  87. package/js/src/coinmetro.js +22 -11
  88. package/js/src/coinone.js +8 -10
  89. package/js/src/coinsph.d.ts +10 -1
  90. package/js/src/coinsph.js +126 -1
  91. package/js/src/cryptocom.d.ts +10 -1
  92. package/js/src/cryptocom.js +111 -1
  93. package/js/src/cryptomus.js +43 -89
  94. package/js/src/delta.js +76 -36
  95. package/js/src/deribit.js +4 -5
  96. package/js/src/derive.js +46 -10
  97. package/js/src/ellipx.d.ts +2 -3
  98. package/js/src/ellipx.js +175 -80
  99. package/js/src/gate.js +1 -1
  100. package/js/src/gemini.js +3 -5
  101. package/js/src/hitbtc.js +56 -69
  102. package/js/src/hollaex.js +107 -49
  103. package/js/src/htx.js +20 -44
  104. package/js/src/hyperliquid.js +6 -6
  105. package/js/src/kraken.js +29 -24
  106. package/js/src/kucoinfutures.d.ts +1 -0
  107. package/js/src/kucoinfutures.js +6 -0
  108. package/js/src/lbank.js +1 -1
  109. package/js/src/mexc.js +2 -2
  110. package/js/src/ndax.js +25 -24
  111. package/js/src/okcoin.js +12 -31
  112. package/js/src/okx.js +9 -0
  113. package/js/src/onetrading.js +9 -6
  114. package/js/src/oxfun.js +42 -114
  115. package/js/src/paradex.d.ts +12 -1
  116. package/js/src/paradex.js +124 -4
  117. package/js/src/pro/binance.d.ts +26 -26
  118. package/js/src/pro/binance.js +32 -33
  119. package/js/src/pro/bithumb.js +5 -3
  120. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  121. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  122. package/js/src/pro/kraken.d.ts +7 -6
  123. package/js/src/pro/kraken.js +290 -80
  124. package/js/src/pro/luno.js +6 -5
  125. package/js/src/pro/mexc.d.ts +58 -0
  126. package/js/src/pro/mexc.js +304 -7
  127. package/js/src/pro/poloniex.d.ts +1 -1
  128. package/js/src/pro/poloniex.js +6 -2
  129. package/package.json +1 -1
  130. package/js/src/abstract/bl3p.d.ts +0 -22
  131. package/js/src/abstract/huobijp.js +0 -11
  132. package/js/src/abstract/idex.d.ts +0 -29
  133. package/js/src/abstract/idex.js +0 -11
  134. package/js/src/abstract/kuna.d.ts +0 -185
  135. package/js/src/abstract/kuna.js +0 -11
  136. package/js/src/bl3p.d.ts +0 -116
  137. package/js/src/bl3p.js +0 -552
  138. package/js/src/idex.d.ts +0 -312
  139. package/js/src/idex.js +0 -1961
  140. package/js/src/kuna.d.ts +0 -335
  141. package/js/src/kuna.js +0 -2006
  142. package/js/src/pro/idex.d.ts +0 -81
  143. package/js/src/pro/idex.js +0 -720
  144. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  145. /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
package/js/src/bl3p.js DELETED
@@ -1,552 +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/bl3p.js';
9
- import { Precise } from './base/Precise.js';
10
- import { TICK_SIZE } from './base/functions/number.js';
11
- import { sha512 } from './static_dependencies/noble-hashes/sha512.js';
12
- // ---------------------------------------------------------------------------
13
- /**
14
- * @class bl3p
15
- * @augments Exchange
16
- */
17
- export default class bl3p extends Exchange {
18
- describe() {
19
- return this.deepExtend(super.describe(), {
20
- 'id': 'bl3p',
21
- 'name': 'BL3P',
22
- 'countries': ['NL'],
23
- 'rateLimit': 1000,
24
- 'version': '1',
25
- 'comment': 'An exchange market by BitonicNL',
26
- 'pro': false,
27
- 'has': {
28
- 'CORS': undefined,
29
- 'spot': true,
30
- 'margin': false,
31
- 'swap': false,
32
- 'future': false,
33
- 'option': false,
34
- 'addMargin': false,
35
- 'cancelOrder': true,
36
- 'closeAllPositions': false,
37
- 'closePosition': false,
38
- 'createDepositAddress': true,
39
- 'createOrder': true,
40
- 'createReduceOnlyOrder': false,
41
- 'createStopLimitOrder': false,
42
- 'createStopMarketOrder': false,
43
- 'createStopOrder': false,
44
- 'fetchBalance': true,
45
- 'fetchBorrowRateHistories': false,
46
- 'fetchBorrowRateHistory': false,
47
- 'fetchCrossBorrowRate': false,
48
- 'fetchCrossBorrowRates': false,
49
- 'fetchDepositAddress': false,
50
- 'fetchDepositAddresses': false,
51
- 'fetchDepositAddressesByNetwork': false,
52
- 'fetchFundingHistory': false,
53
- 'fetchFundingRate': false,
54
- 'fetchFundingRateHistory': false,
55
- 'fetchFundingRates': false,
56
- 'fetchIndexOHLCV': false,
57
- 'fetchIsolatedBorrowRate': false,
58
- 'fetchIsolatedBorrowRates': false,
59
- 'fetchLeverage': false,
60
- 'fetchMarginMode': false,
61
- 'fetchMarkOHLCV': false,
62
- 'fetchOpenInterestHistory': false,
63
- 'fetchOrderBook': true,
64
- 'fetchPosition': false,
65
- 'fetchPositionHistory': false,
66
- 'fetchPositionMode': false,
67
- 'fetchPositions': false,
68
- 'fetchPositionsForSymbol': false,
69
- 'fetchPositionsHistory': false,
70
- 'fetchPositionsRisk': false,
71
- 'fetchPremiumIndexOHLCV': false,
72
- 'fetchTicker': true,
73
- 'fetchTrades': true,
74
- 'fetchTradingFee': false,
75
- 'fetchTradingFees': true,
76
- 'fetchTransfer': false,
77
- 'fetchTransfers': false,
78
- 'reduceMargin': false,
79
- 'setLeverage': false,
80
- 'setMarginMode': false,
81
- 'setPositionMode': false,
82
- 'transfer': false,
83
- 'ws': false,
84
- },
85
- 'urls': {
86
- 'logo': 'https://github.com/user-attachments/assets/75aeb14e-cd48-43c8-8492-dff002dea0be',
87
- 'api': {
88
- 'rest': 'https://api.bl3p.eu',
89
- },
90
- 'www': 'https://bl3p.eu',
91
- 'doc': [
92
- 'https://github.com/BitonicNL/bl3p-api/tree/master/docs',
93
- 'https://bl3p.eu/api',
94
- 'https://bitonic.nl/en/api',
95
- ],
96
- },
97
- 'api': {
98
- 'public': {
99
- 'get': [
100
- '{market}/ticker',
101
- '{market}/orderbook',
102
- '{market}/trades',
103
- ],
104
- },
105
- 'private': {
106
- 'post': [
107
- '{market}/money/depth/full',
108
- '{market}/money/order/add',
109
- '{market}/money/order/cancel',
110
- '{market}/money/order/result',
111
- '{market}/money/orders',
112
- '{market}/money/orders/history',
113
- '{market}/money/trades/fetch',
114
- 'GENMKT/money/info',
115
- 'GENMKT/money/deposit_address',
116
- 'GENMKT/money/new_deposit_address',
117
- 'GENMKT/money/wallet/history',
118
- 'GENMKT/money/withdraw',
119
- ],
120
- },
121
- },
122
- 'markets': {
123
- 'BTC/EUR': this.safeMarketStructure({ 'id': 'BTCEUR', 'symbol': 'BTC/EUR', 'base': 'BTC', 'quote': 'EUR', 'baseId': 'BTC', 'quoteId': 'EUR', 'maker': 0.0025, 'taker': 0.0025, 'type': 'spot', 'spot': true }),
124
- },
125
- 'features': {
126
- 'spot': {
127
- 'sandbox': false,
128
- 'createOrder': {
129
- 'marginMode': false,
130
- 'triggerPrice': false,
131
- 'triggerPriceType': undefined,
132
- 'triggerDirection': false,
133
- 'stopLossPrice': false,
134
- 'takeProfitPrice': false,
135
- 'attachedStopLossTakeProfit': undefined,
136
- 'timeInForce': {
137
- 'IOC': false,
138
- 'FOK': false,
139
- 'PO': false,
140
- 'GTD': false,
141
- },
142
- 'hedged': false,
143
- 'leverage': false,
144
- 'marketBuyRequiresPrice': false,
145
- 'marketBuyByCost': false,
146
- 'selfTradePrevention': false,
147
- 'trailing': false,
148
- 'iceberg': false,
149
- },
150
- 'createOrders': undefined,
151
- 'fetchMyTrades': undefined,
152
- 'fetchOrder': undefined,
153
- 'fetchOpenOrders': undefined,
154
- 'fetchOrders': undefined,
155
- 'fetchClosedOrders': undefined,
156
- 'fetchOHLCV': undefined,
157
- },
158
- 'swap': {
159
- 'linear': undefined,
160
- 'inverse': undefined,
161
- },
162
- 'future': {
163
- 'linear': undefined,
164
- 'inverse': undefined,
165
- },
166
- },
167
- 'precisionMode': TICK_SIZE,
168
- });
169
- }
170
- parseBalance(response) {
171
- const data = this.safeValue(response, 'data', {});
172
- const wallets = this.safeValue(data, 'wallets', {});
173
- const result = { 'info': data };
174
- const codes = Object.keys(this.currencies);
175
- for (let i = 0; i < codes.length; i++) {
176
- const code = codes[i];
177
- const currency = this.currency(code);
178
- const currencyId = currency['id'];
179
- const wallet = this.safeValue(wallets, currencyId, {});
180
- const available = this.safeValue(wallet, 'available', {});
181
- const balance = this.safeValue(wallet, 'balance', {});
182
- const account = this.account();
183
- account['free'] = this.safeString(available, 'value');
184
- account['total'] = this.safeString(balance, 'value');
185
- result[code] = account;
186
- }
187
- return this.safeBalance(result);
188
- }
189
- /**
190
- * @method
191
- * @name bl3p#fetchBalance
192
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
193
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
194
- * @param {object} [params] extra parameters specific to the exchange API endpoint
195
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
196
- */
197
- async fetchBalance(params = {}) {
198
- await this.loadMarkets();
199
- const response = await this.privatePostGENMKTMoneyInfo(params);
200
- return this.parseBalance(response);
201
- }
202
- parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
203
- const price = this.safeString(bidask, priceKey);
204
- const size = this.safeString(bidask, amountKey);
205
- return [
206
- this.parseNumber(Precise.stringDiv(price, '100000.0')),
207
- this.parseNumber(Precise.stringDiv(size, '100000000.0')),
208
- ];
209
- }
210
- /**
211
- * @method
212
- * @name bl3p#fetchOrderBook
213
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
214
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#22---orderbook
215
- * @param {string} symbol unified symbol of the market to fetch the order book for
216
- * @param {int} [limit] the maximum amount of order book entries to return
217
- * @param {object} [params] extra parameters specific to the exchange API endpoint
218
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
219
- */
220
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
221
- const market = this.market(symbol);
222
- const request = {
223
- 'market': market['id'],
224
- };
225
- const response = await this.publicGetMarketOrderbook(this.extend(request, params));
226
- const orderbook = this.safeDict(response, 'data');
227
- return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price_int', 'amount_int');
228
- }
229
- parseTicker(ticker, market = undefined) {
230
- //
231
- // {
232
- // "currency":"BTC",
233
- // "last":32654.55595,
234
- // "bid":32552.3642,
235
- // "ask":32703.58231,
236
- // "high":33500,
237
- // "low":31943,
238
- // "timestamp":1643372789,
239
- // "volume":{
240
- // "24h":2.27372413,
241
- // "30d":320.79375456
242
- // }
243
- // }
244
- //
245
- const symbol = this.safeSymbol(undefined, market);
246
- const timestamp = this.safeTimestamp(ticker, 'timestamp');
247
- const last = this.safeString(ticker, 'last');
248
- const volume = this.safeValue(ticker, 'volume', {});
249
- return this.safeTicker({
250
- 'symbol': symbol,
251
- 'timestamp': timestamp,
252
- 'datetime': this.iso8601(timestamp),
253
- 'high': this.safeString(ticker, 'high'),
254
- 'low': this.safeString(ticker, 'low'),
255
- 'bid': this.safeString(ticker, 'bid'),
256
- 'bidVolume': undefined,
257
- 'ask': this.safeString(ticker, 'ask'),
258
- 'askVolume': undefined,
259
- 'vwap': undefined,
260
- 'open': undefined,
261
- 'close': last,
262
- 'last': last,
263
- 'previousClose': undefined,
264
- 'change': undefined,
265
- 'percentage': undefined,
266
- 'average': undefined,
267
- 'baseVolume': this.safeString(volume, '24h'),
268
- 'quoteVolume': undefined,
269
- 'info': ticker,
270
- }, market);
271
- }
272
- /**
273
- * @method
274
- * @name bl3p#fetchTicker
275
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
276
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#21---ticker
277
- * @param {string} symbol unified symbol of the market to fetch the ticker for
278
- * @param {object} [params] extra parameters specific to the exchange API endpoint
279
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
280
- */
281
- async fetchTicker(symbol, params = {}) {
282
- const market = this.market(symbol);
283
- const request = {
284
- 'market': market['id'],
285
- };
286
- const ticker = await this.publicGetMarketTicker(this.extend(request, params));
287
- //
288
- // {
289
- // "currency":"BTC",
290
- // "last":32654.55595,
291
- // "bid":32552.3642,
292
- // "ask":32703.58231,
293
- // "high":33500,
294
- // "low":31943,
295
- // "timestamp":1643372789,
296
- // "volume":{
297
- // "24h":2.27372413,
298
- // "30d":320.79375456
299
- // }
300
- // }
301
- //
302
- return this.parseTicker(ticker, market);
303
- }
304
- parseTrade(trade, market = undefined) {
305
- //
306
- // fetchTrades
307
- //
308
- // {
309
- // "trade_id": "2518789",
310
- // "date": "1694348697745",
311
- // "amount_int": "2959153",
312
- // "price_int": "2416231440"
313
- // }
314
- //
315
- const id = this.safeString(trade, 'trade_id');
316
- const timestamp = this.safeInteger(trade, 'date');
317
- const price = this.safeString(trade, 'price_int');
318
- const amount = this.safeString(trade, 'amount_int');
319
- market = this.safeMarket(undefined, market);
320
- return this.safeTrade({
321
- 'id': id,
322
- 'info': trade,
323
- 'timestamp': timestamp,
324
- 'datetime': this.iso8601(timestamp),
325
- 'symbol': market['symbol'],
326
- 'type': undefined,
327
- 'side': undefined,
328
- 'order': undefined,
329
- 'takerOrMaker': undefined,
330
- 'price': Precise.stringDiv(price, '100000'),
331
- 'amount': Precise.stringDiv(amount, '100000000'),
332
- 'cost': undefined,
333
- 'fee': undefined,
334
- }, market);
335
- }
336
- /**
337
- * @method
338
- * @name bl3p#fetchTrades
339
- * @description get the list of most recent trades for a particular symbol
340
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#23---last-1000-trades
341
- * @param {string} symbol unified symbol of the market to fetch trades for
342
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
343
- * @param {int} [limit] the maximum amount of trades to fetch
344
- * @param {object} [params] extra parameters specific to the exchange API endpoint
345
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
346
- */
347
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
348
- const market = this.market(symbol);
349
- const response = await this.publicGetMarketTrades(this.extend({
350
- 'market': market['id'],
351
- }, params));
352
- //
353
- // {
354
- // "result": "success",
355
- // "data": {
356
- // "trades": [
357
- // {
358
- // "trade_id": "2518789",
359
- // "date": "1694348697745",
360
- // "amount_int": "2959153",
361
- // "price_int": "2416231440"
362
- // },
363
- // ]
364
- // }
365
- // }
366
- const result = this.parseTrades(response['data']['trades'], market, since, limit);
367
- return result;
368
- }
369
- /**
370
- * @method
371
- * @name bl3p#fetchTradingFees
372
- * @description fetch the trading fees for multiple markets
373
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
374
- * @param {object} [params] extra parameters specific to the exchange API endpoint
375
- * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
376
- */
377
- async fetchTradingFees(params = {}) {
378
- await this.loadMarkets();
379
- const response = await this.privatePostGENMKTMoneyInfo(params);
380
- //
381
- // {
382
- // "result": "success",
383
- // "data": {
384
- // "user_id": "13396",
385
- // "wallets": {
386
- // "BTC": {
387
- // "balance": {
388
- // "value_int": "0",
389
- // "display": "0.00000000 BTC",
390
- // "currency": "BTC",
391
- // "value": "0.00000000",
392
- // "display_short": "0.00 BTC"
393
- // },
394
- // "available": {
395
- // "value_int": "0",
396
- // "display": "0.00000000 BTC",
397
- // "currency": "BTC",
398
- // "value": "0.00000000",
399
- // "display_short": "0.00 BTC"
400
- // }
401
- // },
402
- // ...
403
- // },
404
- // "trade_fee": "0.25"
405
- // }
406
- // }
407
- //
408
- const data = this.safeValue(response, 'data', {});
409
- const feeString = this.safeString(data, 'trade_fee');
410
- const fee = this.parseNumber(Precise.stringDiv(feeString, '100'));
411
- const result = {};
412
- for (let i = 0; i < this.symbols.length; i++) {
413
- const symbol = this.symbols[i];
414
- result[symbol] = {
415
- 'info': data,
416
- 'symbol': symbol,
417
- 'maker': fee,
418
- 'taker': fee,
419
- 'percentage': true,
420
- 'tierBased': false,
421
- };
422
- }
423
- return result;
424
- }
425
- /**
426
- * @method
427
- * @name bl3p#createOrder
428
- * @description create a trade order
429
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/examples/nodejs/example.md#21---create-an-order
430
- * @param {string} symbol unified symbol of the market to create an order in
431
- * @param {string} type 'market' or 'limit'
432
- * @param {string} side 'buy' or 'sell'
433
- * @param {float} amount how much of currency you want to trade in units of base currency
434
- * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
435
- * @param {object} [params] extra parameters specific to the exchange API endpoint
436
- *
437
- * EXCHANGE SPECIFIC PARAMETERS
438
- * @param {int} [params.amount_funds] maximal EUR amount to spend (*1e5)
439
- * @param {string} [params.fee_currency] 'EUR' or 'BTC'
440
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
441
- */
442
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
443
- const market = this.market(symbol);
444
- const amountString = this.numberToString(amount);
445
- const priceString = this.numberToString(price);
446
- const order = {
447
- 'market': market['id'],
448
- 'amount_int': parseInt(Precise.stringMul(amountString, '100000000')),
449
- 'fee_currency': market['quote'],
450
- 'type': (side === 'buy') ? 'bid' : 'ask',
451
- };
452
- if (type === 'limit') {
453
- order['price_int'] = parseInt(Precise.stringMul(priceString, '100000.0'));
454
- }
455
- const response = await this.privatePostMarketMoneyOrderAdd(this.extend(order, params));
456
- const orderId = this.safeString(response['data'], 'order_id');
457
- return this.safeOrder({
458
- 'info': response,
459
- 'id': orderId,
460
- }, market);
461
- }
462
- /**
463
- * @method
464
- * @name bl3p#cancelOrder
465
- * @description cancels an open order
466
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#22---cancel-an-order
467
- * @param {string} id order id
468
- * @param {string} symbol unified symbol of the market the order was made in
469
- * @param {object} [params] extra parameters specific to the exchange API endpoint
470
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
471
- */
472
- async cancelOrder(id, symbol = undefined, params = {}) {
473
- const request = {
474
- 'order_id': id,
475
- };
476
- const response = await this.privatePostMarketMoneyOrderCancel(this.extend(request, params));
477
- //
478
- // "success"
479
- //
480
- return this.safeOrder({
481
- 'info': response,
482
- });
483
- }
484
- /**
485
- * @method
486
- * @name bl3p#createDepositAddress
487
- * @description create a currency deposit address
488
- * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#32---create-a-new-deposit-address
489
- * @param {string} code unified currency code of the currency for the deposit address
490
- * @param {object} [params] extra parameters specific to the exchange API endpoint
491
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
492
- */
493
- async createDepositAddress(code, params = {}) {
494
- await this.loadMarkets();
495
- const currency = this.currency(code);
496
- const request = {
497
- 'currency': currency['id'],
498
- };
499
- const response = await this.privatePostGENMKTMoneyNewDepositAddress(this.extend(request, params));
500
- //
501
- // {
502
- // "result": "success",
503
- // "data": {
504
- // "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
505
- // }
506
- // }
507
- //
508
- const data = this.safeDict(response, 'data');
509
- return this.parseDepositAddress(data, currency);
510
- }
511
- parseDepositAddress(depositAddress, currency = undefined) {
512
- //
513
- // {
514
- // "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
515
- // }
516
- //
517
- const address = this.safeString(depositAddress, 'address');
518
- this.checkAddress(address);
519
- return {
520
- 'info': depositAddress,
521
- 'currency': this.safeString(currency, 'code'),
522
- 'address': address,
523
- 'tag': undefined,
524
- 'network': undefined,
525
- };
526
- }
527
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
528
- const request = this.implodeParams(path, params);
529
- let url = this.urls['api']['rest'] + '/' + this.version + '/' + request;
530
- const query = this.omit(params, this.extractParams(path));
531
- if (api === 'public') {
532
- if (Object.keys(query).length) {
533
- url += '?' + this.urlencode(query);
534
- }
535
- }
536
- else {
537
- this.checkRequiredCredentials();
538
- const nonce = this.nonce();
539
- body = this.urlencode(this.extend({ 'nonce': nonce }, query));
540
- const secret = this.base64ToBinary(this.secret);
541
- // eslint-disable-next-line quotes
542
- const auth = request + "\0" + body;
543
- const signature = this.hmac(this.encode(auth), secret, sha512, 'base64');
544
- headers = {
545
- 'Content-Type': 'application/x-www-form-urlencoded',
546
- 'Rest-Key': this.apiKey,
547
- 'Rest-Sign': signature,
548
- };
549
- }
550
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
551
- }
552
- }