Commit 12dd5b6b by wangfa

合约价格同步

parent de2d1e6c
......@@ -4,7 +4,6 @@ from db.redis_db import RedisClientLocal
SOCKET = "wss://fstream.binance.com/ws"
SUBSCRIBE_MESSAGE = "{\"method\": \"SUBSCRIBE\",\"params\":[\"!markPrice@arr\"]}"
MARK_PRICES = {}
def on_open(ws):
......@@ -19,9 +18,8 @@ def on_close(ws):
def on_message(ws, message):
message = json.loads(message)
for item in message:
print(item)
MARK_PRICES[item["s"]] = item["p"]
redis_con.con().set(f"laravel_cache:premium-price:binance:{item['s']}", item['p'])
print("保存成功")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment