Python RunTime error

When I use this code I get the next error:
(RuntimeError: cannot be called from a running event loop)
import alpaca_trade_api as tradeapi

API_KEY= ’ ’

async def bar_callback(t):

def main():
stream = tradeapi.Stream(key_id=API_KEY,base_url=API_ACCOUNT_URL, secret_key=API_SECRET_KEY,data_feed=‘iex’)

data = main()
I would appreciate any help on how to solve it, thanks.

This sounds like you’re using alpaca_trade_api incorrectly. I’d suggest asking in the support channel for that package, as they will likely be able to help you better than we can here.

I already did it three days ago but still haven’t got any response that’s why I’ve post it here