zenbot icon indicating copy to clipboard operation
zenbot copied to clipboard

opts.order_type is undefined when Bitfinex API is down! unable to call buy, retrying in 10s

Open nao0811ta opened this issue 9 years ago • 9 comments

Code

108     buy: function (opts, cb) {
109       var func_args = [].slice.call(arguments)
110       var client = authedClient()
111       if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'maker') {
112         opts.type = 'exchange limit'
113       }
114       else if (c.bitfinex.wallet === 'exchange' && typeof opts.order_type === 'taker') {
115         opts.type = 'exchange market'
116       }
117       if (typeof opts.post_only === 'undefined') {
118          opts.post_only = true
129        }
......
128       var params = {
129         symbol,
130         amount,
131         price,
132         exchange,
133         side,
134         type,
135         is_hidden,
136         is_postonly
137       }
138 console.error(params)

Result of

[ec2-user@ip-10-166-11-188 zen4-bit-2]$ ./zenbot.sh buy
{ symbol: 'ETCUSD',
  amount: '7.55683975',
  price: '19.6040',
  exchange: 'bitfinex',
  side: 'buy',
  type: undefined,
  is_hidden: false,
  is_postonly: true }

Bitfinex API is down! unable to call buy, retrying in 10s
placing order...

nao0811ta avatar Jun 11 '17 02:06 nao0811ta

@nedievas any chance you can take a look into this?

DeviaVir avatar Jun 11 '17 09:06 DeviaVir

@nedievas Thank you I have a question err.toString('') have to be err.toString().match('')?

FYI, I testing bitfinex backfill with v2 api. it seems well. After testing , I will upload.

nao0811ta avatar Jun 11 '17 18:06 nao0811ta

@nao0811ta string.match(regexp).

Good. I'm thinking of websockets also.

nedievas avatar Jun 11 '17 20:06 nedievas

Your new code is err.toString(regex)

nao0811ta avatar Jun 11 '17 23:06 nao0811ta

still can't buy

Bitfinex API is down! unable to call buy, retryin g in 10s
placing order...
placing order...
placing order...

nao0811ta avatar Jun 12 '17 04:06 nao0811ta

typeof opts.order_type === 'maker' to be c.order_type === 'maker'

nao0811ta avatar Jun 12 '17 05:06 nao0811ta

Still it is not fixed. I will give a fix in a few seconds.

nedievas avatar Jun 12 '17 09:06 nedievas

c.bitfinex.wallet === 'exchange' && c.order_type === 'maker'

err && err.match && err.match(/Error: Invalid order: not enough exchange balance$/)

nao0811ta avatar Jun 12 '17 10:06 nao0811ta

pull

nedievas avatar Jun 12 '17 10:06 nedievas