Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
- Bitfinex and Kraken API throw the "post only" error only on checkOr…
Browse files Browse the repository at this point in the history
…der(), check for it in engine.js (#391)

- Sometimes I would get "0% funds on hold (0.000000)". New check if balance on hold is > 0
  • Loading branch information
crubb authored and DeviaVir committed Jul 19, 2017
1 parent e48dff4 commit 1d8735a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module.exports = function container (get, set, clear) {
cb(null, order)
})
}
if (order.status === 'rejected' && order.reject_reason === 'post only') {
if (order.status === 'rejected' && (order.reject_reason === 'post only' || api_order.reject_reason === 'post only')) {
msg('post-only ' + type + ' failed, re-ordering')
return cancelOrder(true)
}
Expand Down Expand Up @@ -416,7 +416,7 @@ module.exports = function container (get, set, clear) {
return cb(err)
}
}
if (n(s.balance.currency).subtract(s.balance.currency_hold || 0).value() < n(price).multiply(size).value()) {
if (n(s.balance.currency).subtract(s.balance.currency_hold || 0).value() < n(price).multiply(size).value() && s.balance.currency_hold > 0) {
msg('buy delayed: ' + pct(n(s.balance.currency_hold || 0).divide(s.balance.currency).value()) + ' of funds (' + fc(s.balance.currency_hold) + ') on hold')
return setTimeout(function () {
if (s.last_signal === signal) {
Expand Down

0 comments on commit 1d8735a

Please sign in to comment.