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

#257 & #262 fix #264

Merged
merged 1 commit into from
Jun 11, 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
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