Snapshots

This commit is contained in:
Luis Fernando Molina committed 2020-05-10 14:17:33 +02:00
1 parent e91125801d
commit 6368221937
75 files changed
+8943 -4332

No files matched your search

+94 -25
View File
@@ -164,6 +164,26 @@ module.exports = class gateio extends Exchange {
async fetchMarkets (params = {}) {
const response = await this.publicGetMarketinfo (params);
//
// {
// "result":"true",
// "pairs":[
// {
// "usdt_cnyx":{
// "decimal_places":3,
// "amount_decimal_places":3,
// "min_amount":1,
// "min_amount_a":1,
// "min_amount_b":3,
// "fee":0.02,
// "trade_disabled":0,
// "buy_disabled":0,
// "sell_disabled":0
// }
// },
// ]
// }
//
const markets = this.safeValue (response, 'pairs');
if (!markets) {
throw new ExchangeError (this.id + ' fetchMarkets got an unrecognized response');
@@ -190,14 +210,14 @@ module.exports = class gateio extends Exchange {
const symbol = base + '/' + quote;
const precision = {
'amount': 8,
'price': details['decimal_places'],
'price': this.safeInteger (details, 'decimal_places'),
};
const amountLimits = {
'min': details['min_amount'],
'min': this.safeFloat (details, 'min_amount'),
'max': undefined,
};
const priceLimits = {
'min': Math.pow (10, -details['decimal_places']),
'min': Math.pow (10, -precision['price']),
'max': undefined,
};
const defaultCost = amountLimits['min'] * priceLimits['min'];
@@ -211,9 +231,13 @@ module.exports = class gateio extends Exchange {
'price': priceLimits,
'cost': costLimits,
};
const active = true;
const disabled = this.safeValue (details, 'trade_disabled');
const active = !disabled;
const uppercaseId = id.toUpperCase ();
const fee = this.safeFloat (details, 'fee');
result.push ({
'id': id,
'uppercaseId': uppercaseId,
'symbol': symbol,
'base': base,
'quote': quote,
@@ -221,8 +245,8 @@ module.exports = class gateio extends Exchange {
'quoteId': quoteId,
'info': market,
'active': active,
'maker': details['fee'] / 100,
'taker': details['fee'] / 100,
'maker': fee / 100,
'taker': fee / 100,
'precision': precision,
'limits': limits,
});
@@ -484,22 +508,64 @@ module.exports = class gateio extends Exchange {
parseOrder (order, market = undefined) {
//
// {'amount': '0.00000000',
// 'currencyPair': 'xlm_usdt',
// 'fee': '0.0113766632239302 USDT',
// 'feeCurrency': 'USDT',
// 'feePercentage': 0.18,
// 'feeValue': '0.0113766632239302',
// 'filledAmount': '30.14004987',
// 'filledRate': 0.2097,
// 'initialAmount': '30.14004987',
// 'initialRate': '0.2097',
// 'left': 0,
// 'orderNumber': '998307286',
// 'rate': '0.2097',
// 'status': 'closed',
// 'timestamp': 1531158583,
// 'type': 'sell'},
// createOrder
//
// {
// "fee": "0 ZEC",
// "code": 0,
// "rate": "0.0055",
// "side": 2,
// "type": "buy",
// "ctime": 1586460839.138,
// "market": "ZEC_BTC",
// "result": "true",
// "status": "open",
// "iceberg": "0",
// "message": "Success",
// "feeValue": "0",
// "filledRate": "0.005500000",
// "leftAmount": "0.60607456",
// "feeCurrency": "ZEC",
// "orderNumber": 10755887009,
// "filledAmount": "0",
// "feePercentage": 0.002,
// "initialAmount": "0.60607456"
// }
//
// {
// 'amount': '0.00000000',
// 'currencyPair': 'xlm_usdt',
// 'fee': '0.0113766632239302 USDT',
// 'feeCurrency': 'USDT',
// 'feePercentage': 0.18,
// 'feeValue': '0.0113766632239302',
// 'filledAmount': '30.14004987',
// 'filledRate': 0.2097,
// 'initialAmount': '30.14004987',
// 'initialRate': '0.2097',
// 'left': 0,
// 'orderNumber': '998307286',
// 'rate': '0.2097',
// 'status': 'closed',
// 'timestamp': 1531158583,
// 'type': 'sell'
// }
//
// {
// "orderNumber": 10802237760,
// "orderType": 1,
// "type": "buy",
// "rate": "0.54250000",
// "amount": "45.55638518",
// "total": "24.71433896",
// "initialRate": "0.54250000",
// "initialAmount": "45.55638518",
// "filledRate": "0.54250000",
// "filledAmount": "0",
// "currencyPair": "nano_usdt",
// "timestamp": 1586556143,
// "status": "open"
// }
//
const id = this.safeString2 (order, 'orderNumber', 'id');
let symbol = undefined;
@@ -520,12 +586,15 @@ module.exports = class gateio extends Exchange {
} else if (side === '2') {
side = 'buy';
}
const price = this.safeFloat2 (order, 'initialRate', 'price');
const price = this.safeFloat2 (order, 'initialRate', 'rate');
const average = this.safeFloat (order, 'filledRate');
const amount = this.safeFloat2 (order, 'initialAmount', 'amount');
const filled = this.safeFloat (order, 'filledAmount');
// In the order status response, this field has a different name.
const remaining = this.safeFloat2 (order, 'leftAmount', 'left');
let remaining = this.safeFloat2 (order, 'leftAmount', 'left');
if (remaining === undefined) {
remaining = amount - filled;
}
const feeCost = this.safeFloat (order, 'feeValue');
const feeCurrencyId = this.safeString (order, 'feeCurrency');
const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);
@@ -651,7 +720,7 @@ module.exports = class gateio extends Exchange {
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
if (symbol === undefined) {
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires symbol param');
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires symbol argument');
}
await this.loadMarkets ();
const market = this.market (symbol);