⚠ INTERNAL — Operator UX mock · Design preview of V2 development path · demo-wired ≠ production-live · back to dev guide
Polygon · pUSD 10
📓 Developer Guide 📋 Reason Codes 📈 Shadow Mode
JD John Doe · Admin

Portfolio Sync

gov.portfolio-sync
Governance & Ops live General live frozen

PortfolioSync keeps the in-memory portfolio state — open positions and open orders — continuously synchronised with on-chain pUSD balances and CLOB op

What it does

PortfolioSync keeps the in-memory portfolio state — open positions and open orders — continuously synchronised with on-chain pUSD balances and CLOB open-order state. It reconciles the internal position store against clob_auth open orders and the Polygon on-chain balance every sync_interval_s. For negative-risk markets (NegRiskAdapter), it correctly aggregates multi-outcome positions using the negRisk flag. On discrepancy beyond discrepancy_alert_usd, it emits an alert and, if configured, pauses the affected strategy to prevent trading against a stale view of risk. Emits both a SettlementReport (position deltas) and an OperationsReport (sync health) on every cycle.

Pipeline placement

runs after: Every fill event; on configured sync_interval_s; on-demand after significant pos Portfolio Sync runs before: PnLReporter (provides position state), PortfolioGuard (provides current exposure

Applies to: All open positions and open orders across all active markets, including negative-risk multi-outcome positions

Why it matters

If this failsConsequence
In-memory position state drifts from on-chain realityStrategies trade against a stale position view. Risk guards (PortfolioGuard, KillSwitch) see incorrect exposure, potentially allowing positions that exceed risk limits.
Negative-risk positions aggregated incorrectlyMulti-outcome positions in negRisk markets have correlated payoffs. Treating them as independent binary positions overstates available margin and may cause liquidation.
Open-order count diverges from CLOBStrategies submit orders assuming capacity that no longer exists. This inflates fill expectations and distorts P&L projections.
Strategy not paused on drift beyond thresholdTrading continues against a stale portfolio state. Risk exposure is uncontrolled until the next successful sync cycle.

Inputs

Polymarket inputs

InputSourceRequiredUse
Open orders from CLOB (per wallet, per market)clob_authrequiredCompare against internal open-order store to detect divergence.
On-chain pUSD balance (Polygon wallet)onchainrequiredCross-check internal pUSD accounting against actual on-chain balance.
Market metadata (negRisk flag, condition_id, outcome tokens)clob_authrequiredCorrectly aggregate multi-outcome positions in negRisk markets using NegRiskAdapter.

Internal inputs

InputSourceRequiredUse
Internal position store snapshotin-memory staterequiredThe current internal view of open positions that must be reconciled against external state.
KillSwitch active flagKillSwitchoptionalWhen KillSwitch is active, continue syncing but suppress auto-pause-strategy logic.

Authority

What this bot is permitted to do

Explain

State

Readiness

General live

Status

live

Class

Governance Service

Default mode

general_live

Developer owner

Polytraders core — Governance pod

Capital impact

Indirect

Reason codes emitted

CodeSeverityMeaningAction
PORTFOLIO_SYNC_CYCLE_COMPLETEINFOFull sync cycle completed; OperationsReport emitted.No action — routine.
PORTFOLIO_SYNC_DISCREPANCYWARNPosition drift between internal store and CLOB exceeds discrepancy_alert_usd threshold.Emit alert; apply delta to internal store; log drift_pusd.
PORTFOLIO_SYNC_CRITICAL_DISCREPANCYWARNPosition drift exceeds the hard threshold (500 pUSD). This indicates a significant state divergence.Emit page alert; optionally pause affected strategy (auto_pause_strategy_on_drift).
PORTFOLIO_SYNC_STRATEGY_PAUSEDWARNA strategy was automatically paused because position drift exceeded the hard threshold.Notify on-call; do not resume until drift is investigated and resolved.
PORTFOLIO_SYNC_CLOB_UNAVAILABLEWARNCLOB auth API was unavailable during a sync cycle; no delta applied.Skip cycle; emit alert; retry on next interval.
PORTFOLIO_SYNC_NEGRISK_AGGREGATEINFOA negative-risk multi-outcome market was encountered; NegRiskAdapter aggregation applied.No action — informational.
STALE_DATAWARNCLOB or RPC data is older than sync_interval_s; internal store may be stale.Emit WARN; skip delta application; retry sync on next cycle.
PARAMETER_CHANGE_REQUIRES_APPROVALHARD_REJECTsync_interval_s exceeds the 300s hard maximum.Reject the config change; emit alert.

Used by

Reverse index — strategies that currently reference gov.portfolio-sync. If you change this bot's authority or reason codes, these strategies must re-pass shadow.

StrategyStateActivity
NBA H2H — moneyline market-makedemo-wiredlast triggered 24m ago
US Elections — sentiment fadedemo-wiredlast triggered 31m ago

Showing 2 of 2 · demo-wired ≠ production-live

Why this matters

Governance & Ops bots does NOT propose, approve, or block trades; only observes and reports. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →
Polytraders Operator UX Mock · INTERNAL · demo-wired ≠ production-live · the plan · reason codes · shadow-mode pipeline
⚙ Page Configuration
Current page settings
Loading configuration…