Bybit bot problem

Jan 24, 2023
Reaction score

i am quite new to programing . I wanted to create my own algo trading bot.

I have defined a minimum viable strategy i would like to test in the live market. For that i want to use Bybits testnet.
I have manged to connect to something but i can not interact with the testnet . To be honest i dont really understand what i am doing to connect.

I would be thankfull if you could help me achieve interaction with the servers so that i can run my test .

This is the code:

#specify URL of APi
api_url = ""

#Funktion to crate a signal. No fucking idea what i am doing here.
def get_bybit_signature(urlpath,data,secret):
postdata = urllib.parse.urlencode(data)
encoded = (str(data['nonce'])+postdata).encode()
message = urlpath.encode() + hashlib.sha256(encoded).digest()

mac =, message, hashlib.sha512)
sigdigest = base64.b64encode(mac.digest())
return sigdigest.decode()

#request to pass trough get_kraken_signature
def bybit_request(url_path, data, api_key, api_sec):
headers = {"API-Key":api_key, "API-Sign":get_bybit_signature(url_path, data, api_sec)}
resp = + url_path), headers=headers, data = data)
return resp

resp= bybit_request("/spot/v1/account",{
"nonce": str(int(1000*time.time()))

}, api_key, api_sec )

print( resp.json())

and this is the error message
PS C:\Users\DV\Desktop\DOMA\Trading\Bot> & 'C:\Users\DV\Desktop\DOMA\Software\python.exe' 'c:\Users\DV\.vscode\extensions\ms-python.python-2022.20.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60990' '--' 'c:\Users\DV\Desktop\DOMA\Trading\Bot\Buybit'
{'ret_code': -1004, 'ret_msg': "Missing required parameter ''", 'result': {}, 'ext_code': '', 'ext_info': None, 'time_now': '1674575653.755136'}
PS C:\Users\DV\Desktop\DOMA\Trading\Bot>

Thank you!
Have a good one