The prediction market strategy's single-market position limit has always been ineffective, despite multiple fixes that didn't resolve the issue.
Today, I finally identified the root cause: using the wrong order type. Issue Description Since the launch of the H12 Weather Strategy, there have been two strange bugs: 1. The total position in a single market always exceeds $10 limit 2. Placed 32 orders, none filled (0% fill rate) Initially, I thought it was a logic problem. I checked the deduplication function, position calculation, and order status checks—all seemed correct. The code looked fine from all angles. But it simply didn't work online. Root Cause Diagnosis After reviewing the code, I discovered: I had been using IOC ( Immediate-Or-Cancel ) orders. The IOC logic is: place an order, immediately match it against the order book; if it doesn't match, cancel. This caused two issues: • Position limit exceeded: IOC orders are canceled immediately and don't stay in pending status, causing deduplication checks to fail (orders can't be detected), leading the strategy to place duplicate orders in the same market within a single scan cycle • 0% fill rate: Weather markets have poor liquidity, the order book is often empty, so IOC orders are canceled immediately upon placement Solution Switch to GTC Maker orders: • GTC ( Good-Till-Cancel ) - keep the order open until matched by a counterparty • Orders stay in pending status, allowing deduplication checks to work • Before each scan, check if the previous order has been filled Validation (see Figure 1) After deploying on VPS: • Position limit issue disappeared • 5 out of 29 orders filled within 5 minutes (17.2% fill rate vs. previous 0%) • Makers receive rebates, Takers pay fees (after the change, it’s even cheaper) One change fixed two bugs. If you're also working on Polymarket strategies, the order type matrix in Figure 2 can be directly referenced.
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
The prediction market strategy's single-market position limit has always been ineffective, despite multiple fixes that didn't resolve the issue.
Today, I finally identified the root cause: using the wrong order type.
Issue Description
Since the launch of the H12 Weather Strategy, there have been two strange bugs:
1. The total position in a single market always exceeds $10 limit
2. Placed 32 orders, none filled (0% fill rate)
Initially, I thought it was a logic problem. I checked the deduplication function, position calculation, and order status checks—all seemed correct. The code looked fine from all angles.
But it simply didn't work online.
Root Cause Diagnosis
After reviewing the code, I discovered: I had been using IOC ( Immediate-Or-Cancel ) orders.
The IOC logic is: place an order, immediately match it against the order book; if it doesn't match, cancel.
This caused two issues:
• Position limit exceeded: IOC orders are canceled immediately and don't stay in pending status, causing deduplication checks to fail (orders can't be detected), leading the strategy to place duplicate orders in the same market within a single scan cycle
• 0% fill rate: Weather markets have poor liquidity, the order book is often empty, so IOC orders are canceled immediately upon placement
Solution
Switch to GTC Maker orders:
• GTC ( Good-Till-Cancel ) - keep the order open until matched by a counterparty
• Orders stay in pending status, allowing deduplication checks to work
• Before each scan, check if the previous order has been filled
Validation (see Figure 1)
After deploying on VPS:
• Position limit issue disappeared
• 5 out of 29 orders filled within 5 minutes (17.2% fill rate vs. previous 0%)
• Makers receive rebates, Takers pay fees (after the change, it’s even cheaper)
One change fixed two bugs. If you're also working on Polymarket strategies, the order type matrix in Figure 2 can be directly referenced.