Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR - bitmex - Unhandled Error: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk #218

Open
adelorenzo opened this issue Jun 18, 2020 · 3 comments

Comments

@adelorenzo
Copy link

Hello,

I ran the code and got the following error message:

2020-06-18 11:58:13,851 - INFO - market_maker - BitMEX Market Maker Version: v1.1

2020-06-18 11:58:13,854 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2020-06-18 11:58:13,854 - INFO - ws_thread - Authenticating with API Key.
2020-06-18 11:58:13,857 - INFO - ws_thread - Started thread
2020-06-18 11:58:14,862 - INFO - ws_thread - Connected to WS. Waiting for data images, this may take a moment...
2020-06-18 11:58:17,664 - INFO - ws_thread - Got all market data. Starting.
2020-06-18 11:58:17,665 - INFO - market_maker - Using symbol XBTUSD.
2020-06-18 11:58:17,665 - INFO - market_maker - Order Manager initializing, connecting to BitMEX. Live run: executing real trades.
2020-06-18 11:58:17,665 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2020-06-18 11:58:17,665 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{\"ordStatus.isTerminated\": false, \"symbol\": \"XBTUSD\"}", "count": 500}
2020-06-18 11:58:19,507 - INFO - market_maker - XBTUSD Ticker: Buy: 9389.5, Sell: 9390.0
2020-06-18 11:58:19,507 - INFO - market_maker - Start Positions: Buy: 9343.0, Sell: 9436.4, Mid: 9390.0
2020-06-18 11:58:19,508 - INFO - market_maker - Current XBT Balance: 0.096507
2020-06-18 11:58:19,508 - INFO - market_maker - Current Contract Position: 0
2020-06-18 11:58:19,509 - INFO - market_maker - Contracts Traded This Run: 0
2020-06-18 11:58:19,509 - INFO - market_maker - Total Contract Delta: 0.0000 XBT
2020-06-18 11:58:19,510 - INFO - market_maker - Creating 12 orders:
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 100 @ 9436.5
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 200 @ 9483.5
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 300 @ 9531.0
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 400 @ 9578.5
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 500 @ 9626.5
2020-06-18 11:58:19,511 - INFO - market_maker - Sell 600 @ 9674.5
2020-06-18 11:58:19,511 - INFO - market_maker -  Buy 100 @ 9343.0
2020-06-18 11:58:19,512 - INFO - market_maker -  Buy 200 @ 9296.5
2020-06-18 11:58:19,512 - INFO - market_maker -  Buy 300 @ 9250.5
2020-06-18 11:58:19,512 - INFO - market_maker -  Buy 400 @ 9204.5
2020-06-18 11:58:19,512 - INFO - market_maker -  Buy 500 @ 9158.5
2020-06-18 11:58:19,512 - INFO - market_maker -  Buy 600 @ 9113.0
2020-06-18 11:58:19,514 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order/bulk: {"orders": [{"price": 9113.0, "orderQty": 600, "side": "Buy", "clOrdID": "mm_bitmex_JiIB4lv3Soy6/nldx6IIvA", "symbol": "XBTUSD"}, {"price": 9158.5, "orderQty": 500, "side": "Buy", "clOrdID": "mm_bitmex_gK9nJDMiQf2dNVR2/XTqtA", "symbol": "XBTUSD"}, {"price": 9204.5, "orderQty": 400, "side": "Buy", "clOrdID": "mm_bitmex_4dgkhB2FQ3GKFZxNlRs89A", "symbol": "XBTUSD"}, {"price": 9250.5, "orderQty": 300, "side": "Buy", "clOrdID": "mm_bitmex_YLnQROUKSuycx5qibgH0bw", "symbol": "XBTUSD"}, {"price": 9296.5, "orderQty": 200, "side": "Buy", "clOrdID": "mm_bitmex_U/kU55hLQPOYrQ0c/8LH4w", "symbol": "XBTUSD"}, {"price": 9343.0, "orderQty": 100, "side": "Buy", "clOrdID": "mm_bitmex_3KSXhQTfS8+9YOYm4jkVcg", "symbol": "XBTUSD"}, {"price": 9674.5, "orderQty": 600, "side": "Sell", "clOrdID": "mm_bitmex_yQwzoL+6SJaU+GkuFzZUWQ", "symbol": "XBTUSD"}, {"price": 9626.5, "orderQty": 500, "side": "Sell", "clOrdID": "mm_bitmex_39BeHhpqRJ6ja46Ke+CdvQ", "symbol": "XBTUSD"}, {"price": 9578.5, "orderQty": 400, "side": "Sell", "clOrdID": "mm_bitmex_9Ox1s8oOSKGCvKL2AqGUgA", "symbol": "XBTUSD"}, {"price": 9531.0, "orderQty": 300, "side": "Sell", "clOrdID": "mm_bitmex_WafIWqBRRSGt6i2lAlFQ6Q", "symbol": "XBTUSD"}, {"price": 9483.5, "orderQty": 200, "side": "Sell", "clOrdID": "mm_bitmex_Kb6i8asySxW7sRluIQXx8w", "symbol": "XBTUSD"}, {"price": 9436.5, "orderQty": 100, "side": "Sell", "clOrdID": "mm_bitmex_BZBdfebxTU+r6RyPdjcYlw", "symbol": "XBTUSD"}]}
2020-06-18 11:58:19,733 - ERROR - bitmex - Unhandled Error: 403 Client Error: Forbidden for url: https://testnet.bitmex.com/api/v1/order/bulk: {"error":{"message":"Access Denied","name":"HTTPError"}}
2020-06-18 11:58:19,733 - ERROR - bitmex - Endpoint was: POST order/bulk: {"orders": [{"price": 9113.0, "orderQty": 600, "side": "Buy", "clOrdID": "mm_bitmex_JiIB4lv3Soy6/nldx6IIvA", "symbol": "XBTUSD"}, {"price": 9158.5, "orderQty": 500, "side": "Buy", "clOrdID": "mm_bitmex_gK9nJDMiQf2dNVR2/XTqtA", "symbol": "XBTUSD"}, {"price": 9204.5, "orderQty": 400, "side": "Buy", "clOrdID": "mm_bitmex_4dgkhB2FQ3GKFZxNlRs89A", "symbol": "XBTUSD"}, {"price": 9250.5, "orderQty": 300, "side": "Buy", "clOrdID": "mm_bitmex_YLnQROUKSuycx5qibgH0bw", "symbol": "XBTUSD"}, {"price": 9296.5, "orderQty": 200, "side": "Buy", "clOrdID": "mm_bitmex_U/kU55hLQPOYrQ0c/8LH4w", "symbol": "XBTUSD"}, {"price": 9343.0, "orderQty": 100, "side": "Buy", "clOrdID": "mm_bitmex_3KSXhQTfS8+9YOYm4jkVcg", "symbol": "XBTUSD"}, {"price": 9674.5, "orderQty": 600, "side": "Sell", "clOrdID": "mm_bitmex_yQwzoL+6SJaU+GkuFzZUWQ", "symbol": "XBTUSD"}, {"price": 9626.5, "orderQty": 500, "side": "Sell", "clOrdID": "mm_bitmex_39BeHhpqRJ6ja46Ke+CdvQ", "symbol": "XBTUSD"}, {"price": 9578.5, "orderQty": 400, "side": "Sell", "clOrdID": "mm_bitmex_9Ox1s8oOSKGCvKL2AqGUgA", "symbol": "XBTUSD"}, {"price": 9531.0, "orderQty": 300, "side": "Sell", "clOrdID": "mm_bitmex_WafIWqBRRSGt6i2lAlFQ6Q", "symbol": "XBTUSD"}, {"price": 9483.5, "orderQty": 200, "side": "Sell", "clOrdID": "mm_bitmex_Kb6i8asySxW7sRluIQXx8w", "symbol": "XBTUSD"}, {"price": 9436.5, "orderQty": 100, "side": "Sell", "clOrdID": "mm_bitmex_BZBdfebxTU+r6RyPdjcYlw", "symbol": "XBTUSD"}]}
2020-06-18 11:58:19,734 - INFO - market_maker - Shutting down. All open orders will be cancelled.
2020-06-18 11:58:19,734 - INFO - market_maker - Resetting current position. Canceling all existing orders.
2020-06-18 11:58:19,734 - INFO - bitmex - sending req to https://testnet.bitmex.com/api/v1/order: {"filter": "{\"ordStatus.isTerminated\": false, \"symbol\": \"XBTUSD\"}", "count": 500}
2020-06-18 11:58:21,134 - INFO - ws_thread - Websocket Closed

It only works with DRY_RUN=True. My API keys allow Order/Cancel. Please advise.

Thank you!

@dni
Copy link

dni commented Aug 28, 2020

same :) any infos?

@dni
Copy link

dni commented Aug 28, 2020

ok i found the problem, you need to set "Order" Key Permission on your API KEY, i didn't had that and its needed.

@mwithi
Copy link

mwithi commented Oct 11, 2021

ok i found the problem, you need to set "Order" Key Permission on your API KEY, i didn't had that and its needed.

worked for me, I was using a "Order Cancel" API KEY, I misunderstood their usage, which is described here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants