Commit f2e904f
Fix Polymarket order creation: auto-detect price precision when tick resolution rounds price to 0
When a market's defaultTickSize (0.01) rounds a low price like 0.003956 to
0.00, makerAmount becomes 0 causing the API to reject the order with:
"invalid amounts, maker and taker amount must be higher than 0"
In buildAndSignOrder, after rounding the price, check if it became 0. If
so, scan the price string for the first non-zero decimal digit to determine
the minimum precision needed, then re-round with that precision.
Example: 0.003956 with priceDecimals=2 → 0.00 (broken)
neededDecimals=3 → re-round → 0.004 (correct)
Also update market['info']['tick_size'] in fetchOrderBook so future order
calls use the correct rounding config once the order book has been fetched.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 111a876 commit f2e904f
3 files changed
Lines changed: 11011 additions & 48 deletions
0 commit comments