mcli-framework 7.9.0__py3-none-any.whl → 7.9.2__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.

@@ -13,9 +13,7 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union
13
13
  import numpy as np
14
14
  import pandas as pd
15
15
 
16
- sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
17
-
18
- from ml.models.recommendation_models import PortfolioRecommendation, StockRecommendationModel
16
+ from mcli.ml.models.recommendation_models import PortfolioRecommendation, StockRecommendationModel
19
17
 
20
18
  logger = logging.getLogger(__name__)
21
19
 
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for backtesting CLI."""
3
+
4
+ import click
5
+
6
+ from mcli.lib.ui.styling import error, info, success
7
+
8
+
9
+ @click.group(name="mcli-backtest", help="Backtesting CLI for MCLI trading strategies")
10
+ def cli():
11
+ """Main CLI group for backtesting."""
12
+ pass
13
+
14
+
15
+ @cli.command(name="run", help="Run a backtest on historical data")
16
+ @click.option("--strategy", required=True, help="Strategy to backtest")
17
+ @click.option("--start-date", required=True, help="Start date (YYYY-MM-DD)")
18
+ @click.option("--end-date", required=True, help="End date (YYYY-MM-DD)")
19
+ @click.option("--initial-capital", default=100000, help="Initial capital")
20
+ @click.option("--output", help="Output file for results")
21
+ def run_backtest(strategy: str, start_date: str, end_date: str, initial_capital: float, output: str):
22
+ """Run a backtest with the specified parameters."""
23
+ info(f"Running backtest for strategy: {strategy}")
24
+ info(f"Period: {start_date} to {end_date}")
25
+ info(f"Initial capital: ${initial_capital:,.2f}")
26
+
27
+ # TODO: Implement actual backtesting logic
28
+ error("Backtesting functionality not yet implemented")
29
+
30
+
31
+ @cli.command(name="list", help="List available strategies")
32
+ def list_strategies():
33
+ """List all available trading strategies."""
34
+ info("Available strategies:")
35
+ # TODO: Implement strategy listing
36
+ error("Strategy listing not yet implemented")
37
+
38
+
39
+ @cli.command(name="analyze", help="Analyze backtest results")
40
+ @click.argument("results_file")
41
+ def analyze_results(results_file: str):
42
+ """Analyze backtest results from a file."""
43
+ info(f"Analyzing results from: {results_file}")
44
+ # TODO: Implement results analysis
45
+ error("Results analysis not yet implemented")
46
+
47
+
48
+ def main():
49
+ """Main entry point."""
50
+ cli()
51
+
52
+
53
+ if __name__ == "__main__":
54
+ main()
@@ -9,7 +9,7 @@ import pandas as pd
9
9
  import torch
10
10
  import torch.nn as nn
11
11
  import torch.nn.functional as F
12
- from base_models import BaseStockModel, ModelMetrics, ValidationResult
12
+ from mcli.ml.models.base_models import BaseStockModel, ModelMetrics, ValidationResult
13
13
 
14
14
  logger = logging.getLogger(__name__)
15
15
 
@@ -10,8 +10,8 @@ import pandas as pd
10
10
  import torch
11
11
  import torch.nn as nn
12
12
  import torch.nn.functional as F
13
- from base_models import BaseStockModel, ModelMetrics, ValidationResult
14
- from ensemble_models import DeepEnsembleModel, EnsembleConfig, ModelConfig
13
+ from mcli.ml.models.base_models import BaseStockModel, ModelMetrics, ValidationResult
14
+ from mcli.ml.models.ensemble_models import DeepEnsembleModel, EnsembleConfig, ModelConfig
15
15
 
16
16
  logger = logging.getLogger(__name__)
17
17
 
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for portfolio optimization CLI."""
3
+
4
+ import click
5
+
6
+ from mcli.lib.ui.styling import error, info, success
7
+
8
+
9
+ @click.group(name="mcli-optimize", help="Portfolio optimization CLI for MCLI trading system")
10
+ def cli():
11
+ """Main CLI group for portfolio optimization."""
12
+ pass
13
+
14
+
15
+ @cli.command(name="portfolio", help="Optimize portfolio allocation")
16
+ @click.option("--symbols", required=True, help="Comma-separated list of symbols")
17
+ @click.option("--start-date", required=True, help="Start date (YYYY-MM-DD)")
18
+ @click.option("--end-date", required=True, help="End date (YYYY-MM-DD)")
19
+ @click.option("--risk-free-rate", default=0.02, help="Risk-free rate")
20
+ @click.option("--output", help="Output file for results")
21
+ def optimize_portfolio(symbols: str, start_date: str, end_date: str, risk_free_rate: float, output: str):
22
+ """Optimize portfolio allocation for given symbols."""
23
+ symbol_list = [s.strip() for s in symbols.split(",")]
24
+ info(f"Optimizing portfolio for: {', '.join(symbol_list)}")
25
+ info(f"Period: {start_date} to {end_date}")
26
+ info(f"Risk-free rate: {risk_free_rate:.2%}")
27
+
28
+ # TODO: Implement actual optimization
29
+ error("Portfolio optimization not yet implemented")
30
+
31
+
32
+ @cli.command(name="efficient-frontier", help="Generate efficient frontier")
33
+ @click.option("--symbols", required=True, help="Comma-separated list of symbols")
34
+ @click.option("--points", default=100, help="Number of points on frontier")
35
+ def efficient_frontier(symbols: str, points: int):
36
+ """Generate efficient frontier for given symbols."""
37
+ symbol_list = [s.strip() for s in symbols.split(",")]
38
+ info(f"Generating efficient frontier for: {', '.join(symbol_list)}")
39
+ info(f"Points: {points}")
40
+
41
+ # TODO: Implement efficient frontier generation
42
+ error("Efficient frontier generation not yet implemented")
43
+
44
+
45
+ def main():
46
+ """Main entry point."""
47
+ cli()
48
+
49
+
50
+ if __name__ == "__main__":
51
+ main()
@@ -0,0 +1 @@
1
+ """Model serving module for MCLI ML system."""
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for model serving CLI."""
3
+
4
+ import click
5
+
6
+ from mcli.lib.ui.styling import error, info, success
7
+
8
+
9
+ @click.group(name="mcli-serve", help="Model serving CLI for MCLI ML models")
10
+ def cli():
11
+ """Main CLI group for model serving."""
12
+ pass
13
+
14
+
15
+ @cli.command(name="start", help="Start model serving server")
16
+ @click.option("--model", required=True, help="Model to serve")
17
+ @click.option("--port", default=8000, help="Port to serve on")
18
+ @click.option("--host", default="0.0.0.0", help="Host to bind to")
19
+ def start_server(model: str, port: int, host: str):
20
+ """Start the model serving server."""
21
+ info(f"Starting model server for: {model}")
22
+ info(f"Serving on {host}:{port}")
23
+
24
+ # TODO: Implement actual model serving
25
+ error("Model serving functionality not yet implemented")
26
+
27
+
28
+ @cli.command(name="stop", help="Stop model serving server")
29
+ def stop_server():
30
+ """Stop the model serving server."""
31
+ info("Stopping model server...")
32
+ # TODO: Implement server stopping
33
+ error("Server stopping not yet implemented")
34
+
35
+
36
+ @cli.command(name="status", help="Check server status")
37
+ def server_status():
38
+ """Check the status of the model server."""
39
+ info("Checking server status...")
40
+ # TODO: Implement status check
41
+ error("Status check not yet implemented")
42
+
43
+
44
+ def main():
45
+ """Main entry point."""
46
+ cli()
47
+
48
+
49
+ if __name__ == "__main__":
50
+ main()
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for model training CLI."""
3
+
4
+ import click
5
+
6
+ from mcli.lib.ui.styling import error, info, success
7
+
8
+
9
+ @click.group(name="mcli-train", help="Model training CLI for MCLI ML system")
10
+ def cli():
11
+ """Main CLI group for model training."""
12
+ pass
13
+
14
+
15
+ @cli.command(name="model", help="Train a model")
16
+ @click.option("--model-type", required=True, help="Type of model to train")
17
+ @click.option("--dataset", required=True, help="Path to training dataset")
18
+ @click.option("--epochs", default=100, help="Number of training epochs")
19
+ @click.option("--batch-size", default=32, help="Batch size for training")
20
+ @click.option("--learning-rate", default=0.001, help="Learning rate")
21
+ @click.option("--output-dir", help="Directory to save trained model")
22
+ def train_model(model_type: str, dataset: str, epochs: int, batch_size: int, learning_rate: float, output_dir: str):
23
+ """Train a model with the specified parameters."""
24
+ info(f"Training {model_type} model")
25
+ info(f"Dataset: {dataset}")
26
+ info(f"Epochs: {epochs}, Batch size: {batch_size}, Learning rate: {learning_rate}")
27
+
28
+ # TODO: Implement actual training logic
29
+ error("Model training functionality not yet implemented")
30
+
31
+
32
+ @cli.command(name="resume", help="Resume training from checkpoint")
33
+ @click.option("--checkpoint", required=True, help="Path to checkpoint file")
34
+ @click.option("--epochs", default=50, help="Additional epochs to train")
35
+ def resume_training(checkpoint: str, epochs: int):
36
+ """Resume training from a checkpoint."""
37
+ info(f"Resuming training from: {checkpoint}")
38
+ info(f"Additional epochs: {epochs}")
39
+
40
+ # TODO: Implement resume functionality
41
+ error("Resume training not yet implemented")
42
+
43
+
44
+ @cli.command(name="politician-trading", help="Train politician trading prediction model")
45
+ @click.option("--output-dir", default="models", help="Directory to save trained model")
46
+ def train_politician_trading(output_dir: str):
47
+ """Train the politician trading prediction model."""
48
+ info("Training politician trading prediction model...")
49
+
50
+ try:
51
+ # Import the actual training function
52
+ from mcli.ml.training.train_model import train_politician_trading_model
53
+
54
+ # Run the training
55
+ metrics = train_politician_trading_model(output_dir)
56
+
57
+ if metrics:
58
+ success(f"Training completed! Final loss: {metrics.get('final_loss', 'N/A')}")
59
+ else:
60
+ error("Training failed")
61
+ except ImportError:
62
+ error("Politician trading model training not available")
63
+ except Exception as e:
64
+ error(f"Training failed: {str(e)}")
65
+
66
+
67
+ def main():
68
+ """Main entry point."""
69
+ cli()
70
+
71
+
72
+ if __name__ == "__main__":
73
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcli-framework
3
- Version: 7.9.0
3
+ Version: 7.9.2
4
4
  Summary: Portable workflow framework - transform any script into a versioned, schedulable command. Store in ~/.mcli/commands/, version with lockfile, run as daemon or cron job.
