mcli-framework 7.5.1__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/completion_helpers.py +4 -13
- mcli/app/main.py +21 -25
- mcli/app/model_cmd.py +119 -9
- mcli/lib/custom_commands.py +16 -11
- 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/{app → self}/completion_cmd.py +6 -6
- mcli/self/self_cmd.py +100 -57
- mcli/test/test_cmd.py +30 -0
- mcli/workflow/daemon/daemon.py +2 -0
- mcli/workflow/model_service/openai_adapter.py +347 -0
- 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.5.1.dist-info → mcli_framework-7.6.1.dist-info}/METADATA +1 -1
- {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/RECORD +56 -54
- /mcli/{app → self}/logs_cmd.py +0 -0
- /mcli/{app → self}/redis_cmd.py +0 -0
- /mcli/{app → self}/visual_cmd.py +0 -0
- /mcli/{app → test}/cron_test_cmd.py +0 -0
- {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/WHEEL +0 -0
- {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/top_level.txt +0 -0
|
@@ -29,10 +29,11 @@ except ImportError:
|
|
|
29
29
|
# Try to import streamlit-extras
|
|
30
30
|
try:
|
|
31
31
|
from mcli.ml.dashboard.streamlit_extras_utils import (
|
|
32
|
-
section_header,
|
|
33
32
|
enhanced_metrics,
|
|
33
|
+
section_header,
|
|
34
34
|
vertical_space,
|
|
35
35
|
)
|
|
36
|
+
|
|
36
37
|
HAS_EXTRAS = True
|
|
37
38
|
except ImportError:
|
|
38
39
|
HAS_EXTRAS = False
|
|
@@ -76,7 +77,9 @@ def show_monte_carlo_predictions():
|
|
|
76
77
|
)
|
|
77
78
|
|
|
78
79
|
if not HAS_MONTE_CARLO:
|
|
79
|
-
st.error(
|
|
80
|
+
st.error(
|
|
81
|
+
"⚠️ Monte Carlo simulator not available. Please ensure all dependencies are installed."
|
|
82
|
+
)
|
|
80
83
|
st.info(
|
|
81
84
|
"""
|
|
82
85
|
**Required:**
|
|
@@ -156,17 +159,13 @@ def show_monte_carlo_predictions():
|
|
|
156
159
|
)
|
|
157
160
|
|
|
158
161
|
# Main content area with tabs
|
|
159
|
-
tab1, tab2, tab3, tab4 = st.tabs(
|
|
160
|
-
"🎯 Quick Simulation",
|
|
161
|
-
|
|
162
|
-
"📚 Learn More",
|
|
163
|
-
"⚙️ Custom Parameters"
|
|
164
|
-
])
|
|
162
|
+
tab1, tab2, tab3, tab4 = st.tabs(
|
|
163
|
+
["🎯 Quick Simulation", "📊 Advanced Analysis", "📚 Learn More", "⚙️ Custom Parameters"]
|
|
164
|
+
)
|
|
165
165
|
|
|
166
166
|
with tab1:
|
|
167
167
|
show_quick_simulation(
|
|
168
|
-
num_simulations, days_forward, num_paths_display,
|
|
169
|
-
show_percentiles, confidence_level
|
|
168
|
+
num_simulations, days_forward, num_paths_display, show_percentiles, confidence_level
|
|
170
169
|
)
|
|
171
170
|
|
|
172
171
|
with tab2:
|
|
@@ -191,7 +190,7 @@ def show_quick_simulation(
|
|
|
191
190
|
section_header(
|
|
192
191
|
"🚀 Quick Start Simulation",
|
|
193
192
|
"Enter stock details and get instant Monte Carlo predictions",
|
|
194
|
-
divider="blue"
|
|
193
|
+
divider="blue",
|
|
195
194
|
)
|
|
196
195
|
|
|
197
196
|
# Input form
|
|
@@ -306,36 +305,41 @@ def run_simulation(
|
|
|
306
305
|
section_header(
|
|
307
306
|
f"📈 Simulation Results: {stock_symbol}",
|
|
308
307
|
f"{politician_name} • {num_simulations:,} simulations • {days_forward} days",
|
|
309
|
-
divider="green"
|
|
308
|
+
divider="green",
|
|
310
309
|
)
|
|
311
310
|
|
|
312
311
|
# Key metrics
|
|
313
312
|
if HAS_EXTRAS and enhanced_metrics:
|
|
314
|
-
enhanced_metrics(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
313
|
+
enhanced_metrics(
|
|
314
|
+
[
|
|
315
|
+
{
|
|
316
|
+
"label": "Expected Price",
|
|
317
|
+
"value": f"${stats['expected_final_price']:.2f}",
|
|
318
|
+
"delta": f"{stats['expected_return']:.1f}%",
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"label": "Probability of Profit",
|
|
322
|
+
"value": f"{stats['probability_profit']:.1f}%",
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"label": "Value at Risk (95%)",
|
|
326
|
+
"value": f"{stats['value_at_risk_95']:.1f}%",
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"label": "Best Case (95th %ile)",
|
|
330
|
+
"value": f"${stats['percentile_95']:.2f}",
|
|
331
|
+
"delta": f"+{((stats['percentile_95']/current_price - 1) * 100):.1f}%",
|
|
332
|
+
},
|
|
333
|
+
]
|
|
334
|
+
)
|
|
334
335
|
else:
|
|
335
336
|
col1, col2, col3, col4 = st.columns(4)
|
|
336
337
|
with col1:
|
|
337
|
-
st.metric(
|
|
338
|
-
|
|
338
|
+
st.metric(
|
|
339
|
+
"Expected Price",
|
|
340
|
+
f"${stats['expected_final_price']:.2f}",
|
|
341
|
+
f"{stats['expected_return']:.1f}%",
|
|
342
|
+
)
|
|
339
343
|
with col2:
|
|
340
344
|
st.metric("Profit Probability", f"{stats['probability_profit']:.1f}%")
|
|
341
345
|
with col3:
|
|
@@ -349,8 +353,7 @@ def run_simulation(
|
|
|
349
353
|
st.subheader("📊 Simulated Price Paths")
|
|
350
354
|
|
|
351
355
|
path_fig = simulator.create_path_visualization(
|
|
352
|
-
num_paths_to_plot=num_paths_display,
|
|
353
|
-
show_percentiles=show_percentiles
|
|
356
|
+
num_paths_to_plot=num_paths_display, show_percentiles=show_percentiles
|
|
354
357
|
)
|
|
355
358
|
st.plotly_chart(path_fig, config={"displayModeBar": True}, use_container_width=True)
|
|
356
359
|
|
|
@@ -382,7 +385,9 @@ def run_simulation(
|
|
|
382
385
|
st.markdown(f"- Median Return: {stats['median_return']:.2f}%")
|
|
383
386
|
st.markdown(f"- Std Dev Return: {stats['std_return']:.2f}%")
|
|
384
387
|
st.markdown(f"- 5th Percentile: {stats['value_at_risk_95']:.2f}%")
|
|
385
|
-
st.markdown(
|
|
388
|
+
st.markdown(
|
|
389
|
+
f"- 95th Percentile: {((stats['percentile_95']/current_price - 1)*100):.2f}%"
|
|
390
|
+
)
|
|
386
391
|
|
|
387
392
|
# Confidence intervals
|
|
388
393
|
confidence_intervals = simulator.calculate_confidence_intervals([confidence_level])
|
|
@@ -401,7 +406,7 @@ def show_advanced_analysis(num_simulations: int, days_forward: int, confidence_l
|
|
|
401
406
|
section_header(
|
|
402
407
|
"🔬 Advanced Analysis",
|
|
403
408
|
"Use historical price data for more accurate simulations",
|
|
404
|
-
divider="violet"
|
|
409
|
+
divider="violet",
|
|
405
410
|
)
|
|
406
411
|
|
|
407
412
|
st.info(
|
|
@@ -421,10 +426,11 @@ def show_educational_content():
|
|
|
421
426
|
section_header(
|
|
422
427
|
"📚 Understanding Monte Carlo Simulation",
|
|
423
428
|
"Learn how probabilistic modeling predicts trading outcomes",
|
|
424
|
-
divider="orange"
|
|
429
|
+
divider="orange",
|
|
425
430
|
)
|
|
426
431
|
|
|
427
|
-
st.markdown(
|
|
432
|
+
st.markdown(
|
|
433
|
+
"""
|
|
428
434
|
## What is Monte Carlo Simulation?
|
|
429
435
|
|
|
430
436
|
Monte Carlo simulation is a computational technique that uses random sampling
|
|
@@ -467,17 +473,14 @@ def show_educational_content():
|
|
|
467
473
|
- **Risk management**: Understand downside risk before entering positions
|
|
468
474
|
- **Position sizing**: Determine appropriate investment amounts
|
|
469
475
|
- **Timing analysis**: Compare different holding periods
|
|
470
|
-
"""
|
|
476
|
+
"""
|
|
477
|
+
)
|
|
471
478
|
|
|
472
479
|
|
|
473
480
|
def show_custom_parameters(num_simulations: int, days_forward: int):
|
|
474
481
|
"""Custom parameter configuration"""
|
|
475
482
|
|
|
476
|
-
section_header(
|
|
477
|
-
"⚙️ Custom Parameters",
|
|
478
|
-
"Advanced configuration for power users",
|
|
479
|
-
divider="gray"
|
|
480
|
-
)
|
|
483
|
+
section_header("⚙️ Custom Parameters", "Advanced configuration for power users", divider="gray")
|
|
481
484
|
|
|
482
485
|
st.warning(
|
|
483
486
|
"⚠️ **Advanced Users Only** - Modifying these parameters requires "
|
|
@@ -545,8 +548,7 @@ def show_custom_parameters(num_simulations: int, days_forward: int):
|
|
|
545
548
|
|
|
546
549
|
if submitted:
|
|
547
550
|
st.success(
|
|
548
|
-
f"Custom simulation configured with μ={custom_drift:.4f}, "
|
|
549
|
-
f"σ={custom_volatility:.4f}"
|
|
551
|
+
f"Custom simulation configured with μ={custom_drift:.4f}, " f"σ={custom_volatility:.4f}"
|
|
550
552
|
)
|
|
551
553
|
|
|
552
554
|
|