bitmex / sample-market-maker Goto Github PK
View Code? Open in Web Editor NEWThis project forked from chrisacheson/liquidbot
Sample BitMEX Market Making Bot
License: Apache License 2.0
This project forked from chrisacheson/liquidbot
Sample BitMEX Market Making Bot
License: Apache License 2.0
Hi, The endpoint /position leverage shows initial leverage only but i i didn't find value of auto-leverage as in web interface. Is it possible with api? thx for help
The files created by marketmaker setup
are flatly ignored when executing marketmaker
.
Hello Everyone,
There seems to be some sort of issue with most of the products on the BitMEX market, where the market maker is not able to support most of the coin specific contracts. My traceback looks like this:
ip-192-168-128-40:BATU17 tanaytrivedi$ ./marketmaker
2017-07-07 14:41:17,353 - INFO - market_maker - BitMEX Market Maker Version: v1.1-16-g2a6cfe5
2017-07-07 14:41:17,354 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:EOSN17,trade:EOSN17,instrument,order:EOSN17,execution:EOSN17,margin,position
2017-07-07 14:41:17,354 - INFO - ws_thread - Authenticating with API Key.
2017-07-07 14:41:17,355 - INFO - ws_thread - Started thread
2017-07-07 14:41:18,356 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment...
2017-07-07 14:41:19,781 - INFO - ws_thread - Got all market data. Starting.
2017-07-07 14:41:19,782 - INFO - market_maker - Using symbol EOSN17.
2017-07-07 14:41:19,782 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades.
2017-07-07 14:41:19,782 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-07-07 14:41:21,206 - INFO - market_maker - EOSN17 Ticker: Buy: 0.00, Sell: 0.00
2017-07-07 14:41:21,207 - INFO - market_maker - Start Positions: Buy: 0.00, Sell: 0.00, Mid: 0.00
2017-07-07 14:41:21,207 - INFO - market_maker - Current XBT Balance: 1.958391
2017-07-07 14:41:21,207 - INFO - market_maker - Current Contract Position: 0
2017-07-07 14:41:21,207 - INFO - market_maker - Contracts Traded This Run: 0
Traceback (most recent call last):
File "./marketmaker", line 4, in <module>
market_maker.run()
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 538, in run
om.init()
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 212, in init
self.reset()
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 217, in reset
self.print_status()
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 241, in print_status
logger.info("Total Contract Delta: %.4f XBT" % self.exchange.calc_delta()['spot'])
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 95, in calc_delta
portfolio = self.get_portfolio()
File "/Users/tanaytrivedi/Documents/GitHub/BATU17/market_maker/market_maker.py", line 79, in get_portfolio
raise NotImplementedError("Unknown future type; not quanto or inverse: %s" % instrument['symbol'])
NotImplementedError: Unknown future type; not quanto or inverse: EOSN17
2017-07-07 14:41:21,211 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-07-07 14:41:21,212 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-07-07 14:41:22,424 - INFO - ws_thread - Websocket Closed
From what I can gather from this, the websocket isn't getting the data for these products (in specific this one is EOSN17, but it happens with most products that are not XBT or XBJ contracts) because the initial prices the maker sets are 0.00 and 0.00.
Is this by design? Something that needs to be improved? If it is, I would advocate advertising this on the README file so people can work on adding it.
Thanks,
Tanay Trivedi
2017-11-11 08:15:07,198 - INFO - ws_thread - Connecting to wss://www.bitmex.com/realtime?subscribe=quote:XBTZ17,trade:XBTZ17,instrument
,order:XBTZ17,execution:XBTZ17,margin,position
2017-11-11 08:15:07,198 - INFO - ws_thread - Authenticating with API Key.
2017-11-11 08:15:07,200 - INFO - ws_thread - Started thread
2017-11-11 08:15:08,618 - ERROR - ws_thread - Handshake status 403
2017-11-11 08:15:08,618 - INFO - ws_thread - Websocket Closed
2017-11-11 08:15:09,201 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
I am getting the following error when run marketmaker. I am using Python 3.6. Any help is appreciated.
oracle@segfault::/home/oracle/git/sample-market-maker> ./marketmaker
Traceback (most recent call last):
File "./marketmaker", line 3, in
from market_maker import market_maker
File "/home/oracle/git/sample-market-maker/market_maker/market_maker.py", line 11, in
from market_maker import bitmex
File "/home/oracle/git/sample-market-maker/market_maker/bitmex.py", line 12, in
from market_maker.ws.ws_thread import BitMEXWebsocket
File "/home/oracle/git/sample-market-maker/market_maker/ws/ws_thread.py", line 10, in
from market_maker.settings import settings
File "/home/oracle/git/sample-market-maker/market_maker/settings.py", line 22, in
userSettings = import_path(os.path.join('..', 'settings'))
File "/home/oracle/git/sample-market-maker/market_maker/settings.py", line 17, in import_path
module = import(filename)
ModuleNotFoundError: No module named 'settings'
oracle@segfault::/home/oracle/git/sample-market-maker> pip3.6 freeze
certifi==2017.11.5
chardet==3.0.4
future==0.16.0
idna==2.6
psycopg2==2.7.3.2
requests==2.18.4
six==1.11.0
urllib3==1.22
websocket-client==0.45.0
hello , I am trying to run this bot , I am getting the following error ,I used a testnet api key and secret
and used python 3.5.3 version
fatal: Not a git repository (or any of the parent directories): .git
Importing symbol settings for install...
Unable to find settings-install.py.
2017-12-04 22:59:41,483 - INFO - market_maker - BitMEX Market Maker Version: v1.1
2017-12-04 22:59:41,484 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:install,trade:install,instrument,order:install,execution:install,margin,position
2017-12-04 22:59:41,485 - INFO - ws_thread - Authenticating with API Key.
2017-12-04 22:59:41,485 - INFO - ws_thread - Started thread
2017-12-04 22:59:43,253 - ERROR - ws_thread - Handshake status 403
2017-12-04 22:59:43,253 - INFO - ws_thread - Websocket Closed
2017-12-04 22:59:43,486 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
I'd really appreciate it if you let me know how to deal with it.
Thank you
When I try to run the marketmaker I get this error, has anyone seen or encountered this error before? Thanks.
ERROR - bitmex - Unhandled Error: 400 Client Error: Bad Request for url: https://testnet.bitmex.com/api/v1/order?filter=%7B%22ordStatus.isTerminated%22%3A+false%2C+%22symbol%22%3A+%22XRPH18%22%7D&count=500: {"error":{"message":"This request has expired - expires
is in the past. Current time: 1516534870","name":"HTTPError"}}
I have the bot running all the way to the point where it connects to websocket. For some reason I am getting these errors that are preventing me from getting live data from websocket. I have entered my keys into the settings.py file and have the requirements.txt files properly installed. Not sure how to fix these errors, any help is greatly appreciated, thank you! Errors:
Importing symbol settings for XBTUSD...
Unable to find settings-XBTUSD.py.
2017-12-28 11:37:02,360 - INFO - market_maker - BitMEX Market Maker Version: v1.1
2017-12-28 09:29:43,422 - ERROR - ws_thread - [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
2017-12-28 09:29:43,423 - INFO - ws_thread - Websocket Closed
2017-12-28 09:29:44,329 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
I'm using market maker bot since two months and it was working fine. Since last two weeks Im facing problem of Web Socket limits issue. While I open my account at website a pop-up appears that limits have set 20 connection per hour and my account making requests more than limits. I'm confused and don't know how I can resolve the issue. Please help me in this. I'm using shell script to run bot and this shell script first kill all python process and then start to bot. I have set this shell script / file in crontab and it run after each 10 minutes. Two weeks ago it was working smooth and I'm facing web socket limits issue.
So I've been experimenting with this, but I'm finding it's quite unstable and crashes a lot.
2017-08-16 15:13:37,647 - INFO - ws_thread - Execution: Sell 1500 Contracts of XBTUSD at 4239.9 [334/1871]
2017-08-16 15:13:40,077 - INFO - market_maker - XBTUSD Ticker: Buy: 4233.00, Sell: 4233.20
2017-08-16 15:13:40,078 - INFO - market_maker - Start Positions: Buy: 4230.98, Sell: 4235.22, Mid: 4233.10
2017-08-16 15:13:40,078 - INFO - market_maker - Current XBT Balance: 0.525952
2017-08-16 15:13:40,079 - INFO - market_maker - Current Contract Position: -41429
2017-08-16 15:13:40,079 - INFO - market_maker - Position limits: -100000/100000
2017-08-16 15:13:40,079 - INFO - market_maker - Avg Cost Price: 4205.21
2017-08-16 15:13:40,080 - INFO - market_maker - Avg Entry Price: 4205.21
2017-08-16 15:13:40,080 - INFO - market_maker - Contracts Traded This Run: -78824
2017-08-16 15:13:40,081 - INFO - market_maker - Total Contract Delta: -9.8523 XBT
2017-08-16 15:13:40,081 - INFO - market_maker - Creating 2 orders:
2017-08-16 15:13:40,082 - INFO - market_maker - Sell 1000 @ 4235.2
2017-08-16 15:13:40,082 - INFO - market_maker - Sell 1500 @ 4243.7
2017-08-16 15:13:43,087 - WARNING - bitmex - Timed out, retrying...
2017-08-16 15:13:45,626 - INFO - ws_thread - Execution: Sell 783 Contracts of XBTUSD at 4235.2
2017-08-16 15:13:45,628 - INFO - ws_thread - Execution: Sell 217 Contracts of XBTUSD at 4235.2
2017-08-16 15:13:46,169 - WARNING - bitmex - Timed out, retrying...
2017-08-16 15:13:49,249 - WARNING - bitmex - Timed out, retrying...
2017-08-16 15:13:50,365 - INFO - ws_thread - Execution: Sell 100 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:50,466 - INFO - ws_thread - Execution: Sell 978 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:50,510 - INFO - ws_thread - Execution: Sell 6 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:51,031 - INFO - ws_thread - Execution: Sell 5 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:52,126 - INFO - ws_thread - Execution: Sell 35 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:52,330 - INFO - ws_thread - Execution: Sell 376 Contracts of XBTUSD at 4243.7
2017-08-16 15:13:52,330 - WARNING - bitmex - Timed out, retrying...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 377, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 379, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.5/ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.5/ssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 247, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 686, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen
body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 381, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 309, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.bitmex.com', port=443): Read tim
ed out. (read timeout=3)
During handling of the above exception, another exception occurred: [263/1871]
Traceback (most recent call last):
File "/home/chris/code/sample-market-maker/market_maker/bitmex.py", line 211, in _curl_bitmex
response = self.session.send(prepped, timeout=timeout)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='www.bitmex.com', port=443): Read timed out. (read timeout=
3)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 377, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 379, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.5/ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.5/ssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 247, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 686, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen
body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 381, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 309, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.bitmex.com', port=443): Read tim
ed out. (read timeout=3)
This goes on a lot further.
Here's a different one:
2017-08-16 23:41:45,412 - INFO - market_maker - Buy 3500 @ 4358.7
2017-08-16 23:41:45,460 - ERROR - bitmex - Error: 400 Client Error: Bad Request for url: https://www.bitmex.com/api/v
1/order/bulk: {"error":{"message":"Bulk orders: Order price is above the liquidation price of current short position"
,"name":"ValidationError"}}
2017-08-16 23:41:45,461 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"orderQty": 3500, "clOrdID": "
mm_bitmex_nC11SpgfRmSZ1N2cgGkh7g", "symbol": "XBTUSD", "price": 4358.7, "side": "Buy"}, {"orderQty": 3000, "clOrdID":
"mm_bitmex_gBqkOjYfQuWTBzx9uFGUTw", "symbol": "XBTUSD", "price": 4367.5, "side": "Buy"}, {"orderQty": 2500, "clOrdID
": "mm_bitmex_y+bxQPfvT9Ww9lkMItcYkA", "symbol": "XBTUSD", "price": 4376.2, "side": "Buy"}, {"orderQty": 2000, "clOrd
ID": "mm_bitmex_rEv39rmMSjKe19M2AOPluQ", "symbol": "XBTUSD", "price": 4384.9, "side": "Buy"}, {"orderQty": 1500, "clO
rdID": "mm_bitmex_/EncAvL2R3SwtKUP8+1wNg", "symbol": "XBTUSD", "price": 4393.7, "side": "Buy"}, {"orderQty": 1000, "c
lOrdID": "mm_bitmex_nAMGtFIAT4CLQMAQ51goGw", "symbol": "XBTUSD", "price": 4402.5, "side": "Buy"}, {"orderQty": 3500,
"clOrdID": "mm_bitmex_6etvwgWgTTGZNMZxZuKO3A", "symbol": "XBTUSD", "price": 4451.0, "side": "Sell"}, {"orderQty": 300
0, "clOrdID": "mm_bitmex_1Ds7I4BlTYO9TOTC7Ycxtg", "symbol": "XBTUSD", "price": 4442.2, "side": "Sell"}, {"orderQty":
2500, "clOrdID": "mm_bitmex_S6zWBpMJT82PlF3FbCildg", "symbol": "XBTUSD", "price": 4433.3, "side": "Sell"}, {"orderQty
": 2000, "clOrdID": "mm_bitmex_qu3yO1nPSjuXRv01dxZP+A", "symbol": "XBTUSD", "price": 4424.4, "side": "Sell"}, {"order
Qty": 1500, "clOrdID": "mm_bitmex_GYzen6n5RnaQmKqQ47NVbQ", "symbol": "XBTUSD", "price": 4415.6, "side": "Sell"}, {"or
derQty": 1000, "clOrdID": "mm_bitmex_FKtiFuueRSOxlZfcIGKOwg", "symbol": "XBTUSD", "price": 4406.8, "side": "Sell"}]}
Traceback (most recent call last):
File "marketmaker", line 4, in <module>
market_maker.run()
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 546, in run
om.init()
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 220, in init
self.reset()
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 228, in reset
self.place_orders()
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 325, in place_orders
return self.converge_orders(buy_orders, sell_orders)
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 411, in converge_orders
self.exchange.create_bulk_orders(to_create)
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 192, in create_bulk_orders
return self.bitmex.create_bulk_orders(orders)
File "/home/chris/code/sample-market-maker/market_maker/bitmex.py", line 97, in wrapped
return function(self, *args, **kwargs)
File "/home/chris/code/sample-market-maker/market_maker/bitmex.py", line 154, in create_bulk_orders
return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST')
File "/home/chris/code/sample-market-maker/market_maker/bitmex.py", line 279, in _curl_bitmex
raise e
File "/home/chris/code/sample-market-maker/market_maker/bitmex.py", line 213, in _curl_bitmex
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.bitmex.com/api/v1/order/bulk
2017-08-16 23:41:45,504 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-08-16 23:41:45,504 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/home/chris/code/sample-market-maker/market_maker/market_maker.py", line 497, in exit
sys.exit()
SystemExit
The thing is, whatever happened, you take the greatest risk when the thing stops working. Is it possible to make these exceptions non-fatal?
Hi,
Thanks for fixing my earlier request, I updated the files and that is now longer a problem. I now have another issue relating to calculation.
ip-192-168-128-40:tryagain tanaytrivedi$ ./marketmaker
2017-07-07 16:51:19,091 - INFO - market_maker - BitMEX Market Maker Version: v1.1-18-g396b910
2017-07-07 16:51:19,092 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:EOSN17,trade:EOSN17,instrument,order:EOSN17,execution:EOSN17,margin,position
2017-07-07 16:51:19,092 - INFO - ws_thread - Authenticating with API Key.
2017-07-07 16:51:19,093 - INFO - ws_thread - Started thread
2017-07-07 16:51:20,094 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment...
2017-07-07 16:51:21,120 - INFO - ws_thread - Got all market data. Starting.
2017-07-07 16:51:21,120 - INFO - market_maker - Using symbol EOSN17.
2017-07-07 16:51:21,120 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades.
2017-07-07 16:51:21,121 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-07-07 16:51:22,555 - INFO - market_maker - EOSN17 Ticker: Buy: 0.00, Sell: 0.00
2017-07-07 16:51:22,556 - INFO - market_maker - Start Positions: Buy: 0.00, Sell: 0.00, Mid: 0.00
2017-07-07 16:51:22,556 - INFO - market_maker - Current XBT Balance: 3.256083
2017-07-07 16:51:22,556 - INFO - market_maker - Current Contract Position: -32
2017-07-07 16:51:22,556 - INFO - market_maker - Avg Cost Price: 0.00
2017-07-07 16:51:22,557 - INFO - market_maker - Avg Entry Price: 0.00
2017-07-07 16:51:22,557 - INFO - market_maker - Contracts Traded This Run: 0
Traceback (most recent call last):
File "./marketmaker", line 4, in <module>
market_maker.run()
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 543, in run
om.init()
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 217, in init
self.reset()
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 222, in reset
self.print_status()
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 246, in print_status
logger.info("Total Contract Delta: %.4f XBT" % self.exchange.calc_delta()['spot'])
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 97, in calc_delta
portfolio = self.get_portfolio()
File "/Users/tanaytrivedi/Documents/GitHub/tryagain/market_maker/market_maker.py", line 83, in get_portfolio
multiplier = float(instrument['multiplier']) / float(instrument['underlyingToSettleMultiplier'])
TypeError: float() argument must be a string or a number
2017-07-07 16:51:22,559 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-07-07 16:51:22,559 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-07-07 16:51:23,698 - INFO - ws_thread - Websocket Closed
It seems to me here that in the get_portfolio function the calculation is receiving some kind of error with data type.
Thanks for your help,
Tanay Trivedi
Problem seems related to bulk order.
I don't think Error: 403 is documented on the API.
Auth is working fine. Dry run works fine.
2017-11-11 09:51:30,325 - INFO - market_maker - BitMEX Market Maker Version: v1.1-29-g0f23eaa
2017-11-11 09:51:30,325 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2017-11-11 09:51:30,325 - INFO - ws_thread - Authenticating with API Key.
2017-11-11 09:51:30,326 - INFO - ws_thread - Started thread
2017-11-11 09:51:31,327 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment...
2017-11-11 09:51:36,641 - INFO - ws_thread - Got all market data. Starting.
2017-11-11 09:51:36,642 - INFO - market_maker - Using symbol XBTUSD.
2017-11-11 09:51:36,642 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades.
2017-11-11 09:51:36,642 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2017-11-11 09:51:36,642 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{"ordStatus.isTerminated": false, "symbol": "XBTUSD"}", "count": 500}
2017-11-11 09:51:38,170 - INFO - market_maker - XBTUSD Ticker: Buy: 6746.5, Sell: 6748.0
2017-11-11 09:51:38,171 - INFO - market_maker - Start Positions: Buy: 6713.3, Sell: 6781.2, Mid: 6747.5
2017-11-11 09:51:38,171 - INFO - market_maker - Current XBT Balance: 2.124974
2017-11-11 09:51:38,171 - INFO - market_maker - Current Contract Position: 0
2017-11-11 09:51:38,171 - INFO - market_maker - Contracts Traded This Run: 0
2017-11-11 09:51:38,171 - INFO - market_maker - Total Contract Delta: 0.0000 XBT
2017-11-11 09:51:38,172 - INFO - market_maker - Creating 12 orders:
2017-11-11 09:51:38,172 - INFO - market_maker - Sell 100 @ 6781.0
2017-11-11 09:51:38,172 - INFO - market_maker - Sell 200 @ 6815.0
2017-11-11 09:51:38,173 - INFO - market_maker - Sell 300 @ 6849.0
2017-11-11 09:51:38,173 - INFO - market_maker - Sell 400 @ 6883.5
2017-11-11 09:51:38,173 - INFO - market_maker - Sell 500 @ 6918.0
2017-11-11 09:51:38,173 - INFO - market_maker - Sell 600 @ 6952.5
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 100 @ 6713.5
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 200 @ 6680.0
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 300 @ 6646.5
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 400 @ 6613.5
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 500 @ 6580.5
2017-11-11 09:51:38,173 - INFO - market_maker - Buy 600 @ 6548.0
2017-11-11 09:51:38,174 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order/bulk: {"orders": [{"symbol": "XBTUSD", "price": 6548.0, "orderQty": 600, "side": "Buy", "clOrdID": "mm_bitmex_cjIw9BMGRIqxeFm8picSQA"}, {"symbol": "XBTUSD", "price": 6580.5, "orderQty": 500, "side": "Buy", "clOrdID": "mm_bitmex_/JR/Cv/KTQOc7j0AB3K3jw"}, {"symbol": "XBTUSD", "price": 6613.5, "orderQty": 400, "side": "Buy", "clOrdID": "mm_bitmex_dp3mF+M/Sje+9AaWyPMC4g"}, {"symbol": "XBTUSD", "price": 6646.5, "orderQty": 300, "side": "Buy", "clOrdID": "mm_bitmex_UI2WehQeSe67XPBtptHGNw"}, {"symbol": "XBTUSD", "price": 6680.0, "orderQty": 200, "side": "Buy", "clOrdID": "mm_bitmex_8bo0UyRuRiGysHo3Sb8Jbw"}, {"symbol": "XBTUSD", "price": 6713.5, "orderQty": 100, "side": "Buy", "clOrdID": "mm_bitmex_kxVBKg5SSEaorLzANx+Ksw"}, {"symbol": "XBTUSD", "price": 6952.5, "orderQty": 600, "side": "Sell", "clOrdID": "mm_bitmex_+fQ7MdxKStSjn5efSmxtEg"}, {"symbol": "XBTUSD", "price": 6918.0, "orderQty": 500, "side": "Sell", "clOrdID": "mm_bitmex_VNyMGV21QrmjHzPiB9SVHQ"}, {"symbol": "XBTUSD", "price": 6883.5, "orderQty": 400, "side": "Sell", "clOrdID": "mm_bitmex_HN7Ge9KURv2xFP8RS/ggMA"}, {"symbol": "XBTUSD", "price": 6849.0, "orderQty": 300, "side": "Sell", "clOrdID": "mm_bitmex_7YTNj21xRc+igN8ZVFcWXw"}, {"symbol": "XBTUSD", "price": 6815.0, "orderQty": 200, "side": "Sell", "clOrdID": "mm_bitmex_UXGgNBJyTqGalCJJd+2otQ"}, {"symbol": "XBTUSD", "price": 6781.0, "orderQty": 100, "side": "Sell", "clOrdID": "mm_bitmex_3+FvlJzcRBWcG36LpsCmKA"}]}
2017-11-11 09:51:38,358 - ERROR - bitmex - Unhandled Error: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk: {"error":{"message":"Access Denied","name":"Error"}}
2017-11-11 09:51:38,358 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"symbol": "XBTUSD", "price": 6548.0, "orderQty": 600, "side": "Buy", "clOrdID": "mm_bitmex_cjIw9BMGRIqxeFm8picSQA"}, {"symbol": "XBTUSD", "price": 6580.5, "orderQty": 500, "side": "Buy", "clOrdID": "mm_bitmex_/JR/Cv/KTQOc7j0AB3K3jw"}, {"symbol": "XBTUSD", "price": 6613.5, "orderQty": 400, "side": "Buy", "clOrdID": "mm_bitmex_dp3mF+M/Sje+9AaWyPMC4g"}, {"symbol": "XBTUSD", "price": 6646.5, "orderQty": 300, "side": "Buy", "clOrdID": "mm_bitmex_UI2WehQeSe67XPBtptHGNw"}, {"symbol": "XBTUSD", "price": 6680.0, "orderQty": 200, "side": "Buy", "clOrdID": "mm_bitmex_8bo0UyRuRiGysHo3Sb8Jbw"}, {"symbol": "XBTUSD", "price": 6713.5, "orderQty": 100, "side": "Buy", "clOrdID": "mm_bitmex_kxVBKg5SSEaorLzANx+Ksw"}, {"symbol": "XBTUSD", "price": 6952.5, "orderQty": 600, "side": "Sell", "clOrdID": "mm_bitmex_+fQ7MdxKStSjn5efSmxtEg"}, {"symbol": "XBTUSD", "price": 6918.0, "orderQty": 500, "side": "Sell", "clOrdID": "mm_bitmex_VNyMGV21QrmjHzPiB9SVHQ"}, {"symbol": "XBTUSD", "price": 6883.5, "orderQty": 400, "side": "Sell", "clOrdID": "mm_bitmex_HN7Ge9KURv2xFP8RS/ggMA"}, {"symbol": "XBTUSD", "price": 6849.0, "orderQty": 300, "side": "Sell", "clOrdID": "mm_bitmex_7YTNj21xRc+igN8ZVFcWXw"}, {"symbol": "XBTUSD", "price": 6815.0, "orderQty": 200, "side": "Sell", "clOrdID": "mm_bitmex_UXGgNBJyTqGalCJJd+2otQ"}, {"symbol": "XBTUSD", "price": 6781.0, "orderQty": 100, "side": "Sell", "clOrdID": "mm_bitmex_3+FvlJzcRBWcG36LpsCmKA"}]}
2017-11-11 09:51:38,359 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-11-11 09:51:38,359 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2017-11-11 09:51:38,359 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{"ordStatus.isTerminated": false, "symbol": "XBTUSD"}", "count": 500}
2017-11-11 09:51:39,568 - INFO - ws_thread - Websocket Closed
Hi , my my can't verify the SSl certificate, both testnet and main site. What can be a problem?
2017-10-02 08:38:45,900 - DEBUG - ws_thread - Connecting WebSocket.
2017-10-02 08:38:45,900 - INFO - ws_thread - Connecting to wss://www.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2017-10-02 08:38:45,900 - DEBUG - ws_thread - Starting thread
2017-10-02 08:38:45,900 - INFO - ws_thread - Authenticating with API Key.
2017-10-02 08:38:45,901 - INFO - ws_thread - Started thread
2017-10-02 08:38:45,974 - ERROR - ws_thread - [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
2017-10-02 08:38:45,974 - INFO - ws_thread - Websocket Closed
2017-10-02 08:38:46,902 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
Thank you!
Best Regards.
Hi,
It's just on testnet. The market maker bot started and shutted down immediately after display 6 buys and 6 sells information. Any ideas. Thanks!
Below are log and my setting.py
Log:
2018-01-15 16:31:48,213 - INFO - market_maker - BitMEX Market Maker Version: v1.1
2018-01-15 16:31:48,214 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2018-01-15 16:31:48,214 - INFO - ws_thread - Authenticating with API Key.
2018-01-15 16:31:48,217 - INFO - ws_thread - Started thread
2018-01-15 16:31:51,219 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment...
2018-01-15 16:31:51,822 - INFO - ws_thread - Got all market data. Starting.
2018-01-15 16:31:51,822 - INFO - market_maker - Using symbol XBTUSD.
2018-01-15 16:31:51,822 - INFO - market_maker - Initializing dry run. Orders printed below represent what would be posted to BitMEX.
2018-01-15 16:31:51,825 - INFO - market_maker - XBTUSD Ticker: Buy: 13731.0, Sell: 13736.0
2018-01-15 16:31:51,832 - INFO - market_maker - Start Positions: Buy: 13662.8, Sell: 13804.2, Mid: 13733.0
2018-01-15 16:31:51,834 - INFO - market_maker - Current XBT Balance: 0.000000
2018-01-15 16:31:51,835 - INFO - market_maker - Current Contract Position: 0
2018-01-15 16:31:51,835 - INFO - market_maker - Contracts Traded This Run: 0
2018-01-15 16:31:51,835 - INFO - market_maker - Total Contract Delta: 0.0000 XBT
2018-01-15 16:31:51,836 - INFO - market_maker - Creating 12 orders:
2018-01-15 16:31:51,838 - INFO - market_maker - Sell 100 @ 13804.0
2018-01-15 16:31:51,838 - INFO - market_maker - Sell 200 @ 13873.0
2018-01-15 16:31:51,838 - INFO - market_maker - Sell 300 @ 13942.5
2018-01-15 16:31:51,839 - INFO - market_maker - Sell 400 @ 14012.5
2018-01-15 16:31:51,842 - INFO - market_maker - Sell 500 @ 14082.5
2018-01-15 16:31:51,842 - INFO - market_maker - Sell 600 @ 14153.0
2018-01-15 16:31:51,842 - INFO - market_maker - Buy 100 @ 13663.0
2018-01-15 16:31:51,844 - INFO - market_maker - Buy 200 @ 13595.0
2018-01-15 16:31:51,844 - INFO - market_maker - Buy 300 @ 13527.0
2018-01-15 16:31:51,845 - INFO - market_maker - Buy 400 @ 13460.0
2018-01-15 16:31:51,845 - INFO - market_maker - Buy 500 @ 13393.0
2018-01-15 16:31:51,845 - INFO - market_maker - Buy 600 @ 13326.5
2018-01-15 16:31:51,845 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2018-01-15 16:31:51,846 - ERROR - _logging - close status: 31522
2018-01-15 16:31:51,848 - INFO - ws_thread - Websocket Closed
setting.py
from os.path import join
import logging
########################################################################################################################
########################################################################################################################
BASE_URL = "https://testnet.bitmex.com/api/v1/"
API_KEY = "WH2ncvk3SyHUV9CWMTuFe48a"
API_SECRET = "pmxBrD2iaDvaFFis9sCMbPWT-ckGh2nskevisY52cUWREIIn"
########################################################################################################################
########################################################################################################################
SYMBOL = "XBTUSD"
########################################################################################################################
########################################################################################################################
ORDER_PAIRS = 6
ORDER_START_SIZE = 100
ORDER_STEP_SIZE = 100
INTERVAL = 0.005
MIN_SPREAD = 0.01
MAINTAIN_SPREADS = True
RELIST_INTERVAL = 0.01
########################################################################################################################
########################################################################################################################
CHECK_POSITION_LIMITS = False
MIN_POSITION = -10000
MAX_POSITION = 10000
POST_ONLY = False
########################################################################################################################
########################################################################################################################
DRY_RUN = True
LOOP_INTERVAL = 5
API_REST_INTERVAL = 1
API_ERROR_INTERVAL = 10
DRY_BTC = 50
LOG_LEVEL = logging.INFO
ORDERID_PREFIX = "mm_bitmex_"
WATCHED_FILES = [join("market_maker", f) for f in ["market_maker.py", "bitmex.py", file]]
########################################################################################################################
########################################################################################################################
CONTRACTS = ['XBTUSD']
my "on_close" function actually looks like this:
def __on_close(self, ws):
self.logger.warning('Websocket Closed.')
self.exit()
not sure why i am getting this error "__on_close() takes exactly 2 arguments (4 given)"
has anyone seen similar error?
sample-market-maker/test/websocket-apikey-auth-test.py
line 107, api key should be byte encoded before being passed to hmac
signature = hmac.new(bytes(secret, 'utf8'), bytes(message, 'utf8'), digestmod=hashlib.sha256).hexdigest()
^ from APIKeyAuth.py
settings.py (line 37):
settings.update(vars(baseSettings))
fails to load settings from baseSettings
(market_maker_settings_base.py).
Because of this, authentication will always fail (because settings.API_KEY
does not exists).
I am running it on the testnet. There is 5.54 XBT under my account. But when I run the marketmaker, it shows 0?
2018-01-01 03:17:10,664 - INFO - market_maker - Current XBT Balance: 0.000000
2018-01-01 03:17:10,664 - INFO - market_maker - Current Contract Position: 0
2018-01-01 03:17:10,664 - INFO - market_maker - Contracts Traded This Run: 0
2018-01-01 03:17:10,664 - INFO - market_maker - Total Contract Delta: 0.0000 XBT
Im getting this error now
HTTPError: 400 Client Error: Bad Request for url: https://www.bitmex.com/api/v1/order/bulk
Hi,
what is the correct manner to subscribe multiple securities in topic orderbook10?
I tried throwing a list of ["'orderBook10:XBTZ17"","orderBook10:ETHZ17"] but it seems i am only receiving XBT market data.
Thanks.
Running in Windows 8.1 pro, 8G RAM, latest python 2.7.14
FYI
Bot is great, thank you :)
2017-09-18 09:30:03,226 - INFO - market_maker - Contracts Traded This Run: -2000
2017-09-18 09:30:03,226 - INFO - market_maker - Total Contract Delta: 0.2591 XBT
2017-09-18 09:30:03,227 - INFO - market_maker - Creating 2 orders:
2017-09-18 09:30:03,227 - INFO - market_maker - Sell 300 @ 3808.5
2017-09-18 09:30:03,227 - INFO - market_maker - Sell 400 @ 3827.6
2017-09-18 09:30:08,164 - WARNING - bitmex - Timed out, retrying...
Traceback (most recent call last):
File "marketmaker", line 4, in
market_maker.run()
File "E:\market-maker-master\market_maker\market_maker.py", line 547, in run
om.run_loop()
File "E:\market-maker-master\market_maker\market_maker.py", line 515, in run_loop
self.place_orders() # Creates desired orders and converges to existing orders
File "E:\market-maker-master\market_maker\market_maker.py", line 325, in place_orders
return self.converge_orders(buy_orders, sell_orders)
File "E:\market-maker-master\market_maker\market_maker.py", line 411, in converge_orders
self.exchange.create_bulk_orders(to_create)
File "E:\market-maker-master\market_maker\market_maker.py", line 192, in create_bulk_orders
return self.bitmex.create_bulk_orders(orders)
File "E:\market-maker-master\market_maker\bitmex.py", line 97, in wrapped
return function(self, *args, **kwargs)
File "E:\market-maker-master\market_maker\bitmex.py", line 154, in create_bulk_orders
return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST')
File "E:\market-maker-master\market_maker\bitmex.py", line 285, in _curl_bitmex
return self._curl_bitmex(api, query, postdict, timeout, verb)
File "E:\market-maker-master\market_maker\bitmex.py", line 262, in _curl_bitmex
query={'filter': json.dumps({'clOrdID': postdict['clOrdID']})},
KeyError: 'clOrdID'
2017-09-18 09:30:11,865 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-09-18 09:30:11,865 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-09-18 09:30:12,744 - INFO - market_maker - Cancelling: Buy 500 @ 3704.60
2017-09-18 09:30:12,744 - INFO - market_maker - Cancelling: Buy 400 @ 3723.10
2017-09-18 09:30:12,744 - INFO - market_maker - Cancelling: Buy 300 @ 3741.70
2017-09-18 09:30:12,746 - INFO - market_maker - Cancelling: Sell 500 @ 3817.10
2017-09-18 09:30:12,746 - INFO - market_maker - Cancelling: Sell 400 @ 3827.60
2017-09-18 09:30:12,746 - INFO - market_maker - Cancelling: Sell 300 @ 3808.50
2017-09-18 09:30:14,852 - INFO - ws_thread - Websocket Closed
I have been looking through the API docs at Bitmex, but cannot see how to add a simple PnL for open trades. Any advice please?
HI,
I'm getting "Access Denied" error. I created my API key on the testnet with "orderCancel" permissions.
Running with python2 on Mac.
Log shows:
2017-10-26 18:02:31,244 - ERROR - bitmex - Error: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk: {"error":{"message":"Access Denied","name":"Error"}}
2017-10-26 18:02:31,244 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"symbol": "XBTUSD", "price": 5906.5, "orderQty": 10, "side": "Buy", "clOrdID": "mm_bitmex_fZI7kBSpQ6KZQsjONtaGhw"}, {"symbol": "XBTUSD", "price": 5965.8, "orderQty": 10, "side": "Sell", "clOrdID": "mm_bitmex_KS/Ta+XjT4SsgJZJg81qYg"}]}
Traceback (most recent call last):
File "./marketmaker", line 4, in
market_maker.run()
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 546, in run
om.init()
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 220, in init
self.reset()
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 228, in reset
self.place_orders()
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 325, in place_orders
return self.converge_orders(buy_orders, sell_orders)
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 411, in converge_orders
self.exchange.create_bulk_orders(to_create)
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/market_maker.py", line 192, in create_bulk_orders
return self.bitmex.create_bulk_orders(orders)
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/bitmex.py", line 97, in wrapped
return function(self, *args, **kwargs)
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/bitmex.py", line 154, in create_bulk_orders
return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST')
File "/Users/admin/Documents/Projects/Mark/traderjoe/mmaker/sample-market-maker-master/market_maker/bitmex.py", line 280, in _curl_bitmex
raise e
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk
2017-10-26 18:02:31,245 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-10-26 18:02:31,246 - INFO - market_maker - Resetting current position. Cancelling all existing orders.
2017-10-26 18:02:32,298 - INFO - ws_thread - Websocket Closed
I have just created my api keys and inserted them into settings.py.
When I ran marketmaker, I kept getting the following error.
2018-01-26 22:53:29,720 - ERROR - bitmex - Unhandled Error: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk: {"error":{"message":"Access Denied","name":"HTTPError"}}
...
...
2018-01-26 22:53:29,720 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2018-01-26 22:53:29,720 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2018-01-26 22:53:29,721 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{"ordStatus.isTerminated": false, "symbol": "XBTUSD"}", "count": 500}
2018-01-26 22:53:31,012 - ERROR - _logging - close status: 31522
Can you please help? Thanks!
I've been operating this bot on the test net for the last couple of days. Noticed today it started failing. Any idea why it started failing? What does 'Invalid price tickSize' mean? Is that the price of 7290.3 or the orderQty of 285.0.
2017-11-04 22:25:39,591 - INFO - market_maker - Buy 285 @ 7290.3
2017-11-04 22:25:39,640 - ERROR - bitmex - Error: 400 Client Error: Bad Request for url: https://testnet.bitmex.com/api/v1/order/bulk: {"error":{"message":"Invalid price tickSize","name":"HTTPError"}}
2017-11-04 22:25:39,642 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"symbol": "XBTUSD", "price": 7290.3, "orderQty": 285.0, "side": "Buy", "clOrdID": "mm_bitmex_kHgl4pzURu2h/bjFujJzlA"}, {"symbol": "XBTUSD", "price": 7326.8, "orderQty": 235.0, "side": "Buy", "clOrdID": "mm_bitmex_ldk+C3hNT2isCqR7Z0kuRg"}, {"symbol": "XBTUSD", "price": 7363.4, "orderQty": 185.0, "side": "Buy", "clOrdID": "mm_bitmex_p0YXwlQpTA6DcwYBAhhHcg"}, {"symbol": "XBTUSD", "price": 7400.2, "orderQty": 135.0, "side": "Buy", "clOrdID": "mm_bitmex_vqwj3R3oRt2gtuMKWSFTlw"}]}
Traceback (most recent call last):
File "/mnt/mm2/marketmaker", line 4, in
market_maker.run()
File "/mnt/mm2/market_maker/market_maker.py", line 617, in run
om.init()
File "/mnt/mm2/market_maker/market_maker.py", line 225, in init
self.reset()
File "/mnt/mm2/market_maker/market_maker.py", line 233, in reset
self.place_orders()
File "/mnt/mm2/market_maker/market_maker.py", line 363, in place_orders
return self.converge_orders(buy_orders, sell_orders)
File "/mnt/mm2/market_maker/market_maker.py", line 451, in converge_orders
self.exchange.create_bulk_orders(to_create)
File "/mnt/mm2/market_maker/market_maker.py", line 196, in create_bulk_orders
return self.bitmex.create_bulk_orders(orders)
File "/mnt/mm2/market_maker/bitmex.py", line 97, in wrapped
return function(self, *args, **kwargs)
File "/mnt/mm2/market_maker/bitmex.py", line 154, in create_bulk_orders
return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST')
File "/mnt/mm2/market_maker/bitmex.py", line 280, in _curl_bitmex
raise e
RESTART: \bitmex\sample-market-maker-master\market_maker.py
Traceback (most recent call last):
File "\bitmex\sample-market-maker-master\market_maker.py", line 11, in
from market_maker import bitmex
File "\bitmex\sample-market-maker-master\market_maker\bitmex.py", line 12, in
from market_maker.ws.ws_thread import BitMEXWebsocket
File "\bitmex\sample-market-maker-master\market_maker\ws\ws_thread.py", line 10, in
from market_maker.settings import settings
File "\bitmex\sample-market-maker-master\market_maker\settings.py", line 22, in
userSettings = import_path(os.path.join('..', 'settings'))
File "\bitmex\sample-market-maker-master\market_maker\settings.py", line 17, in import_path
module = import(filename)
ModuleNotFoundError: No module named 'settings'
Any idea what I am doing wrong
After pip install, i get this error when I try to run marketmaker setup
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?
Hello ,
On November 12th Bitmex updated their policy regarding the number of orders submitted a time to 100.
Starting November 12, 2017, at 12:00 UTC, the API will limit calls to bulk order endpoints to a maximum count of 100. Calls with a larger number of orders will be rejected with a status code of 400 and the message Too many orders provided. The maximum count allowed is 100.
https://blog.bitmex.com/api_announcement/limits-to-bulk-order-endpoints/
Therefore, on rush moments the script stops working. Please find below the output.
`017-11-16 09:51:48,956 - INFO - ws_thread - Execution: Sell 22 Contracts of XBTUSD at 7418.0
2017-11-16 09:51:48,961 - INFO - ws_thread - Execution: Sell 12 Contracts of XBTUSD at 7410.5
2017-11-16 09:51:48,966 - INFO - ws_thread - Execution: Sell 2 Contracts of XBTUSD at 7403.0
2017-11-16 09:51:49,563 - INFO - ws_thread - Execution: Sell 32 Contracts of XBTUSD at 7424.0
2017-11-16 09:51:51,916 - INFO - market_maker - XBTUSD Ticker: Buy: 7421.0, Sell: 7421.5
2017-11-16 09:51:51,916 - INFO - market_maker - Start Positions: Buy: 7410.4, Sell: 7432.1, Mid: 7421.5
2017-11-16 09:51:51,917 - INFO - market_maker - Current XBT Balance: 0.004284
2017-11-16 09:51:51,917 - INFO - market_maker - Current Contract Position: -444
2017-11-16 09:51:51,917 - INFO - market_maker - Avg Cost Price: 7355.1
2017-11-16 09:51:51,917 - INFO - market_maker - Avg Entry Price: 7355.1
2017-11-16 09:51:51,917 - INFO - market_maker - Contracts Traded This Run: -400
2017-11-16 09:51:51,917 - INFO - market_maker - Total Contract Delta: -0.0604 XBT
2017-11-16 09:51:51,918 - INFO - market_maker - Amending Buy: 2 @ 7328.5 to 2 @ 7410.5 (+82.0)
2017-11-16 09:51:51,918 - INFO - market_maker - Amending Buy: 12 @ 7321.0 to 12 @ 7403.0 (+82.0)
2017-11-16 09:51:51,919 - INFO - bitmex - sending req to https://www.bitmex.com/api/v1/order/bulk: {"orders": [{"orderID": "2b004aa2-28f7-1865-8b2c-645252310b44", "price": 7403.0, "orderQty": 12, "side": "Buy"}, {"orderID": "41707f41-091e-7eb8-a5f7-a0b0cf89b2d9", "price": 7410.5, "orderQty": 2, "side": "Buy"}]}
2017-11-16 09:51:56,928 - WARNING - bitmex - Timed out on request: order/bulk ({"orders": [{"orderID": "2b004aa2-28f7-1865-8b2c-645252310b44", "price": 7403.0, "orderQty": 12, "side": "Buy"}, {"orderID": "41707f41-091e-7eb8-a5f7-a0b0cf89b2d9", "price": 7410.5, "orderQty": 2, "side": "Buy"}]}), retrying...
Traceback (most recent call last):
File "./marketmaker", line 4, in
market_maker.run()
File "/home/muthabor/git/sample-market-maker/market_maker/market_maker.py", line 550, in run
om.run_loop()
File "/home/muthabor/git/sample-market-maker/market_maker/market_maker.py", line 518, in run_loop
self.place_orders() # Creates desired orders and converges to existing orders
File "/home/muthabor/git/sample-market-maker/market_maker/market_maker.py", line 328, in place_orders
return self.converge_orders(buy_orders, sell_orders)
File "/home/muthabor/git/sample-market-maker/market_maker/market_maker.py", line 399, in converge_orders
self.exchange.amend_bulk_orders(to_amend)
File "/home/muthabor/git/sample-market-maker/market_maker/market_maker.py", line 187, in amend_bulk_orders
return self.bitmex.amend_bulk_orders(orders)
File "/home/muthabor/git/sample-market-maker/market_maker/bitmex.py", line 102, in wrapped
return fn(self, *args, **kwargs)
File "/home/muthabor/git/sample-market-maker/market_maker/bitmex.py", line 166, in amend_bulk_orders
return self._curl_bitmex(path='order/bulk', postdict={'orders': orders}, verb='PUT', rethrow_errors=True)
File "/home/muthabor/git/sample-market-maker/market_maker/bitmex.py", line 346, in _curl_bitmex
return retry()
File "/home/muthabor/git/sample-market-maker/market_maker/bitmex.py", line 247, in retry
raise Exception("Max retries on %s (%s) hit, raising." % (path, json.dumps(postdict or '')))
Exception: Max retries on order/bulk ({"orders": [{"orderID": "2b004aa2-28f7-1865-8b2c-645252310b44", "price": 7403.0, "orderQty": 12, "side": "Buy"}, {"orderID": "41707f41-091e-7eb8-a5f7-a0b0cf89b2d9", "price": 7410.5, "orderQty": 2, "side": "Buy"}]}) hit, raising.
2017-11-16 09:51:56,955 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2017-11-16 09:51:56,956 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2017-11-16 09:51:56,956 - INFO - bitmex - sending req to https://www.bitmex.com/api/v1/order: {"filter": "{"ordStatus.isTerminated": false, "symbol": "XBTUSD"}", "count": 500}
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Buy 42 @ 7315.5
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Buy 32 @ 7326.0
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Buy 22 @ 7330.5
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Buy 12 @ 7403.0
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Buy 2 @ 7410.5
2017-11-16 09:51:57,223 - INFO - market_maker - Canceling: Sell 42 @ 7431.0
2017-11-16 09:51:57,224 - INFO - bitmex - sending req to https://www.bitmex.com/api/v1/order: {"orderID": ["5b901309-0c19-22cb-6643-1076c1fa26df", "54b0876b-2614-e56c-4ee0-95b6e8718af0", "2ea229ad-ce78-8578-eb40-3ba09eac2f2c", "2b004aa2-28f7-1865-8b2c-645252310b44", "41707f41-091e-7eb8-a5f7-a0b0cf89b2d9", "5b88cc1e-5eb9-8b9b-d3c6-620dd906f0f4"]}
`
Hi , I am trying to run this bot , however after providing my API key and secret, I am getting the following error :
2017-08-19 21:56:44,853 - INFO - ws_thread - Authenticating with API Key.
2017-08-19 21:56:44,854 - INFO - ws_thread - Started thread
2017-08-19 21:56:45,391 - ERROR - ws_thread - Handshake status 401
2017-08-19 21:56:45,392 - INFO - ws_thread - Websocket Closed
Any idea why this happening ? Any hint would be greatly appreciated !
Thanks a lot !
Best.
Hey, I have been using a modified version of your market maker and I think its pretty great. You saved me a tonne of time so thank you. There is something that you should know about with the bitmex exchange that caused me issues. When you amend an order via order/bulk the exchange doesn't check if the order was filled before moving it, this means if the exchange is busy you can get multiple fills from the same order. In the market maker currently you don't keep information about the current state of orders and if they were successfully cancelled or amended. This is only an issue if the exchange response time is greater than settings.LOOP_INTERVAL but when things get really crazy it is possible to blow your risk limits but placing a lot more orders than you intended to. The fix is to have a state engine in the order manager that keeps track of the messages sent to the exchange and then maps these onto the state of the order to avoid sending multiple messages if you have not had a response from the first.
Hi, I have a bot that updates prices every 30 secs using the market-maker code. It works fine 99% of the time.
Usually every 24-48hrs of continuous running, I get the following error:
ERROR - ws_thread - [WinError 10054] An existing connection was forcibly closed by the remote host
INFO - ws_thread - Websocket Closed
After that, the prices don't update and I have to restart the bot.
Hi I couldn't find market order code in sample-marker-maker or maybe I miss something.
Can you share me how to send market order?
I know that I can sens limit order with much higher price but it is not enough solution.
thanks
Hi
I dont know how to handle this exception and avoid exit but make restart or skip this exception.
Can you help?
Exception: Attempted to recover from duplicate clOrdID, but order returned from API did not match POST. POST data: {"symbol": "XBTUSD", "orderQty": -200, "price": 12558.5, "clOrdID": "mm_bitmex_Koc1va+9ScWjROsXLqXm0A"}
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://testnet.bitmex.com/api/v1/order/bulk
2017-12-16 16:34:15,731 - INFO - market_maker - Shutting down. All open orders will be cancelled.
^some kind of issue with bulk? wont start
I tried to run the marketmaker python bot and it occasionally bummed out due to the following error. Sometimes it could run for hours and sometimes for only a few minutes. So far I haven't found any clue. Maybe a network traffic issue? Can you please help? Thanks!
2018-01-31 16:07:11,802 - INFO - bitmex - sending req to https://www.bitmex.com/api/v1/order/bulk: {"orders": [{"side": "Buy", "orderQty": 700, "orderID": "c5af9dc6-04f6-5d0f-8629-2f0d72e1f2e0", "price": 9914.0}, {"side": "Buy", "orderQty": 600, "orderID": "71e4389f-c877-2817-3e5d-3959463871b5", "price": 9963.5}, {"side": "Buy", "orderQty": 500, "orderID": "d2a55d15-7081-8a5c-8b40-a7a0fd50b208", "price": 10013.5}, {"side": "Buy", "orderQty": 400, "orderID": "8e2dde49-0b4f-a575-f3c1-583aa52375b0", "price": 10063.5}, {"side": "Buy", "orderQty": 300, "orderID": "4ab5c80e-a41c-d2d9-0bfd-787f4d1d1743", "price": 10114.0}, {"side": "Buy", "orderQty": 200, "orderID": "701ae0b2-69f9-dba7-12ae-ba6d2096faff", "price": 10164.5}, {"side": "Sell", "orderQty": 700, "orderID": "4ad09c98-745d-2ba2-7525-b9093bcc5c68", "price": 10530.0}, {"side": "Sell", "orderQty": 600, "orderID": "6f35b43c-393a-3570-7dd6-fbf70d453e25", "price": 10477.5}, {"side": "Sell", "orderQty": 500, "orderID": "a4b13571-3662-5089-aaa5-ac91195c01cd", "price": 10425.5}, {"side": "Sell", "orderQty": 400, "orderID": "51224d15-98e4-5a57-ec08-ee7f8990e489", "price": 10373.5}]}
2018-01-31 16:07:13,465 - WARNING - bitmex - Unable to contact the BitMEX API (503), retrying. Request: https://www.bitmex.com/api/v1/order/bulk
{"orders": [{"side": "Buy", "orderQty": 700, "orderID": "c5af9dc6-04f6-5d0f-8629-2f0d72e1f2e0", "price": 9914.0}, {"side": "Buy", "orderQty": 600, "orderID": "71e4389f-c877-2817-3e5d-3959463871b5", "price": 9963.5}, {"side": "Buy", "orderQty": 500, "orderID": "d2a55d15-7081-8a5c-8b40-a7a0fd50b208", "price": 10013.5}, {"side": "Buy", "orderQty": 400, "orderID": "8e2dde49-0b4f-a575-f3c1-583aa52375b0", "price": 10063.5}, {"side": "Buy", "orderQty": 300, "orderID": "4ab5c80e-a41c-d2d9-0bfd-787f4d1d1743", "price": 10114.0}, {"side": "Buy", "orderQty": 200, "orderID": "701ae0b2-69f9-dba7-12ae-ba6d2096faff", "price": 10164.5}, {"side": "Sell", "orderQty": 700, "orderID": "4ad09c98-745d-2ba2-7525-b9093bcc5c68", "price": 10530.0}, {"side": "Sell", "orderQty": 600, "orderID": "6f35b43c-393a-3570-7dd6-fbf70d453e25", "price": 10477.5}, {"side": "Sell", "orderQty": 500, "orderID": "a4b13571-3662-5089-aaa5-ac91195c01cd", "price": 10425.5}, {"side": "Sell", "orderQty": 400, "orderID": "51224d15-98e4-5a57-ec08-ee7f8990e489", "price": 10373.5}]}
Traceback (most recent call last):
File "/home/longbeach/bitmex/market_maker/bitmex.py", line 263, in _curl_bitmex
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 840, 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
It could be I'm using it wrong, but as far as i can tell the version of sample-market-maker you get when you install via pip is completely busted.
2017-10-11 15:49:34,454 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2017-10-11 15:49:34,454 - INFO - ws_thread - Authenticating with API Key.
2017-10-11 15:49:34,455 - INFO - ws_thread - Started thread
2017-10-11 15:49:39,461 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
Whenever I try to run the './marmetmaker' command, it exits with the above given error. I tried changing the API keys, but no use.
An improvement to this bot would be to help the orders stay open for longer or only cancel them at the last minute to give the orders a higher probability of executing. (reducing the amount of time that there are no orders open in the market)
For now i have been increasing the sleep interval so it sleeps longer and thus leaves orders open for longer in the market.
May get time to do this in my fork which adds support for forecasts at https://github.com/BitBanknz/sample-market-maker
Thanks.
Kind Regards,
Lee - Founder
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/anaconda/lib/python3.6/site-packages/bitmex_market_maker-1.3-py3.6.egg/market_maker/market_maker.py", line 501, in exit
2018-01-26 20:04:50,636 - INFO - ws_thread - Websocket Closed
sys.exit()
Happens when I run in DRYRUN=True
It looks to me like the BitMEX REST API connector will not retry placing an order (which uses POST) on a 503 error, which happens frequently when placing an order during times of heavy volatility:
sample-market-maker/market_maker/bitmex.py
Lines 228 to 233 in 61f5d67
This is contrary to the official BitMEX recommendation:
To help improve responsiveness during high-load periods, the BitMEX trading engine will begin load-shedding when requests reach a critical queue depth. When this happens, you will quickly receive a 503 status code with the message βThe system is currently overloaded. Please try again later.β The request will not have reached the engine, and you should retry after at least 500 milliseconds.
https://blog.bitmex.com/api_announcement/scheduled-maintenance-november-9-2017/
I'm trying to run the commad:
$ ./marketmaker XBTUSD
which returns the following:
'Traceback (most recent call last):
File "./marketmaker", line 3, in
from market_maker import market_maker
File "/home/bitBot/sample-market-maker/market_maker/market_maker.py", line 11, in
from market_maker import bitmex
File "/home/bitBot/sample-market-maker/market_maker/bitmex.py", line 12, in
from market_maker.ws.ws_thread import BitMEXWebsocket
File "/home/bitBot/sample-market-maker/market_maker/ws/ws_thread.py", line 104
return {k: round(float(v or 0), instrument['tickLog']) for k, v in iteritems(ticker)}
^
SyntaxError: invalid syntax'
I'm assuming I don't have the correct dependencies installed. If that is not the issue, than what have I missed?
Hello there,
Last week I was still able to run the sample market maker but now I 'm getting the following error:
2017-10-31 14:07:40,680 - ERROR - bitmex - Error: 400 Client Error: Bad Request for url: https://testnet.bitmex.com/api/v1/order?filter=%7B%22ordStatus.isTerminated%22%3A+false%2C+%22symbol%22%3A+%22XBTUSD%22%7D: {"error":{"message":"This request has expired -
expiresis in the past. Current time: 1509455267","name":"HTTPError"}}
- shouldn't I be using "wss://testnet.bitmex.com/realtime" for the base_url or is this only to be used for the websocket?
- The Bitmex websocket in sample market maker is different from the one in the api-connector.
Which one should we take as the main source for further developing?
Kind regards
Hi guys, is it possible to install the market-maker as site-package and import it from there? When I run pip install . from the folder I am not able to import the module. Or does it simply not work as pip site-package?
Since I wanted to access to the api manually, I made the following script.
import bitmex
b = bitmex.BitMEX(base_url="https://testnet.bitmex.com/api/v1/",symbol="XBTUSD",apiKey="myApiKey",apiSecret="MyApiSecret",orderIDPrefix="my_prefix_",postOnly=False)
print(b.funds())
but this script returns the following error
ERROR:root:API Key incorrect, please check and restart.
ERROR:root:Couldn't connect to WS! Exiting.
And I found out that the apiKey on settings.py was used instead of what I set in instance arguments.
We can see in ws/ws_thread.py, it is referencing the "settings".
def __get_auth(self):
'''Return auth headers. Will use API Keys if present in settings.'''
if self.shouldAuth is False:
return []
self.logger.info("Authenticating with API Key.")
# To auth to the WS using an API key, we generate a signature of a nonce and
# the WS API endpoint.
nonce = generate_nonce()
return [
"api-nonce: " + str(nonce),
"api-signature: " + generate_signature(settings.API_SECRET, 'GET', '/realtime', nonce, ''),
"api-key:" + settings.API_KEY
]
Settings should be referred in higher level, not in the ws module because ws module is required by the bitmex api. ws module should refer to bitmex instance.
Hi All,
Today is 1/8. Is there something going on with both the production websocket and testnet websocket? Get disconnected right away every time. I got the connection, got market data, even got contracts created and see them popping up on the site. But then immediately shutting down and everything canceled.
Thanks.
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
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.