5
5
  Author-email: Luis Fernandez de la Vara <luis@lefv.io>
6
6
  Maintainer-email: Luis Fernandez de la Vara <luis@lefv.io>
@@ -97,8 +97,9 @@ mcli/ml/auth/auth_manager.py,sha256=_UUt42YCMKxCEfOxuw4rGMVjh6BQEP0dbLOP_EzSvFQ,
97
97
  mcli/ml/auth/models.py,sha256=Ww6lMLVGxtH6Biru5z4efSULCudQFXgmUWgVPTfUCwo,4398
98
98
  mcli/ml/auth/permissions.py,sha256=9N8Q6zQ-0-WcErVxviVzHELpzurBAby02wI3C1YziF0,8400
99
99
  mcli/ml/backtesting/__init__.py,sha256=z0UVuZlXatyJr4eh4tpF-8ytJbmBmLMtNr6TmnbN4hU,717
100
- mcli/ml/backtesting/backtest_engine.py,sha256=LhUdKYLZ9FHRYmBzmW6HPWJZpwYCqorjjWcwvhyjGEU,19081
100
+ mcli/ml/backtesting/backtest_engine.py,sha256=bmgHd1MBHQT4ddgWMdOQH8cFw8M_iiLqde6Yga2Q2ys,19016
101
101
  mcli/ml/backtesting/performance_metrics.py,sha256=M4qe9QYYserwuCSMMMKwsT6-GEJbH4rHDl66NO31IC0,14674
