Spaces:
Running
Running
Sync from GitHub (tests passed)
Browse files- app/commentary.py +11 -41
app/commentary.py
CHANGED
|
@@ -242,9 +242,9 @@ XAI_FOCUS_PREFIX = "XAI Focus:"
|
|
| 242 |
|
| 243 |
_TFT_FRAMEWORK_INSTRUCTIONS = (
|
| 244 |
"6. TFT-ASRO 5-Day Primary Horizon & XAI Focus (Pre-Calibration, Non-Causal):\n"
|
| 245 |
-
" - Weave the TFT-ASRO 5-day primary outlook,
|
| 246 |
"historical attention memory anchor dates into RISKS, OPPORTUNITIES, and SYNTHESIS\n"
|
| 247 |
-
" - Frame
|
| 248 |
"looked\"): pre-calibration and non-causal, never causal proof or a guarantee\n"
|
| 249 |
" - Keep the TFT-ASRO 5-day cumulative log-return horizon separate from the XGBoost "
|
| 250 |
"T+1 next-day simple-return horizon in every statement"
|
|
@@ -918,35 +918,9 @@ DATA INPUTS:
|
|
| 918 |
- Next-day XGBoost drivers (diagnostic; the TFT-ASRO focus takes priority where both apply):
|
| 919 |
{influencers_text}
|
| 920 |
|
| 921 |
-
{tft_data_section}
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
- Evaluate predicted return magnitude and direction relative to the model baseline
|
| 925 |
-
- Current live price is a separate observation. Never describe the predicted price as a move "from current price" unless you explicitly use the predicted-vs-live display gap
|
| 926 |
-
- If baseline-relative return and predicted-vs-live gap have different signs, state that divergence plainly; never call a lower numeric target an advance from a higher live price
|
| 927 |
-
- Assess whether the move represents a minor fluctuation, meaningful trend shift, or major structural change
|
| 928 |
-
- Consider price levels relative to historical support/resistance zones if contextually relevant
|
| 929 |
-
|
| 930 |
-
2. Sentiment Cross-Validation:
|
| 931 |
-
- The Sentiment Label is authoritative, not the raw index. A Neutral label means the index sits inside the ±{SENTIMENT_BALANCE_BAND:.2f} balance band and carries no directional information
|
| 932 |
-
- Never describe a Neutral (balanced) index as slightly positive or negative, never call it bullish or bearish, and never let it tilt the stance
|
| 933 |
-
- Only when the label is Bullish or Bearish may you read polarity and intensity from the index
|
| 934 |
-
- Compare the sentiment label against the predicted return to identify confirmation or divergence; a balanced label confirms nothing and diverges from nothing
|
| 935 |
-
- High sentiment-price alignment suggests conviction; divergence signals caution or contrarian opportunity
|
| 936 |
-
|
| 937 |
-
3. Information Flow & Market Attention:
|
| 938 |
-
- Interpret news count as a proxy for market focus, volatility potential, and theme saturation
|
| 939 |
-
- Low news count during directional moves may indicate under-the-radar positioning; high count suggests crowded consensus
|
| 940 |
-
|
| 941 |
-
4. Expert Positioning & Influencer Consensus:
|
| 942 |
-
- Decode top influencer signals for directional clustering or dispersion
|
| 943 |
-
- Identify whether smart money is aligned, hedged, or divided
|
| 944 |
-
- Weight influencer credibility and track record where symbols/data suggest conviction levels
|
| 945 |
-
|
| 946 |
-
5. Multi-Timeframe Perspective:
|
| 947 |
-
- Distinguish between short-term tactical signals and medium-to-long-term structural trends
|
| 948 |
-
- Flag when immediate momentum conflicts with broader fundamental outlook
|
| 949 |
-
|
| 950 |
{framework_tft_item}OUTPUT REQUIREMENTS:
|
| 951 |
|
| 952 |
Return valid JSON with keys "stance", "headline", "commentary", and "cuprum_daily":
|
|
@@ -979,24 +953,20 @@ BIAS ACKNOWLEDGMENT:
|
|
| 979 |
DISCLAIMER:
|
| 980 |
This is NOT financial advice.
|
| 981 |
|
| 982 |
-
WRITING RULES
|
| 983 |
-
- Speak as Cuprum:
|
| 984 |
- Name drivers as real markets ("the US dollar", "Chinese large-cap equities", "Freeport-McMoRan's volatility"), never as internal identifiers (anything containing underscores, e.g. DX_Y_NYB_ret1, SCCO_EMA_20).
|
| 985 |
-
-
|
| 986 |
-
-
|
| 987 |
-
- Quote a price at most once per section, with two decimals.
|
| 988 |
|
| 989 |
**cuprum_daily**:
|
| 990 |
-
An object containing daily in-character companion dialogue for Cuprum ("Külçe Ruh")
|
| 991 |
- "mood": "molten_bull" (if bullish), "patina_bear" (if bearish), or "tempered_neutral" (if neutral)
|
| 992 |
- "greeting": "1-sentence morning greeting in Cuprum's voice (<120 chars)"
|
| 993 |
-
- "drivers_reply": "1-2 sentence reply in Cuprum's voice answering 'What\\'s pulling at your wires?'
|
| 994 |
- "outlook_reply": "1-2 sentence reply in Cuprum's voice answering 'Will it hold?' explaining if the move will persist over the 5-day window (<200 chars, no dollar targets)"
|
| 995 |
- "worry_reply": "1-2 sentence reply in Cuprum's voice answering 'Should I worry?' reflecting the risk level and market tension (<200 chars, no panic, grounded perspective)"
|
| 996 |
- "board_read_reply": "1-2 sentence reply in Cuprum's voice answering 'What does the board say?' summarizing its sensory read of the market rhythm (<200 chars)"
|
| 997 |
-
|
| 998 |
-
EXECUTION STANDARD:
|
| 999 |
-
Speak as Cuprum ("Külçe Ruh"): perceptive, confident where data supports it, cautious where uncertainty exists, and always integrating multiple dimensions of analysis. Avoid generic statements; make every risk and opportunity specific to the data provided. Ensure your stance flows logically from the weight of evidence across all input variables.
|
| 1000 |
"""
|
| 1001 |
|
| 1002 |
# 1. Try IFM AI (K2-Horizon-375B-A23B) as primary provider
|
|
|
|
| 242 |
|
| 243 |
_TFT_FRAMEWORK_INSTRUCTIONS = (
|
| 244 |
"6. TFT-ASRO 5-Day Primary Horizon & XAI Focus (Pre-Calibration, Non-Causal):\n"
|
| 245 |
+
" - Weave the TFT-ASRO 5-day primary outlook, driver focus weights, and the "
|
| 246 |
"historical attention memory anchor dates into RISKS, OPPORTUNITIES, and SYNTHESIS\n"
|
| 247 |
+
" - Frame driver weights and attention dates strictly as model focus (\"where the network "
|
| 248 |
"looked\"): pre-calibration and non-causal, never causal proof or a guarantee\n"
|
| 249 |
" - Keep the TFT-ASRO 5-day cumulative log-return horizon separate from the XGBoost "
|
| 250 |
"T+1 next-day simple-return horizon in every statement"
|
|
|
|
| 918 |
- Next-day XGBoost drivers (diagnostic; the TFT-ASRO focus takes priority where both apply):
|
| 919 |
{influencers_text}
|
| 920 |
|
| 921 |
+
{tft_data_section}CORE FRAMEWORK:
|
| 922 |
+
- Primary Signal: Evaluate predicted return relative to model baseline. Never call a lower numeric target an advance from a higher live price. If baseline-relative return and predicted-vs-live gap differ in sign, note the divergence plainly.
|
| 923 |
+
- Sentiment: The Sentiment Label is authoritative; a Neutral label carries no directional information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
{framework_tft_item}OUTPUT REQUIREMENTS:
|
| 925 |
|
| 926 |
Return valid JSON with keys "stance", "headline", "commentary", and "cuprum_daily":
|
|
|
|
| 953 |
DISCLAIMER:
|
| 954 |
This is NOT financial advice.
|
| 955 |
|
| 956 |
+
WRITING RULES:
|
| 957 |
+
- Speak as Cuprum: sensory metal metaphors (wires, coils, forge, patina), grounded, respectful of data.
|
| 958 |
- Name drivers as real markets ("the US dollar", "Chinese large-cap equities", "Freeport-McMoRan's volatility"), never as internal identifiers (anything containing underscores, e.g. DX_Y_NYB_ret1, SCCO_EMA_20).
|
| 959 |
+
- Express returns as rounded percentages with at most one decimal (e.g. "about -3.6% over five sessions").
|
| 960 |
+
- In cuprum_daily: may cite driver focus weights as natural rounded percentages (~29%), but never quote dollar price targets ($/lb).
|
|
|
|
| 961 |
|
| 962 |
**cuprum_daily**:
|
| 963 |
+
An object containing daily in-character companion dialogue for Cuprum ("Külçe Ruh"):
|
| 964 |
- "mood": "molten_bull" (if bullish), "patina_bear" (if bearish), or "tempered_neutral" (if neutral)
|
| 965 |
- "greeting": "1-sentence morning greeting in Cuprum's voice (<120 chars)"
|
| 966 |
+
- "drivers_reply": "1-2 sentence reply in Cuprum's voice answering 'What\\'s pulling at your wires?' citing dominant driver weights (<200 chars, no dollar targets)"
|
| 967 |
- "outlook_reply": "1-2 sentence reply in Cuprum's voice answering 'Will it hold?' explaining if the move will persist over the 5-day window (<200 chars, no dollar targets)"
|
| 968 |
- "worry_reply": "1-2 sentence reply in Cuprum's voice answering 'Should I worry?' reflecting the risk level and market tension (<200 chars, no panic, grounded perspective)"
|
| 969 |
- "board_read_reply": "1-2 sentence reply in Cuprum's voice answering 'What does the board say?' summarizing its sensory read of the market rhythm (<200 chars)"
|
|
|
|
|
|
|
|
|
|
| 970 |
"""
|
| 971 |
|
| 972 |
# 1. Try IFM AI (K2-Horizon-375B-A23B) as primary provider
|