These docs are for v2.0. Click to read the latest docs for v2.0.1.

Discussions

Ask a Question
Back to All

Trying deposit & withdraw code

Hello Bluefin Team,

I copy the deposit & withdraw code and run. But it response error as belows. Need help to fix it

Traceback (most recent call last):
  File "/home/bluefin/deposit_n_withdraw.py", line 45, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/bluefin/deposit_n_withdraw.py", line 26, in main
    resp = await client.get_margin_bank_balance()
  File "/usr/local/lib/python3.10/dist-packages/bluefin_v2_client/client.py", line 760, in get_margin_bank_balance
    raise (Exception("Failed to get balance, Exception: {}".format(e)))
Exception: Failed to get balance, Exception: 'data'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fdafd58e6e0>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fdafd58e980>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fdafd575960>, 2071.017588417)]']
connector: <aiohttp.connector.TCPConnector object at 0x7fdafd58e860>

Hello! Can you please confirm if thiscode snippet is the one you're attempting to run? I noticed there's a spacing issue with the code, but aside from that, it should work fine, especially the get_margin_bank_balance call, as it's just a simple chain call to retrieve the balance. However, if you're still encountering the issue, could you kindly share the code snippet here for me to investigate further if it's any different than the shared above.

Thanks.