Type/to search
0
Follow
1
Followers
متضاد مسائل:
Help
Created 2023-03-17 22:48:45  Updated 2023-03-17 22:49:07
 1
 1558

import asyncio
import aiohttp
import websockets
import json
import pandas as pd
from datetime import datetime

async def get_usdt_symbols():
url = "https://fapi.binance.com/fapi/v1/exchangeInfo"
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
response = await resp.json()
symbols = [symbol_info["symbol"] for symbol_info in response["symbols"] if symbol_info["quoteAsset"] == "USDT" and symbol_info["contractType"] == "PERPETUAL"]
return symbols

async def main():
symbol_list = await get_usdt_symbols()
print(f"Total USDT perpetual symbols: {len(symbol_list)}")

# 在此处添加WebSocket连接和数据处理代码

if name == "main":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

اسی کوڈ میں ، VSCODE میں کوئی غلطی نہیں ہے ، ہم میں یہ غلطی ہے: Traceback (most recent call last): File "<string>", line 1248, in init_ctx File "<string>", line 62, in <module> TypeError: Object of type coroutine is not JSON serializable sys:1: RuntimeWarning: coroutine 'main' was never awaited RuntimeWarning: Enable tracemalloc to get the object allocation traceback
کیا وجہ ہے؟ تمام معاہدے کرنسی کے جوڑے کے ناموں کو حاصل کرنے کے لئے شکریہ

Related Recommendations
Comment
All comments (1)

    "TypeError: Object of type coroutine is not JSON serializable":这个错误表示您尝试将一个类型为 coroutine 的对象序列化为 JSON。您可能需要先使用 await 运行 coroutine,然后序列化它的结果。

    "RuntimeWarning: coroutine 'main' was never awaited":这个警告表示 coroutine 函数 'main' 被调用了,但从未被 await 运行,这意味着该函数还没有被异步执行。为了解决这个问题,您应该在调用 coroutine 函数时使用 await 关键字,或使用适当的异步方法运行它。

    3 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)