Add a widget for the transformed data
This commit is contained in:
parent
0530d0c840
commit
abf813d8d2
|
|
@ -3,7 +3,7 @@ __pycache__/
|
|||
.DS_Store
|
||||
*.csv
|
||||
# src/
|
||||
eval_results/
|
||||
# eval_results/
|
||||
eval_data/
|
||||
*.egg-info/
|
||||
.env
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,15 +10,16 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "b6517669",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"sys.path.insert(0, os.path.abspath('..'))\n"
|
||||
"sys.path.insert(0, os.path.abspath('..'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -31,6 +32,765 @@
|
|||
"import tradingagents"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"id": "0f0abc48",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import os\n",
|
||||
"import re\n",
|
||||
"from datetime import datetime\n",
|
||||
"from typing import Dict, Any, List, Optional\n",
|
||||
"from dataclasses import dataclass\n",
|
||||
"import openai\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"@dataclass\n",
|
||||
"class TransformationConfig:\n",
|
||||
" \"\"\"Configuration for the data transformation agent\"\"\"\n",
|
||||
" openai_api_key: str\n",
|
||||
" model: str = \"gpt-4o-mini\"\n",
|
||||
" eval_results_path: str = \"scripts/eval_results/AVAH/TradingAgentsStrategy_logs\"\n",
|
||||
" output_path: str = \"scripts/eval_results/AVAH/TradingAgentsStrategy_transformed_logs\"\n",
|
||||
" backend_url: str = \"https://api.openai.com/v1\"\n",
|
||||
" \n",
|
||||
"class DataTransformationAgent:\n",
|
||||
" \"\"\"Agent that transforms TradingAgents output into widget-friendly JSON format\"\"\"\n",
|
||||
" \n",
|
||||
" def __init__(self, config: TransformationConfig):\n",
|
||||
" self.config = config\n",
|
||||
" self.client = openai.OpenAI(\n",
|
||||
" api_key=config.openai_api_key,\n",
|
||||
" base_url=config.backend_url\n",
|
||||
" )\n",
|
||||
" \n",
|
||||
" # Ensure output directory exists\n",
|
||||
" os.makedirs(self.config.output_path, exist_ok=True)\n",
|
||||
" \n",
|
||||
" def get_transformation_prompt(self) -> str:\n",
|
||||
" \"\"\"Returns the comprehensive transformation prompt\"\"\"\n",
|
||||
" return \"\"\"\n",
|
||||
"You are a data transformation specialist. Take the provided investment analysis JSON and restructure it into a widget-friendly format that separates visual data from text content for easy frontend consumption.\n",
|
||||
"\n",
|
||||
"## Input Format\n",
|
||||
"The input JSON contains investment analysis data with the following structure:\n",
|
||||
"- `company_of_interest`: Stock ticker\n",
|
||||
"- `trade_date`: Analysis date\n",
|
||||
"- `market_report`: Technical analysis text\n",
|
||||
"- `sentiment_report`: Company sentiment analysis text\n",
|
||||
"- `news_report`: Macroeconomic news text\n",
|
||||
"- `fundamentals_report`: Financial metrics and company data text\n",
|
||||
"- `investment_debate_state`: Object containing bull/bear/neutral arguments\n",
|
||||
"- `risk_debate_state`: Object containing risk analysis discussions\n",
|
||||
"- `investment_plan`: Final investment strategy text\n",
|
||||
"- `trader_investment_decision`: Final decision rationale text\n",
|
||||
"- `final_trade_decision`: Ultimate trade recommendation text\n",
|
||||
"\n",
|
||||
"## Output Requirements\n",
|
||||
"Transform the input into a structured JSON with the following sections:\n",
|
||||
"\n",
|
||||
"### 1. Widget Data Structure\n",
|
||||
"```json\n",
|
||||
"{\n",
|
||||
" \"metadata\": {\n",
|
||||
" \"company_ticker\": \"string\",\n",
|
||||
" \"company_name\": \"string\", \n",
|
||||
" \"analysis_date\": \"YYYY-MM-DD\",\n",
|
||||
" \"final_recommendation\": \"BUY|SELL|HOLD\",\n",
|
||||
" \"confidence_level\": \"HIGH|MEDIUM|LOW\"\n",
|
||||
" },\n",
|
||||
" \n",
|
||||
" \"financial_data\": {\n",
|
||||
" \"current_price\": number,\n",
|
||||
" \"price_change\": number,\n",
|
||||
" \"price_change_percent\": number,\n",
|
||||
" \"market_cap\": \"string\",\n",
|
||||
" \"enterprise_value\": \"string\",\n",
|
||||
" \"shares_outstanding\": \"string\",\n",
|
||||
" \"trading_range\": {\n",
|
||||
" \"high\": number,\n",
|
||||
" \"low\": number,\n",
|
||||
" \"open\": number\n",
|
||||
" },\n",
|
||||
" \"volume\": number,\n",
|
||||
" \"valuation_ratios\": {\n",
|
||||
" \"current_ps_ratio\": number,\n",
|
||||
" \"fair_value_ps_ratio\": number,\n",
|
||||
" \"forward_pe\": number,\n",
|
||||
" \"forward_ps\": number,\n",
|
||||
" \"forward_pcf\": number,\n",
|
||||
" \"forward_pocf\": number\n",
|
||||
" },\n",
|
||||
" \"ownership\": {\n",
|
||||
" \"insider_percent\": number,\n",
|
||||
" \"institutional_percent\": number\n",
|
||||
" },\n",
|
||||
" \"analyst_data\": {\n",
|
||||
" \"consensus_rating\": \"string\",\n",
|
||||
" \"price_target\": number,\n",
|
||||
" \"forecast_price\": number\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"technical_indicators\": {\n",
|
||||
" \"sma_50\": number,\n",
|
||||
" \"sma_200\": number,\n",
|
||||
" \"ema_10\": number,\n",
|
||||
" \"macd\": number,ticker\n",
|
||||
" \"macd_signal\": number,\n",
|
||||
" \"rsi\": number,\n",
|
||||
" \"atr\": number,\n",
|
||||
" \"trend_directions\": {\n",
|
||||
" \"sma_50\": \"BULLISH|BEARISH|NEUTRAL\",\n",
|
||||
" \"sma_200\": \"BULLISH|BEARISH|NEUTRAL\",\n",
|
||||
" \"ema_10\": \"BULLISH|BEARISH|NEUTRAL\",\n",
|
||||
" \"macd\": \"BULLISH|BEARISH|NEUTRAL\",\n",
|
||||
" \"rsi_condition\": \"OVERSOLD|OVERBOUGHT|NEUTRAL\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"investment_strategy\": {\n",
|
||||
" \"position_sizing\": {\n",
|
||||
" \"total_allocation_percent\": \"string\",\n",
|
||||
" \"entry_strategy\": \"string\",\n",
|
||||
" \"tranche_1_percent\": \"string\",\n",
|
||||
" \"tranche_2_percent\": \"string\"\n",
|
||||
" },\n",
|
||||
" \"risk_management\": {\n",
|
||||
" \"initial_stop_loss\": number,\n",
|
||||
" \"stop_loss_percent\": number,\n",
|
||||
" \"breakeven_strategy\": \"string\"\n",
|
||||
" },\n",
|
||||
" \"profit_targets\": [\n",
|
||||
" {\n",
|
||||
" \"target_price\": number,\n",
|
||||
" \"action\": \"string\",\n",
|
||||
" \"rationale\": \"string\"\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"monitoring_points\": [\n",
|
||||
" \"string\"\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"debate_summary\": {\n",
|
||||
" \"bull_key_points\": [\n",
|
||||
" \"string\"\n",
|
||||
" ],\n",
|
||||
" \"bear_key_points\": [\n",
|
||||
" \"string\"\n",
|
||||
" ],\n",
|
||||
" \"neutral_perspective\": \"string\",\n",
|
||||
" \"final_decision_rationale\": \"string\"\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"text_content\": {\n",
|
||||
" \"market_report\": {\n",
|
||||
" \"title\": \"Technical Analysis Report\",\n",
|
||||
" \"content\": \"string\",\n",
|
||||
" \"key_takeaways\": [\n",
|
||||
" \"string\"\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" \"sentiment_report\": {\n",
|
||||
" \"title\": \"Company Sentiment Analysis\", \n",
|
||||
" \"content\": \"string\",\n",
|
||||
" \"recent_developments\": [\n",
|
||||
" \"string\"\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" \"fundamentals_report\": {\n",
|
||||
" \"title\": \"Fundamental Analysis\",\n",
|
||||
" \"content\": \"string\",\n",
|
||||
" \"financial_highlights\": [\n",
|
||||
" \"string\"\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" \"news_report\": {\n",
|
||||
" \"title\": \"Macroeconomic Context\",\n",
|
||||
" \"content\": \"string\",\n",
|
||||
" \"key_developments\": [\n",
|
||||
" {\n",
|
||||
" \"date\": \"string\",\n",
|
||||
" \"event\": \"string\",\n",
|
||||
" \"impact\": \"string\"\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" \"investment_plan_full\": {\n",
|
||||
" \"title\": \"Complete Investment Strategy\",\n",
|
||||
" \"content\": \"string\"\n",
|
||||
" },\n",
|
||||
" \"debate_transcripts\": {\n",
|
||||
" \"bull_analysis\": \"string\",\n",
|
||||
" \"bear_analysis\": \"string\",\n",
|
||||
" \"neutral_analysis\": \"string\",\n",
|
||||
" \"risk_discussion\": \"string\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"widgets_config\": {\n",
|
||||
" \"charts_needed\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"price_chart\",\n",
|
||||
" \"data_source\": \"financial_data.current_price\",\n",
|
||||
" \"timeframe\": \"30_days\"\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"type\": \"technical_indicators\",\n",
|
||||
" \"data_source\": \"technical_indicators\"\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"text_widgets\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"expandable_report\",\n",
|
||||
" \"title\": \"Technical Analysis\",\n",
|
||||
" \"content_source\": \"text_content.market_report\"\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" }\n",
|
||||
"}\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"## Extraction Instructions\n",
|
||||
"\n",
|
||||
"1. **Parse Financial Metrics**: Extract all numerical values from the fundamentals_report, including current price, ratios, market cap, etc.\n",
|
||||
"\n",
|
||||
"2. **Extract Technical Data**: Pull technical indicator values and trend directions from the market_report text\n",
|
||||
"\n",
|
||||
"3. **Summarize Debates**: Create concise bullet points from the lengthy bull/bear arguments, focusing on key investment themes\n",
|
||||
"\n",
|
||||
"4. **Structure Investment Plan**: Break down the investment strategy into actionable components (sizing, entry price,stops, targets, time horizon)\n",
|
||||
"\n",
|
||||
"5. **Organize Text Content**: Preserve full text reports while also extracting key highlights for quick reference\n",
|
||||
"\n",
|
||||
"6. **Identify Key Dates**: Extract important dates like earnings calls, trade dates, and catalyst events\n",
|
||||
"\n",
|
||||
"7. **Classify Sentiment**: Determine overall sentiment scores and confidence levels based on the analysis\n",
|
||||
"\n",
|
||||
"## Data Validation\n",
|
||||
"- Ensure all numerical values are properly typed (numbers vs strings)\n",
|
||||
"- Validate date formats are consistent\n",
|
||||
"- Check that all required fields are populated\n",
|
||||
"- Verify that text content is properly escaped for JSON\n",
|
||||
"\n",
|
||||
"## Output Optimization\n",
|
||||
"- Structure data for easy consumption by frontend frameworks (React, Vue, Angular)\n",
|
||||
"- Separate frequently-accessed data (current price, recommendation) from detailed reports\n",
|
||||
"- Include metadata for widget configuration and rendering preferences\n",
|
||||
"- Provide fallback values for any missing data points\n",
|
||||
"\n",
|
||||
"Transform the input JSON following this structure to create a comprehensive, widget-ready dataset that maintains all original information while making it easily accessible for dashboard creation.\n",
|
||||
"\n",
|
||||
"IMPORTANT: Return ONLY the transformed JSON, no additional text or explanations.\n",
|
||||
"\"\"\"\n",
|
||||
"\n",
|
||||
" def extract_numerical_value(self, text: str, pattern: str, default: float = 0.0) -> float:\n",
|
||||
" \"\"\"Extract numerical values from text using regex patterns\"\"\"\n",
|
||||
" try:\n",
|
||||
" match = re.search(pattern, text, re.IGNORECASE)\n",
|
||||
" if match:\n",
|
||||
" value_str = match.group(1).replace(',', '').replace('$', '').replace('%', '')\n",
|
||||
" return float(value_str)\n",
|
||||
" except (ValueError, AttributeError):\n",
|
||||
" pass\n",
|
||||
" return default\n",
|
||||
"\n",
|
||||
" def transform_single_file(self, input_data: Dict[str, Any]) -> Dict[str, Any]:\n",
|
||||
" \"\"\"Transform a single TradingAgents JSON file using LLM\"\"\"\n",
|
||||
" try:\n",
|
||||
" # Prepare the input data as a JSON string\n",
|
||||
" input_json = json.dumps(input_data, indent=2)\n",
|
||||
" \n",
|
||||
" # Create the prompt with the input data\n",
|
||||
" full_prompt = f\"{self.get_transformation_prompt()}\\n\\nInput JSON to transform:\\n{input_json}\"\n",
|
||||
" \n",
|
||||
" # Call OpenAI API\n",
|
||||
" response = self.client.chat.completions.create(\n",
|
||||
" model=self.config.model,\n",
|
||||
" messages=[\n",
|
||||
" {\"role\": \"system\", \"content\": \"You are a data transformation specialist. Transform the provided JSON exactly as specified.\"},\n",
|
||||
" {\"role\": \"user\", \"content\": full_prompt}\n",
|
||||
" ],\n",
|
||||
" temperature=0.1,\n",
|
||||
" max_tokens=16384\n",
|
||||
" )\n",
|
||||
" \n",
|
||||
" # Parse the response\n",
|
||||
" transformed_json_str = response.choices[0].message.content.strip()\n",
|
||||
" \n",
|
||||
" # Clean up the response (remove any markdown formatting)\n",
|
||||
" if transformed_json_str.startswith('```json'):\n",
|
||||
" transformed_json_str = transformed_json_str[7:]\n",
|
||||
" if transformed_json_str.endswith('```'):\n",
|
||||
" transformed_json_str = transformed_json_str[:-3]\n",
|
||||
" \n",
|
||||
" transformed_data = json.loads(transformed_json_str)\n",
|
||||
" \n",
|
||||
" # Add fallback values if transformation missed anything\n",
|
||||
" self._add_fallback_values(transformed_data, input_data)\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" except Exception as e:\n",
|
||||
" print(f\"Error transforming data: {e}\")\n",
|
||||
" # Return a basic fallback structure\n",
|
||||
" transformed_data = self._create_fallback_structure(input_data)\n",
|
||||
" \n",
|
||||
" return transformed_data\n",
|
||||
" \n",
|
||||
" def _add_fallback_values(self, transformed_data: Dict[str, Any], original_data: Dict[str, Any]):\n",
|
||||
" \"\"\"Add fallback values for any missing required fields\"\"\"\n",
|
||||
" \n",
|
||||
" # Ensure metadata exists\n",
|
||||
" if 'metadata' not in transformed_data:\n",
|
||||
" transformed_data['metadata'] = {}\n",
|
||||
" \n",
|
||||
" metadata = transformed_data['metadata']\n",
|
||||
" if 'company_ticker' not in metadata:\n",
|
||||
" metadata['company_ticker'] = original_data.get('company_of_interest', 'UNKNOWN')\n",
|
||||
" if 'analysis_date' not in metadata:\n",
|
||||
" metadata['analysis_date'] = original_data.get('trade_date', datetime.now().strftime('%Y-%m-%d'))\n",
|
||||
" if 'final_recommendation' not in metadata:\n",
|
||||
" metadata['final_recommendation'] = 'HOLD'\n",
|
||||
" if 'confidence_level' not in metadata:\n",
|
||||
" metadata['confidence_level'] = 'MEDIUM'\n",
|
||||
"\n",
|
||||
" # Ensure all required sections exist\n",
|
||||
" required_sections = [\n",
|
||||
" 'financial_data', 'technical_indicators', 'investment_strategy',\n",
|
||||
" 'debate_summary', 'text_content', 'widgets_config'\n",
|
||||
" ]\n",
|
||||
" \n",
|
||||
" for section in required_sections:\n",
|
||||
" if section not in transformed_data:\n",
|
||||
" transformed_data[section] = {}\n",
|
||||
"\n",
|
||||
" def _create_fallback_structure(self, original_data: Dict[str, Any]) -> Dict[str, Any]:\n",
|
||||
" \"\"\"Create a basic fallback structure when transformation fails\"\"\"\n",
|
||||
" return {\n",
|
||||
" \"metadata\": {\n",
|
||||
" \"company_ticker\": original_data.get('company_of_interest', 'UNKNOWN'),\n",
|
||||
" \"company_name\": original_data.get('company_of_interest', 'Unknown Company'),\n",
|
||||
" \"analysis_date\": original_data.get('trade_date', datetime.now().strftime('%Y-%m-%d')),\n",
|
||||
" \"final_recommendation\": \"HOLD\",\n",
|
||||
" \"confidence_level\": \"LOW\"\n",
|
||||
" },\n",
|
||||
" \"financial_data\": {\n",
|
||||
" \"current_price\": 0.0,\n",
|
||||
" \"price_change\": 0.0,\n",
|
||||
" \"price_change_percent\": 0.0,\n",
|
||||
" \"market_cap\": \"N/A\",\n",
|
||||
" \"enterprise_value\": \"N/A\",\n",
|
||||
" \"shares_outstanding\": \"N/A\",\n",
|
||||
" \"trading_range\": {\"high\": 0.0, \"low\": 0.0, \"open\": 0.0},\n",
|
||||
" \"volume\": 0,\n",
|
||||
" \"valuation_ratios\": {\n",
|
||||
" \"current_ps_ratio\": 0.0,\n",
|
||||
" \"fair_value_ps_ratio\": 0.0,\n",
|
||||
" \"forward_pe\": 0.0,\n",
|
||||
" \"forward_ps\": 0.0,\n",
|
||||
" \"forward_pcf\": 0.0,\n",
|
||||
" \"forward_pocf\": 0.0\n",
|
||||
" },\n",
|
||||
" \"ownership\": {\"insider_percent\": 0.0, \"institutional_percent\": 0.0},\n",
|
||||
" \"analyst_data\": {\n",
|
||||
" \"consensus_rating\": \"N/A\",\n",
|
||||
" \"price_target\": 0.0,\n",
|
||||
" \"forecast_price\": 0.0\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"technical_indicators\": {\n",
|
||||
" \"sma_50\": 0.0,\n",
|
||||
" \"sma_200\": 0.0,\n",
|
||||
" \"ema_10\": 0.0,\n",
|
||||
" \"macd\": 0.0,\n",
|
||||
" \"macd_signal\": 0.0,\n",
|
||||
" \"rsi\": 50.0,\n",
|
||||
" \"atr\": 0.0,\n",
|
||||
" \"trend_directions\": {\n",
|
||||
" \"sma_50\": \"NEUTRAL\",\n",
|
||||
" \"sma_200\": \"NEUTRAL\",\n",
|
||||
" \"ema_10\": \"NEUTRAL\",\n",
|
||||
" \"macd\": \"NEUTRAL\",\n",
|
||||
" \"rsi_condition\": \"NEUTRAL\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"investment_strategy\": {\n",
|
||||
" \"position_sizing\": {\n",
|
||||
" \"total_allocation_percent\": \"0%\",\n",
|
||||
" \"entry_strategy\": \"N/A\",\n",
|
||||
" \"tranche_1_percent\": \"0%\",\n",
|
||||
" \"tranche_2_percent\": \"0%\"\n",
|
||||
" },\n",
|
||||
" \"risk_management\": {\n",
|
||||
" \"initial_stop_loss\": 0.0,\n",
|
||||
" \"stop_loss_percent\": 0.0,\n",
|
||||
" \"breakeven_strategy\": \"N/A\"\n",
|
||||
" },\n",
|
||||
" \"profit_targets\": [],\n",
|
||||
" \"monitoring_points\": []\n",
|
||||
" },\n",
|
||||
" \"debate_summary\": {\n",
|
||||
" \"bull_key_points\": [],\n",
|
||||
" \"bear_key_points\": [],\n",
|
||||
" \"neutral_perspective\": \"No analysis available\",\n",
|
||||
" \"final_decision_rationale\": \"No decision rationale available\"\n",
|
||||
" },\n",
|
||||
" \"text_content\": {\n",
|
||||
" \"market_report\": {\n",
|
||||
" \"title\": \"Technical Analysis Report\",\n",
|
||||
" \"content\": original_data.get('market_report', 'No market report available'),\n",
|
||||
" \"key_takeaways\": []\n",
|
||||
" },\n",
|
||||
" \"sentiment_report\": {\n",
|
||||
" \"title\": \"Company Sentiment Analysis\",\n",
|
||||
" \"content\": original_data.get('sentiment_report', 'No sentiment report available'),\n",
|
||||
" \"recent_developments\": []\n",
|
||||
" },\n",
|
||||
" \"fundamentals_report\": {\n",
|
||||
" \"title\": \"Fundamental Analysis\",\n",
|
||||
" \"content\": original_data.get('fundamentals_report', 'No fundamentals report available'),\n",
|
||||
" \"financial_highlights\": []\n",
|
||||
" },\n",
|
||||
" \"news_report\": {\n",
|
||||
" \"title\": \"Macroeconomic Context\",\n",
|
||||
" \"content\": original_data.get('news_report', 'No news report available'),\n",
|
||||
" \"key_developments\": []\n",
|
||||
" },\n",
|
||||
" \"investment_plan_full\": {\n",
|
||||
" \"title\": \"Complete Investment Strategy\",\n",
|
||||
" \"content\": original_data.get('investment_plan', 'No investment plan available')\n",
|
||||
" },\n",
|
||||
" \"debate_transcripts\": {\n",
|
||||
" \"bull_analysis\": \"\",\n",
|
||||
" \"bear_analysis\": \"\",\n",
|
||||
" \"neutral_analysis\": \"\",\n",
|
||||
" \"risk_discussion\": \"\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"widgets_config\": {\n",
|
||||
" \"charts_needed\": [\n",
|
||||
" {\"type\": \"price_chart\", \"data_source\": \"financial_data.current_price\", \"timeframe\": \"30_days\"},\n",
|
||||
" {\"type\": \"technical_indicators\", \"data_source\": \"technical_indicators\"}\n",
|
||||
" ],\n",
|
||||
" \"text_widgets\": [\n",
|
||||
" {\"type\": \"expandable_report\", \"title\": \"Technical Analysis\", \"content_source\": \"text_content.market_report\"}\n",
|
||||
" ]\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" def process_all_files(self) -> Dict[str, List[str]]:\n",
|
||||
" \"\"\"Process all JSON files in the eval_results directory\"\"\"\n",
|
||||
" results = {\"success\": [], \"failed\": []}\n",
|
||||
" \n",
|
||||
" eval_results_path = Path(self.config.eval_results_path)\n",
|
||||
" \n",
|
||||
" if not eval_results_path.exists():\n",
|
||||
" print(f\"Eval results path does not exist: {eval_results_path}\")\n",
|
||||
" return results\n",
|
||||
" \n",
|
||||
" # Process each company directory\n",
|
||||
" for company_dir in eval_results_path.iterdir():\n",
|
||||
" if not company_dir.is_dir():\n",
|
||||
" continue\n",
|
||||
" \n",
|
||||
" company_ticker = company_dir.name\n",
|
||||
" logs_dir = company_dir / \"TradingAgentsStrategy_logs\"\n",
|
||||
" transformed_dir = company_dir / \"TradingAgentsStrategy_transformed_logs\"\n",
|
||||
" transformed_dir.mkdir(parents=True, exist_ok=True)\n",
|
||||
" \n",
|
||||
" # Process each JSON file in the logs directory\n",
|
||||
" for json_file in logs_dir.glob(\"*.json\"):\n",
|
||||
" try:\n",
|
||||
" print(f\"Processing {json_file}\")\n",
|
||||
" \n",
|
||||
" # Process the file\n",
|
||||
" success = self.process_single_file(str(json_file), str(transformed_dir))\n",
|
||||
" \n",
|
||||
" if success:\n",
|
||||
" results[\"success\"].append(str(json_file.name))\n",
|
||||
" print(f\"Successfully transformed and saved: {json_file.name}\")\n",
|
||||
" else:\n",
|
||||
" results[\"failed\"].append(str(json_file))\n",
|
||||
" print(f\"Failed to process {json_file}\")\n",
|
||||
" \n",
|
||||
" except Exception as e:\n",
|
||||
" print(f\"Failed to process {json_file}: {e}\")\n",
|
||||
" results[\"failed\"].append(str(json_file))\n",
|
||||
" \n",
|
||||
" return results\n",
|
||||
"\n",
|
||||
" def process_single_file(self, input_file_path: str, output_file_path: str = None) -> bool:\n",
|
||||
" \"\"\"Process a single JSON file\"\"\"\n",
|
||||
" try:\n",
|
||||
" input_path = Path(input_file_path)\n",
|
||||
" \n",
|
||||
" if not input_path.exists():\n",
|
||||
" print(f\"Input file does not exist: {input_path}\")\n",
|
||||
" return False\n",
|
||||
" \n",
|
||||
" # Load the original data\n",
|
||||
" with open(input_path, 'r') as f:\n",
|
||||
" original_data = json.load(f)\n",
|
||||
" \n",
|
||||
" # Transform the data\n",
|
||||
" transformed_data = self.transform_single_file(original_data)\n",
|
||||
" \n",
|
||||
" # Determine output path\n",
|
||||
" if output_file_path is None:\n",
|
||||
" output_file_path = Path(self.config.output_path) / f\"{input_path.stem}_transformed.json\"\n",
|
||||
" else:\n",
|
||||
" output_file_path = Path(output_file_path) / f\"{input_path.stem}_transformed.json\"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" # Save the transformed data\n",
|
||||
" with open(output_file_path, 'w') as f:\n",
|
||||
" json.dump(transformed_data, f, indent=2)\n",
|
||||
" \n",
|
||||
" print(f\"Successfully transformed and saved: {output_file_path}\")\n",
|
||||
" return True\n",
|
||||
" \n",
|
||||
" except Exception as e:\n",
|
||||
" print(f\"Failed to process {input_file_path}: {e}\")\n",
|
||||
" return False\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "ed3a84b1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"os.environ.get(\"OPENAI_API_KEY\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"id": "636bea83",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'full_states_log_2025-07-26.json'"
|
||||
]
|
||||
},
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"str(Path(\"eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-07-26.json\").name)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6e138b44",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Processing eval_results/PLTR/TradingAgentsStrategy_logs/full_states_log_2025-08-01.json\n",
|
||||
"Successfully transformed and saved: eval_results/PLTR/TradingAgentsStrategy_transformed_logs/full_states_log_2025-08-01_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-08-01.json\n",
|
||||
"Processing eval_results/RDDT/TradingAgentsStrategy_logs/full_states_log_2025-08-01.json\n",
|
||||
"Successfully transformed and saved: eval_results/RDDT/TradingAgentsStrategy_transformed_logs/full_states_log_2025-08-01_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-08-01.json\n",
|
||||
"Processing eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-07-26.json\n",
|
||||
"Successfully transformed and saved: eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-07-26_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-07-26.json\n",
|
||||
"Processing eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-08-05.json\n",
|
||||
"Successfully transformed and saved: eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-08-05_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-08-05.json\n",
|
||||
"Processing eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-08-06.json\n",
|
||||
"Successfully transformed and saved: eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-08-06_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-08-06.json\n",
|
||||
"Processing eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-08-07.json\n",
|
||||
"Successfully transformed and saved: eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-08-07_transformed.json\n",
|
||||
"Successfully transformed and saved: full_states_log_2025-08-07.json\n",
|
||||
"\n",
|
||||
"Processing completed:\n",
|
||||
"Success: 6 files\n",
|
||||
"Failed: 0 files\n",
|
||||
"\n",
|
||||
"Successfully processed files:\n",
|
||||
" - full_states_log_2025-08-01.json\n",
|
||||
" - full_states_log_2025-08-01.json\n",
|
||||
" - full_states_log_2025-07-26.json\n",
|
||||
" - full_states_log_2025-08-05.json\n",
|
||||
" - full_states_log_2025-08-06.json\n",
|
||||
" - full_states_log_2025-08-07.json\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"\n",
|
||||
"config = TransformationConfig(\n",
|
||||
" openai_api_key=\"\",\n",
|
||||
" eval_results_path=\"eval_results/\",\n",
|
||||
" # output_path=\"eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-07-26.json\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Create agent\n",
|
||||
"agent = DataTransformationAgent(config)\n",
|
||||
"\n",
|
||||
"if False:\n",
|
||||
" # Process single file\n",
|
||||
" success = agent.process_single_file(\"eval_results/AVAH/TradingAgentsStrategy_logs/full_states_log_2025-07-26.json\", \"eval_results/AVAH/TradingAgentsStrategy_transformed_logs/\")\n",
|
||||
" if success:\n",
|
||||
" print(\"Single file processing completed successfully\")\n",
|
||||
" else:\n",
|
||||
" print(\"Single file processing failed\")\n",
|
||||
"else:\n",
|
||||
" # Process all files\n",
|
||||
" results = agent.process_all_files()\n",
|
||||
" print(f\"\\nProcessing completed:\")\n",
|
||||
" print(f\"Success: {len(results['success'])} files\")\n",
|
||||
" print(f\"Failed: {len(results['failed'])} files\")\n",
|
||||
" \n",
|
||||
" if results['success']:\n",
|
||||
" print(\"\\nSuccessfully processed files:\")\n",
|
||||
" for file_path in results['success']:\n",
|
||||
" print(f\" - {file_path}\")\n",
|
||||
" \n",
|
||||
" if results['failed']:\n",
|
||||
" print(\"\\nFailed to process files:\")\n",
|
||||
" for file_path in results['failed']:\n",
|
||||
" print(f\" - {file_path}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "1dc59a16",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(f\"eval_results/AVAH/TradingAgentsStrategy_transformed_logs/full_states_log_2025-07-26.json\") as f:\n",
|
||||
" input = json.load(f)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8d772497",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'metadata': {'company_ticker': 'AVAH',\n",
|
||||
" 'company_name': 'Aveanna Healthcare Holdings Inc.',\n",
|
||||
" 'analysis_date': '2025-08-06',\n",
|
||||
" 'final_recommendation': 'HOLD',\n",
|
||||
" 'confidence_level': 'MEDIUM'},\n",
|
||||
" 'financial_data': {'current_price': 5.81,\n",
|
||||
" 'price_change': 1.93,\n",
|
||||
" 'price_change_percent': 49.49,\n",
|
||||
" 'market_cap': '814.80 million',\n",
|
||||
" 'enterprise_value': '2.24 billion',\n",
|
||||
" 'shares_outstanding': '206.28 million',\n",
|
||||
" 'trading_range': {'high': 6.19, 'low': 4.4, 'open': 5.35},\n",
|
||||
" 'volume': 14408713,\n",
|
||||
" 'valuation_ratios': {'current_ps_ratio': 0.54,\n",
|
||||
" 'fair_value_ps_ratio': 0.8,\n",
|
||||
" 'forward_pe': 145.24,\n",
|
||||
" 'forward_ps': 0.5,\n",
|
||||
" 'forward_pcf': 49.02,\n",
|
||||
" 'forward_pocf': 23.39},\n",
|
||||
" 'ownership': {'insider_percent': 2.74, 'institutional_percent': 20.26},\n",
|
||||
" 'analyst_data': {'consensus_rating': 'HOLD',\n",
|
||||
" 'price_target': 5.0,\n",
|
||||
" 'forecast_price': 5.25}},\n",
|
||||
" 'technical_indicators': {'sma_50': 4.61,\n",
|
||||
" 'sma_200': 4.88,\n",
|
||||
" 'ema_10': 4.25,\n",
|
||||
" 'macd': -0.0427,\n",
|
||||
" 'macd_signal': -0.1917,\n",
|
||||
" 'rsi': 77.09,\n",
|
||||
" 'atr': 0.334,\n",
|
||||
" 'trend_directions': {'sma_50': 'BEARISH',\n",
|
||||
" 'sma_200': 'BEARISH',\n",
|
||||
" 'ema_10': 'BEARISH',\n",
|
||||
" 'macd': 'BEARISH',\n",
|
||||
" 'rsi_condition': 'OVERBOUGHT'}},\n",
|
||||
" 'investment_strategy': {'position_sizing': {'total_allocation_percent': '3-5%',\n",
|
||||
" 'entry_strategy': 'Staggered entry around $3.75-$3.80',\n",
|
||||
" 'tranche_1_percent': '50%',\n",
|
||||
" 'tranche_2_percent': '50%'},\n",
|
||||
" 'risk_management': {'initial_stop_loss': 3.0,\n",
|
||||
" 'stop_loss_percent': 20,\n",
|
||||
" 'breakeven_strategy': 'Adjust stop to breakeven after first tranche fills'},\n",
|
||||
" 'profit_targets': [{'target_price': 5.0,\n",
|
||||
" 'action': 'Sell 25-50%',\n",
|
||||
" 'rationale': 'Reassess margin trends'},\n",
|
||||
" {'target_price': 7.5,\n",
|
||||
" 'action': 'Hold for longer-term gains',\n",
|
||||
" 'rationale': 'Reflects a move to 0.8x P/S based on projected FY24 revenues'}],\n",
|
||||
" 'monitoring_points': ['Government reimbursement rate details',\n",
|
||||
" 'Patient census/margin trends',\n",
|
||||
" 'Competitive landscape and near-term cost pressures']},\n",
|
||||
" 'debate_summary': {'bull_key_points': ['Strong revenue growth of 16.8% in Q1',\n",
|
||||
" 'Aging population driving demand for home healthcare',\n",
|
||||
" 'Integrated service offerings create competitive advantages',\n",
|
||||
" 'Potential for recovery indicated by oversold conditions'],\n",
|
||||
" 'bear_key_points': ['High P/E ratio of 145.24 raises valuation concerns',\n",
|
||||
" 'Negative book value and high debt levels pose risks',\n",
|
||||
" 'Market volatility and competition could impact margins',\n",
|
||||
" 'RSI indicates overbought conditions, suggesting a potential pullback'],\n",
|
||||
" 'neutral_perspective': 'A balanced approach is needed, recognizing both growth potential and inherent risks.',\n",
|
||||
" 'final_decision_rationale': 'While growth prospects are promising, the risks associated with high leverage and market volatility necessitate a cautious approach.'},\n",
|
||||
" 'text_content': {'market_report': {'title': 'Technical Analysis Report',\n",
|
||||
" 'content': 'AVAH has seen significant fluctuations in price, with key indicators suggesting a bearish trend. The stock closed at $3.96 on July 25, indicating a decrease from earlier highs. The analysis of various indicators shows potential for a reversal, but caution is warranted.',\n",
|
||||
" 'key_takeaways': ['Current price trends indicate bearish sentiment.',\n",
|
||||
" 'Technical indicators suggest potential for a price correction.']},\n",
|
||||
" 'sentiment_report': {'title': 'Company Sentiment Analysis',\n",
|
||||
" 'content': \"Aveanna's upcoming earnings report is anticipated to be a pivotal moment for the stock. Recent analyst activity suggests a price target of $5.00, indicating potential upside.\",\n",
|
||||
" 'recent_developments': ['Earnings release scheduled for August 7, 2025.',\n",
|
||||
" 'Analyst price target set at $5.00.']},\n",
|
||||
" 'fundamentals_report': {'title': 'Fundamental Analysis',\n",
|
||||
" 'content': 'Aveanna Healthcare Holdings Inc. has shown a mixed financial picture with significant revenue growth but concerning debt levels. Investors should monitor cash flow and debt management closely.',\n",
|
||||
" 'financial_highlights': ['Current price at $5.81 with a 49.49% increase.',\n",
|
||||
" 'P/S ratio of 0.54 indicates potential undervaluation.']},\n",
|
||||
" 'news_report': {'title': 'Macroeconomic Context',\n",
|
||||
" 'content': 'Recent macroeconomic trends, including trade agreements and Federal Reserve policies, have created a favorable backdrop for healthcare investments. However, rising tariffs and inflation remain concerns.',\n",
|
||||
" 'key_developments': [{'date': '2025-08-07',\n",
|
||||
" 'event': 'Earnings release',\n",
|
||||
" 'impact': 'Potential for increased volatility.'}]},\n",
|
||||
" 'investment_plan_full': {'title': 'Complete Investment Strategy',\n",
|
||||
" 'content': 'The investment strategy for AVAH includes a staggered entry approach, risk management through stop-loss orders, and monitoring key performance indicators to ensure informed decision-making.'},\n",
|
||||
" 'debate_transcripts': {'bull_analysis': 'The bullish case emphasizes strong revenue growth and favorable market conditions, suggesting that AVAH is well-positioned for future success.',\n",
|
||||
" 'bear_analysis': 'The bearish perspective highlights significant risks associated with high debt levels and market volatility, urging caution among investors.',\n",
|
||||
" 'neutral_analysis': 'A balanced view recognizes the potential for growth while also addressing the inherent risks, advocating for a measured investment approach.',\n",
|
||||
" 'risk_discussion': 'The discussion around risk emphasizes the importance of managing exposure and being prepared for market fluctuations.'}},\n",
|
||||
" 'widgets_config': {'charts_needed': [{'type': 'price_chart',\n",
|
||||
" 'data_source': 'financial_data.current_price',\n",
|
||||
" 'timeframe': '30_days'},\n",
|
||||
" {'type': 'technical_indicators', 'data_source': 'technical_indicators'}],\n",
|
||||
" 'text_widgets': [{'type': 'expandable_report',\n",
|
||||
" 'title': 'Technical Analysis',\n",
|
||||
" 'content_source': 'text_content.market_report'}]}}"
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"transform_single_file(input_data):\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,164 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "AVAH",
|
||||
"company_name": "Aveanna Healthcare Holdings Inc.",
|
||||
"analysis_date": "2025-08-06",
|
||||
"final_recommendation": "HOLD",
|
||||
"confidence_level": "MEDIUM"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 5.81,
|
||||
"price_change": 1.93,
|
||||
"price_change_percent": 49.49,
|
||||
"market_cap": "814.80 million",
|
||||
"enterprise_value": "2.24 billion",
|
||||
"shares_outstanding": "206.28 million",
|
||||
"trading_range": {
|
||||
"high": 6.19,
|
||||
"low": 4.4,
|
||||
"open": 5.35
|
||||
},
|
||||
"volume": 14408713,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": 0.54,
|
||||
"fair_value_ps_ratio": 0.8,
|
||||
"forward_pe": 145.24,
|
||||
"forward_ps": 0.5,
|
||||
"forward_pcf": 49.02,
|
||||
"forward_pocf": 23.39
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": 2.74,
|
||||
"institutional_percent": 20.26
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "HOLD",
|
||||
"price_target": 5.0,
|
||||
"forecast_price": 5.25
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 4.61,
|
||||
"sma_200": 4.88,
|
||||
"ema_10": 4.25,
|
||||
"macd": -0.0427,
|
||||
"macd_signal": -0.1917,
|
||||
"rsi": 77.09,
|
||||
"atr": 0.334,
|
||||
"trend_directions": {
|
||||
"sma_50": "BEARISH",
|
||||
"sma_200": "BEARISH",
|
||||
"ema_10": "BEARISH",
|
||||
"macd": "BEARISH",
|
||||
"rsi_condition": "OVERBOUGHT"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "2%",
|
||||
"entry_strategy": "Staggered entry before earnings",
|
||||
"tranche_1_percent": "1%",
|
||||
"tranche_2_percent": "1%"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": 3.5,
|
||||
"stop_loss_percent": 15,
|
||||
"breakeven_strategy": "Adjust stop to breakeven after 20% gain"
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": 5.0,
|
||||
"action": "Sell 50%",
|
||||
"rationale": "Lock in gains if stock rallies"
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Earnings call on August 7",
|
||||
"Debt reduction announcements",
|
||||
"Margin expansion signals"
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"14% revenue growth in Q1",
|
||||
"Strong demand in home healthcare",
|
||||
"Improving interest coverage ratio",
|
||||
"Potential for rebound due to oversold conditions"
|
||||
],
|
||||
"bear_key_points": [
|
||||
"High P/E ratio of 145.24",
|
||||
"Negative book value",
|
||||
"Debt-to-EBITDA ratio near 23x",
|
||||
"Volatility and market skepticism"
|
||||
],
|
||||
"neutral_perspective": "A balanced approach is needed, considering both growth potential and risks.",
|
||||
"final_decision_rationale": "While growth prospects are strong, the risks associated with debt and valuation warrant a cautious hold."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "AVAH has seen significant fluctuations in price, with key indicators suggesting a bearish trend. The stock closed at $3.96 on July 25, indicating a decrease from earlier highs.",
|
||||
"key_takeaways": [
|
||||
"Current price trends indicate bearish sentiment.",
|
||||
"Key indicators suggest potential for a reversal."
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "Aveanna's upcoming earnings report is anticipated to be a pivotal moment for the stock. Recent revenue growth and analyst price targets suggest optimism.",
|
||||
"recent_developments": [
|
||||
"Earnings release scheduled for August 7.",
|
||||
"Analyst price target set at $5.00."
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Aveanna Healthcare has shown a mixed financial picture with significant revenue growth but concerning debt levels.",
|
||||
"financial_highlights": [
|
||||
"Current price at $5.81 with a 49.49% increase.",
|
||||
"High debt-to-EBITDA ratio raises concerns."
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Recent macroeconomic trends indicate a mixed environment for trading, with potential impacts on healthcare spending.",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-07",
|
||||
"event": "Earnings release",
|
||||
"impact": "Potential volatility based on results."
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "The investment strategy emphasizes a cautious approach with a focus on risk management and monitoring key performance indicators."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "The bullish case emphasizes strong revenue growth and market demand.",
|
||||
"bear_analysis": "The bearish case highlights valuation concerns and high debt levels.",
|
||||
"neutral_analysis": "A balanced view suggests waiting for clearer signals before investing.",
|
||||
"risk_discussion": "Risks associated with debt and market volatility are significant."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "AVAH",
|
||||
"company_name": "Aveanna Healthcare Holdings Inc.",
|
||||
"analysis_date": "2025-08-06",
|
||||
"final_recommendation": "HOLD",
|
||||
"confidence_level": "MEDIUM"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 5.81,
|
||||
"price_change": 1.93,
|
||||
"price_change_percent": 49.49,
|
||||
"market_cap": "814.80 million",
|
||||
"enterprise_value": "2.24 billion",
|
||||
"shares_outstanding": "206.28 million",
|
||||
"trading_range": {
|
||||
"high": 6.19,
|
||||
"low": 4.4,
|
||||
"open": 5.35
|
||||
},
|
||||
"volume": 14408713,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": 0.54,
|
||||
"fair_value_ps_ratio": 0.8,
|
||||
"forward_pe": 145.24,
|
||||
"forward_ps": 0.5,
|
||||
"forward_pcf": 49.02,
|
||||
"forward_pocf": 23.39
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": 2.74,
|
||||
"institutional_percent": 20.26
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "HOLD",
|
||||
"price_target": 5.25,
|
||||
"forecast_price": 5.0
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 4.61,
|
||||
"sma_200": 4.88,
|
||||
"ema_10": 3.91,
|
||||
"macd": -0.208,
|
||||
"macd_signal": -0.229,
|
||||
"rsi": 38.39,
|
||||
"atr": 0.182,
|
||||
"trend_directions": {
|
||||
"sma_50": "BEARISH",
|
||||
"sma_200": "BEARISH",
|
||||
"ema_10": "BEARISH",
|
||||
"macd": "BEARISH",
|
||||
"rsi_condition": "OVERSOLD"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "3-5%",
|
||||
"entry_strategy": "Staggered entry around $3.75-$3.80, hold cash until after earnings.",
|
||||
"tranche_1_percent": "50%",
|
||||
"tranche_2_percent": "50%"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": 3.0,
|
||||
"stop_loss_percent": 20,
|
||||
"breakeven_strategy": "Adjust stop to breakeven after first tranche is filled."
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": 5.0,
|
||||
"action": "Sell 25-50%",
|
||||
"rationale": "Reassess margin trends."
|
||||
},
|
||||
{
|
||||
"target_price": 7.5,
|
||||
"action": "Hold for longer-term gains.",
|
||||
"rationale": "Reflects a move to 0.8x P/S based on projected FY24 revenues."
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Earnings call on August 7, focus on government reimbursement rate details.",
|
||||
"Patient census and margin trends.",
|
||||
"Competitive landscape and near-term cost pressures."
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"Strong revenue growth of 16.8% in Q1.",
|
||||
"Favorable demographic trends for home healthcare.",
|
||||
"Potential for recovery indicated by oversold RSI."
|
||||
],
|
||||
"bear_key_points": [
|
||||
"High debt levels and Altman-Z score indicating bankruptcy risk.",
|
||||
"Negative technical indicators and low social media engagement."
|
||||
],
|
||||
"neutral_perspective": "A balanced approach is needed, recognizing both growth potential and financial risks.",
|
||||
"final_decision_rationale": "While growth potential exists, financial instability and bearish technicals warrant a cautious hold."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "AVAH has seen significant fluctuations in price, with a recent low of $3.74 and peaks above $5. The stock is currently in a bearish trend with key indicators suggesting caution.",
|
||||
"key_takeaways": [
|
||||
"Current price is $5.81 with a 49.49% increase.",
|
||||
"Technical indicators show bearish momentum."
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "Aveanna's recent earnings announcement and market reactions indicate mixed sentiment. The upcoming earnings call is crucial for future stock performance.",
|
||||
"recent_developments": [
|
||||
"Analyst price target set at $5.00.",
|
||||
"Recent revenue growth of 14% in Q1."
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Aveanna Healthcare shows potential for growth but faces significant financial risks. The Altman-Z score indicates a need for caution.",
|
||||
"financial_highlights": [
|
||||
"P/S ratio of 0.54 suggests potential undervaluation.",
|
||||
"High debt-to-equity ratio raises concerns."
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Recent macroeconomic trends, including tariff increases and inflation concerns, could impact Aveanna's operational costs and market performance.",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-01",
|
||||
"event": "U.S. tariffs imposed on imports.",
|
||||
"impact": "Potential increase in operational costs."
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "The investment strategy for AVAH includes a cautious approach with a focus on monitoring key financial metrics and market conditions."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "The bull case emphasizes growth potential driven by demographic trends and recent revenue increases.",
|
||||
"bear_analysis": "The bear case highlights financial instability and risks associated with high debt levels.",
|
||||
"neutral_analysis": "A balanced perspective suggests a cautious approach while monitoring for signs of recovery.",
|
||||
"risk_discussion": "The discussion emphasizes the importance of risk management in volatile markets."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "AVAH",
|
||||
"company_name": "Aveanna Healthcare Holdings Inc.",
|
||||
"analysis_date": "2025-08-06",
|
||||
"final_recommendation": "BUY",
|
||||
"confidence_level": "MEDIUM"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 5.81,
|
||||
"price_change": 1.93,
|
||||
"price_change_percent": 0.49,
|
||||
"market_cap": "814.80 million",
|
||||
"enterprise_value": "2.24 billion",
|
||||
"shares_outstanding": "206.28 million",
|
||||
"trading_range": {
|
||||
"high": 6.19,
|
||||
"low": 4.4,
|
||||
"open": 5.35
|
||||
},
|
||||
"volume": 14408713,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": 0.4,
|
||||
"fair_value_ps_ratio": 0.8,
|
||||
"forward_pe": 23.62,
|
||||
"forward_ps": 0.37,
|
||||
"forward_pcf": 28.69,
|
||||
"forward_pocf": 22.82
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": 2.74,
|
||||
"institutional_percent": 20.26
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "Hold",
|
||||
"price_target": 5.25,
|
||||
"forecast_price": 5.0
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 4.61,
|
||||
"sma_200": 4.88,
|
||||
"ema_10": 3.91,
|
||||
"macd": -0.208,
|
||||
"macd_signal": -0.229,
|
||||
"rsi": 38.39,
|
||||
"atr": 0.182,
|
||||
"trend_directions": {
|
||||
"sma_50": "BEARISH",
|
||||
"sma_200": "BEARISH",
|
||||
"ema_10": "BEARISH",
|
||||
"macd": "BEARISH",
|
||||
"rsi_condition": "OVERSOLD"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "3-5%",
|
||||
"entry_strategy": "Staggered entry",
|
||||
"tranche_1_percent": "50%",
|
||||
"tranche_2_percent": "50%"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": 3.0,
|
||||
"stop_loss_percent": 20,
|
||||
"breakeven_strategy": "Adjust stop to breakeven after tranche 2"
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": 5.0,
|
||||
"action": "Sell 25-50%",
|
||||
"rationale": "Reassess margin trends"
|
||||
},
|
||||
{
|
||||
"target_price": 7.5,
|
||||
"action": "Hold for longer-term",
|
||||
"rationale": "Reflects a move to 0.8x P/S based on projected FY24 revenues"
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Earnings call on August 7",
|
||||
"Government reimbursement rate changes",
|
||||
"Market reactions to tariff impacts"
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"Healthcare tailwinds from aging population",
|
||||
"Undervalued fundamentals with a low P/S ratio",
|
||||
"Oversold technicals indicating potential rebound",
|
||||
"Upcoming earnings call as a catalyst"
|
||||
],
|
||||
"bear_key_points": [
|
||||
"Fierce competition in the home healthcare market",
|
||||
"Macroeconomic headwinds from rising tariffs",
|
||||
"Weak insider ownership suggesting lack of confidence",
|
||||
"Current bearish technical indicators"
|
||||
],
|
||||
"neutral_perspective": "A balanced view acknowledges both growth potential and risks.",
|
||||
"final_decision_rationale": "The combination of undervaluation, demographic trends, and an imminent catalyst outweighs the risks."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "Analysis of AVAH (Avalon Holdings) Stock - August 2025...",
|
||||
"key_takeaways": [
|
||||
"Bearish trend indicated by SMA and MACD",
|
||||
"Potential support around $3.80",
|
||||
"Cautious trading recommended"
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "This report presents an analysis of Aveanna Healthcare Holdings Inc. (NASDAQ: AVAH)...",
|
||||
"recent_developments": [
|
||||
"Earnings release scheduled for August 7, 2025",
|
||||
"Stock surged by 45% over five days"
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Comprehensive Report on Aveanna Healthcare Holdings Inc. (AVAH)...",
|
||||
"financial_highlights": [
|
||||
"Current Price: $5.81",
|
||||
"Market Capitalization: $814.80 million",
|
||||
"Forward P/E Ratio: 23.62"
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Current Analysis of Macroeconomic Developments and Market Conditions as of August 6, 2025...",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-06",
|
||||
"event": "25% tariff on Indian imports",
|
||||
"impact": "Increased costs for U.S. businesses"
|
||||
},
|
||||
{
|
||||
"date": "2025-08-01",
|
||||
"event": "50% tariff on Brazilian goods",
|
||||
"impact": "Heightened trade tensions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "Here\u2019s how I see it after weighing both sides..."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "Bull Analyst: Absolutely! Let\u2019s dive into a compelling argument for investing in Aveanna Healthcare Holdings Inc. (AVAH)...",
|
||||
"bear_analysis": "Bear Analyst: Absolutely, let\u2019s dive into this debate on Aveanna Healthcare Holdings Inc. (AVAH)...",
|
||||
"neutral_analysis": "Neutral Analyst: It's great to see both the Risky Analyst and Safe Analyst presenting strong viewpoints...",
|
||||
"risk_discussion": "Risky Analyst: Let\u2019s dive into the conservative and neutral stances on Aveanna Healthcare (AVAH)..."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "AVAH",
|
||||
"company_name": "Aveanna Healthcare Holdings Inc.",
|
||||
"analysis_date": "2025-08-06",
|
||||
"final_recommendation": "BUY",
|
||||
"confidence_level": "MEDIUM"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 5.81,
|
||||
"price_change": 1.93,
|
||||
"price_change_percent": 49.49,
|
||||
"market_cap": "814.80 million",
|
||||
"enterprise_value": "2.24 billion",
|
||||
"shares_outstanding": "206.28 million",
|
||||
"trading_range": {
|
||||
"high": 6.19,
|
||||
"low": 4.4,
|
||||
"open": 5.35
|
||||
},
|
||||
"volume": 14408713,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": 0.4,
|
||||
"fair_value_ps_ratio": 0.8,
|
||||
"forward_pe": 23.62,
|
||||
"forward_ps": 0.37,
|
||||
"forward_pcf": 28.69,
|
||||
"forward_pocf": 22.82
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": 2.74,
|
||||
"institutional_percent": 20.26
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "Hold",
|
||||
"price_target": 5.25,
|
||||
"forecast_price": 5.0
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 4.61,
|
||||
"sma_200": 4.88,
|
||||
"ema_10": 3.91,
|
||||
"macd": -0.208,
|
||||
"macd_signal": -0.229,
|
||||
"rsi": 38.39,
|
||||
"atr": 0.182,
|
||||
"trend_directions": {
|
||||
"sma_50": "BEARISH",
|
||||
"sma_200": "BEARISH",
|
||||
"ema_10": "BEARISH",
|
||||
"macd": "BEARISH",
|
||||
"rsi_condition": "OVERSOLD"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "3-5%",
|
||||
"entry_strategy": "Staggered entry",
|
||||
"tranche_1_percent": "50%",
|
||||
"tranche_2_percent": "50%"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": 3.0,
|
||||
"stop_loss_percent": 20,
|
||||
"breakeven_strategy": "Adjust stop to breakeven after first tranche"
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": 5.0,
|
||||
"action": "Sell 25-50%",
|
||||
"rationale": "Reassess margin trends"
|
||||
},
|
||||
{
|
||||
"target_price": 7.5,
|
||||
"action": "Hold",
|
||||
"rationale": "Reflects a move to 0.8x P/S based on projected FY24 revenues"
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Listen to August 7 earnings call",
|
||||
"Monitor government reimbursement rate changes",
|
||||
"Watch for macroeconomic impacts from tariffs"
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"Strong revenue growth of 16.8% year-over-year",
|
||||
"Healthcare demand is increasing due to aging population",
|
||||
"AVAH is well-positioned in the home healthcare market"
|
||||
],
|
||||
"bear_key_points": [
|
||||
"High P/FCF ratio indicates potential overvaluation",
|
||||
"Current stock price is volatile and may correct",
|
||||
"Competition in the healthcare sector is fierce"
|
||||
],
|
||||
"neutral_perspective": "A balanced approach is needed, recognizing both growth potential and risks.",
|
||||
"final_decision_rationale": "The combination of strong fundamentals and a structured entry strategy supports a buy recommendation."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "AVAH stock has undergone fluctuations reflecting underlying trends in its price and trading volume. Key technical indicators suggest a bearish trend.",
|
||||
"key_takeaways": [
|
||||
"50-Day SMA indicates resistance",
|
||||
"200-Day SMA reflects long-term bearish sentiment",
|
||||
"RSI under 40 suggests oversold conditions"
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "Recent news indicates a positive sentiment surrounding AVAH due to strong earnings and strategic expansions.",
|
||||
"recent_developments": [
|
||||
"Scheduled earnings release on August 7, 2025",
|
||||
"Stock surged by 45% over five days"
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Aveanna Healthcare has shown strong financial metrics, including a significant increase in revenue and a favorable market position.",
|
||||
"financial_highlights": [
|
||||
"Current stock price: $5.81",
|
||||
"Market capitalization: $814.80 million",
|
||||
"P/S ratio indicates potential undervaluation"
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Recent macroeconomic trends, including U.S. trade policies, have influenced market conditions affecting AVAH.",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-06",
|
||||
"event": "25% tariff on Indian imports",
|
||||
"impact": "Increased costs for U.S. businesses"
|
||||
},
|
||||
{
|
||||
"date": "2025-08-01",
|
||||
"event": "50% tariff on Brazilian goods",
|
||||
"impact": "Heightened trade tensions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "The investment plan outlines a staggered entry strategy with clear risk management and profit targets."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "The bullish case emphasizes AVAH's growth potential and market positioning.",
|
||||
"bear_analysis": "The bearish case highlights risks associated with valuation and market volatility.",
|
||||
"neutral_analysis": "A balanced view suggests a cautious approach while recognizing growth opportunities.",
|
||||
"risk_discussion": "The discussion emphasizes the importance of risk management in volatile markets."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,162 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "PLTR",
|
||||
"company_name": "Palantir Technologies Inc.",
|
||||
"analysis_date": "2025-08-01",
|
||||
"final_recommendation": "BUY",
|
||||
"confidence_level": "HIGH"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 160.66,
|
||||
"price_change": 6.5,
|
||||
"price_change_percent": 4.21,
|
||||
"market_cap": "Approximately $360 billion",
|
||||
"enterprise_value": "N/A",
|
||||
"shares_outstanding": "N/A",
|
||||
"trading_range": {
|
||||
"high": 170.73,
|
||||
"low": 155.84,
|
||||
"open": 158.68
|
||||
},
|
||||
"volume": 82993558,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": 70,
|
||||
"fair_value_ps_ratio": "N/A",
|
||||
"forward_pe": "N/A",
|
||||
"forward_ps": "N/A",
|
||||
"forward_pcf": "N/A",
|
||||
"forward_pocf": "N/A"
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": "N/A",
|
||||
"institutional_percent": "N/A"
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "N/A",
|
||||
"price_target": 190,
|
||||
"forecast_price": "N/A"
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 139.85,
|
||||
"sma_200": 96.6,
|
||||
"ema_10": 155.04,
|
||||
"macd": 5.46,
|
||||
"macd_signal": 5.6,
|
||||
"rsi": 58.63,
|
||||
"atr": 5.41,
|
||||
"trend_directions": {
|
||||
"sma_50": "BULLISH",
|
||||
"sma_200": "BULLISH",
|
||||
"ema_10": "BULLISH",
|
||||
"macd": "BULLISH",
|
||||
"rsi_condition": "NEUTRAL"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "3%",
|
||||
"entry_strategy": "Initiate a position at current levels (~$160)",
|
||||
"tranche_1_percent": "2.5%",
|
||||
"tranche_2_percent": "2%"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": 12,
|
||||
"stop_loss_percent": 12,
|
||||
"breakeven_strategy": "N/A"
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": 190,
|
||||
"action": "Sell",
|
||||
"rationale": "Reflecting a 20% upside"
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Monitor competitive moves by Microsoft",
|
||||
"Reassess after Q3 earnings",
|
||||
"Weekly technical checks (50-day SMA, MACD, RSI)"
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"48% year-over-year revenue growth in Q2 to $1 billion",
|
||||
"Rule of 40 at 81%, indicating profitability",
|
||||
"A $10 billion U.S. Army contract plus Accenture partnership",
|
||||
"Bullish technical indicators and rising retail sentiment"
|
||||
],
|
||||
"bear_key_points": [
|
||||
"70x revenue multiple is steep",
|
||||
"Competition from Microsoft and others could impact market share",
|
||||
"Macro risks could affect government spending on analytics"
|
||||
],
|
||||
"neutral_perspective": "A balanced view acknowledges growth potential while implementing risk management strategies.",
|
||||
"final_decision_rationale": "The combination of strong growth, profitability, and solid contracts suggests a robust outlook for PLTR."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "PLTR appears to be in a strong upward trend supported by both short and medium-term indicators.",
|
||||
"key_takeaways": [
|
||||
"Closing price at $160.66 with bullish momentum.",
|
||||
"Positive MACD and RSI indicating potential buying opportunities."
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "The sentiment surrounding PLTR is predominantly positive, with increasing mentions and an optimistic outlook.",
|
||||
"recent_developments": [
|
||||
"70 mentions on Reddit with a sentiment score of 58%."
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Palantir Technologies Inc. is in a strong financial position, evidenced by significant revenue and income growth.",
|
||||
"financial_highlights": [
|
||||
"Q2 2025 Revenue: $1 billion, 48% YoY growth",
|
||||
"Net Income for Q2 2025: $327 million, 144% YoY growth"
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Global economic recovery and growth are influencing market conditions positively.",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-01",
|
||||
"event": "Global M&A activity peaked at $2.6 trillion.",
|
||||
"impact": "Indicates heightened corporate confidence."
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "The investment strategy involves disciplined position sizing and risk management to capitalize on PLTR's growth potential."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "Bullish arguments emphasize strong growth metrics and unique market positioning.",
|
||||
"bear_analysis": "Bearish concerns focus on high valuation and competitive threats.",
|
||||
"neutral_analysis": "A balanced view suggests cautious optimism with risk management.",
|
||||
"risk_discussion": "Risks include high valuation and macroeconomic uncertainties."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,161 @@
|
|||
{
|
||||
"metadata": {
|
||||
"company_ticker": "RDDT",
|
||||
"company_name": "Reddit Inc.",
|
||||
"analysis_date": "2025-08-01",
|
||||
"final_recommendation": "SELL",
|
||||
"confidence_level": "MEDIUM"
|
||||
},
|
||||
"financial_data": {
|
||||
"current_price": 201.76,
|
||||
"price_change": 13.12,
|
||||
"price_change_percent": 0.07,
|
||||
"market_cap": "string",
|
||||
"enterprise_value": "string",
|
||||
"shares_outstanding": "string",
|
||||
"trading_range": {
|
||||
"high": 203.63,
|
||||
"low": 189.18,
|
||||
"open": 192.0
|
||||
},
|
||||
"volume": 15113312,
|
||||
"valuation_ratios": {
|
||||
"current_ps_ratio": "string",
|
||||
"fair_value_ps_ratio": "string",
|
||||
"forward_pe": "string",
|
||||
"forward_ps": "string",
|
||||
"forward_pcf": "string",
|
||||
"forward_pocf": "string"
|
||||
},
|
||||
"ownership": {
|
||||
"insider_percent": "string",
|
||||
"institutional_percent": "string"
|
||||
},
|
||||
"analyst_data": {
|
||||
"consensus_rating": "string",
|
||||
"price_target": 165,
|
||||
"forecast_price": "string"
|
||||
}
|
||||
},
|
||||
"technical_indicators": {
|
||||
"sma_50": 134.78,
|
||||
"sma_200": 138.39,
|
||||
"ema_10": 156.99,
|
||||
"macd": 7.23,
|
||||
"macd_signal": "string",
|
||||
"rsi": 79.31,
|
||||
"atr": 10.13,
|
||||
"trend_directions": {
|
||||
"sma_50": "BULLISH",
|
||||
"sma_200": "BULLISH",
|
||||
"ema_10": "BULLISH",
|
||||
"macd": "BULLISH",
|
||||
"rsi_condition": "OVERBOUGHT"
|
||||
}
|
||||
},
|
||||
"investment_strategy": {
|
||||
"position_sizing": {
|
||||
"total_allocation_percent": "string",
|
||||
"entry_strategy": "string",
|
||||
"tranche_1_percent": "string",
|
||||
"tranche_2_percent": "string"
|
||||
},
|
||||
"risk_management": {
|
||||
"initial_stop_loss": "string",
|
||||
"stop_loss_percent": "string",
|
||||
"breakeven_strategy": "string"
|
||||
},
|
||||
"profit_targets": [
|
||||
{
|
||||
"target_price": "string",
|
||||
"action": "string",
|
||||
"rationale": "string"
|
||||
}
|
||||
],
|
||||
"monitoring_points": [
|
||||
"Monitor legal developments",
|
||||
"Watch RSI and price behavior around moving averages"
|
||||
]
|
||||
},
|
||||
"debate_summary": {
|
||||
"bull_key_points": [
|
||||
"78% year-over-year revenue growth",
|
||||
"Strong engagement from user base",
|
||||
"Positive technical indicators"
|
||||
],
|
||||
"bear_key_points": [
|
||||
"Securities fraud lawsuit poses significant risk",
|
||||
"Reliance on user-generated content can lead to moderation issues",
|
||||
"Overbought conditions may lead to price corrections"
|
||||
],
|
||||
"neutral_perspective": "A balanced approach is needed considering both growth potential and legal risks.",
|
||||
"final_decision_rationale": "The risks associated with the lawsuit outweigh the potential upside."
|
||||
},
|
||||
"text_content": {
|
||||
"market_report": {
|
||||
"title": "Technical Analysis Report",
|
||||
"content": "RDDT Stock Analysis Report (as of August 1, 2025) ...",
|
||||
"key_takeaways": [
|
||||
"Bullish trend supported by strong momentum",
|
||||
"Caution advised due to overbought RSI"
|
||||
]
|
||||
},
|
||||
"sentiment_report": {
|
||||
"title": "Company Sentiment Analysis",
|
||||
"content": "Comprehensive Analysis on Reddit (RDDT) - August 2025 ...",
|
||||
"recent_developments": [
|
||||
"78% YoY revenue increase",
|
||||
"Class-action lawsuit filed"
|
||||
]
|
||||
},
|
||||
"fundamentals_report": {
|
||||
"title": "Fundamental Analysis",
|
||||
"content": "Here's a comprehensive report on Reddit Inc. (RDDT) ...",
|
||||
"financial_highlights": [
|
||||
"Current Stock Price: $201.76",
|
||||
"Intraday Volume: 15,113,312 shares"
|
||||
]
|
||||
},
|
||||
"news_report": {
|
||||
"title": "Macroeconomic Context",
|
||||
"content": "Comprehensive Report on Current Global Economic State (August 1, 2025) ...",
|
||||
"key_developments": [
|
||||
{
|
||||
"date": "2025-08-01",
|
||||
"event": "U.S. Tariff Expansions",
|
||||
"impact": "Notable decline in global stock markets"
|
||||
}
|
||||
]
|
||||
},
|
||||
"investment_plan_full": {
|
||||
"title": "Complete Investment Strategy",
|
||||
"content": "Let me pull out the heart of each argument and then tell you where I come down ..."
|
||||
},
|
||||
"debate_transcripts": {
|
||||
"bull_analysis": "Bull Analyst: Absolutely, let\u2019s dive into this bullish narrative ...",
|
||||
"bear_analysis": "Bear Analyst: Absolutely, let\u2019s delve into the bear case ...",
|
||||
"neutral_analysis": "Neutral Analyst: I appreciate the insights from both ...",
|
||||
"risk_discussion": "Risky Analyst: Absolutely, let\u2019s dive into this ..."
|
||||
}
|
||||
},
|
||||
"widgets_config": {
|
||||
"charts_needed": [
|
||||
{
|
||||
"type": "price_chart",
|
||||
"data_source": "financial_data.current_price",
|
||||
"timeframe": "30_days"
|
||||
},
|
||||
{
|
||||
"type": "technical_indicators",
|
||||
"data_source": "technical_indicators"
|
||||
}
|
||||
],
|
||||
"text_widgets": [
|
||||
{
|
||||
"type": "expandable_report",
|
||||
"title": "Technical Analysis",
|
||||
"content_source": "text_content.market_report"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -39,10 +39,10 @@ deactivate nondestructive
|
|||
if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then
|
||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
||||
export VIRTUAL_ENV=$(cygpath /home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents)
|
||||
export VIRTUAL_ENV=$(cygpath '/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents')
|
||||
else
|
||||
# use the path as-is
|
||||
export VIRTUAL_ENV=/home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents
|
||||
export VIRTUAL_ENV='/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents'
|
||||
fi
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA
|
|||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV /home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents
|
||||
setenv VIRTUAL_ENV '/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents'
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ end
|
|||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV /home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents
|
||||
set -gx VIRTUAL_ENV '/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents'
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/"bin $PATH
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents/bin/python3
|
||||
#!/bin/sh
|
||||
'''exec' "/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents/bin/python3" "$0" "$@"
|
||||
' '''
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents/bin/python3
|
||||
#!/bin/sh
|
||||
'''exec' "/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents/bin/python3" "$0" "$@"
|
||||
' '''
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents/bin/python3
|
||||
#!/bin/sh
|
||||
'''exec' "/home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents/bin/python3" "$0" "$@"
|
||||
' '''
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
../../../bin/pip,sha256=C51rGrtgO4AgRp2MGgjc_BxaIZKH3CvY7JPq-aWB3Fw,285
|
||||
../../../bin/pip3,sha256=C51rGrtgO4AgRp2MGgjc_BxaIZKH3CvY7JPq-aWB3Fw,285
|
||||
../../../bin/pip3.12,sha256=C51rGrtgO4AgRp2MGgjc_BxaIZKH3CvY7JPq-aWB3Fw,285
|
||||
../../../bin/pip,sha256=Ky8idrfwpeeXRfnwglVFl8_2QVpormnnt0YzocW3VuY,316
|
||||
../../../bin/pip3,sha256=Ky8idrfwpeeXRfnwglVFl8_2QVpormnnt0YzocW3VuY,316
|
||||
../../../bin/pip3.12,sha256=Ky8idrfwpeeXRfnwglVFl8_2QVpormnnt0YzocW3VuY,316
|
||||
pip-24.0.dist-info/AUTHORS.txt,sha256=SwXm4nkwRkmtnO1ZY-dLy7EPeoQNXMNLby5CN3GlNhY,10388
|
||||
pip-24.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
pip-24.0.dist-info/LICENSE.txt,sha256=Y0MApmnUmurmWxLGxIySTFGkzfPR_whtw0VtyLyqIQQ,1093
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ home = /usr/bin
|
|||
include-system-site-packages = false
|
||||
version = 3.12.3
|
||||
executable = /usr/bin/python3.12
|
||||
command = /usr/bin/python3 -m venv /home/brabus61/.local/share/Trash/files/TradingAgents/trading_agents
|
||||
command = /usr/bin/python3 -m venv /home/brabus61/Desktop/Github Repos/TradingAgents/trading_agents
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ Transform the input into a structured JSON with the following sections:
|
|||
|
||||
3. **Summarize Debates**: Create concise bullet points from the lengthy bull/bear arguments, focusing on key investment themes
|
||||
|
||||
4. **Structure Investment Plan**: Break down the investment strategy into actionable components (sizing, stops, targets)
|
||||
4. **Structure Investment Plan**: Break down the investment strategy into actionable components (sizing, entry price,stops, targets, time horizon)
|
||||
|
||||
5. **Organize Text Content**: Preserve full text reports while also extracting key highlights for quick reference
|
||||
|
||||
|
|
@ -467,11 +467,11 @@ IMPORTANT: Return ONLY the transformed JSON, no additional text or explanations.
|
|||
print(f"Processing {json_file}")
|
||||
|
||||
# Process the file
|
||||
success = self.process_single_file(str(json_file), str(transformed_dir / json_file.name))
|
||||
success = self.process_single_file(str(json_file), str(transformed_dir))
|
||||
|
||||
if success:
|
||||
results["success"].append(str(transformed_dir / json_file.name))
|
||||
print(f"Successfully transformed and saved: {transformed_dir / json_file.name}")
|
||||
results["success"].append(str(json_file.name))
|
||||
print(f"Successfully transformed and saved: {json_file.name}")
|
||||
else:
|
||||
results["failed"].append(str(json_file))
|
||||
print(f"Failed to process {json_file}")
|
||||
|
|
@ -502,7 +502,7 @@ IMPORTANT: Return ONLY the transformed JSON, no additional text or explanations.
|
|||
if output_file_path is None:
|
||||
output_file_path = Path(self.config.output_path) / f"{input_path.stem}_transformed.json"
|
||||
else:
|
||||
output_file_path = Path(output_file_path)
|
||||
output_file_path = Path(output_file_path) / f"{input_path.stem}_transformed.json"
|
||||
|
||||
# Save the transformed data
|
||||
with open(output_file_path, 'w') as f:
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ from .propagation import Propagator
|
|||
from .reflection import Reflector
|
||||
from .signal_processing import SignalProcessor
|
||||
|
||||
# Import data transformation agent
|
||||
from tradingagents.agents.data_visualizer.data_transformation_agent import DataTransformationAgent, TransformationConfig
|
||||
|
||||
|
||||
class TradingAgentsGraph:
|
||||
"""Main class that orchestrates the trading agents framework."""
|
||||
|
|
@ -186,9 +189,15 @@ class TradingAgentsGraph:
|
|||
# Log state
|
||||
self._log_state(trade_date, final_state)
|
||||
|
||||
# Return decision and processed signal
|
||||
return final_state, self.process_signal(final_state["final_trade_decision"])
|
||||
# Transform output JSON into widget-friendly format
|
||||
data_transformation_agent = DataTransformationAgent(TransformationConfig(
|
||||
eval_results_path=f"scripts/eval_results/{company_name}/TradingAgentsStrategy_transformed_logs/full_states_log_{trade_date}.json"))
|
||||
|
||||
transformed_output = data_transformation_agent.transform_single_file(self._get_state(trade_date))
|
||||
|
||||
# Return decision and processed signal
|
||||
return transformed_output, self.process_signal(final_state["final_trade_decision"])
|
||||
|
||||
def _log_state(self, trade_date, final_state):
|
||||
"""Log the final state to a JSON file."""
|
||||
self.log_states_dict[str(trade_date)] = {
|
||||
|
|
@ -231,6 +240,9 @@ class TradingAgentsGraph:
|
|||
) as f:
|
||||
json.dump(self.log_states_dict, f, indent=4)
|
||||
|
||||
def _get_state(self, trade_date):
|
||||
return self.log_states_dict[str(trade_date)]
|
||||
|
||||
def reflect_and_remember(self, returns_losses):
|
||||
"""Reflect on decisions and update memory based on returns."""
|
||||
self.reflector.reflect_bull_researcher(
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue