import itchatimport requests#获取价格def get_price(symbol):request = requests.get("/api/v1/contract_index?symbol="+symbol).json()price = request["data"]for item in price:return (item['index_price']) # 获取列表中字典的值#获取并发送消息@itchat.msg_register(itchat.content.TEXT)def print_content(msg):price = get_price(msg['Text'])return "火币合约 " + msg['Text'] + "/USDT 价格为:" + str(price) + " 美元"# 直接将消息返回给发送者itchat.auto_login(hotReload=True)itchat.run(True)
如果觉得《【Python量化交易】13行Python代码编写微信数字货币报价机器人》对你有帮助,请点赞、收藏,并留下你的观点哦!