ccxt-look 1.81.50

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 (264) hide show
  1. package/.cache/eslintcache +1 -0
  2. package/.dockerignore +6 -0
  3. package/.eslintignore +1 -0
  4. package/.gitattributes +5 -0
  5. package/.readthedocs.yaml +16 -0
  6. package/CONTRIBUTING.md +1049 -0
  7. package/LICENSE.txt +21 -0
  8. package/README.md +537 -0
  9. package/SECURITY.md +5 -0
  10. package/build/cleanup-old-tags.js +94 -0
  11. package/build/countries.js +256 -0
  12. package/build/export-exchanges.js +520 -0
  13. package/build/fs.js +51 -0
  14. package/build/transpile.js +1772 -0
  15. package/build/vss.js +78 -0
  16. package/ccxt.browser.js +7 -0
  17. package/ccxt.d.ts +692 -0
  18. package/ccxt.js +171 -0
  19. package/cleanup.sh +2 -0
  20. package/composer-install.sh +20 -0
  21. package/dist/ccxt.browser.js +208383 -0
  22. package/gource.sh +3 -0
  23. package/index.html +7 -0
  24. package/js/.eslintrc +87 -0
  25. package/js/aax.js +2686 -0
  26. package/js/ascendex.js +2584 -0
  27. package/js/base/.eslintrc.js +43 -0
  28. package/js/base/Exchange.js +2371 -0
  29. package/js/base/Precise.js +283 -0
  30. package/js/base/errorHierarchy.js +47 -0
  31. package/js/base/errors.js +55 -0
  32. package/js/base/functions/crypto.js +158 -0
  33. package/js/base/functions/encode.js +118 -0
  34. package/js/base/functions/generic.js +270 -0
  35. package/js/base/functions/misc.js +138 -0
  36. package/js/base/functions/number.js +329 -0
  37. package/js/base/functions/platform.js +38 -0
  38. package/js/base/functions/string.js +21 -0
  39. package/js/base/functions/throttle.js +79 -0
  40. package/js/base/functions/time.js +210 -0
  41. package/js/base/functions/type.js +66 -0
  42. package/js/base/functions.js +28 -0
  43. package/js/bequant.js +32 -0
  44. package/js/bibox.js +1407 -0
  45. package/js/bigone.js +1366 -0
  46. package/js/binance.js +5652 -0
  47. package/js/binancecoinm.js +46 -0
  48. package/js/binanceus.js +46 -0
  49. package/js/binanceusdm.js +49 -0
  50. package/js/bit2c.js +535 -0
  51. package/js/bitbank.js +842 -0
  52. package/js/bitbay.js +16 -0
  53. package/js/bitbns.js +1073 -0
  54. package/js/bitcoincom.js +15 -0
  55. package/js/bitfinex.js +1433 -0
  56. package/js/bitfinex2.js +2025 -0
  57. package/js/bitflyer.js +840 -0
  58. package/js/bitforex.js +614 -0
  59. package/js/bitget.js +2397 -0
  60. package/js/bithumb.js +980 -0
  61. package/js/bitmart.js +2516 -0
  62. package/js/bitmex.js +1809 -0
  63. package/js/bitopro.js +1443 -0
  64. package/js/bitpanda.js +1782 -0
  65. package/js/bitrue.js +1747 -0
  66. package/js/bitso.js +1062 -0
  67. package/js/bitstamp.js +1757 -0
  68. package/js/bitstamp1.js +343 -0
  69. package/js/bittrex.js +1876 -0
  70. package/js/bitvavo.js +1579 -0
  71. package/js/bkex.js +1233 -0
  72. package/js/bl3p.js +346 -0
  73. package/js/blockchaincom.js +969 -0
  74. package/js/btcalpha.js +680 -0
  75. package/js/btcbox.js +477 -0
  76. package/js/btcmarkets.js +1022 -0
  77. package/js/btctradeua.js +466 -0
  78. package/js/btcturk.js +734 -0
  79. package/js/buda.js +946 -0
  80. package/js/bw.js +1265 -0
  81. package/js/bybit.js +3372 -0
  82. package/js/bytetrade.js +1336 -0
  83. package/js/cdax.js +1646 -0
  84. package/js/cex.js +1410 -0
  85. package/js/coinbase.js +1342 -0
  86. package/js/coinbaseprime.js +31 -0
  87. package/js/coinbasepro.js +1466 -0
  88. package/js/coincheck.js +755 -0
  89. package/js/coinex.js +3400 -0
  90. package/js/coinfalcon.js +880 -0
  91. package/js/coinmate.js +794 -0
  92. package/js/coinone.js +816 -0
  93. package/js/coinspot.js +345 -0
  94. package/js/crex24.js +1636 -0
  95. package/js/cryptocom.js +1832 -0
  96. package/js/currencycom.js +1748 -0
  97. package/js/delta.js +1547 -0
  98. package/js/deribit.js +2148 -0
  99. package/js/digifinex.js +1585 -0
  100. package/js/eqonex.js +1660 -0
  101. package/js/exmo.js +1670 -0
  102. package/js/fairdesk.js +1231 -0
  103. package/js/flowbtc.js +35 -0
  104. package/js/fmfwio.js +34 -0
  105. package/js/ftx.js +2751 -0
  106. package/js/ftxus.js +38 -0
  107. package/js/gateio.js +4174 -0
  108. package/js/gemini.js +1397 -0
  109. package/js/hitbtc.js +1343 -0
  110. package/js/hitbtc3.js +2329 -0
  111. package/js/hollaex.js +1486 -0
  112. package/js/huobi.js +5706 -0
  113. package/js/huobijp.js +1710 -0
  114. package/js/huobipro.js +18 -0
  115. package/js/idex.js +1439 -0
  116. package/js/independentreserve.js +649 -0
  117. package/js/indodax.js +742 -0
  118. package/js/itbit.js +722 -0
  119. package/js/kraken.js +2179 -0
  120. package/js/kucoin.js +2571 -0
  121. package/js/kucoinfutures.js +1771 -0
  122. package/js/kuna.js +809 -0
  123. package/js/latoken.js +1445 -0
  124. package/js/lbank.js +760 -0
  125. package/js/liquid.js +1432 -0
  126. package/js/luno.js +873 -0
  127. package/js/lykke.js +1147 -0
  128. package/js/mercado.js +771 -0
  129. package/js/mexc.js +3151 -0
  130. package/js/ndax.js +2233 -0
  131. package/js/novadax.js +1318 -0
  132. package/js/oceanex.js +816 -0
  133. package/js/okcoin.js +3841 -0
  134. package/js/okex.js +16 -0
  135. package/js/okex5.js +16 -0
  136. package/js/okx.js +4795 -0
  137. package/js/paymium.js +498 -0
  138. package/js/phemex.js +2957 -0
  139. package/js/poloniex.js +1674 -0
  140. package/js/probit.js +1346 -0
  141. package/js/qtrade.js +1588 -0
  142. package/js/ripio.js +1061 -0
  143. package/js/static_dependencies/BN/bn.js +3526 -0
  144. package/js/static_dependencies/README.md +1 -0
  145. package/js/static_dependencies/crypto-js/crypto-js.js +5988 -0
  146. package/js/static_dependencies/elliptic/lib/elliptic/curve/base.js +375 -0
  147. package/js/static_dependencies/elliptic/lib/elliptic/curve/edwards.js +433 -0
  148. package/js/static_dependencies/elliptic/lib/elliptic/curve/index.js +8 -0
  149. package/js/static_dependencies/elliptic/lib/elliptic/curve/mont.js +180 -0
  150. package/js/static_dependencies/elliptic/lib/elliptic/curve/short.js +938 -0
  151. package/js/static_dependencies/elliptic/lib/elliptic/curves.js +204 -0
  152. package/js/static_dependencies/elliptic/lib/elliptic/ec/index.js +240 -0
  153. package/js/static_dependencies/elliptic/lib/elliptic/ec/key.js +119 -0
  154. package/js/static_dependencies/elliptic/lib/elliptic/ec/signature.js +24 -0
  155. package/js/static_dependencies/elliptic/lib/elliptic/eddsa/index.js +145 -0
  156. package/js/static_dependencies/elliptic/lib/elliptic/eddsa/key.js +100 -0
  157. package/js/static_dependencies/elliptic/lib/elliptic/eddsa/signature.js +65 -0
  158. package/js/static_dependencies/elliptic/lib/elliptic/precomputed/secp256k1.js +780 -0
  159. package/js/static_dependencies/elliptic/lib/elliptic/utils.js +214 -0
  160. package/js/static_dependencies/elliptic/lib/elliptic.js +22 -0
  161. package/js/static_dependencies/elliptic/lib/hmac-drbg/hmac-drbg.js +114 -0
  162. package/js/static_dependencies/fetch-ponyfill/fetch-node.js +39 -0
  163. package/js/static_dependencies/node-fetch/index.js +1564 -0
  164. package/js/static_dependencies/node-rsa/NodeRSA.js +223 -0
  165. package/js/static_dependencies/node-rsa/asn1/ber/errors.js +13 -0
  166. package/js/static_dependencies/node-rsa/asn1/ber/index.js +21 -0
  167. package/js/static_dependencies/node-rsa/asn1/ber/reader.js +262 -0
  168. package/js/static_dependencies/node-rsa/asn1/ber/types.js +36 -0
  169. package/js/static_dependencies/node-rsa/asn1/index.js +17 -0
  170. package/js/static_dependencies/node-rsa/encryptEngines/js.js +34 -0
  171. package/js/static_dependencies/node-rsa/formats/components.js +71 -0
  172. package/js/static_dependencies/node-rsa/formats/formats.js +31 -0
  173. package/js/static_dependencies/node-rsa/formats/pkcs1.js +148 -0
  174. package/js/static_dependencies/node-rsa/formats/pkcs8.js +187 -0
  175. package/js/static_dependencies/node-rsa/libs/jsbn.js +1252 -0
  176. package/js/static_dependencies/node-rsa/libs/rsa.js +147 -0
  177. package/js/static_dependencies/node-rsa/schemes/pkcs1.js +176 -0
  178. package/js/static_dependencies/node-rsa/schemes/schemes.js +21 -0
  179. package/js/static_dependencies/node-rsa/utils.js +98 -0
  180. package/js/static_dependencies/qs/formats.js +18 -0
  181. package/js/static_dependencies/qs/index.js +11 -0
  182. package/js/static_dependencies/qs/parse.js +242 -0
  183. package/js/static_dependencies/qs/stringify.js +269 -0
  184. package/js/static_dependencies/qs/utils.js +230 -0
  185. package/js/stex.js +1925 -0
  186. package/js/test/.eslintrc.js +42 -0
  187. package/js/test/Exchange/test.balance.js +61 -0
  188. package/js/test/Exchange/test.borrowRate.js +32 -0
  189. package/js/test/Exchange/test.currency.js +52 -0
  190. package/js/test/Exchange/test.fetchBalance.js +23 -0
  191. package/js/test/Exchange/test.fetchBorrowInterest.js +59 -0
  192. package/js/test/Exchange/test.fetchBorrowRate.js +32 -0
  193. package/js/test/Exchange/test.fetchBorrowRates.js +28 -0
  194. package/js/test/Exchange/test.fetchClosedOrders.js +32 -0
  195. package/js/test/Exchange/test.fetchCurrencies.js +35 -0
  196. package/js/test/Exchange/test.fetchDeposits.js +31 -0
  197. package/js/test/Exchange/test.fetchFundingFees.js +19 -0
  198. package/js/test/Exchange/test.fetchFundingRateHistory.js +40 -0
  199. package/js/test/Exchange/test.fetchL2OrderBook.js +23 -0
  200. package/js/test/Exchange/test.fetchLedger.js +42 -0
  201. package/js/test/Exchange/test.fetchLeverageTiers.js +33 -0
  202. package/js/test/Exchange/test.fetchMarketLeverageTiers.js +22 -0
  203. package/js/test/Exchange/test.fetchMarkets.js +33 -0
  204. package/js/test/Exchange/test.fetchMyTrades.js +42 -0
  205. package/js/test/Exchange/test.fetchOHLCV.js +46 -0
  206. package/js/test/Exchange/test.fetchOpenOrders.js +36 -0
  207. package/js/test/Exchange/test.fetchOrderBook.js +25 -0
  208. package/js/test/Exchange/test.fetchOrderBooks.js +35 -0
  209. package/js/test/Exchange/test.fetchOrders.js +41 -0
  210. package/js/test/Exchange/test.fetchPositions.js +47 -0
  211. package/js/test/Exchange/test.fetchStatus.js +35 -0
  212. package/js/test/Exchange/test.fetchTicker.js +38 -0
  213. package/js/test/Exchange/test.fetchTickers.js +49 -0
  214. package/js/test/Exchange/test.fetchTrades.js +39 -0
  215. package/js/test/Exchange/test.fetchTradingFee.js +18 -0
  216. package/js/test/Exchange/test.fetchTradingFees.js +22 -0
  217. package/js/test/Exchange/test.fetchTransactions.js +31 -0
  218. package/js/test/Exchange/test.fetchWithdrawals.js +31 -0
  219. package/js/test/Exchange/test.ledgerItem.js +46 -0
  220. package/js/test/Exchange/test.leverageTier.js +33 -0
  221. package/js/test/Exchange/test.loadMarkets.js +35 -0
  222. package/js/test/Exchange/test.market.js +129 -0
  223. package/js/test/Exchange/test.ohlcv.js +33 -0
  224. package/js/test/Exchange/test.order.js +62 -0
  225. package/js/test/Exchange/test.orderbook.js +61 -0
  226. package/js/test/Exchange/test.position.js +21 -0
  227. package/js/test/Exchange/test.throttle.js +94 -0
  228. package/js/test/Exchange/test.ticker.js +95 -0
  229. package/js/test/Exchange/test.trade.js +68 -0
  230. package/js/test/Exchange/test.tradingFee.js +34 -0
  231. package/js/test/Exchange/test.transaction.js +35 -0
  232. package/js/test/base/.eslintrc +38 -0
  233. package/js/test/base/functions/test.crypto.js +110 -0
  234. package/js/test/base/functions/test.datetime.js +62 -0
  235. package/js/test/base/functions/test.generic.js +152 -0
  236. package/js/test/base/functions/test.number.js +362 -0
  237. package/js/test/base/functions/test.time.js +56 -0
  238. package/js/test/base/functions/test.type.js +53 -0
  239. package/js/test/base/test.base.js +193 -0
  240. package/js/test/errors/test.InsufficientFunds.js +86 -0
  241. package/js/test/errors/test.InvalidNonce.js +64 -0
  242. package/js/test/errors/test.InvalidOrder.js +35 -0
  243. package/js/test/errors/test.OrderNotFound.js +39 -0
  244. package/js/test/test.js +426 -0
  245. package/js/test/test.timeout_hang.js +12 -0
  246. package/js/therock.js +1431 -0
  247. package/js/tidebit.js +632 -0
  248. package/js/tidex.js +939 -0
  249. package/js/timex.js +1283 -0
  250. package/js/upbit.js +1622 -0
  251. package/js/vcc.js +1353 -0
  252. package/js/wavesexchange.js +2185 -0
  253. package/js/wazirx.js +732 -0
  254. package/js/whitebit.js +1352 -0
  255. package/js/woo.js +1577 -0
  256. package/js/xena.js +1948 -0
  257. package/js/yobit.js +1129 -0
  258. package/js/zaif.js +647 -0
  259. package/js/zb.js +4088 -0
  260. package/js/zipmex.js +40 -0
  261. package/js/zonda.js +1497 -0
  262. package/multilang.sh +159 -0
  263. package/package.json +591 -0
  264. package/postinstall.js +103 -0
