py-clob-client: Invalid signature when creating orders in negative risk market
Overview
When trying to create an order in negative risk market, it gives me an error “invalid signature”, creating orders for non-negative risk markets works fine.
Code sample
#...
resp = client.create_and_post_order(OrderArgs(
price=0.01,
size=5.0,
side=BUY,
token_id="23879627426961662812922169694268707374662971136118079896087093103802667054172"
))
Response
Traceback (most recent call last):
File "/var/www/html/scripts/py-clob-client/create_and_post_order.py", line 32, in <module>
resp = client.create_and_post_order(OrderArgs(
File "/var/www/html/scripts/py-clob-client/py_clob_client/client.py", line 314, in create_and_post_order
return self.post_order(ord)
File "/var/www/html/scripts/py-clob-client/py_clob_client/client.py", line 305, in post_order
return post("{}{}".format(self.host, POST_ORDER), headers=headers, data=body)
File "/var/www/html/scripts/py-clob-client/py_clob_client/http_helpers/helpers.py", line 48, in post
return request(endpoint, POST, headers, data)
File "/var/www/html/scripts/py-clob-client/py_clob_client/http_helpers/helpers.py", line 41, in request
raise PolyApiException(resp)
py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=400, error_message={'error': 'invalid signature'}]
I was initially using version v0.11.0, but it’s same on v0.16.0
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 16
Got this working with help from Isulls50 on Discord. “as a Python moron like countless above, it should be pinned that ‘funder=’ should be the browser Polymarket Wallet address in the top right under your profile name, NOT YOUR METAMASK! This was the solution to ‘invalid signature’ for me and i would bet thousands that it’s what other people are messing up too” https://discord.com/channels/710897173927297116/782024576275447848/1267323493209342073
@zlandme I actually figured this out, the official example doesn’t include this, but in recent versions you need to actually pass a parameter to the function if it’s negative risk market or not. Here is an example:
for me the problem was solved with:
Who solve the problem with - “py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=400, error_message={‘error’: ‘not enough balance / allowance’}]”?
I try to sell my positions but gett error