ohenrik / bitfinex

A Python client for the Bitfinex API
MIT License
58 stars 32 forks source link

CID invalid for new orders #27

Closed michielz closed 5 years ago

michielz commented 5 years ago

The cid seems to break placing new orders. However, I can still ping with a cid. Weird...

New order with cid returns the following error: [0, 'n', [1546953056495, 'on-req', None, None, [None, None, 15469530564677380, 'tXRPUSD', None, None, -38, None, 'STOP', None, None, None, 1024, None, None, None, 0.3689, None, 0, 0, None, None, None, 0, 0, None, None, None, None, None, None, None], None, 'ERROR', 'cid: invalid']]

Pong seems to work fine with cid: {'event': 'pong', 'cid': 15469530562543840, 'ts': 1546953056279}

I have made cid option for new orders for those who don't use it. https://github.com/ohenrik/bitfinex/pull/28

ohenrik commented 5 years ago

It seems like we might need to reduce CID multiplier further. I still (sometimes) get cid error.

ohenrik commented 5 years ago

Fixed in 1.1.4. cid multiplier reduced to 10.000

michielz commented 5 years ago

Fixed in 1.1.4. cid multiplier reduced to 10.000

I'd like to know how/why to use cid.

I don't find it useful because I always get a cid back, even when a call fails. So I end up comparing my call to the websocket's reply before storing any data. By this time I can simply use the id generated by Bitfinex.

Am I doing something wrong?

dantimofte commented 5 years ago

If i remember correctly if your order get's executed immediatly you will not get 'on' notification with the id. you will get a 'oc' directly and you won't be able to match it with the request you made.

if you set a cid then you will be able to know which order was filled (oc with SUCCESS)