Skip to content

Commit

Permalink
Integrated Coingi, added exchangeMaxHistoryAge config feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcklondonuk authored and askmike committed Mar 12, 2018
1 parent 3aeb24f commit 429a732
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
9 changes: 8 additions & 1 deletion core/exchangeChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -108,4 +115,4 @@ Checker.prototype.settings = function(conf) {

}

module.exports = new Checker();
module.exports = new Checker();
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
9 changes: 8 additions & 1 deletion web/vue/src/components/data/import/importer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion web/vue/src/store/modules/config/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,4 +47,4 @@ const sync = () => {
export default function() {
init();
sync();
}
}

0 comments on commit 429a732

Please sign in to comment.