102
+ mcli/ml/backtesting/run.py,sha256=j_a5-ZOywbUKehERwtRsn_0hBLHQI4dsaPcMTYblGIs,1804
102
103
  mcli/ml/cli/__init__.py,sha256=ZUo2l2VBEZTMW2lqyWGqIwqiKgRX46GinXQfvdAoH0Y,76
103
104
  mcli/ml/cli/main.py,sha256=9U_cgB4M0AtWCghB5H0388v41sZ-qvJwcMdSKh2_SO0,15664
104
105
  mcli/ml/config/__init__.py,sha256=br-ihnAUIOIyQMXGZIB3xX_y2XB3uXBZyMzRa0lwopE,611
@@ -156,13 +157,14 @@ mcli/ml/mlops/model_serving.py,sha256=GCN53jZiz62vlH-ST8RLbZ2ZFBqvAAXUW33fJgdpFv
156
157
  mcli/ml/mlops/pipeline_orchestrator.py,sha256=2JU2ORNjLjRRLIXN7UzR5_Hq1vmie89H4ZXKq8kIoJU,23514
157
158
  mcli/ml/models/__init__.py,sha256=pZbjBBG8GJanXgX3txg8cst2PzLY22X_LtyFhsq71Jo,2377
158
159
  mcli/ml/models/base_models.py,sha256=eYSf1EQo5w0zInyypl9Qt_2St8mw1rCvS_gVLAsQyYI,10344
