BitMEX / api-connectors

Libraries for connecting to the BitMEX API.
https://www.bitmex.com/app/restAPI
910 stars 795 forks source link

"Data" param in the Signature #114

Closed SfiGatto closed 6 years ago

SfiGatto commented 6 years ago

Hi all, I'm trying to write code (in python) for authentication and I have no issues by WebSocket API where I can obtain all infos...but with rest api, when I insert the "data" param in the string for the signature I receive the message "Signature not valid".

But this not happens when there is no data string: in fact, for example, if I request my orders or position it's all ok!

I tried to insert a limit order manually in the website and cancel it by api (endpoint: /order/all - verb:DELETE) and it works too!

So the problem it seems to be there, in the "data" param.... Can someone help me, please?

Thank you very much!!

ryanfox commented 6 years ago

You do not have to write any authentication code for the python connector. The official adapter here already supports authentication.

You can supply api_key and api_secret when you create the client object. See this example.

SfiGatto commented 6 years ago

Yes, I know...I used It and It works but I want to write the code "from zero" and I'd like to understand what is wrong! Do you have any idea?!

Anyway thank you for the answer!

SfiGatto commented 6 years ago

Nothing else....?!....Nobody?! ;-(

ryanfox commented 6 years ago

Information on signing a request can be found in the BitMEX docs.

SfiGatto commented 6 years ago

I'm sorry but if I ask here it is because I do not know what to do anymore...

I read that docs and in effect is what I used to do all other requests and signatures that worked.

I checked the suggestions about "signature not valid" messages several times!

ryanfox commented 6 years ago

The documentation contains all the information necessary to replicate the signing scheme. The request must be constructed exactly as described there.

If you still have issues, consider using the existing authentication mechanism.