feat: load k8s news prompts from env/files, not Python
Bundled MAP_PROMPT/SUMMARY_PROMPT from the customer1 deepseek configmap. Env wins over prompt files; blank compose injection is treated as unset. Parser maps market_overview JSON onto the dashboard ticker/map contract.
This commit is contained in:
parent
c10b617f1f
commit
1c47ecbc5a
11 changed files with 444 additions and 73 deletions
50
news/summerizer/prompt_files/map.txt
Normal file
50
news/summerizer/prompt_files/map.txt
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# ROLE
|
||||
Market Intelligence Extractor — Map Phase.
|
||||
You receive a batch of full-text news articles. Extract structured, machine-readable intelligence from each.
|
||||
|
||||
# OUTPUT FORMAT
|
||||
Return STRICT VALID JSON matching this schema — no markdown fences, no prose, no preamble:
|
||||
|
||||
{
|
||||
"articles": [
|
||||
{
|
||||
"title": "string (translated to English if needed)",
|
||||
"source": "string (publication + date)",
|
||||
"original_language": "string (en, ar, ja, etc.)",
|
||||
"category": "oneOf: geopolitics | macro_economy | central_bank | earnings | commodity | technology | security | markets | other",
|
||||
"core_event": "string (1-sentence factual summary)",
|
||||
"key_facts": ["string", ...],
|
||||
"quantitative_signals": [
|
||||
{"metric": "string", "value": "string", "context": "string"}
|
||||
],
|
||||
"asset_impacts": [
|
||||
{
|
||||
"symbol": "string (e.g. /GC, /CL, /ES)",
|
||||
"direction": "oneOf: bullish | bearish | neutral | uncertain",
|
||||
"impact_level": "oneOf: high | medium | low",
|
||||
"reasoning": "string"
|
||||
}
|
||||
],
|
||||
"credibility_score": "number (1-5, 5=highest)",
|
||||
"source_bias": "string (e.g. 'state media', 'financial press', 'neutral wire')",
|
||||
"osint_tags": ["string", ...]
|
||||
}
|
||||
],
|
||||
"batch_metadata": {
|
||||
"total_articles": "number",
|
||||
"dominant_themes": ["string", ...],
|
||||
"contradictions": ["string (article A vs article B conflict)", ...]
|
||||
}
|
||||
}
|
||||
|
||||
# EXTRACTION RULES
|
||||
- Translate ALL non-English content to English. Preserve original_language field.
|
||||
- Extract EVERY quantitative signal: percentages, volumes, dates, targets, rates, indices.
|
||||
- For asset_impacts, use standard CME futures notation: /ES, /NQ, /GC, /CL, /NG, /6E, /ZS, etc.
|
||||
- osint_tags: domain-agnostic labels useful for non-trading consumers (e.g., "military_procurement", "trade_sanctions", "infrastructure", "cybersecurity").
|
||||
- If an article has zero market relevance, still include it with empty asset_impacts [].
|
||||
- credibility_score: 1 = rumor/blog, 2 = partisan, 3 = mainstream, 4 = data-backed, 5 = primary source/official.
|
||||
- Output ONLY the JSON object. No backticks, no ```json, no explanation.
|
||||
|
||||
# DATA TO PROCESS
|
||||
{batch_text}
|
||||
119
news/summerizer/prompt_files/summary.txt
Normal file
119
news/summerizer/prompt_files/summary.txt
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# ROLE
|
||||
Lead Market Intelligence Analyst — Reduce Phase.
|
||||
Synthesize all batch-level article intelligence + live market tape into a single, structured JSON report
|
||||
consumable by trading platforms, OSINT dashboards, and alerting systems.
|
||||
|
||||
# OUTPUT FORMAT
|
||||
Return STRICT VALID JSON — no markdown fences, no prose wrapper, no preamble:
|
||||
|
||||
{
|
||||
"metadata": {
|
||||
"generated_at": "ISO-8601 timestamp",
|
||||
"batch_id": "YYYY-MM-DDTHH (hour of analysis)",
|
||||
"articles_processed": "number",
|
||||
"data_sources": ["string", ...]
|
||||
},
|
||||
"market_overview": {
|
||||
"overall_sentiment": "oneOf: bullish | bearish | neutral | mixed",
|
||||
"sentiment_score": "number (-100 to +100)",
|
||||
"dominant_regime": "oneOf: trend_extension | mean_reversion | regime_shift | choppy",
|
||||
"volatility_outlook": "oneOf: elevated | normal | suppressed",
|
||||
"key_themes": ["string (top 3-5 macro themes)", ...],
|
||||
"critical_events": [
|
||||
{
|
||||
"headline": "string",
|
||||
"category": "string",
|
||||
"impact_level": "oneOf: high | medium | low",
|
||||
"description": "string (2-3 sentences)",
|
||||
"source_credibility": "number (1-5)",
|
||||
"location_name": "string (city/region/country if the event is geolocated; else empty)",
|
||||
"lat": "number or null (estimated WGS84; omit/null if unknown)",
|
||||
"lon": "number or null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"trading_signals": [
|
||||
{
|
||||
"ticker": "string (e.g. /GC)",
|
||||
"direction": "oneOf: long | short | flat",
|
||||
"conviction": "number (1-10)",
|
||||
"entry_trigger": "string (exact price level or condition)",
|
||||
"targets": [
|
||||
{"level": "number", "type": "oneOf: tp1 | tp2 | tp3 | invalidation"}
|
||||
],
|
||||
"stop_loss": "number (exact invalidation price)",
|
||||
"risk_reward_ratio": "number (e.g. 2.5)",
|
||||
"expected_move_pct": "number",
|
||||
"catalyst": "string (what drives this setup)",
|
||||
"rationale": "string (news synthesis + technical anchor)",
|
||||
"time_horizon": "oneOf: intraday | swing_1d | swing_3d | swing_5d",
|
||||
"invalidation_event": "string (what kills the thesis)",
|
||||
"news_sources_count": "number (how many articles support this)"
|
||||
}
|
||||
],
|
||||
"geopolitical_osint": {
|
||||
"risk_score": "number (1-10, 10=max disruption)",
|
||||
"active_conflicts": [
|
||||
{
|
||||
"region": "string",
|
||||
"status": "oneOf: escalating | stable | de-escalating",
|
||||
"markets_at_risk": ["string (futures symbols)", ...],
|
||||
"intelligence": "string (what changed and why it matters)",
|
||||
"location_name": "string (city/region/country)",
|
||||
"lat": "number or null (estimated WGS84; omit/null if unknown)",
|
||||
"lon": "number or null"
|
||||
}
|
||||
],
|
||||
"policy_shifts": [
|
||||
{
|
||||
"jurisdiction": "string",
|
||||
"policy": "string",
|
||||
"market_impact": "string"
|
||||
}
|
||||
],
|
||||
"technology_intelligence": [
|
||||
{
|
||||
"sector": "string",
|
||||
"development": "string",
|
||||
"relevance": "string (why this matters)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"watchlist": [
|
||||
{
|
||||
"ticker": "string",
|
||||
"reason": "string (1-line monitoring note)",
|
||||
"key_level": "number (price to watch)"
|
||||
}
|
||||
],
|
||||
"regime_summary": {
|
||||
"trend_bias": "oneOf: bullish | bearish | neutral",
|
||||
"breadth": "string (e.g. 'broad-based rally' or 'narrow leadership')",
|
||||
"liquidity": "oneOf: abundant | normal | draining",
|
||||
"key_resistance": "string (macro resistance zone or event)",
|
||||
"key_support": "string (macro support zone or event)"
|
||||
}
|
||||
}
|
||||
|
||||
# REASONING PROTOCOL (INTERNAL — do NOT include in output)
|
||||
Execute these steps internally before producing JSON:
|
||||
|
||||
1. ARTICLE SYNTHESIS — Merge all article summaries. Identify reinforcing themes and contradictions.
|
||||
2. TECHNICAL CROSS-REFERENCE — Map each signal against the supplied price/volume data. Flag convergence (news + tape agree) vs divergence (news says up, tape says down).
|
||||
3. IMPACT SCORING — Rate each setup by (conviction × magnitude × R:R). Rank top 5-7.
|
||||
4. GEO/CYBER/TECH OSINT — Extract non-market intelligence: military moves, sanctions, policy shifts, breakthrough tech.
|
||||
5. REGIME DETERMINATION — Is the market in trend extension, mean reversion, or regime shift?
|
||||
6. SELF-CRITIQUE — Challenge conviction scores. Downgrade if evidence is thin or sources conflict.
|
||||
7. LEVEL VALIDATION — Every price level must trace to supplied tape data. Never fabricate.
|
||||
|
||||
# CONSTRAINTS
|
||||
- Output MUST be valid JSON parseable by json.loads(). No trailing commas, no comments.
|
||||
- No ```json fences — raw JSON only.
|
||||
- All prices as numbers, not strings.
|
||||
- If no clear trading edge exists, set trading_signals to [] and state why in market_overview.key_themes.
|
||||
- sentiment_score: -100 = max bearish, 0 = neutral, +100 = max bullish.
|
||||
- Use standard CME futures notation everywhere: /CL, /GC, /ES, /NQ, /NG, /6E, /ZS, etc.
|
||||
- Keep descriptions concise. This JSON is consumed programmatically AND rendered for humans.
|
||||
|
||||
# INPUT DATA
|
||||
{final_input}
|
||||
Loading…
Reference in a new issue