159
- mcli/ml/models/ensemble_models.py,sha256=dc7mkwVlfDBENN9jXWlsdWVsivHkaSDyCSfOeO_EAaw,22697
160
- mcli/ml/models/recommendation_models.py,sha256=DwARWgBbjYD1owFIu8qi2zaFQA3OBxoKcYw3gUKNw8o,17107
160
+ mcli/ml/models/ensemble_models.py,sha256=qyddEf3Pl2ESNE-BFCu-WvMmpgkpPh2ur1pH-YQvmrE,22712
161
+ mcli/ml/models/recommendation_models.py,sha256=ZStqlSHICKzHMYcEuudc0iHA2GrcxuyScuQtan-LwPg,17137
161
162
  mcli/ml/models/test_models.py,sha256=_amqLeqFF1X8dCBSgIx8Jt4h4XdLqcPZNW2uq4Hd_Ow,15762
162
163
  mcli/ml/monitoring/__init__.py,sha256=DGsaxZQaFqZ-qkkOIfV4yoDx6dBdit1wvXG5P8qDBgU,473
163
164
  mcli/ml/monitoring/drift_detection.py,sha256=MlRWvqDqUYddXsCzFS4bPdMNC2xKkwA1Ghrdf1z0LRE,26112
164
165
  mcli/ml/monitoring/metrics.py,sha256=lC1npD1TzmhTz47WzAH6-jgCrFSvkPiMbo9TacsP0tI,1028
165
166
  mcli/ml/optimization/__init__.py,sha256=LqWont1FqQblM_1GNsVkahTHjQJ7SafX-JNLOXurUlU,633
167
+ mcli/ml/optimization/optimize.py,sha256=fknlTSVKnLT15bdkIswk9Wp8xhU23N1qAp7u4tSG3w8,1946
166
168
  mcli/ml/optimization/portfolio_optimizer.py,sha256=QxkLegU9T7Yv52ZBFtXdeRbS7ybxmKA6uK5d7yJkyNA,31298
167
169
  mcli/ml/predictions/__init__.py,sha256=yA_0mn390awKiI1r3pR71fDa8_mqd3RGUlcCrwymaiM,129
168
170
  mcli/ml/predictions/monte_carlo.py,sha256=33kqyqYzMAmXXDdq5q3LLSTqqKjAoJdFYuiD3J8ApmU,13630
@@ -175,6 +177,8 @@ mcli/ml/preprocessing/politician_trading_preprocessor.py,sha256=woyZGaV6jD4cK9Xk
175
177
  mcli/ml/preprocessing/test_preprocessing.py,sha256=4BJFTTB5D62hdP3HzjO0-Sc7eq5JzATcXvYk2uw7MBc,9576
176
178
  mcli/ml/scripts/__init__.py,sha256=_ToblHT7nJhsbO7IQXjBj6OJHrjynfhlE60Ku_yvFB4,25
