-
Notifications
You must be signed in to change notification settings - Fork 318
Description
Hi,
I’m encountering an issue when using the py-clob-client API with my OKX proxy (I also tried OKX EOA, and the issue persists). I can always buy, but I’m unable to sell my full position (never success).
For example, if I buy 5 shares of “Up” in the BTC15min market, I can only sell 4.5 shares. Attempting to sell all 5 results in this error:
PolyApiException: PolyApiException[status_code=400, error_message={'error': 'not enough balance / allowance'}]
After selling 4.5 shares via the API, I try to sell the remaining 0.5 and get:
PolyApiException: PolyApiException[status_code=400, error_message={'error': 'order 0x519a99d696ba78bd71eff1ac6190ebfd52f27473adb273f17cfbe74f2dbf1a26 is invalid. Size (0.1) lower than the minimum: 5'}]
Despite these issues with the API, I’m always able to sell the full position manually using the Polymarket website in the OKX app.
I have confirmed that both my balance and allowance are sufficient:
client.get_balance_allowance(params=BalanceAllowanceParams(asset_type=AssetType.COLLATERAL))
Returns:
{'balance': '100866980', 'allowances': {'0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E': '115792089237316195423570985008687907853269984665640564039457584007913072382353', '0xC5d563A36AE78145C45a50134d48A1215220f80a': '115792089237316195423570985008687907853269984665640564039457584007913129639935', '0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296': '115792089237316195423570985008687907853269984665640564039457584007913129639935'}}
Here’s how I place my sell order:
order_args = OrderArgs(
price=price,
size=order_size,
side=SELL,
token_id=token_id,
)
signed_order = client.create_order(order_args)
resp = client.post_order(signed_order, OrderType.GTC)
I’ve also tried using FAK and FOK order types, but neither worked.
This issue has been bothering me for a few days. I’ve asked a few friends, but none of them have experienced this. I’d really appreciate your help in figuring this out.
Many thanks