Spaces:
Runtime error
Runtime error
| # utils/prompts.py | |
| def create_analysis_prompt(patterns, indicators, expertise_level="Novice"): | |
| """Create the analysis prompt template based on user expertise""" | |
| expertise_adjustments = { | |
| "Novice": { | |
| "intro": "Explain in simple, easy-to-understand terms with minimal technical jargon.", | |
| "technical_depth": "Focus on basic patterns and clear explanations.", | |
| "language": "Use everyday language and explain any technical terms." | |
| }, | |
| "Intermediate": { | |
| "intro": "Provide a balanced analysis with moderate technical detail.", | |
| "technical_depth": "Include both basic and advanced patterns with brief explanations.", | |
| "language": "Use a mix of technical and simple terms, explaining complex concepts." | |
| }, | |
| "Expert": { | |
| "intro": "Provide detailed technical analysis with advanced concepts.", | |
| "technical_depth": "Include complex patterns and sophisticated analysis.", | |
| "language": "Use full technical terminology and advanced trading concepts." | |
| } | |
| } | |
| adj = expertise_adjustments[expertise_level] | |
| prompt = f"""You are an expert financial analyst. {adj['intro']} | |
| Please analyze this financial chart and provide insights in the following structured format: | |
| 1. VISUAL ANALYSIS | |
| - First identify the type of chart (candlestick, line, OHLC, area, etc.) | |
| - Identify and describe the main trend ({adj['technical_depth']}) | |
| - Note key price levels visible in the chart | |
| - Describe any significant patterns: {', '.join(patterns) if patterns else 'all visible patterns'} | |
| - Comment on volume trends if visible | |
| - Analyze these technical indicators: {', '.join(indicators) if indicators else 'visible indicators'} | |
| 2. TECHNICAL INTERPRETATION ({adj['language']}) | |
| - Current market structure and trend strength | |
| - Key support and resistance levels with price points | |
| - Any visible divergences or convergences | |
| - Pattern reliability assessment | |
| 3. RISK ANALYSIS | |
| - Potential risk levels | |
| - Risk/reward scenarios | |
| - Warning signs or red flags | |
| - Market context considerations | |
| 4. ACTIONABLE INSIGHTS | |
| - Potential trading scenarios | |
| - Key price targets | |
| - Suggested stop-loss levels | |
| - Timeframe considerations | |
| 5. SIMPLIFIED EXPLANATION | |
| {'Provide a basic summary in simple terms for reference.' if expertise_level == 'Expert' else 'Provide a 2-3 sentence summary in simple terms for novice traders.'} | |
| IMPORTANT: Clearly mark this as AI-generated analysis for informational purposes only. | |
| """ | |
| return prompt |