79167554

Date: 2024-11-07 17:48:34
Score: 1
Natty:
Report link

The problem is that main() does not wait for other tasks to finish, so we need to tell it to wait for them. For example using asyncio.gather():

import asyncio
from binance.client import AsyncClient

async def get_data(client):
  res = await client.get_klines(symbol='BTCUSDT', interval='15m', limit=99)
  print(res)

async def main():
  client = await AsyncClient.create()
  await asyncio.gather(
    get_data(client=client)
  )

asyncio.run(main())
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ramesses III