-
Notifications
You must be signed in to change notification settings - Fork 3.9k
new bitfinex code is not working correctly #341
Comments
@xhad you said:
Do you think the the error |
@xhad you said:
Ah that is pretty easy to fix, this code is dangerous:
If the bitfinex ticker call errors for whatever reason (network error like
This means that if there is any error, the callback will not be called but instead the getInfo call the BTC-e exchange will be called again (and this stays happening until a succesfull call). |
I wasn't able to reproduce this error. |
maybe, but @jhnferraris did experience the same error (on an empty account).. |
I will try to look at this a little later, do you think you are able to program if checks that recall the exchange on fail? the btce exchange code has examples. That does require a deep understanding of scoping in async javascript, so if you need some help just let me know! |
Trader.prototype.getTicker = function(callback) {
this.bitfinex.ticker(defaultAsset, function(err, data, body) {
if (err) {
return this.retry(this.bitfinex
.ticker(defaultAsset, function(err, data, body) {
callback(err, {bid: data.bid, ask: data.ask});
}));
}
callback(err, {bid: data.bid, ask: data.ask})
});
} |
Could you please take a look at the code above? It works, but I'm thinking there could be a more elegant way to do it. Thanks for being so kind. |
So how the btc-e function does it is:
Example would be:
Note:
|
Thank you very much Mike. |
No problem, if you have more problems let me know. If you are ready please create a pull request against this branch: https://github.com/askmike/gekko/tree/new-bitfinex The develop branch has the old bitfinex code again. |
Thanks @xhad! I tested your code, everything seems fine :) I merged everything into stable now. |
This issue is not related to the stable branch.
See #337 and #339. Ping @xhad.
Because of the above issues I had to revert to the old but working bitfinex code (see a6c7db). The current dev branch still has the bitfinex code you gave. As soon as it's fixed please submit a PR against the dev branch.
The text was updated successfully, but these errors were encountered: