AI-driven quantitative trading system for onchain intelligence, based on Jim Simons' statistical arbitrage principles.
From noise to signal. From signal to profit.
ChainLens extracts weak but repeatable statistical patterns from onchain data, social media, and news sources, then executes automated trades with strict risk management.
- Smart Money Signals - Track whale/KOL/smart money movements via OKX OnchainOS
- Twitter Sentiment - Monitor KOL mentions and community sentiment
- News Events - AI-rated crypto news with impact scoring
- Onchain Data - 8-dimension token risk auditing
-
Triple Confirmation - Smart Money + Twitter + Risk Score > 60
- Win rate target: >55%
- Position size: 2-5% of capital
- Stop-loss: -15% | Take-profit: +30%
-
Resonance - KOL mention + positive news within 6 hours
- Win rate target: >60%
- Position size: 3-7% of capital
- Stop-loss: -12% | Take-profit: +40%
-
Contrarian - Price drop >20% + strong fundamentals + Smart Money buying
- Win rate target: >50%
- Position size: 1-3% of capital
- Stop-loss: -10% | Take-profit: +25%
-
Arbitrage - DEX price spread >2% with sufficient liquidity
- Win rate target: >90%
- Position size: 10-20% of capital
- No stop-loss (risk-free arbitrage)
- Position Limits: Max 10% per trade, 40% total exposure
- Stop-Loss: Automatic execution at predefined levels
- Circuit Breaker: Halt trading if daily loss >5%
- Kelly Criterion: Position sizing based on win rate and risk/reward
- Python 3.11+
- PostgreSQL 15+ (or use GitHub Actions service container)
- OKX OnchainOS API access
# Clone repository
git clone https://github.com/brucey0017-cloud/ChainLens.git
cd ChainLens
# Install dependencies
pip install psycopg2-binary python-dotenv web3
# Set up environment
cp .env.example .env
# Edit .env with your credentials
# Initialize database
psql $DATABASE_URL -f schema.sqlCreate .env file:
# Database
DATABASE_URL=postgresql://localhost/chainlens
# Trading Wallet (dedicated small-amount wallet)
WALLET_ADDRESS=0x...
WALLET_PRIVATE_KEY=0x...
# Optional: Notification channels
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...# Phase 1: Paper Trading (2 weeks)
python3 signal_monitor.py # Collect signals
python3 strategy_engine.py # Generate paper trades
python3 position_monitor.py # Monitor positions
python3 daily_report.py # Generate report
# Phase 2: Small-amount real trading
# Set is_paper=False in strategy_engine.py after validationThe system runs automatically via GitHub Actions:
- Every 15 minutes: Signal monitoring + strategy execution + position monitoring
- Manual trigger: Backtest or generate reports
See .github/workflows/trading-system.yml
Live dashboard: https://brucey0017-cloud.github.io/ChainLens/
- Real-time signals
- Open positions
- Strategy performance
- Risk metrics
Goal: Validate strategies with >55% win rate
Status:
- ✅ Database schema
- ✅ Signal monitoring (Smart Money)
- ✅ Strategy engine (Triple Confirmation, Contrarian)
- ✅ Position monitoring (stop-loss/take-profit)
- ✅ Daily reporting
- ⏳ Twitter sentiment integration
- ⏳ News event integration
- ⏳ Backtest system
Next Steps:
- Integrate opentwitter skill for KOL sentiment
- Integrate opennews skill for news events
- Implement real price fetching from onchainos
- Run 2-week paper trading validation
- Analyze results and tune parameters
Based on Jim Simons' Medallion Fund principles:
- Monthly Return: 5-15%
- Annual Return: 60-180% (compounded)
- Win Rate: 55-65%
- Profit Factor: 1.5-2.5
- Max Drawdown: 15-25%
This is an experimental quantitative trading system. Past performance does not guarantee future results.
Risks:
- Strategy failure (market structure changes)
- Black swan events (exchange hacks, regulatory crackdowns)
- Technical failures (API downtime, signing errors)
- Capital limits (strategy capacity constraints)
Always:
- Start with paper trading
- Use dedicated small-amount wallets
- Never risk more than you can afford to lose
- Monitor performance continuously
ChainLens/
├── schema.sql # Database schema
├── signal_monitor.py # Collect signals from multiple sources
├── strategy_engine.py # Execute trading strategies
├── position_monitor.py # Monitor open positions
├── daily_report.py # Generate performance reports
├── trade_executor.py # Sign and broadcast transactions
├── token_auditor.py # 8-dimension risk scoring
├── .github/workflows/ # GitHub Actions automation
└── docs/ # Dashboard frontend
- Fork the repository
- Create a feature branch
- Test with paper trading first
- Submit a pull request
- Jim Simons & Renaissance Technologies
- OKX OnchainOS Documentation
- Kelly Criterion
- Quantitative Trading Strategies
Apache License 2.0 - See LICENSE file
- GitHub Issues: Report bugs / Request features
- X Layer AI Hackathon: Project submission
Built with ❤️ by the ChainLens team
"The market is not predictable. But it contains small, repeatable statistical patterns. Find them, validate them, automate them, and manage risk strictly. That's the secret." - Jim Simons (paraphrased)