Skip to content

Instantly share code, notes, and snippets.

@memeyou
Created February 16, 2014 08:37
Show Gist options
  • Select an option

  • Save memeyou/9031218 to your computer and use it in GitHub Desktop.

Select an option

Save memeyou/9031218 to your computer and use it in GitHub Desktop.
// sent advice over to the IRC channel
Actor.prototype.emitAdvice = function() {
var stuff
if(this.advice == 'long') {
stuff = c.green('Go long; buy.');
} else if(this.advice == 'short') {
stuff = c.red('Go short; sell.');
}
// extra info from the advisor method...
if(this.info) stuff += ' ' + this.info;
var message = [
c.bold(config.watch.asset + '-' + config.watch.currency + ' (' + config.tradingAdvisor.candleSize + 'm ' + config.tradingAdvisor.method + '): '),
stuff,
' ',
' (from ' + this.adviceTime.fromNow() + ')'
].join('');
this.bot.say(ircbot.channel, message);
};
// sent price over to the IRC channel
Actor.prototype.emitPrice = function() {
var stuff;
if(this.advice == 'long') {
stuff = c.green(this.price);
} else if(this.advice == 'short') {
stuff = c.red(this.price);
} else {
stuff = this.price;
}
var message = [
c.bold(config.watch.asset) + ' @ ' + c.bold(config.watch.exchange),
' is ',
stuff,
' ',
c.bold(config.watch.currency),
' (',
this.priceTime.fromNow(),
')'
].join('');
this.bot.say(ircbot.channel, message);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment