Closed tanmaykumar closed 7 years ago
Going with default settings in settings.py, the script shows the following output.
This does not happen in a dry run. BitMEX Testnet also shows that no orders are placed by the API.
Any idea what I could be doing wrong?
2017-05-11 18:34:23,134 - INFO - market_maker - BitMEX Market Maker Version: v1.1-1-g0618543 2017-05-11 18:34:23,135 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position 2017-05-11 18:34:23,135 - INFO - ws_thread - Authenticating with API Key. 2017-05-11 18:34:23,136 - INFO - ws_thread - Started thread 2017-05-11 18:34:24,140 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment... 2017-05-11 18:34:25,295 - INFO - ws_thread - Got all market data. Starting. 2017-05-11 18:34:25,296 - INFO - market_maker - Using symbol XBTUSD. 2017-05-11 18:34:25,296 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades. 2017-05-11 18:34:25,298 - INFO - market_maker - XBTUSD Ticker: Buy: 1845.60, Sell: 1848.30 2017-05-11 18:34:25,298 - INFO - market_maker - Start Positions: Buy: 1836.47, Sell: 1857.44, Mid: 1846.90 2017-05-11 18:34:25,298 - INFO - market_maker - Current XBT Balance: 3.131991 2017-05-11 18:34:25,298 - INFO - market_maker - Current Contract Position: 0 2017-05-11 18:34:25,298 - INFO - market_maker - Contracts Traded This Run: 0 2017-05-11 18:34:25,299 - INFO - market_maker - Total Contract Delta: 0.0000 XBT 2017-05-11 18:34:25,299 - INFO - market_maker - Creating 12 orders: 2017-05-11 18:34:25,299 - INFO - market_maker - Sell 100 @ 1857.4 2017-05-11 18:34:25,299 - INFO - market_maker - Sell 200 @ 1866.7 2017-05-11 18:34:25,300 - INFO - market_maker - Sell 300 @ 1876.1 2017-05-11 18:34:25,300 - INFO - market_maker - Sell 400 @ 1885.4 2017-05-11 18:34:25,300 - INFO - market_maker - Sell 500 @ 1894.9 2017-05-11 18:34:25,300 - INFO - market_maker - Sell 600 @ 1904.3 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 100 @ 1836.5 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 200 @ 1827.3 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 300 @ 1818.2 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 400 @ 1809.2 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 500 @ 1800.2 2017-05-11 18:34:25,300 - INFO - market_maker - Buy 600 @ 1791.2 Traceback (most recent call last): File "./marketmaker", line 4, in <module> market_maker.run() File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 538, in run om.init() File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 212, in init self.reset() File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 220, in reset self.place_orders() File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 317, in place_orders return self.converge_orders(buy_orders, sell_orders) File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 403, in converge_orders self.exchange.create_bulk_orders(to_create) File "/Users/tanmayk/git/sample-market-maker/market_maker/market_maker.py", line 184, in create_bulk_orders return self.bitmex.create_bulk_orders(orders) File "/Users/tanmayk/git/sample-market-maker/market_maker/bitmex.py", line 92, in wrapped return function(self, *args, **kwargs) File "/Users/tanmayk/git/sample-market-maker/market_maker/bitmex.py", line 149, in create_bulk_orders return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST') File "/Users/tanmayk/git/sample-market-maker/market_maker/bitmex.py", line 212, in _curl_bitmex response = self.session.send(prepped, timeout=timeout) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 423, in send timeout=timeout File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request conn.request(method, url, **httplib_request_kw) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1042, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1081, in _send_request self.putheader(hdr, value) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1020, in putheader raise ValueError('Invalid header value %r' % (one_value,)) ValueError: Invalid header value 'liquidbot-v1.1-1-g0618543\n' 2017-05-11 18:34:25,950 - INFO - market_maker - Shutting down. All open orders will be cancelled. 2017-05-11 18:34:25,951 - INFO - ws_thread - Websocket Closed `
Hi - this is not your bug, it's ours, and sorry! It's fixed in #7 and 8f6c089399d26490224dc3131093daf531e175b8. Just pull and re-run.
Works well now, thank you!
Going with default settings in settings.py, the script shows the following output.
This does not happen in a dry run. BitMEX Testnet also shows that no orders are placed by the API.
Any idea what I could be doing wrong?