Skip to content

Commit c4f57a3

Browse files
committed
Refactor QuantCoder CLI v2.0 - Inspired by Mistral Vibe CLI
Major architectural refactoring with modern Python best practices: ## New Architecture - Tool-based system inspired by Mistral Vibe CLI - Modern packaging with pyproject.toml - Configuration management via TOML files - Interactive chat interface with prompt-toolkit - Programmatic mode with --prompt flag - Rich terminal UI with syntax highlighting ## Core Components - quantcoder/config.py: Configuration system - quantcoder/cli.py: Modern CLI with Click + Rich - quantcoder/chat.py: Interactive & programmatic chat - quantcoder/core/: LLM handler and article processor - quantcoder/tools/: Modular tool system ## Tools - Article tools: search, download, summarize - Code tools: generate, validate - File tools: read, write ## Features - Updated to OpenAI SDK v1.0+ - Conversational AI interface - Context-aware chat history - Auto-completion and suggestions - Syntax-highlighted code display - Markdown rendering - Configuration via ~/.quantcoder/config.toml ## Documentation - README_v2.md: Complete v2.0 documentation - Updated main README.md - requirements.txt for easy installation Breaking change: Requires Python 3.10+ Legacy v0.3 preserved for backward compatibility
1 parent f4b4674 commit c4f57a3

File tree

18 files changed

+2420
-47
lines changed

18 files changed

+2420
-47
lines changed

.gitignore

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,66 @@
1-
# Python virtual environments
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
24+
# Virtual Environment
25+
.venv/
226
.venv-legacy/
327
venv/
28+
ENV/
29+
env/
430

5-
# Bytecode files
6-
__pycache__/
7-
*.pyc
31+
# IDE
32+
.vscode/
33+
.idea/
34+
*.swp
35+
*.swo
36+
*~
37+
38+
# Logs
39+
*.log
40+
quantcli.log
41+
article_processor.log
842

9-
# Environment variables
43+
# QuantCoder specific
44+
downloads/
45+
generated_code/
46+
articles.json
47+
output.html
48+
49+
# Configuration (contains API keys)
1050
.env
51+
.quantcoder/
1152

12-
# Logs and output
13-
*.log
14-
output.*
53+
# OS
54+
.DS_Store
55+
Thumbs.db
1556

16-
# Packaging metadata
17-
*.egg-info/
57+
# SpaCy models
58+
*.bin
59+
60+
# Testing
61+
.pytest_cache/
62+
.coverage
63+
htmlcov/
64+
65+
# Distribution
66+
*.whl

README.md

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,101 @@
1-
# QuantCoder (CLI Version)
1+
# QuantCoder v2.0
2+
3+
> **AI-powered CLI for generating QuantConnect trading algorithms from research articles**
24
35
QuantCoder is a command-line tool that allows users to generate QuantConnect trading algorithms from research articles using natural language processing and large language models (LLMs). It was initiated in November 2023 and based on a cognitive architecture inspired by the article ["Dual Agent Chatbots and Expert Systems Design"](https://towardsdev.com/dual-agent-chatbots-and-expert-systems-design-25e2cba434e9)
46

57
The initial version successfully coded a blended momentum and mean-reversion strategy as described in ["Outperforming the Market (1000% in 10 years)"](https://medium.com/coinmonks/how-to-outperform-the-market-fe151b944c77?sk=7066045abe12d5cf88c7edc80ec2679c), which received over 10,000 impressions on LinkedIn.
68

7-
As of November 2025, it is under refactoring with readiness expected in February 2026.
9+
## 🌟 Version 2.0 - Complete Refactoring
10+
11+
**Refactored in December 2025** - Inspired by [Mistral's Vibe CLI](https://github.com/mistralai/mistral-vibe) architecture.
12+
13+
### New Features:
14+
- 🤖 **Interactive Chat Interface** with conversational AI
15+
- 🛠️ **Tool-Based Architecture** for modularity and extensibility
16+
- ⚙️ **Configuration System** with TOML support
17+
- 🎨 **Modern Terminal UI** with Rich library
18+
- 📝 **Programmable Mode** via `--prompt` flag
19+
- 💾 **Persistent Context** and conversation history
20+
21+
👉 **[See full v2.0 documentation →](README_v2.md)**
822

923
---
1024

11-
## 🚀 First-Time Installation
25+
## 🚀 Installation (v2.0)
1226

13-
> ✅ Requires **Python 3.8 or later**
27+
> ✅ Requires **Python 3.10 or later**
1428
15-
### 🛠 Setup Instructions
29+
### Quick Start
1630

1731
```bash
18-
# Clone the repository and switch to the legacy branch
19-
git clone https://github.com/SL-Mar/QuantCoder.git
20-
cd QuantCoder
21-
git checkout quantcoder-legacy
32+
# Clone the repository
33+
git clone https://github.com/SL-Mar/quantcoder-cli.git
34+
cd quantcoder-cli
2235

23-
# Create and activate a virtual environment
24-
python -m venv .venv-legacy
36+
# Create and activate virtual environment
37+
python -m venv .venv
38+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
2539

26-
# On Windows:
27-
.\.venv-legacy\Scripts\activate
28-
# On macOS/Linux:
29-
source .venv-legacy/bin/activate
30-
31-
# Install dependencies and the CLI
40+
# Install the package
3241
pip install -e .
42+
43+
# Download SpaCy model
3344
python -m spacy download en_core_web_sm
34-
pip install openai==0.28
3545
```
3646

37-
You may also freeze dependencies:
47+
### First Run
3848

3949
```bash
40-
pip freeze > requirements-legacy.txt
50+
# Launch interactive mode
51+
quantcoder
52+
53+
# Or use the short alias
54+
qc
4155
```
4256

57+
On first run, you'll be prompted for your OpenAI API key.
58+
4359
---
44-
🧠 LLM Configuration
45-
By default, this project uses the OpenAI gpt-4o-2024-11-20 model for generating trading code from research articles.
4660

47-
## 💡 Usage
61+
## 💡 Usage (v2.0)
4862

49-
To launch the CLI tool in interactive mode:
63+
### Interactive Mode
5064

5165
```bash
52-
python -m quantcli.cli interactive
66+
quantcoder> search "momentum trading strategies"
67+
quantcoder> download 1
68+
quantcoder> summarize 1
69+
quantcoder> generate 1
5370
```
5471

55-
Or if `quantcli` is recognized as a command:
72+
### Direct Commands
5673

5774
```bash
58-
quantcli interactive
75+
quantcoder search "algorithmic trading" --num 5
76+
quantcoder download 1
77+
quantcoder summarize 1
78+
quantcoder generate 1
5979
```
6080

61-
---
81+
### Programmatic Mode
6282

63-
## ⚠️ OpenAI SDK Compatibility
83+
```bash
84+
quantcoder --prompt "Find articles about mean reversion"
85+
```
6486

65-
This legacy version uses the **OpenAI SDK v0.28**. Newer versions (`>=1.0.0`) are **not supported**.
87+
---
6688

67-
If you encounter this error:
89+
## 📚 Legacy Version (v0.3)
6890

69-
```
70-
You tried to access openai.ChatCompletion, but this is no longer supported...
71-
```
72-
73-
Fix it by running:
91+
For the original version with OpenAI SDK v0.28:
7492

7593
```bash
76-
pip install openai==0.28
94+
git checkout quantcoder-legacy
7795
```
7896

97+
See legacy documentation for setup instructions.
98+
7999
---
80100

81101
## 📁 Articles and Strategies

0 commit comments

Comments
 (0)