Skip to content

ssolis-ti/poly-mktai

 
 

Repository files navigation

MIT License


Logo

Poly-MktAI (Modernized Fork)

Autonomous Trading Agents for Polymarket.
Now with Multi-Brain Architecture (OpenAI, Anthropic, Local)

Poly-MktAI

This project is a modernized fork of the original Polymarket Agents framework. It has been re-architected to be LLM-Agnostic, allowing you to plug in different "brains" (OpenAI, Anthropic, DeepSeek, Local Llama) to drive your trading strategy.

🚀 Key Modernization Features

  • Multi-Model Architecture: Decoupled LLMProvider interface. Switch between OpenAIGPT-4, Claude 3.5 Sonnet, or local models via config.yaml.
  • Lazy Loading CLI: Instant startup time (no more hanging on import).
  • Robust Dependency Management: Fixed compatibility issues with Web3 and OnnxRuntime on Windows.
  • Configurable: centralized configuration in config.yaml for models, endpoints, and constants.

🛠️ Installation

Prerequisites

  • Python 3.10+ (Recommended)
  • Git

1. Clone the repository

git clone https://github.com/ssolis-ti/poly-mktai.git
cd poly-mktai

2. Create and Activate Virtual Environment

Windows:

python -m venv .venv
.venv\Scripts\activate

macOS/Linux:

python3 -m venv .venv
source .venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configuration

  1. Secrets: Copy .env.example to .env and fill in your keys.

    cp .env.example .env

    Required keys:

    • POLYGON_WALLET_PRIVATE_KEY (Your wallet private key)
    • OPENAI_API_KEY (If using OpenAI)
  2. App Config: Edit config.yaml to tweak model settings (e.g., token limits, model names).

🤖 Usage

Dry Run (Recommended for testing)

Simulate the agent's logic without executing real trades. Perfect for verifying that your "Brain" is working correctly.

# Windows (PowerShell) - Set PYTHONPATH just in case
$env:PYTHONPATH="."; python scripts/python/cli.py run-autonomous-trader --dry-run
# macOS/Linux
PYTHONPATH=. python scripts/python/cli.py run-autonomous-trader --dry-run

Real Trading

⚠️ WARNING: Real money usage.

python scripts/python/cli.py run-autonomous-trader

Other CLI Commands

The CLI provides granular access to the system components:

# Get all markets locally filtered
python scripts/python/cli.py get-all-markets

# Ask the Superforecaster module
python scripts/python/cli.py ask-superforecaster "Will ETH hit 4k?" "Does ETH hit 4k by December?" "Yes"

🏗️ Architecture

Decoupled Brain (agents/llm/)

  • LLMProvider: Abstract interface for all AI models.
  • adapters/: Implementations for specific providers (currently OpenAIAdapter).
  • factory.py: Instantiates the correct provider based on configuration.

Core Components

  • agents/application/executor.py: The central nervous system. Coordinates RAG, Market Tools, and the LLM.
  • agents/polymarket/: Interactions with the Gamma (Market Info) and CLOB (Order Book) APIs.
  • agents/connectors/: Integrations with external data sources (NewsAPI, ChromaDB).

🤝 Contributing

Contributions are welcome! Specifically looking for:

  • New Adapters: Implement AnthropicAdapter or DeepSeekAdapter in agents/llm/adapters/.
  • Strategies: New trading logics in agents/application/trade.py.

📜 License

MIT License. See LICENSE for details.

About

Polymarket AI Bot

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.5%
  • Other 0.5%