2020
2121@click .group ()
2222@click .option ('--verbose' , is_flag = True , help = 'Enables verbose mode.' )
23+ @click .option ('--version' , is_flag = True , help = 'Show version information.' )
2324@click .pass_context
24- def cli (ctx , verbose ):
25+ def cli (ctx , verbose , version ):
2526 """
26- QuantCoder CLI Tool
27+ QuantCoder CLI - Generate QuantConnect Trading Algorithms from Research Articles
28+
29+ QuantCoder uses NLP and LLMs to transform academic research articles into
30+ executable trading algorithms for the QuantConnect platform.
31+
32+ WORKFLOW:
33+
34+ 1. Search for articles: quantcli search "momentum trading"
35+ 2. List found articles: quantcli list
36+ 3. Download article PDF: quantcli download 1
37+ 4. Summarize article: quantcli summarize 1
38+ 5. Generate trading code: quantcli generate-code 1
39+
40+ INTERACTIVE MODE:
41+
42+ quantcli interactive Launch GUI for guided workflow
43+
44+ For help on a specific command:
45+
46+ quantcli <command> --help
47+
48+ Examples:
49+
50+ quantcli search "algorithmic trading" --num 5
51+ quantcli download 1
52+ quantcli generate-code 1
2753 """
54+ if version :
55+ click .echo ("QuantCoder CLI v0.3 (Legacy)" )
56+ click .echo ("Using OpenAI SDK v0.28" )
57+ ctx .exit ()
58+
2859 setup_logging (verbose )
2960 load_api_key ()
3061 ctx .ensure_object (dict )
3162 ctx .obj ['VERBOSE' ] = verbose
3263
3364@cli .command ()
3465def hello ():
35- """A simple command to test the CLI."""
66+ """Test command to verify CLI installation ."""
3667 logger .info ("Executing hello command" )
3768 click .echo ("Hello from QuantCLI!" )
3869
@@ -41,10 +72,14 @@ def hello():
4172@click .option ('--num' , default = 5 , help = 'Number of results to return' )
4273def search (query , num ):
4374 """
44- Search for articles based on QUERY.
75+ Search for academic articles using CrossRef API.
76+
77+ QUERY: Search keywords (e.g., "momentum trading", "mean reversion")
78+
79+ Examples:
4580
46- Example:
4781 quantcli search "algorithmic trading" --num 3
82+ quantcli search "pairs trading strategies" --num 10
4883 """
4984 logger .info (f"Searching for articles with query: { query } , number of results: { num } " )
5085 articles = search_crossref (query , rows = num )
@@ -67,7 +102,10 @@ def search(query, num):
67102@cli .command ()
68103def list ():
69104 """
70- List previously searched articles.
105+ List previously searched articles from the current session.
106+
107+ Displays all articles from the most recent search operation.
108+ Articles are saved in articles.json.
71109 """
72110 if not os .path .exists (ARTICLES_FILE ):
73111 click .echo ("No articles found. Please perform a search first." )
@@ -86,10 +124,13 @@ def list():
86124@click .argument ('article_id' , type = int )
87125def download (article_id ):
88126 """
89- Download an article's PDF by ARTICLE_ID.
127+ Download an article's PDF by its list position.
128+
129+ ARTICLE_ID: The number shown in the 'list' command (1, 2, 3, etc.)
90130
91131 Example:
92- quantcli download 1
132+
133+ quantcli download 1 # Downloads the first article from your search
93134 """
94135 if not os .path .exists (ARTICLES_FILE ):
95136 click .echo ("No articles found. Please perform a search first." )
@@ -122,9 +163,15 @@ def download(article_id):
122163@click .argument ('article_id' , type = int )
123164def summarize (article_id ):
124165 """
125- Summarize a downloaded article by ARTICLE_ID.
166+ Generate an AI summary of a downloaded article.
167+
168+ ARTICLE_ID: The number of the article to summarize
169+
170+ The article must be downloaded first using the 'download' command.
171+ Summary is saved to downloads/article_<ID>_summary.txt
126172
127173 Example:
174+
128175 quantcli summarize 1
129176 """
130177 filepath = os .path .join (DOWNLOADS_DIR , f"article_{ article_id } .pdf" )
@@ -154,9 +201,17 @@ def summarize(article_id):
154201@click .argument ('article_id' , type = int )
155202def generate_code_cmd (article_id ):
156203 """
157- Generate QuantConnect code from a summarized article.
204+ Generate a QuantConnect trading algorithm from an article.
205+
206+ ARTICLE_ID: The number of the article to process
207+
208+ Extracts trading strategy logic from the article and generates
209+ executable Python code for the QuantConnect platform.
210+
211+ Output is saved to generated_code/algorithm_<ID>.py
158212
159213 Example:
214+
160215 quantcli generate-code 1
161216 """
162217 filepath = os .path .join (DOWNLOADS_DIR , f"article_{ article_id } .pdf" )
@@ -187,9 +242,12 @@ def generate_code_cmd(article_id):
187242@click .argument ('article_id' , type = int )
188243def open_article (article_id ):
189244 """
190- Open the article's URL in the default web browser.
245+ Open the article's webpage in your default browser.
246+
247+ ARTICLE_ID: The number of the article to open
191248
192249 Example:
250+
193251 quantcli open-article 1
194252 """
195253 if not os .path .exists (ARTICLES_FILE ):
@@ -208,7 +266,15 @@ def open_article(article_id):
208266@cli .command ()
209267def interactive ():
210268 """
211- Perform an interactive search and process with a GUI.
269+ Launch the interactive GUI for a guided workflow.
270+
271+ The GUI provides a visual interface for:
272+ - Searching articles
273+ - Viewing search results
274+ - Downloading PDFs
275+ - Generating summaries and code
276+
277+ Recommended for first-time users.
212278 """
213279 click .echo ("Starting interactive mode..." )
214280 launch_gui () # Call the launch_gui function to run the GUI
0 commit comments