first commit
This commit is contained in:
commit
aa7869eb33
386 files changed
+69375
No files matched your search
@@ -0,0 +1,38 @@
|
||||
const _ = require('lodash');
|
||||
|
||||
const cache = require('../state/cache');
|
||||
const Logger = require('../state/logger');
|
||||
const apiKeyManager= cache.get('apiKeyManager');
|
||||
const gekkoManager = cache.get('gekkos');
|
||||
|
||||
const base = require('./baseConfig');
|
||||
|
||||
// starts an import
|
||||
// requires a post body with a config object
|
||||
module.exports = function *() {
|
||||
const mode = this.request.body.mode;
|
||||
|
||||
let config = {};
|
||||
|
||||
_.merge(config, base, this.request.body);
|
||||
|
||||
// Attach API keys
|
||||
if(config.trader && config.trader.enabled && !config.trader.key) {
|
||||
|
||||
const keys = apiKeyManager._getApiKeyPair(config.watch.exchange);
|
||||
|
||||
if(!keys) {
|
||||
this.body = 'No API keys found for this exchange.';
|
||||
return;
|
||||
}
|
||||
|
||||
_.merge(
|
||||
config.trader,
|
||||
keys
|
||||
);
|
||||
}
|
||||
|
||||
const state = gekkoManager.add({config, mode});
|
||||
|
||||
this.body = state;
|
||||
}
|
||||
Reference in new issue
Block a user