gferrin / bitfinex

node.js wrapper for bitfinex cryptocurrency exchange
25 stars 20 forks source link

is_hidden does not work when value is false #8

Closed coeniebeyers closed 9 years ago

coeniebeyers commented 9 years ago

Hi,

When I place orders with "is_hidden = true" all is good, but when "is_hidden = false" I get "Error: Key is_hidden was not present."

For reference, not working request: { request: '/v1/order/new', nonce: '1421955474', symbol: 'ltcusd', amount: '0.1', price: '1.431', exchange: 'bitfinex', side: 'sell', type: 'limit', is_hidden: false }

Working request: { request: '/v1/order/new', nonce: '1421955044', symbol: 'ltcusd', amount: '0.1', price: '1.431', exchange: 'bitfinex', side: 'sell', type: 'limit', is_hidden: true }

Is this perhaps an issue at the api?

gferrin commented 9 years ago

It seems to be an issue with the api. I've verified the problem and will push a fix shortly. Thanks for pointing it out.

gferrin commented 9 years ago

Deployed and verified a fix to version 0.3.3

new_order: (symbol, amount, price, exchange, side, type, is_hidden, cb) ->

        if typeof is_hidden is 'function'
            cb = is_hidden
            is_hidden = false

        params = 
            symbol: symbol
            amount: amount
            price: price
            exchange: exchange
            side: side
            type: type

        if is_hidden
            params['is_hidden'] = true

        @make_request('order/new', params, cb)