-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
69 lines (61 loc) · 2.09 KB
/
main.py
File metadata and controls
69 lines (61 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
"""
Main entry point for the Multi-Agent Stock Analyzer
Supports both GUI and CLI modes
"""
import sys
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
def run_gui():
"""Run the Streamlit GUI application"""
try:
import streamlit.web.cli as stcli
sys.argv = ["streamlit", "run", "src/gui.py", "--server.port=8501", "--server.address=localhost"]
sys.exit(stcli.main())
except ImportError:
print("❌ Streamlit not found. Please install it with: pip install streamlit")
sys.exit(1)
def run_cli(ticker):
"""Run the CLI workflow"""
try:
from src.workflows.investment_workflow import run_investment_workflow
run_investment_workflow(ticker)
except ImportError as e:
print(f"❌ Import error: {e}")
print("Make sure all dependencies are installed: pip install -r requirements.txt")
sys.exit(1)
except Exception as e:
print(f"❌ Error running analysis: {e}")
sys.exit(1)
def main():
"""Main entry point"""
if len(sys.argv) > 1:
if sys.argv[1] in ["--gui", "--streamlit", "-g"]:
print("🚀 Starting GUI application...")
run_gui()
elif sys.argv[1] in ["--help", "-h"]:
print("""
🤖 Multi-Agent Stock Analyzer
Usage:
python main.py # Run GUI
python main.py --gui # Run GUI
python main.py --streamlit # Run GUI
python main.py AAPL # Run CLI analysis for AAPL
python main.py --help # Show this help
Examples:
python main.py # Start the web interface
python main.py TSLA # Analyze TSLA via CLI
python main.py --gui # Start the web interface
""")
else:
ticker = sys.argv[1].upper()
print(f"📊 Analyzing {ticker}...")
run_cli(ticker)
else:
print("🚀 Starting GUI application...")
print("💡 Tip: Use 'python main.py --help' for more options")
run_gui()
if __name__ == "__main__":
main()