Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nedievas authored and DeviaVir committed Jun 11, 2017
1 parent be11a88 commit 95e972d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions extensions/exchanges/bitfinex/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ module.exports = function container (get, set, clear) {
buy: function (opts, cb) {
var func_args = [].slice.call(arguments)
var client = authedClient()
if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'maker') {
if (typeof opts.type === 'undefined' && typeof opts.order_type === 'maker') {
opts.type = 'exchange limit'
}
else if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'taker') {
else if (typeof opts.type === 'undefined' && typeof opts.order_type === 'taker') {
opts.type = 'exchange market'
}
if (typeof opts.post_only === 'undefined') {
Expand Down Expand Up @@ -145,7 +145,7 @@ module.exports = function container (get, set, clear) {
created_at: new Date().getTime(),
filled_size: '0'
}
if (err && err.match(/Error: Invalid order: not enough exchange balance$/)) {
if (err && err.toString('Error: Invalid order: not enough exchange balance')) {
status: 'rejected'
reject_reason: 'balance'
return cb(null, order)
Expand All @@ -159,10 +159,10 @@ module.exports = function container (get, set, clear) {
sell: function (opts, cb) {
var func_args = [].slice.call(arguments)
var client = authedClient()
if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'maker') {
if (typeof opts.type === 'undefined' && typeof opts.order_type === 'maker') {
opts.type = 'exchange limit'
}
else if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'taker') {
else if (typeof opts.type === 'undefined' && typeof opts.order_type === 'taker') {
opts.type = 'exchange market'
}
if (typeof opts.post_only === 'undefined') {
Expand Down Expand Up @@ -196,7 +196,7 @@ module.exports = function container (get, set, clear) {
created_at: new Date().getTime(),
filled_size: '0'
}
if (err && err.match(/Error: Invalid order: not enough exchange balance$/)) {
if (err && err.toString('Error: Invalid order: not enough exchange balance')) {
status: 'rejected'
reject_reason: 'balance'
return cb(null, order)
Expand Down

0 comments on commit 95e972d

Please sign in to comment.