Crypto-toolbox / btfxwss

Bitfinex Websocket API Client written in Python3
MIT License
284 stars 125 forks source link

New order status #91

Closed pchandra-uchicago closed 6 years ago

pchandra-uchicago commented 6 years ago

Hi Nils,

I am not able to reply on the other thread. Since this issue is off topic, I thought I might as well open a new thread. When I place a new order, order_id is not returned. So there is no way for me to check the execution status of the order when I subscribe to trades.

I am aware that when I authenticate, I am automatically subscribed to account channel. However, I am not aware of how to get the 'te' and 'tu' messages on the account channel.

Thanks Prakash

deepbrook commented 6 years ago

@pchandra-uchicago ,

As stated in #71, it's a matter of reading the documentation. The cidkwarg is a custom id passed by you, which helps you track your order.

Cheers,

Nils

pchandra-uchicago commented 6 years ago

@nlsdfnbch - May be I was not clear in articulating my question.

What I meant was, since I am already subscribed to account channel, is there a way to check my open orders and all other account info from there without actually having to subscribe to trades channel and look for matching 'cid' to see if my trade went through

Thanks Prakash

deepbrook commented 6 years ago

If you'd like to query your open orders, you will have to use the REST API, since there is no such functionality on the websocket API. And again: You do not subscribe to the trades channel to check for your cid you do this on the account channel, as stated in the documentation of the API.

pchandra-uchicago commented 6 years ago

How do i receive updates on the account channel. On the trade channel we do as below wss.authenticate() wss.subscribe_to_trades('LTCUSD') trades = wss.trades('LTCUSD') while not trades.empty(): trades.get()

I don't see a function in btfxwss that will provide me updates on account channel. May be I am missing something

deepbrook commented 6 years ago

As soon as you authenticate, you are subscribed to the account info channel, as defined in the Bitfinex documentation.

To see these messages, the following code will do what you want:


# On production do:
client.orders()  # will return the queue for orders on the time of authentication
client.orders_new() # will return the queue catching all `new order` messages
client.orders_update() # will return the queue catching all `order update` messages
client.orders_cancel() # will return the queue catching all `order cancelled` messages

# On pre-release, the various queue above have been dropped and a single `account` queue is used:
account_q = client.account  # gives you access to the account queue where all account related messages are stored.