Configuration

Complete guide to configuring MoltMarket for your trading strategy.


Configuration File

MoltMarket uses a YAML configuration file located at ~/.moltmarket/config.yaml.

Full Configuration Example

# Platform Credentials
platforms:
  polymarket:
    enabled: true
    api_key: ${POLYMARKET_API_KEY}
    wallet_address: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
    private_key_path: ~/.moltmarket/polygon.key
    network: polygon
    rpc_url: https://polygon-rpc.com

  kalshi:
    enabled: true
    api_key: ${KALSHI_API_KEY}
    api_secret: ${KALSHI_API_SECRET}
    email: [email protected]
    demo: false
    api_url: https://trading-api.kalshi.com

# Security Settings
security:
  # Position limits
  max_position_size: 1000        # USD per trade
  max_total_exposure: 10000      # Total across all positions
  max_daily_loss: 5000           # Max loss per day

  # Approval thresholds
  require_approval_above: 1000   # Trades > $1000 need Ledger
  auto_approve_below: 100        # Trades < $100 auto-execute

  # Session key settings
  session_key_expiry: 86400      # 24 hours in seconds
  session_key_rotation: true     # Auto-rotate daily

  # Hardware wallet
  ledger:
    enabled: true
    derivation_path: "44'/60'/0'/0/0"
    timeout: 120                 # Approval timeout in seconds

# Risk Management
risk:
  # Stop-loss and take-profit defaults
  default_stop_loss: 0.35        # Close at 35% probability
  default_take_profit: 0.65      # Close at 65% probability

  # Portfolio limits
  max_open_positions: 20
  max_concentration: 0.30        # Max 30% in single market
  max_category_exposure: 0.50    # Max 50% in one category

  # Slippage
  default_slippage_tolerance: 0.01  # 1%
  max_slippage: 0.05                # 5% maximum

# Logging
logging:
  level: info                    # debug, info, warn, error
  console_output: true
  file_output: true
  log_path: ~/.moltmarket/logs/moltmarket.log

  # Audit logging (compliance)
  audit_enabled: true
  audit_path: ~/.moltmarket/audit.log
  audit_retention_days: 365

# Performance
performance:
  # Caching
  cache_enabled: true
  cache_market_data_seconds: 30
  cache_orderbook_seconds: 5

  # API rate limiting
  polymarket_requests_per_second: 10
  kalshi_requests_per_minute: 100

  # Timeouts
  api_timeout_seconds: 10
  trade_confirmation_timeout: 30

# Notifications (optional)
notifications:
  enabled: false
  email:
    enabled: false
    smtp_host: smtp.gmail.com
    smtp_port: 587
    from_address: [email protected]
    to_addresses:
      - [email protected]
  telegram:
    enabled: false
    bot_token: ${TELEGRAM_BOT_TOKEN}
    chat_id: ${TELEGRAM_CHAT_ID}
  discord:
    enabled: false
    webhook_url: ${DISCORD_WEBHOOK_URL}

# Advanced
advanced:
  # Multi-agent coordination
  enable_multi_agent: false
  agent_coordination_port: 3402

  # Backtesting
  backtesting_mode: false
  backtest_data_path: ~/.moltmarket/backtest/

  # Smart contract guardrails (Polymarket only)
  smart_contract_guardrail:
    enabled: false
    contract_address: "0x..."
    deploy_on_start: false

Environment Variables

Sensitive credentials should be stored as environment variables:

Required Variables

Optional Variables

Loading Environment Variables

Add to ~/.bashrc or ~/.zshrc:


Security Configuration

Position Size Limits

Recommendation:

  • Start with 10% of total capital as max_position_size

  • Set max_total_exposure to 80-90% of capital (keep reserve for fees)

Daily Loss Limits

Behavior:

  • Tracks realized + unrealized losses

  • Resets at midnight UTC

  • Blocks all new positions when limit hit

Approval Thresholds

Workflow:


Risk Management Configuration

Stop-Loss and Take-Profit

Example:

Portfolio Concentration

Validation:


Platform Configuration

Polymarket

Network Options:

  • polygon: Production (mainnet)

  • polygon-mumbai: Testnet

Kalshi

Demo Mode:


Logging Configuration

Log Levels

Level Descriptions:

  • debug: All events including API calls

  • info: Important events (trades, errors)

  • warn: Warnings and anomalies

  • error: Errors only

Audit Logging

Audit Log Format:


Performance Tuning

Caching

Benefits:

  • Reduces API calls by 70-80%

  • Faster market searches

  • Lower rate limit usage

Trade-offs:

  • Market data may be stale (up to 30s old)

  • Not recommended for high-frequency trading

API Rate Limits

Default Limits (platform-imposed):

  • Polymarket: Unlimited (public data)

  • Kalshi: 100 requests/minute


Notification Configuration

Email Notifications

Events Notified:

  • Position opened

  • Position closed (P&L)

  • Risk limit exceeded

  • Platform errors

Telegram Notifications

Setup:

  1. Create bot with @BotFatherarrow-up-right

  2. Set environment variables


Advanced Configuration

Multi-Agent Coordination

Use case: Multiple agents share risk limits

Backtesting Mode

Behavior:

  • Trades execute against historical data

  • No real API calls

  • No actual funds used


Configuration Validation

Validate Configuration

Test Configuration


Common Configurations

Conservative (Low Risk)

Moderate (Balanced)

Aggressive (High Risk)



Support

Configuration questions? [email protected]envelope

Last updated