for ticker in tickers:
asyncio.create_task(get_natr())
def start_background_loop(side_loop: asyncio.AbstractEventLoop) -> None:
asyncio.set_event_loop(side_loop)
side_loop.run_forever()
async def on_startup(dp):
await bot.set_webhook(config.tg_bot.webhook_url)
new_loop = asyncio.new_event_loop()
t = Thread(target=start_background_loop, args=(new_loop,), daemon=True)
t.start()
asyncio.run_coroutine_threadsafe(orders_queue(), new_loop)
if __name__ == "__main__":
loop.create_task(main(dp, config))
executor.start_webhook(
dp,
config.tg_bot.webhook_path,
on_startup=on_startup,
on_shutdown=on_shutdown,
skip_updates=True
)