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.

Files changed (56) hide show
  1. mcli/app/commands_cmd.py +51 -39
  2. mcli/app/completion_helpers.py +4 -13
  3. mcli/app/main.py +21 -25
  4. mcli/app/model_cmd.py +119 -9
  5. mcli/lib/custom_commands.py +16 -11
  6. mcli/ml/api/app.py +1 -5
  7. mcli/ml/dashboard/app.py +2 -2
  8. mcli/ml/dashboard/app_integrated.py +168 -116
  9. mcli/ml/dashboard/app_supabase.py +7 -3
  10. mcli/ml/dashboard/app_training.py +3 -6
  11. mcli/ml/dashboard/components/charts.py +74 -115
  12. mcli/ml/dashboard/components/metrics.py +24 -44
  13. mcli/ml/dashboard/components/tables.py +32 -40
  14. mcli/ml/dashboard/overview.py +102 -78
  15. mcli/ml/dashboard/pages/cicd.py +103 -56
  16. mcli/ml/dashboard/pages/debug_dependencies.py +35 -28
  17. mcli/ml/dashboard/pages/gravity_viz.py +374 -313
  18. mcli/ml/dashboard/pages/monte_carlo_predictions.py +50 -48
  19. mcli/ml/dashboard/pages/predictions_enhanced.py +396 -248
  20. mcli/ml/dashboard/pages/scrapers_and_logs.py +299 -273
  21. mcli/ml/dashboard/pages/test_portfolio.py +153 -121
  22. mcli/ml/dashboard/pages/trading.py +238 -169
  23. mcli/ml/dashboard/pages/workflows.py +129 -84
  24. mcli/ml/dashboard/streamlit_extras_utils.py +70 -79
  25. mcli/ml/dashboard/utils.py +24 -21
  26. mcli/ml/dashboard/warning_suppression.py +6 -4
  27. mcli/ml/database/session.py +16 -5
  28. mcli/ml/mlops/pipeline_orchestrator.py +1 -3
  29. mcli/ml/predictions/monte_carlo.py +6 -18
  30. mcli/ml/trading/alpaca_client.py +95 -96
  31. mcli/ml/trading/migrations.py +76 -40
  32. mcli/ml/trading/models.py +78 -60
  33. mcli/ml/trading/paper_trading.py +92 -74
  34. mcli/ml/trading/risk_management.py +106 -85
  35. mcli/ml/trading/trading_service.py +155 -110
  36. mcli/ml/training/train_model.py +1 -3
  37. mcli/{app → self}/completion_cmd.py +6 -6
  38. mcli/self/self_cmd.py +100 -57
  39. mcli/test/test_cmd.py +30 -0
  40. mcli/workflow/daemon/daemon.py +2 -0
  41. mcli/workflow/model_service/openai_adapter.py +347 -0
  42. mcli/workflow/politician_trading/models.py +6 -2
  43. mcli/workflow/politician_trading/scrapers_corporate_registry.py +39 -88
  44. mcli/workflow/politician_trading/scrapers_free_sources.py +32 -39
  45. mcli/workflow/politician_trading/scrapers_third_party.py +21 -39
  46. mcli/workflow/politician_trading/seed_database.py +70 -89
  47. {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/METADATA +1 -1
  48. {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/RECORD +56 -54
  49. /mcli/{app → self}/logs_cmd.py +0 -0
  50. /mcli/{app → self}/redis_cmd.py +0 -0
  51. /mcli/{app → self}/visual_cmd.py +0 -0
  52. /mcli/{app → test}/cron_test_cmd.py +0 -0
  53. {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/WHEEL +0 -0
  54. {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/entry_points.txt +0 -0
  55. {mcli_framework-7.5.1.dist-info → mcli_framework-7.6.1.dist-info}/licenses/LICENSE +0 -0
  56. {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("⚠️ Monte Carlo simulator not available. Please ensure all dependencies are installed.")
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
- "📊 Advanced Analysis",
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
- "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
- ])
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("Expected Price", f"${stats['expected_final_price']:.2f}",
338
- f"{stats['expected_return']:.1f}%")
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(f"- 95th Percentile: {((stats['percentile_95']/current_price - 1)*100):.2f}%")
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