Skip to main content

Signature

client.sync_orders(order_id: str = None) -> Dict

Parameters

ParameterTypeDescription
order_idstringSpecific order to sync. If None, syncs all pending orders

Returns

Single order:
FieldTypeDescription
statusstringSync result: updated, no_change, already_complete, error
order_idstringThe order ID that was synced
filled_sizefloatTotal shares filled (cumulative)
new_statusstringCurrent order status (PLACED, PARTIALLY_FILLED, FILLED, CANCELLED)
new_fill_sizefloatNew shares filled in this sync (0 if no new fills)
messagestringError message (only present if status is “error”)
All orders:
FieldTypeDescription
syncedintOrders whose status was updated
totalintTotal orders processed

Example

from polyhush import PolyhushClient

client = PolyhushClient(api_key="your-api-key")

# Sync all pending orders
result = client.sync_orders()
print(f"Synced {result['synced']} of {result['total']} orders")

# Sync a specific order
result = client.sync_orders(order_id="ord_abc123")
if result['status'] == 'updated':
    print(f"Order synced: {result['new_fill_size']} new shares filled")
    print(f"Total filled: {result['filled_size']}, Status: {result['new_status']}")
elif result['status'] == 'no_change':
    print(f"Order unchanged: {result['filled_size']} filled, Status: {result['new_status']}")
elif result['status'] == 'error':
    print(f"Sync failed: {result.get('message', 'Unknown error')}")
Order status is automatically kept in sync via WebSocket. Only call this manually after network interruptions or if an order seems stuck.