Closed davidjcooper closed 6 years ago
Is there any more output? Does the program terminate?
You could use a script to restart the program automatically. Something like
while true; ./marketmaker; done
Hi Ryan, Here is the output from my run. The bot shutdown automatically.
2018-02-26 21:14:00,971 - INFO - market_maker - Amending Buy: 100 @ 10312.5 to 100 @ 10323.0 (+10.5) 2018-02-26 21:14:00,971 - INFO - bitmex - sending req to https://www.bitmex.com/api/v1/order/bulk: {"orders": [{"orderID": "0b63a8bb-9d20-c582-443a-a8dc35d6ac4a", "orderQty": 100, "price": 10323.0, "side": "Buy"}]} 2018-02-26 21:14:01,011 - WARNING - bitmex - Unable to contact the BitMEX API (503), retrying. Request: https://www.bitmex.com/api/v1/order/bulk {"orders": [{"orderID": "0b63a8bb-9d20-c582-443a-a8dc35d6ac4a", "orderQty": 100, "price": 10323.0, "side": "Buy"}]} Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/market_maker/bitmex.py", line 263, in _curl_bitmex response.raise_for_status() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://www.bitmex.com/api/v1/order/bulk
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/marketmaker", line 11, in
Where do i add the script that you mentioned in your last post? right at the end?
Thanks
The script at the end is something you might run in e.g. bash to restart the market maker.
Have you modified the market maker code? Is the error reproducible?
okay. Is there a way to automatically restart market maker, in the event of such an error. The only changes I have made are to the values of "order pair", "order start size", "Interval", "Min Spread" and "Relist Interval". I have also enabled "Post only" and set very conservative position limits. The error is sporadic. Looks like when the market moves aggressively in one direction, the bot stops. So in that sense I'm not sure if it is reproducible on demand.
Unfortunately, this leaves me with an unwanted open position (either long or short). Had the bot been running, it would've closed my position, albeit at a small loss. If I am not around to restart it immediately, I usually end up with a heavy loss.
If you want to automatically restart the market maker, you might run it via while true; marketmaker; done
instead of marketmaker
.
This library is intended as a reference for programmers. Some familiarity with Python is required to utilize it. Also keep in mind the README:
BitMEX is not responsible for any losses incurred when using this code. This code is intended for sample purposes ONLY - do not use this code for real trades unless you fully understand what it does and what its caveats are. This is not a sophisticated market making program. It is intended to show the basics of market making while abstracting some of the rote work of interacting with the BitMEX API. It does not make smart decisions and will likely lose money.
If you want to automatically restart the market maker, you might run it via while true; marketmaker; done instead of marketmaker.
I'm running the bot on Windows and I start it by opening Windows cmd and typing "marketmaker". However when I try to run it with "while true; marketmaker; done" it doesn't start. Sorry I'm a complete noob in python. Anyone can help me?
Windows CMD doesn't support this syntax: while true; marketmaker; done
.
Also keep in mind the previous message:
This library is intended as a reference for programmers. Some familiarity with Python is required to utilize it. Also keep in mind the README:
BitMEX is not responsible for any losses incurred when using this code. This code is intended for sample purposes ONLY - do not use this code for real trades unless you fully understand what it does and what its caveats are. This is not a sophisticated market making program. It is intended to show the basics of market making while abstracting some of the rote work of interacting with the BitMEX API. It does not make smart decisions and will likely lose money.
Been running script for 7 days. It has disconnected randomly.
websocket disconnected.
Any chance to get an update that checks for the connection and reconnects if it is dropped?