Polymarket Edge Trader
This is a template. The default signal is a user-supplied fair YES probability for markets matching
MARKET_QUERY— remix it with your own model output, external API, or ML prediction. The skill handles all the plumbing: market discovery, context safeguards, position sizing, trade execution, operator summaries, auto-redemption, and AION trade tagging. Your job is to provide the alpha.
Setup
Install the AION SDK:
pip install aionmarket-sdk
Key Safeguards (Built-In)
- Risk Alerts Guard: Skips new entries if briefing reports active risk alerts; runs de-risk logic instead.
- Flip-Flop Detection: Rejects markets with excessive trading reversals or discipline warnings from context.
- Slippage Enforcement: Enforces maximum estimated slippage threshold before showing candidates.
- Market Context Check: Fetches warnings, edge analysis, and trading discipline from AION API; skips if risk detected.
- Kelly Sizing: Uses Kelly-fraction bankroll model with configurable multiplier (
AION_KELLY_MULTIPLIER) for position control. - Auto-Redeem: Automatically claims payouts from resolved markets at each cycle start.
- Dry-Run Default: Only submits live orders when
--liveis explicitly passed with signed order payload. - Public Reasoning: Every trade includes reasoning tied to edge signal, market state, and risk metrics.
- Jitter Polling: Daemon mode (
--daemon) uses randomized wait intervals to avoid synchronized order bursts.
What It Does
- Scans active AION Polymarket markets matching
MARKET_QUERY - Scores each candidate against
MODEL_PROBABILITY - Picks the market with the largest absolute edge
- Skips trades when edge is too small, slippage is too high, briefing risk alerts are active, or AION warns about flip-flopping
- Sizes the position with a Kelly-style bankroll model
- Prints an operator summary with risk state, decisions, and order updates
- Executes through
AionMarketClient.trade()when you explicitly provide--liveand a signed order payload
Defaults
MARKET_QUERY=bitcoinMODEL_PROBABILITY=0.60TARGET_VENUE=polymarketMAX_MARKETS=25MAX_STAKE_USD=50MIN_EDGE=0.03MAX_SLIPPAGE_PCT=0.15STARTING_BALANCE_USD=1000AION_BASE_URL=https://pm-t1.bxingupdate.com/bvapiAION_KELLY_MULTIPLIER=0.25AION_MIN_EV=0.03WALLET_ADDRESS=AION_SIGNED_ORDER_JSON=
How To Run
Dry-run mode (default — no orders submitted):
python edge_trader.py
Scan a different market with custom probability:
python edge_trader.py --query "fed" --probability 0.64
Show ranked candidates before selecting best:
python edge_trader.py --show-candidates
Daemon mode with jitter (for cron/automaton orchestration):
python edge_trader.py --daemon --poll-interval 60
Live trading (requires --live, wallet address, and pre-signed order JSON):
WALLET_ADDRESS=0xYourWallet \
AION_SIGNED_ORDER_JSON='{"maker":"...","signer":"...","taker":"0x0000000000000000000000000000000000000000","tokenId":"...","makerAmount":"...","takerAmount":"...","side":"BUY","expiration":"...","signature":"...","salt":"...","signatureType":0,"nonce":"...","feeRateBps":"0"}' \
python edge_trader.py --query "bitcoin" --probability 0.58 --live
Required Credentials
AION_API_KEYis always requiredWALLET_PRIVATE_KEYis optional and only needed for self-custody Polymarket tradingWALLET_ADDRESSis required for user-scoped briefing and live order submissionAION_SIGNED_ORDER_JSONis only required for live order submission, because the AION SDK expects a complete signed order payload
Remix Ideas
The skill's plumbing is fixed (safeguards, sizing, execution, summaries). Your alpha is:
Signal replacement:
- Replace
MODEL_PROBABILITYwith your own ML model output, external API call, or ensemble forecast. - Swap
discover_markets()forbriefing.opportunityMarkets(pre-curated high-quality markets). - Integrate a multi-model ensemble: call multiple probability endpoints and aggregate them.
- Use sentiment analysis, weather data, or on-chain metrics to derive fair probability.
Advanced position management:
- Add sell logic: close existing positions when signal flips.
- Implement rebalance logic around target portfolio weights.
- Use
get_bankroll()to scale position size dynamically with account growth. - Add staggered entry: split Kelly fraction across multiple limit orders at different prices.
Extended safeguards:
- Tighten
MIN_EDGEfor high-frequency strategies; relax for lower-frequency. - Add custom risk filters: skip markets with high volatility, thin liquidity, or specific conditions.
- Extend auto-redeem to other venues (Kalshi, etc.) by removing venue checks.
- Integrate external alerts: pause trading if certain conditions are met from other systems.
Operational tweaks:
- Adjust
AION_KELLY_MULTIPLIERfor more conservative or aggressive sizing. - Use
--max-slippage-pctandMAX_STAKE_USDas dynamic parameters from a config file. - Add custom telemetry: log trade decisions to your own database or reporting system.
- Build a CLI wrapper that spins up multiple skill instances with different queries.
Scan to join WeChat group