BitMEX / sample-market-maker

Sample BitMEX Market Making Bot
Apache License 2.0
1.7k stars 757 forks source link

Errors With update of API #27

Closed Willstar44 closed 6 years ago

Willstar44 commented 7 years ago

Im getting this error now

HTTPError: 400 Client Error: Bad Request for url: https://www.bitmex.com/api/v1/order/bulk

tonypius commented 7 years ago

I'm getting the same issue. Is there any solution ?

gonwi commented 6 years ago

I was getting this error, updated my API keys and tried with a fresh copy of the code and now get a different error.

2017-11-16 19:55:55,913 - INFO - market_maker - Shutting down. All open orders will be cancelled. 2017-11-16 19:55:55,913 - INFO - market_maker - Resetting current position. Canceling all existing orders. 2017-11-16 19:55:55,914 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{\"ordStatus.isTerminated\": false, \"symbol\": \"XBTUSD\"}", "count": 500} 2017-11-16 19:55:57,099 - INFO - ws_thread - Websocket Closed

STRML commented 6 years ago

Could you post the whole error? That's always emitted when the program shuts down.

tonypius commented 6 years ago

2017-11-17 06:19:09,532 - INFO - market_maker - BitMEX Market Maker Version: v1.1

2017-11-17 06:19:09,533 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position 2017-11-17 06:19:09,533 - INFO - ws_thread - Authenticating with API Key. 2017-11-17 06:19:09,534 - INFO - ws_thread - Started thread 2017-11-17 06:19:12,538 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment... 2017-11-17 06:19:15,851 - INFO - ws_thread - Got all market data. Starting. 2017-11-17 06:19:15,851 - INFO - market_maker - Using symbol XBTUSD. 2017-11-17 06:19:15,852 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades. 2017-11-17 06:19:15,852 - INFO - market_maker - Resetting current position. Cancelling all existing orders. 2017-11-17 06:19:17,742 - INFO - market_maker - XBTUSD Ticker: Buy: 7884.50, Sell: 7890.00 2017-11-17 06:19:17,743 - INFO - market_maker - Start Positions: Buy: 7845.57, Sell: 7928.95, Mid: 7887.20 2017-11-17 06:19:17,743 - INFO - market_maker - Current XBT Balance: 1.365841 2017-11-17 06:19:17,743 - INFO - market_maker - Current Contract Position: 0 2017-11-17 06:19:17,743 - INFO - market_maker - Position limits: -1000/1000 2017-11-17 06:19:17,743 - INFO - market_maker - Contracts Traded This Run: 0 2017-11-17 06:19:17,743 - INFO - market_maker - Total Contract Delta: 0.0000 XBT 2017-11-17 06:19:17,743 - INFO - market_maker - Creating 16 orders: 2017-11-17 06:19:17,743 - INFO - market_maker - Sell 200 @ 7928.9 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 210 @ 7968.6 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 220 @ 8008.4 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 230 @ 8048.5 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 240 @ 8088.7 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 250 @ 8129.2 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 260 @ 8169.8 2017-11-17 06:19:17,744 - INFO - market_maker - Sell 270 @ 8210.7 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 200 @ 7845.6 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 210 @ 7806.5 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 220 @ 7767.7 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 230 @ 7729.1 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 240 @ 7690.6 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 250 @ 7652.3 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 260 @ 7614.3 2017-11-17 06:19:17,744 - INFO - market_maker - Buy 270 @ 7576.4 2017-11-17 06:19:17,989 - 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-17 06:19:17,990 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"clOrdID": "mm_bitmex_awUS+On2TPu+zLIcGVj76g", "symbol": "XBTUSD", "orderQty": 270, "side": "Buy", "price": 7576.4}, {"clOrdID": "mm_bitmex_PVB8geH0R6OuIZsI/Um2gw", "symbol": "XBTUSD", "orderQty": 260, "side": "Buy", "price": 7614.3}, {"clOrdID": "mm_bitmex_27W0k8hBRrmg6hlylkLKpg", "symbol": "XBTUSD", "orderQty": 250, "side": "Buy", "price": 7652.3}, {"clOrdID": "mm_bitmex_Czs2eIuQSf677isVHpdvPQ", "symbol": "XBTUSD", "orderQty": 240, "side": "Buy", "price": 7690.6}, {"clOrdID": "mm_bitmex_xNLvUfWCQBKfImB3vMvadQ", "symbol": "XBTUSD", "orderQty": 230, "side": "Buy", "price": 7729.1}, {"clOrdID": "mm_bitmex_T/Cc7ZD3T1yCYCaid2NoXg", "symbol": "XBTUSD", "orderQty": 220, "side": "Buy", "price": 7767.7}, {"clOrdID": "mm_bitmex_MStpnZZgS/u0V4fGyxgKkg", "symbol": "XBTUSD", "orderQty": 210, "side": "Buy", "price": 7806.5}, {"clOrdID": "mm_bitmex_OtHs7JvUQjSbTl5kXhvi+Q", "symbol": "XBTUSD", "orderQty": 200, "side": "Buy", "price": 7845.6}, {"clOrdID": "mm_bitmex_iZbwm1JkQSKlF6i/tPaWeQ", "symbol": "XBTUSD", "orderQty": 270, "side": "Sell", "price": 8210.7}, {"clOrdID": "mm_bitmex_2/cWbYDHTeqwcDYuwiRdoA", "symbol": "XBTUSD", "orderQty": 260, "side": "Sell", "price": 8169.8}, {"clOrdID": "mm_bitmex_sd3FZmIQRaqn2johMVXKzg", "symbol": "XBTUSD", "orderQty": 250, "side": "Sell", "price": 8129.2}, {"clOrdID": "mm_bitmex_IYRrpeI7TWWweO47hmYzDA", "symbol": "XBTUSD", "orderQty": 240, "side": "Sell", "price": 8088.7}, {"clOrdID": "mm_bitmex_zwe+BS1/Q0aQIgMz0QH1JQ", "symbol": "XBTUSD", "orderQty": 230, "side": "Sell", "price": 8048.5}, {"clOrdID": "mm_bitmex_5Noj/w8oQn+kMry3I/7/Fw", "symbol": "XBTUSD", "orderQty": 220, "side": "Sell", "price": 8008.4}, {"clOrdID": "mm_bitmex_Qo9hY4aBQOaJ42ewdXN0sA", "symbol": "XBTUSD", "orderQty": 210, "side": "Sell", "price": 7968.6}, {"clOrdID": "mm_bitmex_FnZdZN6SRzao4A3lDTwMww", "symbol": "XBTUSD", "orderQty": 200, "side": "Sell", "price": 7928.9}]} Traceback (most recent call last): File "./marketmaker", line 4, in market_maker.run() File "/root/Stocker/misc/market_maker/market_maker.py", line 546, in run om.init() File "/root/Stocker/misc/market_maker/market_maker.py", line 220, in init self.reset() File "/root/Stocker/misc/market_maker/market_maker.py", line 228, in reset self.place_orders() File "/root/Stocker/misc/market_maker/market_maker.py", line 325, in place_orders return self.converge_orders(buy_orders, sell_orders) File "/root/Stocker/misc/market_maker/market_maker.py", line 411, in converge_orders self.exchange.create_bulk_orders(to_create) File "/root/Stocker/misc/market_maker/market_maker.py", line 192, in create_bulk_orders return self.bitmex.create_bulk_orders(orders) File "/root/Stocker/misc/market_maker/bitmex.py", line 97, in wrapped return function(self, *args, **kwargs) File "/root/Stocker/misc/market_maker/bitmex.py", line 187, in create_bulk_orders return self._curl_bitmex(api='order/bulk', postdict={'orders': orders}, verb='POST') File "/root/Stocker/misc/market_maker/bitmex.py", line 314, in _curl_bitmex raise e File "/root/Stocker/misc/market_maker/bitmex.py", line 247, 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://testnet.bitmex.com/api/v1/order/bulk 2017-11-17 06:19:18,061 - INFO - market_maker - Shutting down. All open orders will be cancelled. 2017-11-17 06:19:18,062 - INFO - market_maker - Resetting current position. Cancelling all existing orders. 2017-11-17 06:19:19,677 - INFO - ws_thread - Websocket Closed Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/root/Stocker/misc/market_maker/market_maker.py", line 497, in exit sys.exit() SystemExit

STRML commented 6 years ago

Your error is:

{"error":{"message":"Invalid price tickSize","name":"HTTPError"}}

Please update the project to the latest version, where this is fixed.