Skip to content

Commit

Permalink
provide more info in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Dec 21, 2013
1 parent c59d4f7 commit 792f498
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions exchangeChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Checker.prototype.cantMonitor = function(conf) {

var name = exchange.name;

if('monitorError' in exchange)
return 'At this moment Gekko can\'t monitor ' + name + ', find out more info here:\n\n' + exchange.monitorError;

var name = exchange.name;

if(!_.contains(exchange.currencies, conf.currency))
return 'Gekko only supports the currencies [ ' + exchange.currencies.join(', ') + ' ] at ' + name;

Expand All @@ -42,6 +47,9 @@ Checker.prototype.cantTrade = function(conf) {
var exchange = _.find(exchanges, function(e) { return e.slug === slug });
var name = exchange.name;

if('tradeError' in exchange)
return 'At this moment Gekko can\'t trade at ' + name + ', find out more info here:\n\n' + exchange.tradeError;

if(conf.key === 'your-key')
throw '"your-key" is not a valid API key';

Expand Down
11 changes: 9 additions & 2 deletions exchanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// implementation in gekko.
// assets: all the assets supported by the exchange implementation
// in gekko.
//
// monitorError: if Gekko is currently not able to monitor this exchange, please set it
// to an URL explaining the problem.
// tradeError: If gekko is currently not able to trade at this exchange, please set it
// to an URL explaining the problem.
var exchanges = [
{
name: 'MtGox',
Expand Down Expand Up @@ -44,7 +49,8 @@ var exchanges = [
currencies: ['USD'],
assets: ['BTC'],
requires: ['key', 'secret', 'username'],
minimalOrder: { amount: 1, unit: 'currency' }
minimalOrder: { amount: 1, unit: 'currency' },
tradeError: 'https://github.com/askmike/gekko/issues/38#issuecomment-29552100'
},
{
name: 'CEX.io',
Expand All @@ -54,7 +60,8 @@ var exchanges = [
currencies: ['BTC'],
assets: ['GHS'],
requires: ['key', 'secret', 'username'],
minimalOrder: { amount: 0.000001, unit: 'currency' }
minimalOrder: { amount: 0.000001, unit: 'currency' },
monitorError: 'https://github.com/askmike/gekko/issues/90'
}
];

Expand Down
3 changes: 0 additions & 3 deletions gekko.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ var configureManagers = function(_next) {
if(invalid)
throw invalid;

if(conf.exchange === 'bitstamp')
throw 'Live trading currently broken at Bitstamp! :(';

var manager = new Manager(conf);

consultant.on('advice', manager.trade);
Expand Down

0 comments on commit 792f498

Please sign in to comment.