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

Fix for "post only error" not handled and fix for "balance on hold == 0" #391

Merged
merged 1 commit into from
Jul 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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