print(‘成交记录’,len(df),’条。’)
api.close()
在程序的最后一行,写了api.close(),引发了报错:
Task was destroyed but it is pending!
task: <Task pending name=’Task-49′ coro=<Connection.keepalive() running at C:\Python312\Lib\site-packages\websockets\asyncio\connection.py:815> wait_for=<Future pending cb=[Task.task_wakeup()]>>
关键词是Connection.keepalive() running
虽然是最后一行,不影响当前程序运行,但可能会影响下一个py进程。