ccxt-ir 4.12.4 → 4.13.0
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.
- package/README.md +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/abstract/bitwana.js +11 -0
- package/dist/cjs/src/bitwana.js +420 -0
- package/dist/cjs/src/hamtapay.js +59 -48
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bitwana.d.ts +9 -0
- package/js/src/abstract/bitwana.js +11 -0
- package/js/src/abstract/hamtapay.d.ts +1 -0
- package/js/src/bitwana.d.ts +24 -0
- package/js/src/bitwana.js +419 -0
- package/js/src/hamtapay.js +59 -48
- package/js/src/src/bitwana.d.ts +21 -0
- package/js/test.js +78 -26
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -50,6 +50,7 @@ var bitteam = require('./src/bitteam.js');
|
|
|
50
50
|
var bittrade = require('./src/bittrade.js');
|
|
51
51
|
var bitunix = require('./src/bitunix.js');
|
|
52
52
|
var bitvavo = require('./src/bitvavo.js');
|
|
53
|
+
var bitwana = require('./src/bitwana.js');
|
|
53
54
|
var blockchaincom = require('./src/blockchaincom.js');
|
|
54
55
|
var blofin = require('./src/blofin.js');
|
|
55
56
|
var btcalpha = require('./src/btcalpha.js');
|
|
@@ -239,7 +240,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
239
240
|
|
|
240
241
|
//-----------------------------------------------------------------------------
|
|
241
242
|
// this is updated by vss.js when building
|
|
242
|
-
const version = '4.
|
|
243
|
+
const version = '4.13.0';
|
|
243
244
|
Exchange["default"].ccxtVersion = version;
|
|
244
245
|
const exchanges = {
|
|
245
246
|
'abantether': abantether["default"],
|
|
@@ -280,6 +281,7 @@ const exchanges = {
|
|
|
280
281
|
'bittrade': bittrade["default"],
|
|
281
282
|
'bitunix': bitunix["default"],
|
|
282
283
|
'bitvavo': bitvavo["default"],
|
|
284
|
+
'bitwana': bitwana["default"],
|
|
283
285
|
'blockchaincom': blockchaincom["default"],
|
|
284
286
|
'blofin': blofin["default"],
|
|
285
287
|
'btcalpha': btcalpha["default"],
|
|
@@ -558,6 +560,7 @@ exports.bitteam = bitteam["default"];
|
|
|
558
560
|
exports.bittrade = bittrade["default"];
|
|
559
561
|
exports.bitunix = bitunix["default"];
|
|
560
562
|
exports.bitvavo = bitvavo["default"];
|
|
563
|
+
exports.bitwana = bitwana["default"];
|
|
561
564
|
exports.blockchaincom = blockchaincom["default"];
|
|
562
565
|
exports.blofin = blofin["default"];
|
|
563
566
|
exports.btcalpha = btcalpha["default"];
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Exchange$1 = require('../base/Exchange.js');
|
|
6
|
+
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
class Exchange extends Exchange$1["default"] {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports["default"] = Exchange;
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var bitwana$1 = require('./abstract/bitwana.js');
|
|
6
|
+
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
/**
|
|
10
|
+
* @class bitwana
|
|
11
|
+
* @augments Exchange
|
|
12
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
13
|
+
*/
|
|
14
|
+
class bitwana extends bitwana$1["default"] {
|
|
15
|
+
marketTypeToSymbol(base, quote, marketType = 'spot') {
|
|
16
|
+
return base + '/' + quote;
|
|
17
|
+
}
|
|
18
|
+
describe() {
|
|
19
|
+
return this.deepExtend(super.describe(), {
|
|
20
|
+
'id': 'bitwana',
|
|
21
|
+
'name': 'Bitwana',
|
|
22
|
+
'countries': ['IR'],
|
|
23
|
+
'rateLimit': 1000,
|
|
24
|
+
'version': '1',
|
|
25
|
+
'certified': false,
|
|
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
|
+
'cancelAllOrders': false,
|
|
36
|
+
'cancelOrder': false,
|
|
37
|
+
'cancelOrders': false,
|
|
38
|
+
'createDepositAddress': false,
|
|
39
|
+
'createOrder': false,
|
|
40
|
+
'createStopLimitOrder': false,
|
|
41
|
+
'createStopMarketOrder': false,
|
|
42
|
+
'createStopOrder': false,
|
|
43
|
+
'editOrder': false,
|
|
44
|
+
'fetchBalance': false,
|
|
45
|
+
'fetchBorrowInterest': false,
|
|
46
|
+
'fetchBorrowRateHistories': false,
|
|
47
|
+
'fetchBorrowRateHistory': false,
|
|
48
|
+
'fetchClosedOrders': false,
|
|
49
|
+
'fetchCrossBorrowRate': false,
|
|
50
|
+
'fetchCrossBorrowRates': false,
|
|
51
|
+
'fetchCurrencies': false,
|
|
52
|
+
'fetchDepositAddress': false,
|
|
53
|
+
'fetchDeposits': false,
|
|
54
|
+
'fetchFundingHistory': false,
|
|
55
|
+
'fetchFundingRate': false,
|
|
56
|
+
'fetchFundingRateHistory': false,
|
|
57
|
+
'fetchFundingRates': false,
|
|
58
|
+
'fetchIndexOHLCV': false,
|
|
59
|
+
'fetchIsolatedBorrowRate': false,
|
|
60
|
+
'fetchIsolatedBorrowRates': false,
|
|
61
|
+
'fetchL2OrderBook': false,
|
|
62
|
+
'fetchL3OrderBook': false,
|
|
63
|
+
'fetchLedger': false,
|
|
64
|
+
'fetchLedgerEntry': false,
|
|
65
|
+
'fetchLeverageTiers': false,
|
|
66
|
+
'fetchMarkets': true,
|
|
67
|
+
'fetchMarkOHLCV': false,
|
|
68
|
+
'fetchMyTrades': false,
|
|
69
|
+
'fetchOHLCV': false,
|
|
70
|
+
'fetchOpenInterestHistory': false,
|
|
71
|
+
'fetchOpenOrders': false,
|
|
72
|
+
'fetchOrder': false,
|
|
73
|
+
'fetchOrderBook': false,
|
|
74
|
+
'fetchOrders': false,
|
|
75
|
+
'fetchOrderTrades': 'emulated',
|
|
76
|
+
'fetchPositions': false,
|
|
77
|
+
'fetchPremiumIndexOHLCV': false,
|
|
78
|
+
'fetchTicker': true,
|
|
79
|
+
'fetchTickers': true,
|
|
80
|
+
'fetchTime': false,
|
|
81
|
+
'fetchTrades': false,
|
|
82
|
+
'fetchTradingFee': false,
|
|
83
|
+
'fetchTradingFees': false,
|
|
84
|
+
'fetchWithdrawals': false,
|
|
85
|
+
'otc': true,
|
|
86
|
+
'setLeverage': false,
|
|
87
|
+
'setMarginMode': false,
|
|
88
|
+
'transfer': false,
|
|
89
|
+
'withdraw': false,
|
|
90
|
+
},
|
|
91
|
+
'comment': 'This comment is optional',
|
|
92
|
+
'urls': {
|
|
93
|
+
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bitwana/64x64.png',
|
|
94
|
+
'api': {
|
|
95
|
+
'public': 'https://bitwana.com',
|
|
96
|
+
},
|
|
97
|
+
'www': 'https://bitwana.com/',
|
|
98
|
+
'doc': [
|
|
99
|
+
'https://bitwana.com/',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
'api': {
|
|
103
|
+
'public': {
|
|
104
|
+
'get': {
|
|
105
|
+
'api/1/markets': 1,
|
|
106
|
+
'api/1/markets/{id}': 1,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
'fees': {},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
parseSpotMarket(market) {
|
|
114
|
+
// {
|
|
115
|
+
// "id": "BTC_IRT",
|
|
116
|
+
// "symbol": "بیتکوین-تومان",
|
|
117
|
+
// "base": "BTC",
|
|
118
|
+
// "quote": "IRT",
|
|
119
|
+
// "buyPrice": "10222846365",
|
|
120
|
+
// "sellPrice": "10233403625",
|
|
121
|
+
// "userOrderPricePrecision": 0,
|
|
122
|
+
// "quantityPrecision": 6,
|
|
123
|
+
// "minimumOrder": 100000,
|
|
124
|
+
// "maximumOrder": 300000000,
|
|
125
|
+
// "lastTradedPrice": "10249911984",
|
|
126
|
+
// "lowestPrice": "10063564406",
|
|
127
|
+
// "highestPrice": "10320391247",
|
|
128
|
+
// "sourceVolume": "0.036557",
|
|
129
|
+
// "destinationVolume": "371770611.78",
|
|
130
|
+
// "tradingEnabled": true,
|
|
131
|
+
// "otcEnabled": false,
|
|
132
|
+
// }
|
|
133
|
+
const id = this.safeString(market, 'id');
|
|
134
|
+
const baseId = this.safeString(market, 'base');
|
|
135
|
+
const quoteId = this.safeString(market, 'quote');
|
|
136
|
+
const base = this.safeCurrencyCode(baseId);
|
|
137
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
138
|
+
return {
|
|
139
|
+
'id': id,
|
|
140
|
+
'symbol': this.marketTypeToSymbol(base, quote, 'spot'),
|
|
141
|
+
'base': base,
|
|
142
|
+
'quote': quote,
|
|
143
|
+
'settle': undefined,
|
|
144
|
+
'baseId': baseId,
|
|
145
|
+
'quoteId': quoteId,
|
|
146
|
+
'settleId': undefined,
|
|
147
|
+
'type': 'spot',
|
|
148
|
+
'spot': true,
|
|
149
|
+
'margin': false,
|
|
150
|
+
'swap': false,
|
|
151
|
+
'future': false,
|
|
152
|
+
'option': false,
|
|
153
|
+
'active': true,
|
|
154
|
+
'contract': false,
|
|
155
|
+
'linear': undefined,
|
|
156
|
+
'inverse': undefined,
|
|
157
|
+
'contractSize': undefined,
|
|
158
|
+
'expiry': undefined,
|
|
159
|
+
'expiryDatetime': undefined,
|
|
160
|
+
'strike': undefined,
|
|
161
|
+
'optionType': undefined,
|
|
162
|
+
'precision': {
|
|
163
|
+
'amount': this.safeInteger(market, 'quantityPrecision'),
|
|
164
|
+
'price': this.safeInteger(market, 'userOrderPricePrecision'),
|
|
165
|
+
},
|
|
166
|
+
'limits': {
|
|
167
|
+
'leverage': {
|
|
168
|
+
'min': undefined,
|
|
169
|
+
'max': undefined,
|
|
170
|
+
},
|
|
171
|
+
'amount': {
|
|
172
|
+
'min': undefined,
|
|
173
|
+
'max': undefined,
|
|
174
|
+
},
|
|
175
|
+
'price': {
|
|
176
|
+
'min': undefined,
|
|
177
|
+
'max': undefined,
|
|
178
|
+
},
|
|
179
|
+
'cost': {
|
|
180
|
+
'min': this.safeNumber(market, 'minimumOrder'),
|
|
181
|
+
'max': this.safeNumber(market, 'maximumOrder'),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
'created': undefined,
|
|
185
|
+
'info': market,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
parseOtcMarket(market) {
|
|
189
|
+
const rawId = this.safeString(market, 'id');
|
|
190
|
+
const baseId = this.safeString(market, 'base');
|
|
191
|
+
const quoteId = this.safeString(market, 'quote');
|
|
192
|
+
const base = this.safeCurrencyCode(baseId);
|
|
193
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
194
|
+
return {
|
|
195
|
+
'id': rawId + '_OTC',
|
|
196
|
+
'symbol': this.marketTypeToSymbol(base, quote, 'otc'),
|
|
197
|
+
'base': base,
|
|
198
|
+
'quote': quote,
|
|
199
|
+
'settle': undefined,
|
|
200
|
+
'baseId': baseId,
|
|
201
|
+
'quoteId': quoteId,
|
|
202
|
+
'settleId': undefined,
|
|
203
|
+
'type': 'otc',
|
|
204
|
+
'spot': false,
|
|
205
|
+
'margin': false,
|
|
206
|
+
'swap': false,
|
|
207
|
+
'future': false,
|
|
208
|
+
'option': false,
|
|
209
|
+
'active': true,
|
|
210
|
+
'contract': false,
|
|
211
|
+
'linear': undefined,
|
|
212
|
+
'inverse': undefined,
|
|
213
|
+
'contractSize': undefined,
|
|
214
|
+
'expiry': undefined,
|
|
215
|
+
'expiryDatetime': undefined,
|
|
216
|
+
'strike': undefined,
|
|
217
|
+
'optionType': undefined,
|
|
218
|
+
'precision': {
|
|
219
|
+
'amount': this.safeInteger(market, 'quantityPrecision'),
|
|
220
|
+
'price': this.safeInteger(market, 'userOrderPricePrecision'),
|
|
221
|
+
},
|
|
222
|
+
'limits': {
|
|
223
|
+
'leverage': {
|
|
224
|
+
'min': undefined,
|
|
225
|
+
'max': undefined,
|
|
226
|
+
},
|
|
227
|
+
'amount': {
|
|
228
|
+
'min': undefined,
|
|
229
|
+
'max': undefined,
|
|
230
|
+
},
|
|
231
|
+
'price': {
|
|
232
|
+
'min': undefined,
|
|
233
|
+
'max': undefined,
|
|
234
|
+
},
|
|
235
|
+
'cost': {
|
|
236
|
+
'min': this.safeNumber(market, 'minimumOrder'),
|
|
237
|
+
'max': this.safeNumber(market, 'maximumOrder'),
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
'created': undefined,
|
|
241
|
+
'info': market,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
async fetchMarkets(params = {}) {
|
|
245
|
+
/**
|
|
246
|
+
* @method
|
|
247
|
+
* @name bitwana#fetchMarkets
|
|
248
|
+
* @description retrieves data on all markets for bitwana
|
|
249
|
+
* @see https://bitwana.com/api/1/markets?with_price=true
|
|
250
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
251
|
+
* @returns {object[]} an array of objects representing market data
|
|
252
|
+
*/
|
|
253
|
+
const marketType = this.safeString(params, 'type', 'spot');
|
|
254
|
+
const request = {
|
|
255
|
+
'with_price': true,
|
|
256
|
+
};
|
|
257
|
+
const response = await this.publicGetApi1Markets(this.extend(request, params));
|
|
258
|
+
const markets = this.safeList(response, 'content', []);
|
|
259
|
+
const result = [];
|
|
260
|
+
for (let i = 0; i < markets.length; i++) {
|
|
261
|
+
const market = markets[i];
|
|
262
|
+
if (marketType === 'otc') {
|
|
263
|
+
result.push(this.parseOtcMarket(market));
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
result.push(this.parseSpotMarket(market));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
272
|
+
/**
|
|
273
|
+
* @method
|
|
274
|
+
* @name bitwana#fetchTickers
|
|
275
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
276
|
+
* @see https://bitwana.com/api/1/markets?with_price=true
|
|
277
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
278
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
279
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
280
|
+
*/
|
|
281
|
+
const marketType = this.safeString(params, 'type', 'spot');
|
|
282
|
+
await this.loadMarkets(false, { 'type': marketType });
|
|
283
|
+
if (symbols !== undefined) {
|
|
284
|
+
symbols = this.marketSymbols(symbols);
|
|
285
|
+
}
|
|
286
|
+
const request = {
|
|
287
|
+
'with_price': true,
|
|
288
|
+
};
|
|
289
|
+
const response = await this.publicGetApi1Markets(this.extend(request, params));
|
|
290
|
+
const markets = this.safeList(response, 'content', []);
|
|
291
|
+
const result = {};
|
|
292
|
+
for (let i = 0; i < markets.length; i++) {
|
|
293
|
+
const market = markets[i];
|
|
294
|
+
if (marketType === 'otc') {
|
|
295
|
+
const otcTicker = this.parseOtcTicker(market);
|
|
296
|
+
result[otcTicker['symbol']] = otcTicker;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
const spotTicker = this.parseSpotTicker(market);
|
|
300
|
+
result[spotTicker['symbol']] = spotTicker;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
304
|
+
}
|
|
305
|
+
async fetchTicker(symbol, params = {}) {
|
|
306
|
+
/**
|
|
307
|
+
* @method
|
|
308
|
+
* @name bitwana#fetchTicker
|
|
309
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
310
|
+
* @see https://bitwana.com/api/1/markets/BTC_IRT?with_price=true
|
|
311
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
312
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
313
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
314
|
+
*/
|
|
315
|
+
const marketType = this.safeString(params, 'type', 'spot');
|
|
316
|
+
await this.loadMarkets(false, { 'type': marketType });
|
|
317
|
+
const market = this.market(symbol);
|
|
318
|
+
const request = {
|
|
319
|
+
'id': this.safeString(market['info'], 'id'),
|
|
320
|
+
'with_price': true,
|
|
321
|
+
};
|
|
322
|
+
const response = await this.publicGetApi1MarketsId(this.extend(request, params));
|
|
323
|
+
const ticker = this.safeDict(response, 'content');
|
|
324
|
+
if (marketType === 'otc') {
|
|
325
|
+
return this.parseOtcTicker(ticker, market);
|
|
326
|
+
}
|
|
327
|
+
return this.parseSpotTicker(ticker, market);
|
|
328
|
+
}
|
|
329
|
+
parseSpotTicker(ticker, market = undefined) {
|
|
330
|
+
const baseId = this.safeString(ticker, 'base');
|
|
331
|
+
const quoteId = this.safeString(ticker, 'quote');
|
|
332
|
+
const base = this.safeCurrencyCode(baseId);
|
|
333
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
334
|
+
let symbol = this.marketTypeToSymbol(base, quote, 'spot');
|
|
335
|
+
if (market !== undefined) {
|
|
336
|
+
symbol = market['symbol'];
|
|
337
|
+
}
|
|
338
|
+
const high = this.safeNumber(ticker, 'highestPrice');
|
|
339
|
+
const low = this.safeNumber(ticker, 'lowestPrice');
|
|
340
|
+
const bid = this.safeNumber(ticker, 'buyPrice');
|
|
341
|
+
const ask = this.safeNumber(ticker, 'sellPrice');
|
|
342
|
+
const last = this.safeNumber(ticker, 'lastTradedPrice');
|
|
343
|
+
const change = this.safeNumber(ticker, 'changePrice');
|
|
344
|
+
const percentage = this.safeNumber(ticker, 'changeRate');
|
|
345
|
+
const baseVolume = this.safeNumber(ticker, 'sourceVolume');
|
|
346
|
+
const quoteVolume = this.safeNumber(ticker, 'destinationVolume');
|
|
347
|
+
return this.safeTicker({
|
|
348
|
+
'symbol': symbol,
|
|
349
|
+
'timestamp': undefined,
|
|
350
|
+
'datetime': undefined,
|
|
351
|
+
'high': high,
|
|
352
|
+
'low': low,
|
|
353
|
+
'bid': bid,
|
|
354
|
+
'bidVolume': undefined,
|
|
355
|
+
'ask': ask,
|
|
356
|
+
'askVolume': undefined,
|
|
357
|
+
'vwap': undefined,
|
|
358
|
+
'open': undefined,
|
|
359
|
+
'close': last,
|
|
360
|
+
'last': last,
|
|
361
|
+
'previousClose': undefined,
|
|
362
|
+
'change': change,
|
|
363
|
+
'percentage': percentage,
|
|
364
|
+
'average': undefined,
|
|
365
|
+
'baseVolume': baseVolume,
|
|
366
|
+
'quoteVolume': quoteVolume,
|
|
367
|
+
'info': ticker,
|
|
368
|
+
}, market);
|
|
369
|
+
}
|
|
370
|
+
parseOtcTicker(ticker, market = undefined) {
|
|
371
|
+
const baseId = this.safeString(ticker, 'base');
|
|
372
|
+
const quoteId = this.safeString(ticker, 'quote');
|
|
373
|
+
const base = this.safeCurrencyCode(baseId);
|
|
374
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
375
|
+
let symbol = this.marketTypeToSymbol(base, quote, 'otc');
|
|
376
|
+
if (market !== undefined) {
|
|
377
|
+
symbol = market['symbol'];
|
|
378
|
+
}
|
|
379
|
+
const high = this.safeNumber(ticker, 'highestPrice');
|
|
380
|
+
const low = this.safeNumber(ticker, 'lowestPrice');
|
|
381
|
+
const bid = this.safeNumber(ticker, 'buyPrice');
|
|
382
|
+
const ask = this.safeNumber(ticker, 'sellPrice');
|
|
383
|
+
const last = this.safeNumber(ticker, 'lastTradedPrice');
|
|
384
|
+
const change = this.safeNumber(ticker, 'changePrice');
|
|
385
|
+
const percentage = this.safeNumber(ticker, 'changeRate');
|
|
386
|
+
return this.safeTicker({
|
|
387
|
+
'symbol': symbol,
|
|
388
|
+
'timestamp': undefined,
|
|
389
|
+
'datetime': undefined,
|
|
390
|
+
'high': high,
|
|
391
|
+
'low': low,
|
|
392
|
+
'bid': bid,
|
|
393
|
+
'bidVolume': undefined,
|
|
394
|
+
'ask': ask,
|
|
395
|
+
'askVolume': undefined,
|
|
396
|
+
'vwap': undefined,
|
|
397
|
+
'open': undefined,
|
|
398
|
+
'close': last,
|
|
399
|
+
'last': last,
|
|
400
|
+
'previousClose': undefined,
|
|
401
|
+
'change': change,
|
|
402
|
+
'percentage': percentage,
|
|
403
|
+
'average': undefined,
|
|
404
|
+
'baseVolume': undefined,
|
|
405
|
+
'quoteVolume': undefined,
|
|
406
|
+
'info': ticker,
|
|
407
|
+
}, market);
|
|
408
|
+
}
|
|
409
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
410
|
+
const query = this.omit(params, this.extractParams(path));
|
|
411
|
+
let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
|
|
412
|
+
if (Object.keys(query).length) {
|
|
413
|
+
url += '?' + this.urlencode(query);
|
|
414
|
+
}
|
|
415
|
+
headers = { 'Content-Type': 'application/json' };
|
|
416
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
exports["default"] = bitwana;
|
package/dist/cjs/src/hamtapay.js
CHANGED
|
@@ -88,7 +88,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
88
88
|
'urls': {
|
|
89
89
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/hamtapay/64x64.png',
|
|
90
90
|
'api': {
|
|
91
|
-
'public': 'https://
|
|
91
|
+
'public': 'https://api.hamtapay.org',
|
|
92
92
|
},
|
|
93
93
|
'www': 'https://hamtapay.net/',
|
|
94
94
|
'doc': [
|
|
@@ -99,6 +99,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
99
99
|
'public': {
|
|
100
100
|
'get': {
|
|
101
101
|
'/financial/api/market': 1,
|
|
102
|
+
'/financial/api/vitrin/prices': 1,
|
|
102
103
|
},
|
|
103
104
|
},
|
|
104
105
|
},
|
|
@@ -117,7 +118,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
117
118
|
* @method
|
|
118
119
|
* @name hamtapay#fetchMarkets
|
|
119
120
|
* @description retrieves data on all markets for hamtapay
|
|
120
|
-
* @see https://
|
|
121
|
+
* @see https://api.hamtapay.org/financial/api/market
|
|
121
122
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
122
123
|
* @returns {object[]} an array of objects representing market data
|
|
123
124
|
*/
|
|
@@ -154,8 +155,8 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
154
155
|
'baseId': baseId,
|
|
155
156
|
'quoteId': quoteId,
|
|
156
157
|
'settleId': undefined,
|
|
157
|
-
'type': '
|
|
158
|
-
'spot':
|
|
158
|
+
'type': 'otc',
|
|
159
|
+
'spot': false,
|
|
159
160
|
'margin': false,
|
|
160
161
|
'swap': false,
|
|
161
162
|
'future': false,
|
|
@@ -170,8 +171,8 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
170
171
|
'strike': undefined,
|
|
171
172
|
'optionType': undefined,
|
|
172
173
|
'precision': {
|
|
173
|
-
'amount':
|
|
174
|
-
'price':
|
|
174
|
+
'amount': undefined,
|
|
175
|
+
'price': undefined,
|
|
175
176
|
},
|
|
176
177
|
'limits': {
|
|
177
178
|
'leverage': {
|
|
@@ -200,7 +201,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
200
201
|
* @method
|
|
201
202
|
* @name hamtapay#fetchTickers
|
|
202
203
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
203
|
-
* @see https://
|
|
204
|
+
* @see https://api.hamtapay.org/financial/api/vitrin/prices
|
|
204
205
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
205
206
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
206
207
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -209,12 +210,23 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
209
210
|
if (symbols !== undefined) {
|
|
210
211
|
symbols = this.marketSymbols(symbols);
|
|
211
212
|
}
|
|
212
|
-
const response = await this.
|
|
213
|
-
const data = this.
|
|
213
|
+
const response = await this.publicGetFinancialApiVitrinPrices(params);
|
|
214
|
+
const data = this.safeDict(response, 'data', {});
|
|
214
215
|
const result = {};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
const quotes = ['IRT', 'USDT'];
|
|
217
|
+
for (let i = 0; i < quotes.length; i++) {
|
|
218
|
+
const current_qoute = quotes[i];
|
|
219
|
+
const corresponding_data = this.safeDict(data, current_qoute, {});
|
|
220
|
+
const baseSymbols = Object.keys(corresponding_data);
|
|
221
|
+
for (let j = 0; j < baseSymbols.length; j++) {
|
|
222
|
+
const current_base = baseSymbols[j];
|
|
223
|
+
const current_ticker = corresponding_data[current_base];
|
|
224
|
+
current_ticker['base'] = current_base;
|
|
225
|
+
current_ticker['quote'] = current_qoute;
|
|
226
|
+
current_ticker['symbol'] = current_base + '/' + current_qoute;
|
|
227
|
+
current_ticker['id'] = current_base + '-' + current_qoute;
|
|
228
|
+
result[current_ticker['symbol']] = this.parseTicker(current_ticker);
|
|
229
|
+
}
|
|
218
230
|
}
|
|
219
231
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
220
232
|
}
|
|
@@ -223,41 +235,48 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
223
235
|
* @method
|
|
224
236
|
* @name hamtapay#fetchTicker
|
|
225
237
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
226
|
-
* @see https://
|
|
238
|
+
* @see https://hamtapay.com/management/all-coins/?format=json
|
|
227
239
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
228
240
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
229
241
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
230
242
|
*/
|
|
231
|
-
const
|
|
232
|
-
return
|
|
243
|
+
const ticker = await this.fetchTickers([symbol]);
|
|
244
|
+
return ticker[symbol];
|
|
233
245
|
}
|
|
234
246
|
parseTicker(ticker, market = undefined) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
// {
|
|
248
|
+
// "id": "USDT-IRT",
|
|
249
|
+
// "symbol": "USDT/IRT",
|
|
250
|
+
// "base": "USDT",
|
|
251
|
+
// "quote": "IRT",
|
|
252
|
+
// "min_price_24h": "111702",
|
|
253
|
+
// "max_price_24h": "115872",
|
|
254
|
+
// "market_price": "115942",
|
|
255
|
+
// "buy_price": "117101",
|
|
256
|
+
// "sell_price": "114782",
|
|
257
|
+
// "change_rate_24h": 3.29,
|
|
258
|
+
// "amount_decimals": 0,
|
|
259
|
+
// "price_decimals": 0,
|
|
260
|
+
// "status": "ACTIVE"
|
|
261
|
+
// }
|
|
262
|
+
const marketType = 'otc';
|
|
263
|
+
const marketId = this.safeString(ticker, 'id');
|
|
264
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
265
|
+
const last = this.safeFloat(ticker, 'buy_price', 0);
|
|
266
|
+
const change = this.safeFloat(ticker, 'change_rate_24h', 0);
|
|
267
|
+
const ask = this.safeFloat(ticker, 'buy_price', 0);
|
|
268
|
+
const bid = this.safeFloat(ticker, 'sell_price', 0);
|
|
269
|
+
const high = this.safeFloat(ticker, 'max_price_24h', 0);
|
|
270
|
+
const low = this.safeFloat(ticker, 'min_price_24h', 0);
|
|
252
271
|
return this.safeTicker({
|
|
253
272
|
'symbol': symbol,
|
|
254
273
|
'timestamp': undefined,
|
|
255
274
|
'datetime': undefined,
|
|
256
|
-
'high':
|
|
257
|
-
'low':
|
|
258
|
-
'bid':
|
|
275
|
+
'high': high,
|
|
276
|
+
'low': low,
|
|
277
|
+
'bid': bid,
|
|
259
278
|
'bidVolume': undefined,
|
|
260
|
-
'ask':
|
|
279
|
+
'ask': ask,
|
|
261
280
|
'askVolume': undefined,
|
|
262
281
|
'vwap': undefined,
|
|
263
282
|
'open': undefined,
|
|
@@ -265,23 +284,15 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
265
284
|
'last': last,
|
|
266
285
|
'previousClose': undefined,
|
|
267
286
|
'change': undefined,
|
|
268
|
-
'percentage':
|
|
287
|
+
'percentage': change,
|
|
269
288
|
'average': undefined,
|
|
270
|
-
'baseVolume':
|
|
271
|
-
'quoteVolume':
|
|
289
|
+
'baseVolume': undefined,
|
|
290
|
+
'quoteVolume': undefined,
|
|
272
291
|
'info': ticker,
|
|
273
292
|
}, market);
|
|
274
293
|
}
|
|
275
294
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
276
|
-
const
|
|
277
|
-
let normalizedPath = path;
|
|
278
|
-
while (normalizedPath.length && normalizedPath[0] === '/') {
|
|
279
|
-
normalizedPath = normalizedPath.slice(1);
|
|
280
|
-
}
|
|
281
|
-
let url = this.urls['api']['public'] + '/' + this.implodeParams(normalizedPath, params);
|
|
282
|
-
if (Object.keys(query).length) {
|
|
283
|
-
url += '?' + this.urlencode(query);
|
|
284
|
-
}
|
|
295
|
+
const url = this.urls['api']['public'] + '/' + path;
|
|
285
296
|
headers = {
|
|
286
297
|
'Content-Type': 'application/json',
|
|
287
298
|
'Origin': 'https://hamtapay.net',
|