Loading repository data…
Loading repository data…
qrak / repository
LLM-powered Crypto Trading Framework with Vision AI chart analysis, real-time Neural Engine, and a live monitoring dashboard at semanticsignal.qrak.org. Features memory-augmented reasoning and professional risk metrics.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
An autonomous AI trading agent that reads charts, remembers outcomes, and sharpens its strategy in real time.
📊 Live Dashboard — Watch the neural trading brain in action
📖 Read the Full Story (Medium)
💬 Join the Discord
⚠️ Research Edition. Runs in paper-trading mode only. Real exchange order execution is not implemented in this public branch.
git clone https://github.com/qrak/LLM_trader.git && cd LLM_trader
python -m venv .venv && source .venv/bin/activate # or .venv\Scripts\Activate.ps1 on Windows
pip install -r requirements.txt
cp keys.env.example keys.env # add your API keys (Google Gemini free tier works)
python start.py # dashboard at http://localhost:8000
Platform-specific scripts live in scripts/ — they handle venv creation, dependency install, and startup:
| Script | Purpose |
|---|---|
scripts/start_script_main.ps1 | Start the bot (Windows) |
scripts/start_script_main_linux.sh | Start the bot (Linux) |
scripts/start_script_main_macos.sh | Start the bot (macOS) |
scripts/run_all_tests.sh | Run full test suite in .venv |
scripts/query_trade_history.py | CLI utility to inspect SQLite trade history |
| Key | Action |
|---|
a | Force analysis — run immediate market check |
d | Toggle dashboard on/off |
h | Help — show available commands |
q | Quit — graceful shutdown with state preservation |
N closed trades, the system synthesizes best-practice rules, anti-patterns, and AI-mistake rules. These persist in vector memory and influence future decisions — the bot learns from its own outcomes.0.0.0.0:8000 (or semanticsignal.qrak.org). Shows brain activity, last prompt/response, position state, performance stats, news, market data, and memory bank.flowchart TB
subgraph Data["Data Sources"]
EX["Exchanges (CCXT) → OHLCV + Order Book + Trade Flow"]
NEWS["RSS Feeds + Crawl4AI"]
FUND["CoinGecko + DeFiLlama + Alternative.me"]
end
subgraph Analysis["Analysis Engine"]
TC["Technical Calculator<br/>40+ indicators"]
PE["Pattern Engine<br/>Deterministic indicator patterns"]
CG["Chart Generator<br/>4K PNG with SMA/RSI/Volume"]
RAG["RAG Engine<br/>News relevance scoring"]
end
subgraph Brain["🧠 Brain Layer"]
VM["Vector Memory<br/>ChromaDB (3 collections)"]
REFL["Reflection Engine<br/>Rules from closed trades"]
CTX["Context Builder<br/>Similarity retrieval + confidence calibration"]
end
subgraph Execution["Paper Execution"]
RP["Risk Manager<br/>SL/TP, sizing, R:R"]
GP["Guard Pipeline<br/>Symbol → Size → Cooldown"]
STRAT["Trading Strategy<br/>ExitMonitor + PositionStatusMonitor"]
end
Data --> Analysis
Analysis --> Brain
Brain --> AI["AI Provider<br/>(Gemini / OpenRouter / LM Studio)"]
AI --> RP --> GP --> STRAT
STRAT -.->|Closed trade feedback| Brain
| Path | Role |
|---|---|
start.py | Entry point — 8-stage dependency injection, ChromaDB + CoinGecko cache setup |
src/app.py | CryptoTradingBot — main async loop, ticker fetch, analysis orchestration |
src/trading/brain.py | TradingBrainService — context assembly, experience recording, reflection triggers |
src/trading/vector_memory.py | ChromaDB interface — trade experiences, semantic rules, blocked trades |
src/analyzer/analysis_engine.py | Market analysis orchestration — indicators, chart, RAG, LLM call |
src/managers/provider_orchestrator.py | AI provider fallback chain with retry logic |
src/managers/risk_manager.py | Dynamic SL/TP, position sizing, friction tracking |
src/trading/trading_strategy.py | Position lifecycle, guard enforcement, exit monitoring |
src/analyzer/prompts/template_manager.py | System prompt construction with falsification-based invalidation step |
src/analyzer/trend_validator.py | Cross-checks LLM-reported trend strength against computed ADX |
src/analyzer/pattern_quality_scorer.py | Deterministic pattern quality scoring replacing LLM's self-reported score |
src/notifiers/notifier.py | Discord notifications with message expiration tracking |
# Full suite (900+ tests)
pytest tests/ -q
# Focused
pytest tests/test_ticker_retry.py tests/test_brain_integration.py -q
# Linting
ruff check src tests start.py
Key settings in config/config.ini:
| Setting | Default | Description |
|---|---|---|
crypto_pair | BTC/USDC | Trading pair |
timeframe | 4h | Analysis candle timeframe |
provider | googleai | AI provider (googleai, openrouter, lmstudio) |
demo_quote_capital | 10000 | Simulated capital |
max_position_size | 0.10 | Max position as fraction of capital |
stop_loss_type | hard | hard (interval check) or soft (candle close) |
Required API keys in keys.env:
| Variable | Required | For |
|---|---|---|
GOOGLE_STUDIO_API_KEY | Yes | Primary AI provider (free tier) |
GOOGLE_STUDIO_PAID_API_KEY | If used | Paid tier Google AI |
OPENROUTER_API_KEY | If used | Secondary AI provider |
BOT_TOKEN_DISCORD | If used | Discord notifications |
MAIN_CHANNEL_ID | If used | Discord notification channel |
COINGECKO_API_KEY | No | Market metrics (rate limit boost) |
HF_TOKEN | No | HuggingFace model access |
.ai/plans/real_trading_implementation_plan.md)config.ini editing) (plan at .ai/plans/admin-dashboard-plan.md)NOT FINANCIAL ADVICE. This software is experimental and in BETA. Paper-trading only — real exchange order execution is not implemented. No warranty provided. Use at your own risk.