__init __()获得了意外的关键字参数'endpoint'

时间:2019-01-05 07:24:03

标签: python python-3.x websocket

我正在尝试使用代码通过websocket获取实时数据

from bitmex_websocket import *
# import logging
# from logging.handlers import RotatingFileHandler
from time import sleep

crypto = "XBTUSD"
api_key = "XXXXX"
api_secret = "YYYYY"
sleeping = 5

def run():
    ws = BitMEXWebsocket(endpoint="https://testnet.bitmex.com/api/v1",
                         symbol=crypto, api_key=api_key, api_secret=api_secret)
    logger.info("Instrument data: %s" % ws.get_instrument())
    while(ws.ws.sock.connected):
        logger.info("Ticker: %s" % ws.get_ticker())
        sleep(sleeping)

if __name__ == "__main__":
    run()

该代码一直工作到今天早上,每5秒获取实时价格,但现在却给我一个错误

2019-01-05 12:47:53 DEBUG [bitmex_websocket._settings_base:24] INFO
Traceback (most recent call last):
  File "F:\Test files\T2.py", line 25, in <module>
    run()
  File "F:\Test files\T2.py", line 17, in run
    symbol=crypto, api_key=api_key, api_secret=api_secret)
TypeError: __init__() got an unexpected keyword argument 'endpoint'
[Finished in 0.5s]

我是python的新手,这是我第一次使用实时数据,我尝试了我能想到的一切,但我无法解决它。

0 个答案:

没有答案