Browse Source

No db is necessary when using Gekko Cloud markets. Added nodb config option.

develop
mark-sch 1 year ago
parent
commit
0eefce2f3b
4 changed files with 66 additions and 1 deletions
  1. +5
    -1
      config-cloudstrategy.js
  2. +4
    -0
      core/util.js
  3. +28
    -0
      plugins/nodb/reader.js
  4. +29
    -0
      plugins/nodb/writer.js

+ 5
- 1
config-cloudstrategy.js View File

@ -213,7 +213,11 @@ config.backtestResultExporter = {
// CONFIGURING ADAPTER
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
config.adapter = 'sqlite';
config.adapter = 'nodb';
config.nodb = {
path: 'plugins/nodb'
}
config.sqlite = {
path: 'plugins/sqlite',

+ 4
- 0
core/util.js View File

@ -50,6 +50,10 @@ var util = {
}
}
if (_config.adapter == 'nodb' && (_config.cloudConnector == undefined || _config.cloudConnector.enabled == false || _config.cloudConnector.useCloudMarket == false)) {
util.die('Invalid config setting. config.adapter = \'nodb\' is only valid when using the Gekko Cloud market.', true);
}
return _config;
},
// overwrite the whole config

+ 28
- 0
plugins/nodb/reader.js View File

@ -0,0 +1,28 @@
var _ = require('lodash');
var Reader = function(mydb) {
_.bindAll(this);
}
// returns the furthest point (up to `from`) in time we have valid data from
Reader.prototype.mostRecentWindow = function(from, to, next) {
return next(false);
}
Reader.prototype.tableExists = function (name, next) {
next();
}
Reader.prototype.get = function(from, to, what, next, mytable) {
next();
}
Reader.prototype.count = function(from, to, next) {
next();
}
Reader.prototype.close = function() {
}
module.exports = Reader;

+ 29
- 0
plugins/nodb/writer.js View File

@ -0,0 +1,29 @@
var _ = require('lodash');
const util = require('../../core/util');
const config = util.getConfig();
var Store = function(done, pluginMeta) {
_.bindAll(this);
this.done = done;
done();
}
Store.prototype.writeCandles = function() {
return;
}
var processCandle = function(candle, done) {
done();
};
var finalize = function(done) {
done();
}
if(config.candleWriter.enabled) {
Store.prototype.processCandle = processCandle;
Store.prototype.finalize = finalize;
}
module.exports = Store;

Loading…
Cancel
Save