Skip to content

Commit 024d325

Browse files
author
Ruben Callewaert
committedJan 19, 2015
Bugfix for the BTC-E exchange
1 parent 9dedfda commit 024d325

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed
 

‎apps/backtester.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Util.inherits(backtester, EventEmitter);
3636

3737
backtester.prototype.run = function() {
3838

39-
advisor.setIndicator(this.indicatorSettings, false);
39+
advisor.setIndicator(this.indicatorSettings);
4040

4141
async.series(
4242
{

‎exchanges/btce.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ exchange.prototype.getBalance = function(retry, cb) {
126126

127127
if(!err) {
128128

129-
cb(null, {assetAvailable: response.funds[asset], currencyAvailable: response.funds[currency], fee: 0.2});
129+
cb(null, {assetAvailable: response.return.funds[asset], currencyAvailable: response.return.funds[currency], fee: 0.2});
130130

131131
} else {
132132

@@ -196,13 +196,13 @@ exchange.prototype.placeOrder = function(type, amount, price, retry, cb) {
196196

197197
var status = 'open';
198198

199-
if(response.order_id === 0) {
199+
if(response.return.order_id === 0) {
200200

201201
status = 'filled';
202202

203203
}
204204

205-
cb(null, {txid: response.order_id, status: status});
205+
cb(null, {txid: response.return.order_id, status: status});
206206

207207
} else {
208208

@@ -242,7 +242,7 @@ exchange.prototype.orderFilled = function(order, retry, cb) {
242242

243243
if(!err) {
244244

245-
if(response[order]) {
245+
if(response.return[order]) {
246246

247247
cb(null, false);
248248

@@ -282,7 +282,7 @@ exchange.prototype.cancelOrder = function(order, retry, cb) {
282282

283283
if(!err) {
284284

285-
if(response.order_id === order) {
285+
if(response.return.order_id === order) {
286286
cb(null, true);
287287
} else {
288288
cb(null, false);

‎services/tradingadvisor.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ advisor.prototype.start = function() {
5959

6060
}
6161

62-
this.emit('advice', this.latestTradeAdvice );
62+
if(['buy', 'sell'].indexOf(this.latestTradeAdvice) >= 0) {
63+
this.emit('advice', this.latestTradeAdvice);
64+
}
6365

6466
}.bind(this));
6567

@@ -86,16 +88,10 @@ advisor.prototype.setPosition = function(pos) {
8688

8789
};
8890

89-
advisor.prototype.setIndicator = function(indicatorSettings, updateIndicator) {
91+
advisor.prototype.setIndicator = function(indicatorSettings) {
9092

9193
this.selectedIndicator = new this.indicators[indicatorSettings.indicator](indicatorSettings.options);
9294

93-
if(updateIndicator) {
94-
95-
this.start();
96-
97-
}
98-
9995
};
10096

10197
module.exports = advisor;

0 commit comments

Comments
 (0)
Please sign in to comment.