177
179
  mcli/ml/scripts/populate_sample_data.py,sha256=TBiTQpiUWeNkT2X5H5IEd-v4lM507JMXw3nAD0Iq62g,7811
180
+ mcli/ml/serving/__init__.py,sha256=ZmEp18149ylWrQBY9lL3hw5Rh1Hpvac0dnIKkvQLTIs,46
181
+ mcli/ml/serving/serve.py,sha256=tZFQg87bvGjHyAXnXstMbREpMTkuve_FwFRdeIxnek8,1404
178
182
  mcli/ml/tests/test_integration.py,sha256=c5XhNIn-3vQsN_k5tAYCEb-VpZc58kPSJPhsokmvUgo,15956
179
183
  mcli/ml/tests/test_training_dashboard.py,sha256=fCNyNdVQzARE6LYdZwQJAFr3dO8GAG-u0dJhW-sFpLU,14013
180
184
  mcli/ml/trading/__init__.py,sha256=Y7ANy3NZ_6zOKxXUj3xOXFAX7WXQ8jUvIveoH1jCKGM,1484
@@ -185,6 +189,7 @@ mcli/ml/trading/paper_trading.py,sha256=7faoabOOv3BdIDmrzPkLF_zTmWwZspq588sU9_m_
185
189
  mcli/ml/trading/risk_management.py,sha256=7eygbQaC1sfJlFvyInOc4MQtwxmU5lDnj28UcrfkBCk,15572
186
190
  mcli/ml/trading/trading_service.py,sha256=TguV7E_P5E8oGyGHOU2wEemh0iVepqitL4zjulm6NBE,20896
187
191
  mcli/ml/training/__init__.py,sha256=ldDLgyrpgU6B5pQhBMmC5Xt_sP7jgvpSwqHK8VJzGos,278
192
+ mcli/ml/training/train.py,sha256=_lZLAPQvdQ1_vKyrokR1mm4ZRNXx57lNea-8cD0CmlY,2718
188
193
  mcli/ml/training/train_model.py,sha256=_brE4ud0R9xfT5x3IpxgMhmakvbLbxqN82Ix4ycxSSo,16861
189
194
  mcli/mygroup/__init__.py,sha256=nXHIIt-BAROSr-22u567KklVcdcHQU19G2efSEIpmHU,35
190
195
  mcli/mygroup/test_cmd.py,sha256=WjzgoH1WFa79wc8A7O6UMuJfookLfgciUNcCMbKHAQQ,21
@@ -274,9 +279,9 @@ mcli/workflow/sync/test_cmd.py,sha256=neVgs9zEnKSxlvzDpFkuCGucqnzjrShm2OvJtHibsl
274
279
  mcli/workflow/videos/__init__.py,sha256=aV3DEoO7qdKJY4odWKoQbOKDQq4ludTeCLnZcupOFIM,25
275
280
  mcli/workflow/wakatime/__init__.py,sha256=wKG8cVIHVtMPhNRFGFtX43bRnocHqOMMkFMkmW-M6pU,2626
276
281
  mcli/workflow/wakatime/wakatime.py,sha256=sEjsUKa3-XyE8Ni6sAb_D3GAY5jDcA30KknW9YTbLTA,142
277
- mcli_framework-7.9.0.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
278
- mcli_framework-7.9.0.dist-info/METADATA,sha256=JNzXPY0C0wGjCEu8B8DR9r7EiFYlYQ0_DBNFAHrcgRk,16418
279
- mcli_framework-7.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
280
- mcli_framework-7.9.0.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
281
- mcli_framework-7.9.0.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
282
- mcli_framework-7.9.0.dist-info/RECORD,,
282
+ mcli_framework-7.9.2.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
283
+ mcli_framework-7.9.2.dist-info/METADATA,sha256=YrWVYcidm2DUFNW0c4YZb3QmXeRUOQzq35i48RSYcX8,16418
284
+ mcli_framework-7.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
285
+ mcli_framework-7.9.2.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
286
+ mcli_framework-7.9.2.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
287
+ mcli_framework-7.9.2.dist-info/RECORD,,