diff --git a/core/exchangeChecker.js b/core/exchangeChecker.js index 79e3582b9..a4542b11e 100644 --- a/core/exchangeChecker.js +++ b/core/exchangeChecker.js @@ -3,6 +3,7 @@ var fs = require('fs'); var util = require('./util'); var config = util.getConfig(); var dirs = util.dirs(); +var moment = require('moment'); var Checker = function() { _.bindAll(this); @@ -72,6 +73,12 @@ Checker.prototype.cantFetchFullHistory = function(conf) { if(!exchange.providesFullHistory) return 'The exchange ' + name + ' does not provide full history (or Gekko doesn\'t support importing it)'; + + if ("exchangeMaxHistoryAge" in exchange) { + if (moment(config.importer.daterange.from) < moment().subtract(exchange.exchangeMaxHistoryAge, "days")) { + return 'Unsupported date from! ' + exchange.name + ' supports history of max ' + exchange.exchangeMaxHistoryAge + ' days..'; + } + } } // check if the exchange if configured correctly for real trading @@ -108,4 +115,4 @@ Checker.prototype.settings = function(conf) { } -module.exports = new Checker(); \ No newline at end of file +module.exports = new Checker(); diff --git a/package.json b/package.json index 6a7106489..21fb44600 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@slack/client": "^3.10.0", "async": "2.1.2", "binance": "^1.3.1", - "bitcoin-co-id-update": "0.0.2", + "bitcoin-co-id": "0.0.1", "bitexthai": "^0.1.0", "bitfinex-api-node": "^1.2.0", "bitstamp": "^1.0.3", @@ -28,6 +28,7 @@ "cexio": "0.0.x", "co-fs": "^1.2.0", "coinfalcon": "^1.0.3", + "coingi": "^1.0.4", "commander": "^2.13.0", "gdax": "^0.4.2", "gekko": "0.0.9", diff --git a/web/vue/src/components/data/import/importer.vue b/web/vue/src/components/data/import/importer.vue index fe575fad0..3d070c1c1 100644 --- a/web/vue/src/components/data/import/importer.vue +++ b/web/vue/src/components/data/import/importer.vue @@ -7,7 +7,7 @@ ul(v-if='imports.length') li(v-for='_import in imports') router-link(:to='"/data/importer/import/" + _import.id') {{ _import.watch.exchange }}:{{ _import.watch.currency }}/{{ _import.watch.asset }} - + .hr h3 Start a new import import-config-builder(v-on:config='updateConfig') @@ -64,6 +64,13 @@ export default { if(daysApart < 1) return alert('You can only import at least one day of data..') + let exchange = this.$store.state.exchanges[this.config.watch.exchange]; + if ("exchangeMaxHistoryAge" in exchange) { + if (moment(this.config.importer.daterange.from) < moment().subtract(exchange.exchangeMaxHistoryAge, "days")) { + return alert('Your date from is too old for ' + this.config.watch.exchange + '. It supports only the last ' + exchange.exchangeMaxHistoryAge + ' days..'); + } + } + post('import', this.config, (error, response) => { if(error) return alert(error); diff --git a/web/vue/src/store/modules/config/sync.js b/web/vue/src/store/modules/config/sync.js index 5bb447ac3..9a3b0d689 100644 --- a/web/vue/src/store/modules/config/sync.js +++ b/web/vue/src/store/modules/config/sync.js @@ -15,6 +15,10 @@ const transformMarkets = backendData => { exchangesTemp[e.slug].markets[currency].push( asset ); }); + if ("exchangeMaxHistoryAge" in e) { + exchangesTemp[e.slug].exchangeMaxHistoryAge = e.exchangeMaxHistoryAge; + } + exchangesTemp[e.slug].importable = e.providesFullHistory ? true : false; exchangesTemp[e.slug].tradable = e.tradable ? true : false; exchangesTemp[e.slug].requires = e.requires; @@ -43,4 +47,4 @@ const sync = () => { export default function() { init(); sync(); -} \ No newline at end of file +}