Skip to main content

Trading with PolyOracle AI

Learn how to execute trades based on your market analysis and manage your trading strategy effectively.

Trading Workflow

1. Analysis to Trade Decision

After completing market analysis, the agent provides a structured decision:

Decision: BUY YES tokens
Confidence: 0.82 (High)
Recommended Size: $250 USDC
Expected Price: $0.67
Rationale: Strong research consensus supports higher probability
Risk Assessment: Medium - liquid market, good fundamentals

2. Human Confirmation (Default)

By default, all trades require human approval:

In Web Interface:

  • Review the analysis summary
  • Check the trade parameters
  • Click "Approve Trade" or "Reject Trade"
  • Monitor execution progress

Safety Features:

  • Clear display of trade size and direction
  • Summary of key analysis points
  • Risk warnings for large positions
  • Ability to modify trade size before approval

3. Trade Execution

Once approved, the agent executes the trade:

  1. Pre-execution Checks:

    • Verify sufficient USDC balance
    • Check current market price
    • Validate order parameters
    • Confirm proxy contract is ready
  2. Order Placement:

    • Places market order on Polymarket CLOB
    • Monitors order status and fills
    • Updates position records
    • Logs execution details
  3. Post-execution:

    • Confirms token receipt
    • Updates portfolio balances
    • Records trade history
    • Calculates realized/unrealized P&L

Trade Types and Strategies

Market Orders

When to Use:

  • High-confidence signals
  • Time-sensitive opportunities
  • Liquid markets with tight spreads

Configuration:

market_order = {
"type": "market",
"side": "buy", # or "sell"
"size": 100, # USDC amount
"outcome": "yes" # or "no"
}

Position Sizing Strategies

Fixed Dollar Amount

fixed_size = {
"method": "fixed_amount",
"amount": 100, # Always trade $100
"max_position": 500 # Maximum total position
}

Confidence-Based Sizing

confidence_sizing = {
"method": "confidence_based",
"base_amount": 50,
"multiplier": 200, # 200 * confidence
# Confidence 0.8 = $160 trade
}

Kelly Criterion Sizing

kelly_sizing = {
"method": "kelly",
"bankroll": 1000,
"edge_estimate": "research_based",
"max_fraction": 0.25 # Never risk over 25% of bankroll
}

Risk Management Rules

Position Limits

risk_limits = {
"max_single_position": 500, # Max $500 per market
"max_total_exposure": 2000, # Max $2000 total
"max_positions": 10, # Max 10 concurrent positions
"max_correlation": 0.7 # Max 70% correlation between positions
}

Stop-Loss Rules

stop_loss = {
"enabled": True,
"threshold": -0.3, # Stop if down 30%
"trailing_stop": True, # Trail profits
"min_hold_time": 3600 # Minimum 1 hour hold
}

Advanced Trading Features

Portfolio Rebalancing

Automatic Rebalancing:

  • Triggered by new high-confidence signals
  • Reduces overconcentrated positions
  • Maintains target allocation across markets

Manual Rebalancing:

# Via web interface
Click "Portfolio" → "Rebalance" → Review → Execute

# Via API
curl -X POST http://localhost:2024/rebalance \
-H "Content-Type: application/json" \
-d '{"target_allocation": "equal_weight"}'

Multi-Market Strategies

Arbitrage Detection

arbitrage_config = {
"min_spread": 0.02, # 2% minimum spread
"max_execution_time": 60, # 60 seconds max
"related_markets_only": True, # Only arb related markets
}

Correlation Trading

correlation_strategy = {
"base_market": "0x123...",
"correlated_markets": ["0x456...", "0x789..."],
"correlation_threshold": 0.8,
"trade_on_divergence": True
}

Automated Trading (Advanced)

⚠️ Warning: Automated trading involves significant risk. Start with small amounts and paper trading.

Enable Automated Trading

# In backend configuration
auto_trading = {
"enabled": False, # Set to True when ready
"min_confidence": 0.8, # Only trade high-confidence signals
"max_daily_trades": 5, # Limit daily activity
"position_limits": {...} # Include all risk limits
}

Paper Trading Mode

paper_trading = {
"enabled": True,
"starting_balance": 1000,
"track_performance": True,
"log_would_be_trades": True
}

Monitoring Your Trades

Real-Time Monitoring

