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

ccxt.pro mexc watch_balance no data #22425

Closed
BEEBSDONE opened this issue May 7, 2024 · 1 comment
Closed

ccxt.pro mexc watch_balance no data #22425

BEEBSDONE opened this issue May 7, 2024 · 1 comment
Assignees
Labels

Comments

@BEEBSDONE
Copy link

BEEBSDONE commented May 7, 2024

Operating System

Windows 10

Programming Languages

Python

CCXT Version

4.2.77

Description

When I try to use watch_balance for mexc, I get no message back at all. Like no error, no message, anything... I've tried to change balance while the script is running to see if it behaves like a ticker, but I didn't get any message. Then I tried to change watch_balance to fetch_balance and I got my balance message. So REST api works but websocket is not working. So it's not a apikey issue either. I really need to use watch_balance for mexc because fetch is too slow. Did someone have any problem like that?
Thank you in advance!

Code

import ccxt.pro as ccxt
import config_shawy
import asyncio

exchange_id = "mexc"
exchange_class = getattr(ccxt, exchange_id)
exchange = exchange_class({
    'apiKey': getattr(config_shawy, f'{exchange_id}_pub_key'),
    'secret': getattr(config_shawy, f'{exchange_id}_priv_key'),
    'enableRateLimit': True
})

async def watch_balance():
    if exchange.has['watchBalance']:
        while True:
            try:
                balance = await exchange.watch_balance({'type' : 'spot'})
                print(balance)
            except Exception as e:
                print(e)
                # stop the loop on exception or leave it commented to retry
                # raise e
    else:
        print("exchange has no watch balance mode")

async def main():
    await watch_balance()

if __name__ == "__main__":
    asyncio.run(main())

@sc0Vu sc0Vu self-assigned this May 8, 2024
@sc0Vu
Copy link
Contributor

sc0Vu commented May 8, 2024

@BEEBSDONE it works for me, I got message when transfer USDT from spot to swap wallet. How do you change your spot balance?

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

No branches or pull requests

2 participants