Usage
result = client.force_settlement_check(market_id="0x1234...abcd")
Use this only when automatic settlement hasn’t triggered. In normal operation, settlements are processed automatically.
Parameters
The market ID (condition ID) to check.
When to Use
- A market has resolved but settlement didn’t trigger automatically
- WebSocket notification was missed
- You want to force-check a specific market immediately
This bypasses the normal 5-minute check interval and forces the settlement system to immediately evaluate this market.
Response
Whether settlement was triggered.
Current settlement status if already in progress.
True if market was already settled.
Total payout amount (if already settled).
Users credited (if already settled).
Example
from polyhush import PolyhushClient
client = PolyhushClient(api_key="your-api-key")
result = client.force_settlement_check(market_id="0x1234...abcd")
if result.get('success'):
print("✅ Settlement triggered!")
print(" Check back in a few minutes for completion")
elif result.get('already_settled'):
print("ℹ️ Market already settled")
print(f" Total payout: ${result.get('total_payout', 0):.2f}")
print(f" Users credited: {result.get('users_credited', 0)}")
elif result.get('status'):
print(f"⏳ Settlement already in progress: {result['status']}")
else:
print(f"❌ Error: {result.get('error')}")
Response (Triggered)
Response (Already Settled)
{
"success": false,
"already_settled": true,
"total_payout": 50000.00,
"users_credited": 150
}
Response (In Progress)
{
"success": false,
"status": "REDEEMING"
}
Response (Error)
{
"success": false,
"error": "Market not yet resolved"
}
Safety
This method is safe to call multiple times. It’s idempotent and won’t double-settle markets that have already been processed.
Debugging Settlement Issues
def debug_settlement(client, market_id):
"""Debug why a settlement isn't working"""
# 1. Check current status
status = client.get_settlement_status(market_id)
print(f"Current status: {status['status']}")
if status['settled']:
print("Market already settled!")
return
# 2. Check if we have a position
if not status.get('had_position'):
print("You don't have a position in this market")
return
# 3. Try forcing a settlement check
print("Forcing settlement check...")
result = client.force_settlement_check(market_id)
if result.get('success'):
print("Settlement triggered! Waiting...")
time.sleep(30)
# 4. Re-check status
new_status = client.get_settlement_status(market_id)
print(f"New status: {new_status['status']}")
else:
print(f"Could not trigger: {result.get('error', result.get('status'))}")