Skip to content

Commit

Permalink
chore: update ccxt to version 1.57.94
Browse files Browse the repository at this point in the history
feat: use `OKex` V5 API (requires a *Unified* account)
fix: fix `ccxt` pairs retrieval when precision mode is `TICK_SIZE` (ex: `OKex`)
  • Loading branch information
aloysius-pgast committed Oct 11, 2021
1 parent 519deb1 commit 8ac8212
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [v1.11.0]
### Gateway
* chore: update ccxt to version `1.57.94`
* feat: use `OKex` V5 API (requires a *Unified* account)
* fix: fix `ccxt` pairs retrieval when precision mode is `TICK_SIZE` (ex: `OKex`)

## [v1.10.3]
### UI
* fix: display error message in case auth is refused by exchange
Expand Down
11 changes: 8 additions & 3 deletions app/abstract-ccxt-exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,15 @@ _getCurrencyPrecision(currency)
{
return null;
}
return {
precision:this._client.ccxt.currencies[currency].precision,
step:this._precisionToStep(this._client.ccxt.currencies[currency].precision)
let precision = this._client.ccxt.currencies[currency].precision;
if (this._client.ccxt.TICK_SIZE == this._client.ccxt.precisionMode) {
precision = this._stepToPrecision(precision);
}
let step = this._precisionToStep(precision);
return {
precision:precision,
step:step
};
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/default-ccxt-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ async getPairs()
}
throw e;
}
return {ccxt:data, custom:this.formatPairs(data)};
const customData = this.formatPairs(data);
return {ccxt:data, custom:customData};
}

/**
Expand Down
11 changes: 8 additions & 3 deletions app/exchanges/okex/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const CcxtClient = require('./ccxt-client');
const AbstractCcxtExchangeClass = require('../../abstract-ccxt-exchange');
const SubscriptionManagerClass = require('./subscription-manager');

const exchangeType = 'okex';
const exchangeType = 'okex5';

// limit when retrieving trades (OKex will always return the last 60 trades)
const TRADES_LIMIT = 60;
Expand Down Expand Up @@ -61,7 +61,11 @@ class Exchange extends AbstractCcxtExchangeClass
constructor(exchangeId, exchangeName, config)
{
let opt = AbstractCcxtExchangeClass.getCcxtOpt(exchangeId, config, {
options:{warnOnFetchOHLCVLimitArgument:false},
options:{
warnOnFetchOHLCVLimitArgument:false,
// only retrieve spot markets
fetchMarkets:['spot']
},
fetchOrderBookWarning:false
});
let client = new CcxtClient('okex', opt);
Expand All @@ -73,8 +77,9 @@ constructor(exchangeId, exchangeName, config)
async _getPairs()
{
let list = {};
const pairs = await super._getPairs();
// ignore futures (ie: baseCurrency == USD)
_.forEach(await super._getPairs(), (e, pair) => {
_.forEach(pairs, (e, pair) => {
if ('USD' == e.baseCurrency)
{
return;
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bittrex-signalr-client": "git+https://github.com/aloysius-pgast/bittrex-signalr-client.git#master",
"body-parser": "^1.17.2",
"bottleneck": "^2.3.0",
"ccxt": "^1.50.8",
"ccxt": "^1.57.94",
"chump": "^1.2.0",
"compression": "^1.7.1",
"css-select": "^2.0.0",
Expand Down

0 comments on commit 8ac8212

Please sign in to comment.