
Polymarket Portfolio Manager
Batch-manage Polymarket positions: track settlement, trigger redemptions, report P&L.
CategoryPrediction MarketsAutomation
ChainsMATIC
C
Cobo· Author
71 views·7 uses
Overview
Batch-manage Polymarket positions: track settlement, trigger redemptions, report P&L.
Facts
•ctf_exchange:
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E•neg_risk_ctf_exchange:
0xC5d563A36AE78145C45a50134d48A1215220f80a•neg_risk_adapter:
0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296•conditional_tokens (CTF ERC1155):
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045•usdc_e (collateral, 6 decimals):
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174•api.gamma:
https://gamma-api.polymarket.com/markets•api.clob:
https://clob.polymarket.comFunctions:
solidity
function balanceOf(address account, uint256 id) external view returns (uint256);function redeemPositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets) external;
Typical Flows
Portfolio monitoring — scheduled off-chain:
1.Enumerate all held conditional token positions via CTF ERC1155
balanceOf queries2.For each position, fetch current odds from CLOB API and resolution status from Gamma API
3.Compute per-position P&L:
current_value - cost_basisAuto-redemption — 1 tx per resolved market:
4.Filter positions where event has resolved
5.For winning positions:
redeemPositions(collateral, parentCollectionId, conditionId, indexSets) on appropriate exchange6.Log:
{market, outcome, payout, cost_basis, realized_pnl}Consolidated reporting:
7.Aggregate: total invested, total redeemed, open exposure, unrealized P&L, realized P&L
Policy Controls
•Batch redemption gas: Multiple redemptions in sequence; ensure sufficient MATIC for gas.
•Exchange routing per position: Each position must route to the correct exchange (CTF vs Neg Risk CTF); wrong routing = revert.
•Stale odds data: Odds shift rapidly near resolution; P&L snapshots are approximate until settlement.
•Losing positions: Tokens on losing side return nothing; do not attempt redemption on losing outcomes.
•Policy denial: Redemptions are contract calls; ensure pact covers exchange contracts.
•Related recipes: use
polymarket-research-polygon for market discovery, polymarket-trading-polygon for order execution, polymarket-settlement-polygon for redemption•Not applicable for: placing new prediction market orders — use
polymarket-trading-polygon; testnet operations — use Amoy testnet recipes•Partial reference: use web search for unlisted tokens, contracts, parameters, or up-to-date addresses
References
•Docs:
https://docs.polymarket.com/llms.txt — CTF/neg-risk contract ABI, CLOB order types, conditional token redemption, USDC.e collateral.