verata-veritatis / bybit-market-maker

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

Does this bot only work on Inverse perpetual? #9

Open andy1245 opened 2 years ago

andy1245 commented 2 years ago

Hi I try to use this bot for USDT Perpetual, but it seems not to work. In config I use SYMBOL = 'BTCUSDT' COIN = 'BTC'

error is pybit.exceptions.InvalidRequestError: Param validation for 'qty' failed on the 'required' tag (ErrCode: 10001) (ErrTime: 17:57:04). Request →

However using the Inverse perpetual BTCUSD works. Doesn't it work on USDT Perpetual?

xbrandonx commented 2 years ago

I don't think bybit uses USD. It only works in USDT. On 01 Jan 2022, 19:59 +0200, andy1245 @.***>, wrote:

Hi I try to use this bot for USDT Perpetual, but it seems not to work. In config I use SYMBOL = 'BTCUSDT' COIN = 'BTC' error is pybit.exceptions.InvalidRequestError: Param validation for 'qty' failed on the 'required' tag (ErrCode: 10001) (ErrTime: 17:57:04). Request → However using the Inverse perpetual BTCUSD works. Doesn't it work on USDT Perpetual? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>

andy1245 commented 2 years ago

How to use the USDT-pairs? For me it only works in the USD-pairs. Maybe this bot can only handel the USD Inverse perpetual coins?

xbrandonx commented 2 years ago

Post your sample code and let's get it figured out. On 03 Jan 2022, 18:00 +0200, andy1245 @.***>, wrote:

How to use the USDT-pairs? For me it only works in the USD-pairs. Maybe this bot can only handeln the USD Inverse perpetual coins? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

xbrandonx commented 2 years ago

I started a new project and Bybit account and was getting the same error on testnet. Then I opened a position manually on the Bybit website. And then ran this script. It then worked perfectly.

andy1245 commented 2 years ago

Thank you for your help. Unfurtunatelly this doesn't work for me. The bot cancels my open position and when it wants to place the new orders a get an error: Param validation for 'close_on_trigger' failed on the 'exists' tag (ErrCode: 10001)

2022-01-05 19:07:04.001225 - INFO - Checking last price. 2022-01-05 19:07:04.206856 - INFO - Generating order prices. 2022-01-05 19:07:04.207144 - INFO - Generating order quantities. 2022-01-05 19:07:04.412388 - INFO - Submitting orders. Traceback (most recent call last): File "run.py", line 126, in responses = s.place_active_order_bulk(orders=orders) File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 515, in place_active_order_bulk return [execution.result() for execution in executions] File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 515, in return [execution.result() for execution in executions] File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result return self.get_result() File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in get_result raise self._exception File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 488, in place_active_order return self._submit_request( File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 1882, in _submit_request raise InvalidRequestError( pybit.exceptions.InvalidRequestError: Param validation for 'close_on_trigger' failed on the 'exists' tag (ErrCode: 10001) (ErrTime: 19:07:04). Request → POST https://api.bybit.com/private/linear/order/create: {'api_key': 'xxx', 'order_type': 'Limit', 'price': 44884, 'qty': 10899875, 'recv_window': 5000, 'side': 'Buy', 'symbol': 'BTCUSDT', 'time_in_force': 'GoodTillCancel', 'timestamp': 1641409624412, 'sign': '4ea54cb6faa768ac6804e305eedbe55e4143d87e326074cf81a4c0217d36a6f8'}.

secp600k1 commented 2 years ago

got the same issue, I think it only works with Inverse Perps. I tried connecting linear perps on testnet, still gives the same error. I tried changing 'close_on_trigger' and 'reduce_only'. still the issue remains.

@xbrandonx tried creating positions beforehand. still the issue remains.

EDIT: @andy1245 I got it working for other orders like "place_active_order". I think the issue is with placing bulk orders on BTCUSDT perp market.

xbrandonx commented 2 years ago

response_container_BBPPID{font-family: Calibri, sans-serif; font-size:12pt; color: initial;} The URL in your error shows you're trading live. Are you using a live API key?https://api.bybit.com/private/linear/order/create Regards,Brandon From: @.: 05 January 2022 21:34To: @. to: @.: @.; @.***: Re: [verata-veritatis/bybit-market-maker] Does this bot only work on Inverse perpetual? (Issue #9)

Thank you for your help. Unfurtunatelly this doesn't work for me.

The bot cancels my open position and when it wants to place the new orders a get an error: Param validation for 'close_on_trigger' failed on the 'exists' tag (ErrCode: 10001)

2022-01-05 19:07:04.001225 - INFO - Checking last price.

2022-01-05 19:07:04.206856 - INFO - Generating order prices.

2022-01-05 19:07:04.207144 - INFO - Generating order quantities.

2022-01-05 19:07:04.412388 - INFO - Submitting orders.

Traceback (most recent call last):

File "run.py", line 126, in

responses = s.place_active_order_bulk(orders=orders)

File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 515, in place_active_order_bulk

return [execution.result() for execution in executions]

File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 515, in

return [execution.result() for execution in executions]

File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result

return self.__get_result()

File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result

raise self._exception

File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run

result = self.fn(*self.args, **self.kwargs)

File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 488, in place_active_order

return self._submit_request(

File "/usr/local/lib/python3.8/dist-packages/pybit/init.py", line 1882, in _submit_request

raise InvalidRequestError(

pybit.exceptions.InvalidRequestError: Param validation for 'close_on_trigger' failed on the 'exists' tag (ErrCode: 10001) (ErrTime: 19:07:04).

Request → POST https://api.bybit.com/private/linear/order/create: {'api_key': 'xxx', 'order_type': 'Limit', 'price': 44884, 'qty': 10899875, 'recv_window': 5000, 'side': 'Buy', 'symbol': 'BTCUSDT', 'time_in_force': 'GoodTillCancel', 'timestamp': 1641409624412, 'sign': '4ea54cb6faa768ac6804e305eedbe55e4143d87e326074cf81a4c0217d36a6f8'}.

—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you commented.Message ID: @.***>

xbrandonx commented 2 years ago

response_container_BBPPID{font-family: Calibri, sans-serif; font-size:12pt; color: initial;} Check the bybit API for the coin syntax to use. It might be XBTUSD or something like that.  Regards,Brandon From: @.: 03 January 2022 18:00To: @. to: @.: @.; @.***: Re: [verata-veritatis/bybit-market-maker] Does this bot only work on Inverse perpetual? (Issue #9)

How to use the USDT-pairs? For me it only works in the USD-pairs. Maybe this bot can only handeln the USD Inverse perpetual coins?

—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>