I was trying to get asyncio to work in parallel, which I thought was its bread and butter? However, it's executing my calls one after another. What am I missing?
async def fetch(stock):
ticker = yfinance.Ticker(stock)
info = ticker.info
return info
async def get_results():
task1 = asyncio.create_task(fetch('AAPL'))
task2 = asyncio.create_task(fetch('TSLA'))
task3 = asyncio.create_task(fetch('GME'))
print(await asyncio.gather(task1, task2, task3))
asyncio.run(get_results())