mcli-framework 7.6.0__py3-none-any.whl → 7.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mcli-framework might be problematic. Click here for more details.
- mcli/app/commands_cmd.py +51 -39
- mcli/app/main.py +10 -2
- mcli/app/model_cmd.py +1 -1
- mcli/lib/custom_commands.py +4 -10
- mcli/ml/api/app.py +1 -5
- mcli/ml/dashboard/app.py +2 -2
- mcli/ml/dashboard/app_integrated.py +168 -116
- mcli/ml/dashboard/app_supabase.py +7 -3
- mcli/ml/dashboard/app_training.py +3 -6
- mcli/ml/dashboard/components/charts.py +74 -115
- mcli/ml/dashboard/components/metrics.py +24 -44
- mcli/ml/dashboard/components/tables.py +32 -40
- mcli/ml/dashboard/overview.py +102 -78
- mcli/ml/dashboard/pages/cicd.py +103 -56
- mcli/ml/dashboard/pages/debug_dependencies.py +35 -28
- mcli/ml/dashboard/pages/gravity_viz.py +374 -313
- mcli/ml/dashboard/pages/monte_carlo_predictions.py +50 -48
- mcli/ml/dashboard/pages/predictions_enhanced.py +396 -248
- mcli/ml/dashboard/pages/scrapers_and_logs.py +299 -273
- mcli/ml/dashboard/pages/test_portfolio.py +153 -121
- mcli/ml/dashboard/pages/trading.py +238 -169
- mcli/ml/dashboard/pages/workflows.py +129 -84
- mcli/ml/dashboard/streamlit_extras_utils.py +70 -79
- mcli/ml/dashboard/utils.py +24 -21
- mcli/ml/dashboard/warning_suppression.py +6 -4
- mcli/ml/database/session.py +16 -5
- mcli/ml/mlops/pipeline_orchestrator.py +1 -3
- mcli/ml/predictions/monte_carlo.py +6 -18
- mcli/ml/trading/alpaca_client.py +95 -96
- mcli/ml/trading/migrations.py +76 -40
- mcli/ml/trading/models.py +78 -60
- mcli/ml/trading/paper_trading.py +92 -74
- mcli/ml/trading/risk_management.py +106 -85
- mcli/ml/trading/trading_service.py +155 -110
- mcli/ml/training/train_model.py +1 -3
- mcli/self/self_cmd.py +71 -57
- mcli/workflow/daemon/daemon.py +2 -0
- mcli/workflow/model_service/openai_adapter.py +6 -2
- mcli/workflow/politician_trading/models.py +6 -2
- mcli/workflow/politician_trading/scrapers_corporate_registry.py +39 -88
- mcli/workflow/politician_trading/scrapers_free_sources.py +32 -39
- mcli/workflow/politician_trading/scrapers_third_party.py +21 -39
- mcli/workflow/politician_trading/seed_database.py +70 -89
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/METADATA +1 -1
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/RECORD +49 -49
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/WHEEL +0 -0
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.6.0.dist-info → mcli_framework-7.6.1.dist-info}/top_level.txt +0 -0
mcli/ml/dashboard/overview.py
CHANGED
|
@@ -4,11 +4,8 @@ import streamlit as st
|
|
|
4
4
|
|
|
5
5
|
# Try to import streamlit-extras for enhanced UI
|
|
6
6
|
try:
|
|
7
|
-
from mcli.ml.dashboard.streamlit_extras_utils import
|
|
8
|
-
|
|
9
|
-
info_card,
|
|
10
|
-
vertical_space,
|
|
11
|
-
)
|
|
7
|
+
from mcli.ml.dashboard.streamlit_extras_utils import info_card, section_header, vertical_space
|
|
8
|
+
|
|
12
9
|
HAS_EXTRAS = True
|
|
13
10
|
except ImportError:
|
|
14
11
|
HAS_EXTRAS = False
|
|
@@ -32,7 +29,7 @@ def show_overview():
|
|
|
32
29
|
</h3>
|
|
33
30
|
</div>
|
|
34
31
|
""",
|
|
35
|
-
unsafe_allow_html=True
|
|
32
|
+
unsafe_allow_html=True,
|
|
36
33
|
)
|
|
37
34
|
|
|
38
35
|
st.markdown("---")
|
|
@@ -41,10 +38,11 @@ def show_overview():
|
|
|
41
38
|
section_header(
|
|
42
39
|
"🎯 What is Politician Trading Tracker?",
|
|
43
40
|
"Your comprehensive tool for analyzing Congressional stock trades",
|
|
44
|
-
divider="blue"
|
|
41
|
+
divider="blue",
|
|
45
42
|
)
|
|
46
43
|
|
|
47
|
-
st.markdown(
|
|
44
|
+
st.markdown(
|
|
45
|
+
"""
|
|
48
46
|
This dashboard provides **real-time access** to Congressional stock trading disclosures,
|
|
49
47
|
allowing you to track when U.S. politicians buy and sell stocks, analyze their patterns,
|
|
50
48
|
and make informed investment decisions.
|
|
@@ -55,56 +53,56 @@ def show_overview():
|
|
|
55
53
|
🔍 **Early Insights**: Politicians may have access to non-public information through briefings
|
|
56
54
|
💡 **Smart Money**: Following experienced investors can inform your strategy
|
|
57
55
|
📊 **Transparency**: Make use of public disclosure data for better decisions
|
|
58
|
-
"""
|
|
56
|
+
"""
|
|
57
|
+
)
|
|
59
58
|
|
|
60
59
|
vertical_space(2)
|
|
61
60
|
|
|
62
61
|
# Key Features
|
|
63
|
-
section_header(
|
|
64
|
-
"✨ Key Features",
|
|
65
|
-
"Powerful tools for trading analysis",
|
|
66
|
-
divider="green"
|
|
67
|
-
)
|
|
62
|
+
section_header("✨ Key Features", "Powerful tools for trading analysis", divider="green")
|
|
68
63
|
|
|
69
64
|
col1, col2, col3 = st.columns(3)
|
|
70
65
|
|
|
71
66
|
with col1:
|
|
72
|
-
st.markdown(
|
|
67
|
+
st.markdown(
|
|
68
|
+
"""
|
|
73
69
|
### 📊 Data Tracking
|
|
74
70
|
- **Real-time updates** from official sources
|
|
75
71
|
- **Historical data** going back years
|
|
76
72
|
- **Multiple sources**: Senate, House, Senate Stock Watcher
|
|
77
73
|
- **Automated scraping** for latest disclosures
|
|
78
|
-
"""
|
|
74
|
+
"""
|
|
75
|
+
)
|
|
79
76
|
|
|
80
77
|
with col2:
|
|
81
|
-
st.markdown(
|
|
78
|
+
st.markdown(
|
|
79
|
+
"""
|
|
82
80
|
### 🤖 ML Predictions
|
|
83
81
|
- **Machine learning models** for stock prediction
|
|
84
82
|
- **Monte Carlo simulations** for risk analysis
|
|
85
83
|
- **Pattern recognition** in trading behavior
|
|
86
84
|
- **Price forecasting** based on historical data
|
|
87
|
-
"""
|
|
85
|
+
"""
|
|
86
|
+
)
|
|
88
87
|
|
|
89
88
|
with col3:
|
|
90
|
-
st.markdown(
|
|
89
|
+
st.markdown(
|
|
90
|
+
"""
|
|
91
91
|
### 💼 Trading Tools
|
|
92
92
|
- **Paper trading** integration (Alpaca)
|
|
93
93
|
- **Portfolio tracking** and management
|
|
94
94
|
- **Risk assessment** tools
|
|
95
95
|
- **Performance analytics**
|
|
96
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
)
|
|
97
98
|
|
|
98
99
|
vertical_space(2)
|
|
99
100
|
|
|
100
101
|
# Quick Start Guide
|
|
101
|
-
section_header(
|
|
102
|
-
"🚀 Quick Start Guide",
|
|
103
|
-
"Get started in 3 easy steps",
|
|
104
|
-
divider="violet"
|
|
105
|
-
)
|
|
102
|
+
section_header("🚀 Quick Start Guide", "Get started in 3 easy steps", divider="violet")
|
|
106
103
|
|
|
107
|
-
st.markdown(
|
|
104
|
+
st.markdown(
|
|
105
|
+
"""
|
|
108
106
|
### Step 1: Explore Trading Data
|
|
109
107
|
|
|
110
108
|
👉 Navigate to **"Scrapers & Logs"** to:
|
|
@@ -128,61 +126,63 @@ def show_overview():
|
|
|
128
126
|
- Replicate politician trades
|
|
129
127
|
- Track your performance
|
|
130
128
|
- Compare to market benchmarks
|
|
131
|
-
"""
|
|
129
|
+
"""
|
|
130
|
+
)
|
|
132
131
|
|
|
133
132
|
vertical_space(2)
|
|
134
133
|
|
|
135
134
|
# Page Navigation Guide
|
|
136
|
-
section_header(
|
|
137
|
-
"🗺️ Page Navigation Guide",
|
|
138
|
-
"Explore all available features",
|
|
139
|
-
divider="orange"
|
|
140
|
-
)
|
|
135
|
+
section_header("🗺️ Page Navigation Guide", "Explore all available features", divider="orange")
|
|
141
136
|
|
|
142
137
|
# Create expandable sections for each page category
|
|
143
138
|
with st.expander("📊 **Data & Monitoring Pages**", expanded=True):
|
|
144
|
-
st.markdown(
|
|
139
|
+
st.markdown(
|
|
140
|
+
"""
|
|
145
141
|
- **Pipeline Overview**: System status and data processing metrics
|
|
146
142
|
- **Scrapers & Logs**: Manual and automated data collection from government sources
|
|
147
143
|
- **System Health**: Monitor data pipeline health and API connections
|
|
148
144
|
- **LSH Jobs**: Background job status and processing queues
|
|
149
|
-
"""
|
|
145
|
+
"""
|
|
146
|
+
)
|
|
150
147
|
|
|
151
148
|
with st.expander("🤖 **ML & Predictions Pages**"):
|
|
152
|
-
st.markdown(
|
|
149
|
+
st.markdown(
|
|
150
|
+
"""
|
|
153
151
|
- **Predictions**: Enhanced ML predictions based on politician trading patterns
|
|
154
152
|
- **Monte Carlo Predictions**: Probabilistic simulation of price paths and returns
|
|
155
153
|
- **Model Performance**: Evaluation metrics for ML models
|
|
156
154
|
- **Model Training & Evaluation**: Train new models and compare performance
|
|
157
|
-
"""
|
|
155
|
+
"""
|
|
156
|
+
)
|
|
158
157
|
|
|
159
158
|
with st.expander("💼 **Trading & Portfolio Pages**"):
|
|
160
|
-
st.markdown(
|
|
159
|
+
st.markdown(
|
|
160
|
+
"""
|
|
161
161
|
- **Trading Dashboard**: Full-featured paper trading interface
|
|
162
162
|
- **Test Portfolio**: Simplified portfolio testing and tracking
|
|
163
163
|
- **Paper trading** via Alpaca API integration
|
|
164
164
|
- Track performance against politician portfolios
|
|
165
|
-
"""
|
|
165
|
+
"""
|
|
166
|
+
)
|
|
166
167
|
|
|
167
168
|
with st.expander("⚙️ **Technical & DevOps Pages**"):
|
|
168
|
-
st.markdown(
|
|
169
|
+
st.markdown(
|
|
170
|
+
"""
|
|
169
171
|
- **CI/CD Pipelines**: Monitor build and deployment pipelines
|
|
170
172
|
- **Workflows**: Track automated workflow executions
|
|
171
173
|
- **ML Processing**: Data preprocessing and feature engineering
|
|
172
174
|
- **Debug Dependencies**: Troubleshoot installation and import issues (useful for alpaca-py debugging)
|
|
173
|
-
"""
|
|
175
|
+
"""
|
|
176
|
+
)
|
|
174
177
|
|
|
175
178
|
vertical_space(2)
|
|
176
179
|
|
|
177
180
|
# FAQ Section
|
|
178
|
-
section_header(
|
|
179
|
-
"❓ Frequently Asked Questions",
|
|
180
|
-
"Common questions answered",
|
|
181
|
-
divider="gray"
|
|
182
|
-
)
|
|
181
|
+
section_header("❓ Frequently Asked Questions", "Common questions answered", divider="gray")
|
|
183
182
|
|
|
184
183
|
with st.expander("**Q: Is this legal? Can I really track politician trades?**"):
|
|
185
|
-
st.markdown(
|
|
184
|
+
st.markdown(
|
|
185
|
+
"""
|
|
186
186
|
**A:** Yes, absolutely! The STOCK Act (Stop Trading on Congressional Knowledge Act)
|
|
187
187
|
requires members of Congress to publicly disclose their stock trades within 45 days.
|
|
188
188
|
This app aggregates and analyzes publicly available data.
|
|
@@ -191,10 +191,12 @@ def show_overview():
|
|
|
191
191
|
- Senate eFiling system
|
|
192
192
|
- House Financial Disclosure reports
|
|
193
193
|
- Senate Stock Watcher (GitHub dataset)
|
|
194
|
-
"""
|
|
194
|
+
"""
|
|
195
|
+
)
|
|
195
196
|
|
|
196
197
|
with st.expander("**Q: How recent is the data?**"):
|
|
197
|
-
st.markdown(
|
|
198
|
+
st.markdown(
|
|
199
|
+
"""
|
|
198
200
|
**A:** Data freshness depends on the source:
|
|
199
201
|
|
|
200
202
|
- **Senate Stock Watcher**: Updated daily from official sources
|
|
@@ -203,10 +205,12 @@ def show_overview():
|
|
|
203
205
|
|
|
204
206
|
Note: Due to the 45-day disclosure requirement, trades are not real-time.
|
|
205
207
|
You're seeing what politicians bought/sold 1-6 weeks ago.
|
|
206
|
-
"""
|
|
208
|
+
"""
|
|
209
|
+
)
|
|
207
210
|
|
|
208
211
|
with st.expander("**Q: Can I actually trade based on this data?**"):
|
|
209
|
-
st.markdown(
|
|
212
|
+
st.markdown(
|
|
213
|
+
"""
|
|
210
214
|
**A:** Yes! The dashboard includes:
|
|
211
215
|
|
|
212
216
|
- **Paper Trading**: Practice with virtual money via Alpaca paper trading API
|
|
@@ -218,10 +222,12 @@ def show_overview():
|
|
|
218
222
|
- Politician trades are disclosed 45 days late
|
|
219
223
|
- This is for educational/informational purposes
|
|
220
224
|
- Always do your own research before investing
|
|
221
|
-
"""
|
|
225
|
+
"""
|
|
226
|
+
)
|
|
222
227
|
|
|
223
228
|
with st.expander("**Q: Which politicians can I track?**"):
|
|
224
|
-
st.markdown(
|
|
229
|
+
st.markdown(
|
|
230
|
+
"""
|
|
225
231
|
**A:** The dashboard tracks:
|
|
226
232
|
|
|
227
233
|
- All U.S. Senators
|
|
@@ -230,10 +236,12 @@ def show_overview():
|
|
|
230
236
|
- Committee members with oversight of industries
|
|
231
237
|
|
|
232
238
|
Search by name in the **Predictions** or **Scrapers & Logs** pages.
|
|
233
|
-
"""
|
|
239
|
+
"""
|
|
240
|
+
)
|
|
234
241
|
|
|
235
242
|
with st.expander("**Q: How do the ML predictions work?**"):
|
|
236
|
-
st.markdown(
|
|
243
|
+
st.markdown(
|
|
244
|
+
"""
|
|
237
245
|
**A:** The system uses multiple techniques:
|
|
238
246
|
|
|
239
247
|
1. **Historical Pattern Analysis**: Identifies successful trading patterns
|
|
@@ -243,10 +251,12 @@ def show_overview():
|
|
|
243
251
|
5. **Risk Metrics**: Calculates probability of profit, Value at Risk, confidence intervals
|
|
244
252
|
|
|
245
253
|
See the **Model Training & Evaluation** page for technical details.
|
|
246
|
-
"""
|
|
254
|
+
"""
|
|
255
|
+
)
|
|
247
256
|
|
|
248
257
|
with st.expander("**Q: What data sources does this use?**"):
|
|
249
|
-
st.markdown(
|
|
258
|
+
st.markdown(
|
|
259
|
+
"""
|
|
250
260
|
**A:** Multiple official and curated sources:
|
|
251
261
|
|
|
252
262
|
**Primary Sources:**
|
|
@@ -258,20 +268,24 @@ def show_overview():
|
|
|
258
268
|
- UK Companies House API (for UK company data)
|
|
259
269
|
- Yahoo Finance (for stock prices and fundamentals)
|
|
260
270
|
- Alpaca API (for trading and market data)
|
|
261
|
-
"""
|
|
271
|
+
"""
|
|
272
|
+
)
|
|
262
273
|
|
|
263
274
|
with st.expander("**Q: Is my trading data private?**"):
|
|
264
|
-
st.markdown(
|
|
275
|
+
st.markdown(
|
|
276
|
+
"""
|
|
265
277
|
**A:** Yes! This is a personal dashboard:
|
|
266
278
|
|
|
267
279
|
- Paper trading portfolios are stored locally or in your Supabase instance
|
|
268
280
|
- No trading data is shared publicly
|
|
269
281
|
- API keys are stored securely in Streamlit secrets
|
|
270
282
|
- You control your own data
|
|
271
|
-
"""
|
|
283
|
+
"""
|
|
284
|
+
)
|
|
272
285
|
|
|
273
286
|
with st.expander("**Q: What if I find a bug or have a feature request?**"):
|
|
274
|
-
st.markdown(
|
|
287
|
+
st.markdown(
|
|
288
|
+
"""
|
|
275
289
|
**A:** Contributions welcome!
|
|
276
290
|
|
|
277
291
|
- **Report bugs**: Open an issue on GitHub
|
|
@@ -280,10 +294,12 @@ def show_overview():
|
|
|
280
294
|
- **Documentation**: Help improve the docs
|
|
281
295
|
|
|
282
296
|
This is an open-source project built for the community.
|
|
283
|
-
"""
|
|
297
|
+
"""
|
|
298
|
+
)
|
|
284
299
|
|
|
285
300
|
with st.expander("**Q: Why are some pages showing errors or not loading?**"):
|
|
286
|
-
st.markdown(
|
|
301
|
+
st.markdown(
|
|
302
|
+
"""
|
|
287
303
|
**A:** Some pages require optional dependencies that may not be installed:
|
|
288
304
|
|
|
289
305
|
**Common Issues:**
|
|
@@ -300,46 +316,49 @@ def show_overview():
|
|
|
300
316
|
- Troubleshooting suggestions
|
|
301
317
|
|
|
302
318
|
**Note:** Most pages have graceful fallbacks and will work with demo data if dependencies are missing.
|
|
303
|
-
"""
|
|
319
|
+
"""
|
|
320
|
+
)
|
|
304
321
|
|
|
305
322
|
vertical_space(2)
|
|
306
323
|
|
|
307
324
|
# Getting Started Actions
|
|
308
|
-
section_header(
|
|
309
|
-
"🎬 Ready to Get Started?",
|
|
310
|
-
"Choose your path",
|
|
311
|
-
divider="rainbow"
|
|
312
|
-
)
|
|
325
|
+
section_header("🎬 Ready to Get Started?", "Choose your path", divider="rainbow")
|
|
313
326
|
|
|
314
327
|
col1, col2, col3 = st.columns(3)
|
|
315
328
|
|
|
316
329
|
with col1:
|
|
317
|
-
st.markdown(
|
|
330
|
+
st.markdown(
|
|
331
|
+
"""
|
|
318
332
|
### 🔍 **Explore Data**
|
|
319
333
|
Start by browsing recent politician trades
|
|
320
334
|
|
|
321
335
|
👉 Go to **Scrapers & Logs**
|
|
322
|
-
"""
|
|
336
|
+
"""
|
|
337
|
+
)
|
|
323
338
|
if st.button("View Trading Data", key="btn_scrapers", use_container_width=True):
|
|
324
339
|
st.info("Navigate to 'Scrapers & Logs' in the sidebar →")
|
|
325
340
|
|
|
326
341
|
with col2:
|
|
327
|
-
st.markdown(
|
|
342
|
+
st.markdown(
|
|
343
|
+
"""
|
|
328
344
|
### 📊 **Run Analysis**
|
|
329
345
|
See ML predictions and simulations
|
|
330
346
|
|
|
331
347
|
👉 Go to **Monte Carlo Predictions**
|
|
332
|
-
"""
|
|
348
|
+
"""
|
|
349
|
+
)
|
|
333
350
|
if st.button("Analyze Stocks", key="btn_monte_carlo", use_container_width=True):
|
|
334
351
|
st.info("Navigate to 'Monte Carlo Predictions' in the sidebar →")
|
|
335
352
|
|
|
336
353
|
with col3:
|
|
337
|
-
st.markdown(
|
|
354
|
+
st.markdown(
|
|
355
|
+
"""
|
|
338
356
|
### 💼 **Start Trading**
|
|
339
357
|
Create a paper trading portfolio
|
|
340
358
|
|
|
341
359
|
👉 Go to **Trading Dashboard**
|
|
342
|
-
"""
|
|
360
|
+
"""
|
|
361
|
+
)
|
|
343
362
|
if st.button("Paper Trade", key="btn_trading", use_container_width=True):
|
|
344
363
|
st.info("Navigate to 'Trading Dashboard' in the sidebar →")
|
|
345
364
|
|
|
@@ -347,7 +366,8 @@ def show_overview():
|
|
|
347
366
|
|
|
348
367
|
# Disclaimers
|
|
349
368
|
st.markdown("---")
|
|
350
|
-
st.markdown(
|
|
369
|
+
st.markdown(
|
|
370
|
+
"""
|
|
351
371
|
### ⚠️ Important Disclaimers
|
|
352
372
|
|
|
353
373
|
- **Not Financial Advice**: This tool is for educational and informational purposes only
|
|
@@ -359,19 +379,23 @@ def show_overview():
|
|
|
359
379
|
|
|
360
380
|
**Legal Note**: All data comes from public sources. This dashboard aggregates
|
|
361
381
|
publicly disclosed information under the STOCK Act and is compliant with all regulations.
|
|
362
|
-
"""
|
|
382
|
+
"""
|
|
383
|
+
)
|
|
363
384
|
|
|
364
385
|
vertical_space(1)
|
|
365
386
|
|
|
366
387
|
# Footer
|
|
367
|
-
st.markdown(
|
|
388
|
+
st.markdown(
|
|
389
|
+
"""
|
|
368
390
|
<div style='text-align: center; color: #666; padding: 2rem 0;'>
|
|
369
391
|
<p>Built with ❤️ for transparent government and informed investing</p>
|
|
370
392
|
<p style='font-size: 0.9rem;'>
|
|
371
393
|
Data sources: Senate.gov • House.gov • Senate Stock Watcher • Yahoo Finance
|
|
372
394
|
</p>
|
|
373
395
|
</div>
|
|
374
|
-
""",
|
|
396
|
+
""",
|
|
397
|
+
unsafe_allow_html=True,
|
|
398
|
+
)
|
|
375
399
|
|
|
376
400
|
|
|
377
401
|
if __name__ == "__main__":
|