Web Interface Dashboard:

  • Current positions and P&L
  • Recent trade history
  • Portfolio allocation
  • Risk metrics

Key Metrics to Watch:

  • Total portfolio value
  • Unrealized P&L by position
  • Win/loss ratio
  • Average holding time
  • Risk-adjusted returns

Trade History Analysis

Performance Metrics:

Trade Performance Summary:
Total Trades: 25
Win Rate: 68% (17 winners, 8 losers)
Average Win: +$45
Average Loss: -$23
Total P&L: +$321
Max Drawdown: -$78 (5.2%)
Sharpe Ratio: 1.34

Analysis by Market Category:

Politics Markets: 12 trades, +$234 P&L
Economics Markets: 8 trades, +$89 P&L
Sports Markets: 5 trades, -$2 P&L

Trading Best Practices

Entry Strategy

  1. Wait for High Confidence (over 0.7)

    • Better to miss trades than make poor ones
    • Quality over quantity approach
    • Focus on your areas of expertise
  2. Check Market Conditions

    • Sufficient liquidity for your size
    • Reasonable bid-ask spreads (under 3%)
    • Not too close to expiration (under 24 hours)
  3. Position Sizing

    • Start smaller than you think
    • Scale up with experience and success
    • Never risk more than you can afford to lose

Exit Strategy

  1. Profit Taking

    • Set profit targets (e.g., 20% gain)
    • Consider partial profit taking
    • Don't get greedy with winners
  2. Loss Management

    • Stick to stop-loss levels
    • Cut losses quickly on new negative information
    • Don't average down unless very confident
  3. Time-Based Exits

    • Consider position duration
    • Markets close to resolution may be less predictable
    • Rebalance periodically

Risk Management

  1. Diversification

    • Don't put all funds in one market
    • Vary market categories and types
    • Consider correlation between positions
  2. Bankroll Management

    • Start with small percentage of total capital
    • Increase position sizes gradually with success
    • Keep some powder dry for opportunities
  3. Emotional Management

    • Let the AI handle analysis, you handle risk
    • Don't override the system based on emotions
    • Take breaks after significant losses

Troubleshooting Trading Issues

Common Execution Problems

"Insufficient Balance"

  • Check USDC balance in wallet
  • Account for gas fees (MATIC)
  • Verify funds are on Polygon network

"Order Rejected"

  • Market may have moved significantly
  • Check current bid/ask prices
  • Verify order size is within limits

"Proxy Contract Error"

  • Ensure proxy contract is properly configured
  • Check proxy address in environment variables
  • Verify proxy has necessary approvals

Performance Issues

Poor Win Rate

  • Increase confidence threshold for trades
  • Focus on markets with better research quality
  • Analyze losing trades for patterns

High Transaction Costs

  • Batch trades when possible
  • Focus on larger position sizes
  • Monitor gas prices and trade timing

Market-Specific Issues

Low Liquidity Markets

  • Reduce position sizes
  • Use limit orders instead of market orders
  • Consider impact on execution price

Volatile Markets

  • Use smaller position sizes
  • Set tighter stop-losses
  • Consider shorter holding periods

Advanced Features

API Trading

Direct API access for custom strategies:

import requests

# Place a trade via API
trade_request = {
"market_id": "0x123...",
"side": "buy",
"outcome": "yes",
"amount": 100,
"confidence_required": 0.75
}

response = requests.post(
"http://localhost:2024/trade",
json=trade_request
)

Backtesting Strategies

Test strategies on historical data:

backtest_config = {
"start_date": "2024-01-01",
"end_date": "2024-06-01",
"initial_capital": 1000,
"strategy": "confidence_based_sizing",
"min_confidence": 0.7
}

Integration with External Tools

TradingView Integration:

  • Export trade signals to TradingView
  • Use TradingView alerts for monitoring
  • Track performance against benchmarks

Spreadsheet Export:

  • Export trade history to CSV
  • Analyze performance in Excel/Google Sheets
  • Create custom reporting dashboards

Next Steps

Once you're comfortable with trading:

  1. Portfolio Management - Use the Portfolio Status API to track positions
  2. Performance Monitoring - Monitor your trades using the dashboard features described in Monitoring Your Trades
  3. Advanced Strategies - Explore the Advanced Trading Features section above

Ready to improve your performance? Review the Trading Best Practices and Risk Management sections to optimize your strategy.