run_pipeline
Execute a complete portfolio rotation analysis pipeline: refresh prices, score holdings and candidates across five dimensions, assess risk, generate swap recommendations, backtest, and produce a summary report.
Instructions
Run the full 6-stage rotation analysis pipeline.
Stages: refresh (fetch prices) -> score (5-dimension scoring) -> risk (concentration/correlation) -> compare (swap recommendations) -> backtest (historical simulation) -> report (markdown summary).
This is the main entry point for a complete rotation analysis.
Args: portfolio_json: JSON array of current holdings, e.g. '[{"ticker": "AAPL", "weight": 0.20, "sector": "Technology"}, {"ticker": "MSFT", "weight": 0.15, "sector": "Technology"}, ...]'. candidates: Comma-separated candidate tickers to evaluate (e.g. "META,AVGO,LLY"). style: Investment style -- "garp" (default), "value", "growth", "momentum", "event_driven". overrides_json: Optional JSON of manual score overrides, e.g. '{"AAPL": {"thesis": 75, "catalyst": 60}}'. benchmark: Benchmark ticker (default "SPY"). stages: Comma-separated stages or "all" (default "all"). skip_refresh: Skip data fetching, use cached data (default False). start_date: Price data start date YYYY-MM-DD (default: 3 years ago). end_date: Price data end date YYYY-MM-DD (default: today). source: Data source for price fetching -- "auto" (API first, yfinance fallback), "api", "financial-datasets" (same as "api"), or "yfinance". If empty, reads PORTFOLIO_ROTATION_SOURCE env var (default: "auto").
Returns: JSON with complete pipeline results: scores, swap recommendations, risk analysis, backtest metrics, and markdown report.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| portfolio_json | Yes | ||
| candidates | Yes | ||
| style | No | garp | |
| overrides_json | No | ||
| benchmark | No | SPY | |
| stages | No | all | |
| skip_refresh | No | ||
| start_date | No | ||
| end_date | No | ||
| source | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |