verata-veritatis / bybit-market-maker Goto Github PK
View Code? Open in Web Editor NEWA sample market maker bot for Bybit
License: MIT License
A sample market maker bot for Bybit
License: MIT License
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
Trying to use bybit testnet and got error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bybit-market-maker-master/run.py", line 61, in
raise PermissionError('API key is invalid.')
PermissionError: API key is invalid.
Any issues?
Hey all, I'm trying to implement a system where there are multiple TP levels and everytime the price reaches those levels the SL will move upwards like to entry, tp1 and so on. I've been using the amend method and I get this issue. From what I see the order is placed with the original TP and SL.
# Place the order for entry 1
orderlinkid_entry1 = f"t{int(time.time())}-test-postonly"
response_entry1 = session.place_order(
category="linear",
symbol=coin,
side=side,
orderType="Limit",
qty=str(formatted_qty),
price=entry1,
timeInForce="PostOnly",
orderlinkid=orderlinkid_entry1,
isLeverage=1,
orderFilter="Order",
takeProfit=str(tp5), # Target 5
stopLoss=str(sl), # SL
tpTriggerBy="MarkPrice",
slTriggerB="IndexPrice",
tpslMode="Partial",
tpOrderType="Limit",
slOrderType="Limit",
tpSize="20",
slSize="100",
tpLimitPrice=str(tp1),
slLimitPrice=str(sl), # SL
)
## Amending Stop Loss to Entry as soon as TP1 is reached
print(session.amend_order(
category="linear",
symbol=coin,
orderLinkId=orderlinkid_entry1,
triggerPrice=str(tp1),
stopLoss=str(entry1),
))
Error Message :
pybit.exceptions.InvalidRequestError: order not exists or too late to replace (ErrCode: 110001) (ErrTime: 04:33:13).
Request → POST https://api-testnet.bybit.com/v5/order/amend: {"category": "linear", "symbol": "CHZUSDT", "orderLinkId": "t1701664392-test-postonly", "triggerPrice": "0.0778", "stopLoss": "0.0735"}.
Solved
Hello, I am having issues with the following error code. Im a bit confused because it seems the library concurrent\futures is also throwing it off. Not really sure how to resolve this - I am quite a noob.
Any help would be much appreciated! Thanks in advance :)
2022-03-03 05:41:45.915880 - INFO - Checking last price.
2022-03-03 05:41:46.105600 - INFO - Generating order prices.
2022-03-03 05:41:46.106597 - INFO - Generating order quantities.
2022-03-03 05:41:46.740765 - INFO - Submitting orders.
Traceback (most recent call last):
File "C:\Users\x\Documents\stuff\mm\envs\bybit-mm1\run.py", line 126, in
responses = s.place_active_order_bulk(orders=orders)
File "C:\Users\x\Documents\stuff\mm\envs\bybit-mm1\lib\site-packages\pybit_init_.py", line 515, in place_active_order_bulk
return [execution.result() for execution in executions]
File "C:\Users\x\Documents\stuff\mm\envs\bybit-mm1\lib\site-packages\pybit_init_.py", line 515, in
return [execution.result() for execution in executions]
File "C:\Users\x\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "C:\Users\x\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 391, in __get_result
raise self.exception
File "C:\Users\x\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\x\Documents\stuff\mm\envs\bybit-mm1\lib\site-packages\pybit_init.py", line 488, in place_active_order
return self.submit_request(
File "C:\Users\x\Documents\stuff\mm\envs\bybit-mm1\lib\site-packages\pybit_init.py", line 1906, in _submit_request
raise InvalidRequestError(
pybit.exceptions.InvalidRequestError: Oc_diff[29455942], new_oc[224330651] with ob[194874709]+ab[5098967] (ErrCode: 30031) (ErrTime: 05:41:47).
Request → POST https://api-testnet.bybit.com/v2/private/order/create: .....
The bot is good but it needs to have option for long only and short only depending on how the user wants it to be,
I first get a fill, then moments later I get this error:
2021-07-03 01:28:11.796893 - INFO - Awaiting position.
Traceback (most recent call last):
File "mm.py", line 191, in
s.set_trading_stop(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pybit/init.py", line 909, in set_trading_stop
return self._submit_request(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pybit/init.py", line 1497, in _submit_request
raise InvalidRequestError(
pybit.exceptions.InvalidRequestError: Not modified (ErrCode: 34040) (ErrTime: 01:28:14).
Request → POST https://api.bybit.com/v2/private/position/trading-stop: {'api_key': '', 'recv_window': 5000, 'stop_loss': 2194, 'symbol': 'ETHUSD', 'timestamp': 1625275694488, 'sign': ''}.
hi I get that weird error on xrpusd
pybit.exceptions.InvalidRequestError: Order_price[0] invalid, [1,1999998] (ErrCode: 30005) (ErrTime: 14:07:52)
how can I fix that ?
Hi the bot is opnening the orders
But when some orders are filled- it does not places stop loss or take profit
What can be the reason
raise InvalidRequestError(
pybit.exceptions.InvalidRequestError: Oc_diff[2202], new_oc[31147] with ob[28945]+ab[1990] (ErrCode: 30031) (ErrTime: 18:55:10)
Get wallet balance is throwing out this error.
`
from pybit import usdc_options, usdc_perpetual
def connect():
bybit_client = usdc_options.HTTP(
endpoint=base_url,
api_key='XXX',
api_secret='XXX',
recv_window=10000
)
return bybit_client
base_url = "https://api.bybit.com"
bybit_client = connect()
balances_response = bybit_client.get_wallet_balance()
print(balances_response)
`
raise InvalidRequestError(
pybit.exceptions.InvalidRequestError: Error sign! (ErrCode: 10004) (ErrTime: 07:45:20)
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?
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.