python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

adding accounts to multiplex on the fly

Open CJ1976 opened this issue 8 years ago • 2 comments

I am still very new at python or any other coding language so if this is an obvious answer and I just don't know what to look for to find it, I apologize. I was wondering if it is possible to add streams to the multiplex socket on the fly? If I make a trade and want more info on the pair I am holding, do I have to restart the multiplex stream each time or is there a way to add the pair I just acquired to the existing stream? Also can I drop info I am recieving on a pair while continuing to receive info for other pairs? Thanks

CJ1976 avatar Jun 11 '18 10:06 CJ1976

You could do something like this listening to the user socket for trades and opening up a socket on trade if thats what you're looking for

def handle_account_socket( m):
    if m['e'] == 'executionReport':
        symbol = m["s"].lower()
        conn_key = bm.start_multiplex_socket([symbol+'@ticker', symbol'@depth'], process_m_message)

K-Kit avatar Jun 15 '18 04:06 K-Kit

Great! Thank you for letting me know how to do this. I have only been messing with python for about a month and have taken a semester of Java and a semester of matlab, so I still don't even know what I don't know.

CJ1976 avatar Jun 15 '18 05:06 CJ1976