Autonomous Trading Agents for Polymarket.
Now with Multi-Brain Architecture (OpenAI, Anthropic, Local)
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.
- Multi-Model Architecture: Decoupled
LLMProviderinterface. Switch between OpenAIGPT-4, Claude 3.5 Sonnet, or local models viaconfig.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.yamlfor models, endpoints, and constants.
- Python 3.10+ (Recommended)
- Git
git clone https://github.com/ssolis-ti/poly-mktai.git
cd poly-mktaiWindows:
python -m venv .venv
.venv\Scripts\activatemacOS/Linux:
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txt-
Secrets: Copy
.env.exampleto.envand fill in your keys.cp .env.example .env
Required keys:
POLYGON_WALLET_PRIVATE_KEY(Your wallet private key)OPENAI_API_KEY(If using OpenAI)
-
App Config: Edit
config.yamlto tweak model settings (e.g., token limits, model names).
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-runpython scripts/python/cli.py run-autonomous-traderThe 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"LLMProvider: Abstract interface for all AI models.adapters/: Implementations for specific providers (currentlyOpenAIAdapter).factory.py: Instantiates the correct provider based on configuration.
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).
Contributions are welcome! Specifically looking for:
- New Adapters: Implement
AnthropicAdapterorDeepSeekAdapterinagents/llm/adapters/. - Strategies: New trading logics in
agents/application/trade.py.
MIT License. See LICENSE for details.