verata-veritatis / bybit-market-maker

A sample market maker bot for Bybit
MIT License
48 stars 19 forks source link

Error code 10012 #1

Open babyrig opened 3 years ago

babyrig commented 3 years ago

Ubuntu 18 Python 3.6.9

error after 3 days or so:

Traceback (most recent call last): -126 (0.04x), Entry: 57224.09, Balance: 0.00xxxxxxx, PNL: -0.00000590. File "run.py", line 215, in p = s.my_position(symbol=config.SYMBOL)['result'] File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 790, in my_position auth=True File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 1501, in _submit_request time=dt.utcnow().strftime("%H:%M:%S") pybit.exceptions.InvalidRequestError: Can not get symbol position info (ErrCode: 10012) (ErrTime: 07:41:51). Request → GET https://api.bybit.com/v2/private/position/list: {'api_key': 'xxxxxx', 'recv_window': 5000, 'symbol': 'BTCUSD', 'timestamp': 1618818111105, 'sign': 'xxxxxxxxx'}.

It's safe to add ErrCode: 10012 to line 51 like: retry_codes={10002, 10012, 10006},

Or will needed another way ?

thanks

verata-veritatis commented 3 years ago

Yeah, if this is a temporary error that you encountered, you can add it to retry_codes to force retry.

babyrig commented 3 years ago

@verata-veritatis already added and so far so good no more errors (+6 days running).

It's possible to have a more basic version without auto generated orders ? Like only to have manually orders, eg: I put a manual order sell limit at 60.000 then when opened the script put an order to close by defined value in settings like 2.000 then when hit 58.000 the position will be closed then the script put another sell order at 60.000 ? And keep repeating this.

babyrig commented 3 years ago

I got another error after 10 days or so running without issues:

Traceback (most recent call last): File "run.py", line 215, in p = s.my_position(symbol=config.SYMBOL)['result'] File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 790, in my_position auth=True File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 1372, in _submit_request time=dt.utcnow().strftime("%H:%M:%S") pybit.exceptions.FailedRequestError: Bad request. retries exceeded maximum. (ErrCode: 400) (ErrTime: 21:06:55). Request → GET https://api.bybit.com/v2/private/position/list: {'api_key': 'xxxxxx', 'recv_window': 7500, 'sign': 'xxxx', 'symbol': 'BTCUSD', 'timestamp': 1619644002304}.

I don't code but I can see this is likely to be related to the pybit

verata-veritatis commented 3 years ago

I got another error after 10 days or so running without issues:

Traceback (most recent call last): File "run.py", line 215, in p = s.my_position(symbol=config.SYMBOL)['result'] File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 790, in my_position auth=True File "/usr/local/lib/python3.6/dist-packages/pybit/init.py", line 1372, in _submit_request time=dt.utcnow().strftime("%H:%M:%S") pybit.exceptions.FailedRequestError: Bad request. retries exceeded maximum. (ErrCode: 400) (ErrTime: 21:06:55). Request → GET https://api.bybit.com/v2/private/position/list: {'api_key': 'xxxxxx', 'recv_window': 7500, 'sign': 'xxxx', 'symbol': 'BTCUSD', 'timestamp': 1619644002304}.

I don't code but I can see this is likely to be related to the pybit

Yikes, interesting. 400 would mean the request is bad but it doesn't seem like it is consider it's been working for 10 days consecutively without issue. I'll play around with error handling to see it this can be avoided. Thanks!

SpaceHODL commented 3 years ago

I'm getting ErrCode 10012 quit often, always in the worst situations. (the error is not even documented in the official APIs doc) I think it's a problem by their side and not the code. It occours randomly when there is a lot of frenzy in the market. I would like to find a way to tell the code to retry instead of crashing the app. It is always related to the /private/position/list. If I debugged this right it happens randomly when the bot is adding more to the current position.

verata-veritatis commented 3 years ago

I'm getting ErrCode 10012 quit often, always in the worst situations. (the error is not even documented in the official APIs doc) I think it's a problem by their side and not the code. It occours randomly when there is a lot of frenzy in the market. I would like to find a way to tell the code to retry instead of crashing the app. It is always related to the /private/position/list. If I debugged this right it happens randomly when the bot is adding more to the current position.

Check the original post here. You can use the retry_codes argument.