package/js/bl3p.js ADDED
@@ -0,0 +1,346 @@
1
+ 'use strict';
2
+
3
+ // ---------------------------------------------------------------------------
4
+
5
+ const Exchange = require ('./base/Exchange');
6
+ const Precise = require ('./base/Precise');
7
+
8
+ // ---------------------------------------------------------------------------
9
+
10
+ module.exports = class bl3p extends Exchange {
11
+ describe () {
12
+ return this.deepExtend (super.describe (), {
13
+ 'id': 'bl3p',
14
+ 'name': 'BL3P',
15
+ 'countries': [ 'NL' ], // Netherlands
16
+ 'rateLimit': 1000,
17
+ 'version': '1',
18
+ 'comment': 'An exchange market by BitonicNL',
19
+ 'has': {
20
+ 'CORS': undefined,
21
+ 'spot': true,
22
+ 'margin': false,
23
+ 'swap': false,
24
+ 'future': false,
25
+ 'option': false,
26
+ 'addMargin': false,
27
+ 'cancelOrder': true,
28
+ 'createOrder': true,
29
+ 'createReduceOnlyOrder': false,
30
+ 'fetchBalance': true,
31
+ 'fetchBorrowRate': false,
32
+ 'fetchBorrowRateHistories': false,
33
+ 'fetchBorrowRateHistory': false,
34
+ 'fetchBorrowRates': false,
35
+ 'fetchBorrowRatesPerSymbol': false,
36
+ 'fetchFundingHistory': false,
37
+ 'fetchFundingRate': false,
38
+ 'fetchFundingRateHistory': false,
39
+ 'fetchFundingRates': false,
40
+ 'fetchIndexOHLCV': false,
41
+ 'fetchLeverage': false,
42
+ 'fetchMarkOHLCV': false,
43
+ 'fetchOrderBook': true,
44
+ 'fetchPosition': false,
45
+ 'fetchPositions': false,
46
+ 'fetchPositionsRisk': false,
47
+ 'fetchPremiumIndexOHLCV': false,
48
+ 'fetchTicker': true,
49
+ 'fetchTrades': true,
50
+ 'fetchTradingFee': false,
51
+ 'fetchTradingFees': true,
52
+ 'fetchTransfer': false,
53
+ 'fetchTransfers': false,
54
+ 'reduceMargin': false,
55
+ 'setLeverage': false,
56
+ 'setMarginMode': false,
57
+ 'setPositionMode': false,
58
+ 'transfer': false,
59
+ },
60
+ 'urls': {
61
+ 'logo': 'https://user-images.githubusercontent.com/1294454/28501752-60c21b82-6feb-11e7-818b-055ee6d0e754.jpg',
62
+ 'api': 'https://api.bl3p.eu',
63
+ 'www': 'https://bl3p.eu', // 'https://bitonic.nl'
64
+ 'doc': [
65
+ 'https://github.com/BitonicNL/bl3p-api/tree/master/docs',
66
+ 'https://bl3p.eu/api',
67
+ 'https://bitonic.nl/en/api',
68
+ ],
69
+ },
70
+ 'api': {
71
+ 'public': {
72
+ 'get': [
73
+ '{market}/ticker',
74
+ '{market}/orderbook',
75
+ '{market}/trades',
76
+ ],
77
+ },
78
+ 'private': {
79
+ 'post': [
80
+ '{market}/money/depth/full',
81
+ '{market}/money/order/add',
82
+ '{market}/money/order/cancel',
83
+ '{market}/money/order/result',
84
+ '{market}/money/orders',
85
+ '{market}/money/orders/history',
86
+ '{market}/money/trades/fetch',
87
+ 'GENMKT/money/info',
88
+ 'GENMKT/money/deposit_address',
89
+ 'GENMKT/money/new_deposit_address',
90
+ 'GENMKT/money/wallet/history',
91
+ 'GENMKT/money/withdraw',
92
+ ],
93
+ },
94
+ },
95
+ 'markets': {
96
+ 'BTC/EUR': { 'id': 'BTCEUR', 'symbol': 'BTC/EUR', 'base': 'BTC', 'quote': 'EUR', 'baseId': 'BTC', 'quoteId': 'EUR', 'maker': 0.0025, 'taker': 0.0025, 'type': 'spot', 'spot': true },
97
+ 'LTC/EUR': { 'id': 'LTCEUR', 'symbol': 'LTC/EUR', 'base': 'LTC', 'quote': 'EUR', 'baseId': 'LTC', 'quoteId': 'EUR', 'maker': 0.0025, 'taker': 0.0025, 'type': 'spot', 'spot': true },
98
+ },
99
+ });
100
+ }
101
+
102
+ parseBalance (response) {
103
+ const data = this.safeValue (response, 'data', {});
104
+ const wallets = this.safeValue (data, 'wallets');
105
+ const result = { 'info': data };
106
+ const codes = Object.keys (this.currencies);
107
+ for (let i = 0; i < codes.length; i++) {
108
+ const code = codes[i];
109
+ const currency = this.currency (code);
110
+ const currencyId = currency['id'];
111
+ const wallet = this.safeValue (wallets, currencyId, {});
112
+ const available = this.safeValue (wallet, 'available', {});
113
+ const balance = this.safeValue (wallet, 'balance', {});
114
+ const account = this.account ();
115
+ account['free'] = this.safeString (available, 'value');
116
+ account['total'] = this.safeString (balance, 'value');
117
+ result[code] = account;
118
+ }
119
+ return this.safeBalance (result);
120
+ }
121
+
122
+ async fetchBalance (params = {}) {
123
+ await this.loadMarkets ();
124
+ const response = await this.privatePostGENMKTMoneyInfo (params);
125
+ return this.parseBalance (response);
126
+ }
127
+
128
+ parseBidAsk (bidask, priceKey = 0, amountKey = 1) {
129
+ const price = this.safeNumber (bidask, priceKey);
130
+ const size = this.safeNumber (bidask, amountKey);
131
+ return [
132
+ price / 100000.0,
133
+ size / 100000000.0,
134
+ ];
135
+ }
136
+
137
+ async fetchOrderBook (symbol, limit = undefined, params = {}) {
138
+ const market = this.market (symbol);
139
+ const request = {
140
+ 'market': market['id'],
141
+ };
142
+ const response = await this.publicGetMarketOrderbook (this.extend (request, params));
143
+ const orderbook = this.safeValue (response, 'data');
144
+ return this.parseOrderBook (orderbook, symbol, undefined, 'bids', 'asks', 'price_int', 'amount_int');
145
+ }
146
+
147
+ parseTicker (ticker, market = undefined) {
148
+ //
149
+ // {
150
+ // "currency":"BTC",
151
+ // "last":32654.55595,
152
+ // "bid":32552.3642,
153
+ // "ask":32703.58231,
154
+ // "high":33500,
155
+ // "low":31943,
156
+ // "timestamp":1643372789,
157
+ // "volume":{
158
+ // "24h":2.27372413,
159
+ // "30d":320.79375456
160
+ // }
161
+ // }
162
+ //
163
+ const symbol = this.safeSymbol (undefined, market);
164
+ const timestamp = this.safeTimestamp (ticker, 'timestamp');
165
+ const last = this.safeString (ticker, 'last');
166
+ const volume = this.safeValue (ticker, 'volume', {});
167
+ return this.safeTicker ({
168
+ 'symbol': symbol,
169
+ 'timestamp': timestamp,
170
+ 'datetime': this.iso8601 (timestamp),
171
+ 'high': this.safeString (ticker, 'high'),
172
+ 'low': this.safeString (ticker, 'low'),
173
+ 'bid': this.safeString (ticker, 'bid'),
174
+ 'bidVolume': undefined,
175
+ 'ask': this.safeString (ticker, 'ask'),
176
+ 'askVolume': undefined,
177
+ 'vwap': undefined,
178
+ 'open': undefined,
179
+ 'close': last,
180
+ 'last': last,
181
+ 'previousClose': undefined,
182
+ 'change': undefined,
183
+ 'percentage': undefined,
184
+ 'average': undefined,
185
+ 'baseVolume': this.safeString (volume, '24h'),
186
+ 'quoteVolume': undefined,
187
+ 'info': ticker,
188
+ }, market, false);
189
+ }
190
+
191
+ async fetchTicker (symbol, params = {}) {
192
+ const market = this.market (symbol);
193
+ const request = {
194
+ 'market': market['id'],
195
+ };
196
+ const ticker = await this.publicGetMarketTicker (this.extend (request, params));
197
+ //
198
+ // {
199
+ // "currency":"BTC",
200
+ // "last":32654.55595,
201
+ // "bid":32552.3642,
202
+ // "ask":32703.58231,
203
+ // "high":33500,
204
+ // "low":31943,
205
+ // "timestamp":1643372789,
206
+ // "volume":{
207
+ // "24h":2.27372413,
208
+ // "30d":320.79375456
209
+ // }
210
+ // }
211
+ //
212
+ return this.parseTicker (ticker, market);
213
+ }
214
+
215
+ parseTrade (trade, market = undefined) {
216
+ const id = this.safeString (trade, 'trade_id');
217
+ const timestamp = this.safeInteger (trade, 'date');
218
+ const price = this.safeString (trade, 'price_int');
219
+ const amount = this.safeString (trade, 'amount_int');
220
+ market = this.safeMarket (undefined, market);
221
+ return this.safeTrade ({
222
+ 'id': id,
223
+ 'info': trade,
224
+ 'timestamp': timestamp,
225
+ 'datetime': this.iso8601 (timestamp),
226
+ 'symbol': market['symbol'],
227
+ 'type': undefined,
228
+ 'side': undefined,
229
+ 'order': undefined,
230
+ 'takerOrMaker': undefined,
231
+ 'price': Precise.stringDiv (price, '100000'),
232
+ 'amount': Precise.stringDiv (amount, '100000000'),
233
+ 'cost': undefined,
234
+ 'fee': undefined,
235
+ }, market);
236
+ }
237
+
238
+ async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
239
+ const market = this.market (symbol);
240
+ const response = await this.publicGetMarketTrades (this.extend ({
241
+ 'market': market['id'],
242
+ }, params));
243
+ const result = this.parseTrades (response['data']['trades'], market, since, limit);
244
+ return result;
245
+ }
246
+
247
+ async fetchTradingFees (params = {}) {
248
+ await this.loadMarkets ();
249
+ const response = await this.privatePostGENMKTMoneyInfo (params);
250
+ //
251
+ // {
252
+ // result: 'success',
253
+ // data: {
254
+ // user_id: '13396',
255
+ // wallets: {
256
+ // BTC: {
257
+ // balance: {
258
+ // value_int: '0',
259
+ // display: '0.00000000 BTC',
260
+ // currency: 'BTC',
261
+ // value: '0.00000000',
262
+ // display_short: '0.00 BTC'
263
+ // },
264
+ // available: {
265
+ // value_int: '0',
266
+ // display: '0.00000000 BTC',
267
+ // currency: 'BTC',
268
+ // value: '0.00000000',
269
+ // display_short: '0.00 BTC'
270
+ // }
271
+ // },
272
+ // ...
273
+ // },
274
+ // trade_fee: '0.25'
275
+ // }
276
+ // }
277
+ //
278
+ const data = this.safeValue (response, 'data', {});
279
+ const feeString = this.safeString (data, 'trade_fee');
280
+ const fee = this.parseNumber (Precise.stringDiv (feeString, '100'));
281
+ const result = {};
282
+ for (let i = 0; i < this.symbols.length; i++) {
283
+ const symbol = this.symbols[i];
284
+ result[symbol] = {
285
+ 'info': data,
286
+ 'symbol': symbol,
287
+ 'maker': fee,
288
+ 'taker': fee,
289
+ 'percentage': true,
290
+ 'tierBased': false,
291
+ };
292
+ }
293
+ return result;
294
+ }
295
+
296
+ async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
297
+ const market = this.market (symbol);
298
+ const order = {
299
+ 'market': market['id'],
300
+ 'amount_int': parseInt (amount * 100000000),
301
+ 'fee_currency': market['quote'],
302
+ 'type': (side === 'buy') ? 'bid' : 'ask',
303
+ };
304
+ if (type === 'limit') {
305
+ order['price_int'] = parseInt (price * 100000.0);
306
+ }
307
+ const response = await this.privatePostMarketMoneyOrderAdd (this.extend (order, params));
308
+ const orderId = this.safeString (response['data'], 'order_id');
309
+ return {
310
+ 'info': response,
311
+ 'id': orderId,
312
+ };
313
+ }
314
+
315
+ async cancelOrder (id, symbol = undefined, params = {}) {
316
+ const request = {
317
+ 'order_id': id,
318
+ };
319
+ return await this.privatePostMarketMoneyOrderCancel (this.extend (request, params));
320
+ }
321
+
322
+ sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
323
+ const request = this.implodeParams (path, params);
324
+ let url = this.urls['api'] + '/' + this.version + '/' + request;
325
+ const query = this.omit (params, this.extractParams (path));
326
+ if (api === 'public') {
327
+ if (Object.keys (query).length) {
328
+ url += '?' + this.urlencode (query);
329
+ }
330
+ } else {
331
+ this.checkRequiredCredentials ();
332
+ const nonce = this.nonce ();
333
+ body = this.urlencode (this.extend ({ 'nonce': nonce }, query));
334
+ const secret = this.base64ToBinary (this.secret);
335
+ // eslint-disable-next-line quotes
336
+ const auth = request + "\0" + body;
337
+ const signature = this.hmac (this.encode (auth), secret, 'sha512', 'base64');
338
+ headers = {
339
+ 'Content-Type': 'application/x-www-form-urlencoded',
340
+ 'Rest-Key': this.apiKey,
341
+ 'Rest-Sign': signature,
342
+ };
343
+ }
344
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
345
+ }
346
+ };