bluebot
Version:
A bitcoin trading bot for auto trading at various exchanges
42 lines (33 loc) • 799 B
JavaScript
const _ = require('lodash');
const promisify = require('tiny-promisify');
const moment = require('moment');
const pipelineRunner = promisify(require('../../core/workers/pipeline/parent'));
const cache = require('../state/cache');
const broadcast = cache.get('broadcast');
const bluebotManager = cache.get('bluebots');
const base = require('./baseConfig');
// starts an import
// requires a post body with a config object
module.exports = function *() {
let id = this.request.body.id;
if(!id) {
this.body = {
status: 'not ok'
}
return;
}
let deleted = bluebotManager.delete(id);
if(!deleted){
this.body = {
status: 'not ok'
}
return;
}
broadcast({
type: 'bluebot_killed',
bluebot_id: id
});
this.body = {
status: 'ok'
};
}