@icgio/icg-exchanges-wrapper 1.9.166 → 1.9.167

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.
@@ -1308,15 +1308,20 @@ module.exports = class Orders {
1308
1308
  get_market_history(this.Exchanges, this.exchange_pairs, this.interval_dict)
1309
1309
  }
1310
1310
  check_ohlcv() {
1311
+ const OHLCV_DEFAULT_PAST_HOURS = 24
1311
1312
  let ohlcv_handler = (exchange, pair, res) => {
1312
1313
  if (res.success) {
1313
- _.set(this.ohlcv, [exchange, pair], { data: res.body, update_time: new Date() })
1314
+ if (res.body.length < OHLCV_DEFAULT_PAST_HOURS) {
1315
+ console.error('ohlcv length should be:', OHLCV_DEFAULT_PAST_HOURS, exchange, pair, res.body.length)
1316
+ this.ohlcv[exchange] = _.omit(this.ohlcv[exchange], [pair])
1317
+ } else {
1318
+ _.set(this.ohlcv, [exchange, pair], { data: res.body, update_time: new Date() })
1319
+ }
1314
1320
  } else if (_.get(this.ohlcv, [exchange, pair, 'update_time']) < new Date().getTime() - this.interval_dict[exchange].ohlcv) {
1315
1321
  this.info_log('%s %s ohlcv expired: %j', exchange, pair, res)
1316
1322
  this.ohlcv[exchange] = _.omit(this.ohlcv[exchange], [pair])
1317
1323
  }
1318
1324
  }
1319
- const OHLCV_DEFAULT_PAST_HOURS = 24
1320
1325
  let get_ohlcv = (Exchanges, exchange_pairs, interval_dict) => {
1321
1326
  for (let exchange in Exchanges) {
1322
1327
  for (let pair of exchange_pairs[exchange]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.9.166",
3
+ "version": "1.9.167",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {