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.' )
2423@click .pass_context
25- def cli (ctx , verbose , version ):
24+ def cli (ctx , verbose ):
2625 """
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
26+ QuantCoder CLI Tool
5327 """
54- if version :
55- click .echo ("QuantCoder CLI v0.3 (Legacy)" )
56- click .echo ("Using OpenAI SDK v0.28" )
57- ctx .exit ()
58-
5928 setup_logging (verbose )
6029 load_api_key ()
6130 ctx .ensure_object (dict )
6231 ctx .obj ['VERBOSE' ] = verbose
6332
6433@cli .command ()
6534def hello ():
66- """Test command to verify CLI installation ."""
35+ """A simple command to test the CLI ."""
6736 logger .info ("Executing hello command" )
6837 click .echo ("Hello from QuantCLI!" )
6938
@@ -72,14 +41,10 @@ def hello():
7241@click .option ('--num' , default = 5 , help = 'Number of results to return' )
7342def search (query , num ):
7443 """
75- Search for academic articles using CrossRef API.
76-
77- QUERY: Search keywords (e.g., "momentum trading", "mean reversion")
78-
79- Examples:
44+ Search for articles based on QUERY.
8045
46+ Example:
8147 quantcli search "algorithmic trading" --num 3
82- quantcli search "pairs trading strategies" --num 10
8348 """
8449 logger .info (f"Searching for articles with query: { query } , number of results: { num } " )
8550 articles = search_crossref (query , rows = num )
@@ -102,10 +67,7 @@ def search(query, num):
10267@cli .command ()
10368def list ():
10469 """
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.
70+ List previously searched articles.
10971 """
11072 if not os .path .exists (ARTICLES_FILE ):
11173 click .echo ("No articles found. Please perform a search first." )
@@ -124,13 +86,10 @@ def list():
12486@click .argument ('article_id' , type = int )
12587def download (article_id ):
12688 """
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.)
89+ Download an article's PDF by ARTICLE_ID.
13090
13191 Example:
132-
133- quantcli download 1 # Downloads the first article from your search
92+ quantcli download 1
13493 """
13594 if not os .path .exists (ARTICLES_FILE ):
13695 click .echo ("No articles found. Please perform a search first." )
@@ -163,15 +122,9 @@ def download(article_id):
163122@click .argument ('article_id' , type = int )
164123def summarize (article_id ):
165124 """
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
125+ Summarize a downloaded article by ARTICLE_ID.
172126
173127 Example:
174-
175128 quantcli summarize 1
176129 """
177130 filepath = os .path .join (DOWNLOADS_DIR , f"article_{ article_id } .pdf" )
@@ -201,17 +154,9 @@ def summarize(article_id):
201154@click .argument ('article_id' , type = int )
202155def generate_code_cmd (article_id ):
203156 """
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
157+ Generate QuantConnect code from a summarized article.
212158
213159 Example:
214-
215160 quantcli generate-code 1
216161 """
217162 filepath = os .path .join (DOWNLOADS_DIR , f"article_{ article_id } .pdf" )
@@ -242,12 +187,9 @@ def generate_code_cmd(article_id):
242187@click .argument ('article_id' , type = int )
243188def open_article (article_id ):
244189 """
245- Open the article's webpage in your default browser.
246-
247- ARTICLE_ID: The number of the article to open
190+ Open the article's URL in the default web browser.
248191
249192 Example:
250-
251193 quantcli open-article 1
252194 """
253195 if not os .path .exists (ARTICLES_FILE ):
@@ -266,15 +208,7 @@ def open_article(article_id):
266208@cli .command ()
267209def interactive ():
268210 """
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.
211+ Perform an interactive search and process with a GUI.
278212 """
279213 click .echo ("Starting interactive mode..." )
280214 launch_gui () # Call the launch_gui function to run the GUI
0 commit comments