Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binance Websocket Position updates not working #22281

Open
duggar opened this issue Apr 25, 2024 · 2 comments
Open

Binance Websocket Position updates not working #22281

duggar opened this issue Apr 25, 2024 · 2 comments
Assignees

Comments

@duggar
Copy link

duggar commented Apr 25, 2024

Operating System

Linux

Programming Languages

Python

CCXT Version

4.3.8

Description

watch_balance() method seems to be probelmatic in 4.3.8, it works ok till 4.1.1 when I downgrade

Code

  
    async def stream_account_update(self, symbol, cb=None, start_with_snap=True):
        if start_with_snap:
            try:
                bal = await self.exch.fetch_balance()
                pos = await self.exch.fetch_positions(symbols=[symbol])
            except Exception as e:
                logger.info(type(e).__name__, e)
                logger.info('Error fetching balance and positions')
                logger.info(traceback.format_exc())
                bal, pos = [], []
            else:
                bal = bal['info']['assets']
            bal = [b for b in bal if float(b['walletBalance']) > 0]
            pos = [p['info'] for p in pos]
            newdata = {'b': bal, 'p': pos}
            await cb(newdata, snap=True) if cb else None

        while True:
            newdata = None
            try:
                newdata = await self.exch.watch_balance()
                await cb(newdata, snap=False) if cb else None
            except Exception as e:
                logger.info(type(e).__name__, e)
                logger.info('stream_account_update:', newdata)
                logger.info(traceback.format_exc())
                await self.exch.close()
                self.connect()
@carlosmiei
Copy link
Collaborator

Hello @duggar thanks for reporting it, we will take a look

@pcriadoperez
Copy link
Contributor

Hi @duggar, I was not able to reproduce the error. Can you give more details on the error you are seeing? Do you have a verbose output you could share?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants