Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge #23

Merged
merged 8 commits into from
Sep 18, 2018
Prev Previous commit
manually trigger gekko stream finalize
  • Loading branch information
askmike committed Sep 18, 2018
commit 767f225feec75ce0158b6d08253a68a6bcd4ff68
8 changes: 8 additions & 0 deletions core/gekkoStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if(config.debug && mode !== 'importer') {
// decorate with more debug information
Gekko.prototype._write = function(chunk, encoding, _done) {

if(chunk.isFinished) {
return this.finalize();
}

const start = moment();
var relayed = false;
var at = null;
Expand All @@ -58,6 +62,10 @@ if(config.debug && mode !== 'importer') {
} else {
// skip decoration
Gekko.prototype._write = function(chunk, encoding, _done) {
if(chunk.isFinished) {
return this.finalize();
}

const flushEvents = _.after(this.candleConsumers.length, () => {
this.flushDefferedEvents();
_done();
Expand Down
1 change: 1 addition & 0 deletions core/markets/backtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Market.prototype.processCandles = function(err, candles) {
if(this.ended) {
this.closed = true;
this.reader.close();
this.push({isFinished: true});
} else {
util.die('Query returned no candles (do you have local data for the specified range?)');
}
Expand Down