理解Websocket Pyhton的模棱两可

时间:2019-08-09 12:52:30

标签: python python-3.x websocket

我正在尝试:

import websocket
import json

def on_open(ws):
    json_data = json.dumps({'ticks':'R_100'})
    ws.send(json_data)

def on_message(ws, message):
    print('ticks update: %s' % message)

if __name__ == "__main__":
    apiUrl = "wss://ws.binaryws.com/websockets/v3?app_id=1089"
    ws = websocket.WebSocketApp(apiUrl, on_message = on_message, on_open = on_open)
    ws.run_forever()

这很好。但是问题是当我想使用有效载荷进行历史记录时:

{
  "ticks_history": "R_50",
  "end": "latest",
  "start": 1,
  "style": "ticks",
  "adjust_start_time": 1,
  "count": 10
}

我不了解应用程序正在运行时究竟需要什么来获取信息,并且无法满足我的请求。
请帮助我解决这个问题。

0 个答案:

没有答案
相关问题