File size: 2,011 Bytes
a9237fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# πŸ“ˆ StockSignalAI

AI-powered stock analysis and signal generation tool using Streamlit.

---

## πŸš€ Features

- Live stock data via Yahoo Finance
- Technical indicators (e.g., RSI, MACD, EMA)
- ML-based trading signal generator
- Model training and evaluation
- Interactive UI with Streamlit
- SQLite-based data storage

---

## βš™οΈ Setup Instructions

### 1. Clone the Repository

```bash
git clone https://github.com/yourusername/StockSignalAI.git
cd StockSignalAI


## 2. Create Virtual Environment (optional but recommended)

python3 -m venv venv
source venv/bin/activate   # For macOS/Linux
venv\Scripts\activate      # For Windows
3. Install Dependencies

pip install -r requirements.txt
If you don’t have a requirements.txt, you can create one:

txt
Copy
Edit
yfinance
pandas
numpy
matplotlib
scikit-learn
streamlit
ta
Save the above as requirements.txt, then run:


pip install -r requirements.txt
πŸ–₯️ Run the App
Use Streamlit, not Python directly:


streamlit run app.py
πŸ’‘ If Port 8501 is Busy

streamlit run app.py --server.port 8888
🧠 Notes
Session State Initialization
Before using any Streamlit session state variables (like model), initialize them at the start of the app:


if "model" not in st.session_state:
    st.session_state.model = None
Add similar blocks for other keys like data, stock_symbol, etc.

πŸ—ƒοΈ Database Tables Used
Your app uses the following tables:

stock_data

technical_indicators

trading_signals

model_metrics

Ensure your SQLite DB or ORM setup creates them before use.

πŸ”§ Project Structure (Example)

StockSignalAI/
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ data/
β”‚   └── stocks.db
β”œβ”€β”€ models/
β”‚   └── trained_models.pkl
└── README.md
πŸ“Œ 

TODO / Future Enhancements
Add backtesting module

Save models per stock  - this is done 

Upload and analyze user CSV data

Add performance metrics dashboard

Email/SMS alerts on new signals

πŸ™Œ Acknowledgments
yfinance

ta-lib

Streamlit

scikit-learn