Bug Fixes

This commit is contained in:
Luis Fernando Molina committed 2020-02-09 16:35:17 +01:00
1 parent 82bc086e92
commit b1af6e078c
131 files changed
+8597 -1930

No files matched your search

+107 -32
View File
@@ -35,6 +35,7 @@ module.exports = class stex extends Exchange {
'fetchDeposits': true,
'fetchWithdrawals': true,
'withdraw': true,
'fetchFundingFees': true,
},
'version': 'v3',
'urls': {
@@ -499,6 +500,15 @@ module.exports = class stex extends Exchange {
symbol = market['symbol'];
}
const last = this.safeFloat (ticker, 'last');
const open = this.safeFloat (ticker, 'open');
let change = undefined;
let percentage = undefined;
if (last !== undefined) {
if (open !== undefined) {
change = last - open;
percentage = ((100 / open) * last) - 100;
}
}
return {
'symbol': symbol,
'timestamp': timestamp,
@@ -510,12 +520,12 @@ module.exports = class stex extends Exchange {
'ask': this.safeFloat (ticker, 'ask'),
'askVolume': undefined,
'vwap': undefined,
'open': this.safeFloat (ticker, 'open'),
'open': open,
'close': last,
'last': last,
'previousClose': undefined, // previous day close
'change': undefined,
'percentage': undefined,
'change': change,
'percentage': percentage,
'average': undefined,
'baseVolume': this.safeFloat (ticker, 'volumeQuote'),
'quoteVolume': this.safeFloat (ticker, 'volume'),
@@ -1511,7 +1521,7 @@ module.exports = class stex extends Exchange {
if ((code === undefined) && (currency !== undefined)) {
code = currency['code'];
}
const type = ('depositId' in transaction) ? 'deposit' : 'withdrawal';
const type = ('deposit_status_id' in transaction) ? 'deposit' : 'withdrawal';
const amount = this.safeFloat (transaction, 'amount');
const status = this.parseTransactionStatus (this.safeStringLower (transaction, 'status'));
const timestamp = this.safeTimestamp2 (transaction, 'timestamp', 'created_ts');
@@ -1549,21 +1559,20 @@ module.exports = class stex extends Exchange {
}
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
if (code === undefined) {
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires a currency code argument');
}
await this.loadMarkets ();
const currency = this.currency (code);
const request = {
'currencyTypeName': currency['name'],
// 'pageSize': limit, // documented as required, but it works without it
// 'pageNum': 0, // also works without it, most likely a typo in the docs
// 'sort': 1, // 1 = asc, 0 = desc
};
if (limit !== undefined) {
request['pageSize'] = limit; // default 50
let currency = undefined;
const request = {};
if (code !== undefined) {
currency = this.currency (code);
request['currencyId'] = currency['id'];
}
const response = await this.privatePostExchangeFundControllerWebsiteFundcontrollerGetPayinCoinRecord (this.extend (request, params));
if (limit !== undefined) {
request['limit'] = limit;
}
if (since !== undefined) {
request['timeStart'] = since;
}
const response = await this.profileGetDeposits (this.extend (request, params));
//
// {
// "success": true,
@@ -1583,31 +1592,35 @@ module.exports = class stex extends Exchange {
// "status_color": "#BC3D51",
// "created_at": "2018-11-28 12:32:08",
// "timestamp": "1543409389",
// "confirmations": "1 of 2"
// "confirmations": "1 of 2",
// "protocol_specific_settings": {
// "protocol_name": "Tether OMNI",
// "protocol_id": 10,
// "block_explorer_url": "https://omniexplorer.info/search/"
// }
// }
// ]
// }
//
const deposits = this.safeValue (response, 'datas', {});
const deposits = this.safeValue (response, 'data', []);
return this.parseTransactions (deposits, code, since, limit);
}
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
if (code === undefined) {
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a currency code argument');
}
await this.loadMarkets ();
const currency = this.currency (code);
const request = {
'currencyId': currency['id'],
// 'pageSize': limit, // documented as required, but it works without it
// 'pageIndex': 0, // also works without it, most likely a typo in the docs
// 'tab': 'all', // all, wait (submitted, not audited), success (auditing passed), fail (auditing failed), cancel (canceled by user)
};
if (limit !== undefined) {
request['pageSize'] = limit; // default 50
let currency = undefined;
const request = {};
if (code !== undefined) {
currency = this.currency (code);
request['currencyId'] = currency['id'];
}
const response = await this.privateGetExchangeFundControllerWebsiteFundwebsitecontrollerGetpayoutcoinrecord (this.extend (request, params));
if (limit !== undefined) {
request['limit'] = limit;
}
if (since !== undefined) {
request['timeStart'] = since;
}
const response = await this.profileGetWithdrawals (this.extend (request, params));
//
// {
// "success": true,
@@ -1638,6 +1651,11 @@ module.exports = class stex extends Exchange {
// "protocol_id": 10,
// "protocol_name": "Tether OMNI",
// "supports_new_address_creation": false
// },
// "protocol_specific_settings": {
// "protocol_name": "Tether OMNI",
// "protocol_id": 10,
// "block_explorer_url": "https://omniexplorer.info/search/"
// }
// }
// ]
@@ -1699,6 +1717,63 @@ module.exports = class stex extends Exchange {
return this.parseTransaction (data, currency);
}
async fetchFundingFees (codes = undefined, params = {}) {
const response = await this.publicGetCurrencies (params);
//
// {
// "success": true,
// "data": [
// {
// "id": 1,
// "code": "BTC",
// "name": "Bitcoin",
// "active": true,
// "delisted": false,
// "precision": 8,
// "minimum_tx_confirmations": 24,
// "minimum_withdrawal_amount": "0.009",
// "minimum_deposit_amount": "0.000003",
// "deposit_fee_currency_id": 1,
// "deposit_fee_currency_code": "ETH",
// "deposit_fee_const": "0.00001",
// "deposit_fee_percent": "0",
// "withdrawal_fee_currency_id": 1,
// "withdrawal_fee_currency_code": "ETH",
// "withdrawal_fee_const": "0.0015",
// "withdrawal_fee_percent": "0",
// "withdrawal_limit": "string",
// "block_explorer_url": "https://blockchain.info/tx/",
// "protocol_specific_settings": [
// {
// "protocol_name": "Tether OMNI",
// "protocol_id": 10,
// "active": true,
// "withdrawal_fee_currency_id": 1,
// "withdrawal_fee_const": 0.002,
// "withdrawal_fee_percent": 0,
// "block_explorer_url": "https://omniexplorer.info/search/"
// }
// ]
// }
// ]
// }
//
const data = this.safeValue (response, 'data', []);
const withdrawFees = {};
const depositFees = {};
for (let i = 0; i < data.length; i++) {
const id = this.safeString (data[i], 'id');
const code = this.safeCurrencyCode (id);
withdrawFees[code] = this.safeFloat (data[i], 'withdrawal_fee_const');
depositFees[code] = this.safeFloat (data[i], 'deposit_fee_const');
}
return {
'withdraw': withdrawFees,
'deposit': depositFees,
'info': response,
};
}
handleErrors (httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
if (response === undefined) {
return; // fallback to default error handler