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 v0.6.4 #2

Merged
merged 13 commits into from
Jul 26, 2018
26 changes: 19 additions & 7 deletions core/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ var pipeline = (settings) => {
_.each(
pluginSubscriptions.filter(s => _.isArray(s.emitter)),
subscription => {
// cache full list
subscription.emitters = subscription.emitter;
var singleEventEmitters = subscription.emitter
.filter(
s => _.size(plugins.filter(p => p.meta.slug === s))
Expand All @@ -110,18 +112,28 @@ var pipeline = (settings) => {
_.each(pluginSubscriptions, function(sub) {

if(plugin[sub.handler]) {

// if a plugin wants to listen
// to something disabled
if(!emitters[sub.emitter]) {
if(!plugin.meta.greedy) {
log.warn([

let emitterMessage;
if(sub.emitters) {
emitterMessage = 'all of the emitting plugins [ ';
emitterMessage += sub.emitters.join(', ');
emitterMessage += ' ] are disabled.';
} else {
emitterMessage += 'the emitting plugin (' + sub.emitter;
emitterMessage += ')is disabled.'
}

log.error([
plugin.meta.name,
'wanted to listen to the',
sub.emitter + ',',
'however the',
sub.emitter,
'is disabled.'
'wanted to listen to event',
sub.event + ',',
'however',
emitterMessage,
plugin.meta.name + ' might malfunction because of it.'
].join(' '));
}
return;
Expand Down
2 changes: 1 addition & 1 deletion docs/internals/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ and will start signaling advice.

- What: An object describing new notification from your strategy
- When: when the strategy emit using `this.notify()` function
- Subscribe: You can subscribe to this event by registering the `stratNotification` method.
- Subscribe: You can subscribe to this event by registering the `processStratNotification` method.
- Example:
{
date: [moment object of the start time of the candle],
Expand Down
4 changes: 1 addition & 3 deletions docs/introduction/supported_exchanges.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gekko is able to directly communicate with the APIs of a number of exchanges. Ho
| [Okcoin.cn][11]* | ✓ | ✓ | ✕ | China, see [#352][20] |
| [Cex.io][12]* | ✓ | ✕ | ✕ | |
| [BTC Markets][13]* | ✓ | ✓ | ✕ | |
| [bitX][14] | ✓ | ✓ | ✓ | aka Luno |
| [Luno][14] | ✓ | ✓ | ✓ | previously BitX |
| [lakeBTC][15]* | ✓ | ✕ | ✕ | |
| [meXBT][16]* | ✓ | ✕ | ✕ | see [here][21] |
| [zaif][17]* | ✓ | ✕ | ✕ | |
Expand Down Expand Up @@ -60,5 +60,3 @@ Gekko is able to directly communicate with the APIs of a number of exchanges. Ho
[24]: https://www.binance.com/?ref=11236330
[25]: https://coinfalcon.com/?ref=CFJSQBMXZZDS
[26]: https://github.com/askmike/gekko/pull/2310


11 changes: 4 additions & 7 deletions exchange/gekkoBroker.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ class Broker {

if(config.private) {
if(this.cantTrade()) {
throw this.cantTrade();
throw new Error(this.cantTrade());
}
} else {
if(this.cantMonitor()) {
throw this.cantMonitor();
throw new Error(this.cantMonitor());
}
}

if(config.private && this.cantTrade()) {
throw this.cantTrade();
}

this.orders = {
// contains current open orders
open: [],
Expand Down Expand Up @@ -81,8 +77,9 @@ class Broker {
return;
}

if(this.cantTrade())
if(this.cantTrade()) {
throw new errors.ExchangeError(this.cantTrade());
}

this.syncPrivateData();
}
Expand Down
Loading