sample-market-maker: on_error() missing 1 required positional argument: 'error'

  • System: Linux 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Python3: Python 3.5.2
  • Sample-market-maker: https://github.com/BitMEX/sample-market-maker/releases/tag/v1.5
  • Running Command: marketmaker
  • Pip Freeze:
bitmex-market-maker==1.5
bitmex-ws==0.3.1
websocket-client==0.52.0
...

Error Message:

2018-10-03 23:18:00,134 - INFO - market_maker - BitMEX Market Maker Version: v1.1

2018-10-03 23:18:00,134 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2018-10-03 23:18:00,135 - INFO - ws_thread - Authenticating with API Key.
2018-10-03 23:18:00,136 - INFO - ws_thread - Started thread
2018-10-03 23:18:00,138 - ERROR - _logging - error from callback <bound method BitMEXWebsocket.__on_error of <market_maker.ws.ws_thread.BitMEXWebsocket object at 0x7f93a2b3e160>>: __on_error() missing 1 required positional argument: 'error'
2018-10-03 23:18:00,139 - INFO - ws_thread - Websocket Closed
2018-10-03 23:18:05,142 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
  • By the way, I am not sure if the version number is wrong. I downloaded the v1.5 release but got v1.1 while running.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26

Most upvoted comments

I have found why, and I guess it would be applied to most people. Go to here and adding a default value for the parameter error.

Also, if you encounter a new error(which I expect to happen) of: 2018-10-10 01:57:13,537 - ERROR - _logging - error from callback <bound method BitMEXWebsocket.__on_message of <market_maker.ws.ws_thread.BitMEXWebsocket object at 0x7ff2e327c630>>: __on_message() takes 2 positional arguments but 3 were given Go to here, change it to def __on_message(self, ws, message):.

The parameter definiation of the on_message callback function of the websocketApp is here. It is clear that it will pass self to the callback, so we need to prepare a positional argument for it. But for the on_error function, websocketApp takes the error argument as optional instead of positional. That’s why causes the first issue.

@Microos, I fixed this by downgrading to websockets client version 0.47.0

You’re a life-saver! I fixed this issue, as noted by mikeghen, by running the following commands:

sudo pip3 uninstall websocket-client
sudo pip3 install websocket-client==0.47.0

@Microos, I fixed this by downgrading to websockets client version 0.47.0

Thanks - we apologize, 1.5.1 was not uploaded to pypi. So while this was working if you cloned the repository, it was not if you downloaded from pip - which is what we recommend in our README, so this was a mistake.

Please reinstall via pip and the problem should be taken care of.