Upload engine/predict_monthly.py with huggingface_hub
Browse files
engine/predict_monthly.py
CHANGED
|
@@ -4043,7 +4043,7 @@ _BEAR_USER_TEMPLATE = """STOCK: {ticker} | CURRENT: ${current_price:.2f} | HORIZ
|
|
| 4043 |
|
| 4044 |
As the RISK MANAGER, make the strongest possible bear case.
|
| 4045 |
In "key_points", include ONLY the topics that are material (drop any you have nothing specific for);
|
| 4046 |
-
each point
|
| 4047 |
Respond with ONLY this JSON:
|
| 4048 |
{{
|
| 4049 |
"expected_return_pct": <float: your bear-case return estimate, typically negative or low positive>,
|
|
@@ -4051,7 +4051,7 @@ Respond with ONLY this JSON:
|
|
| 4051 |
"recommendation": "<HOLD|SELL|STRONG SELL>",
|
| 4052 |
"confidence": <float: 0.0-1.0>,
|
| 4053 |
"direction": "<BEARISH|NEUTRAL>",
|
| 4054 |
-
"reasoning": "<
|
| 4055 |
"key_points": [
|
| 4056 |
{{"topic": "Business outlook", "point": "<demand / growth / guidance credibility, with numbers>"}},
|
| 4057 |
{{"topic": "Competitive landscape", "point": "<moat erosion, share loss, pricing, disruptors>"}},
|
|
@@ -4096,7 +4096,7 @@ _BULL_USER_TEMPLATE = """STOCK: {ticker} | CURRENT: ${current_price:.2f} | HORIZ
|
|
| 4096 |
|
| 4097 |
As the GROWTH ANALYST, make the strongest possible bull case.
|
| 4098 |
In "key_points", include ONLY the topics that are material (drop any you have nothing specific for);
|
| 4099 |
-
each point
|
| 4100 |
Respond with ONLY this JSON:
|
| 4101 |
{{
|
| 4102 |
"expected_return_pct": <float: your bull-case return estimate, typically positive>,
|
|
@@ -4104,7 +4104,7 @@ Respond with ONLY this JSON:
|
|
| 4104 |
"recommendation": "<HOLD|BUY|STRONG BUY>",
|
| 4105 |
"confidence": <float: 0.0-1.0>,
|
| 4106 |
"direction": "<BULLISH|NEUTRAL>",
|
| 4107 |
-
"reasoning": "<
|
| 4108 |
"key_points": [
|
| 4109 |
{{"topic": "Business outlook", "point": "<demand drivers / TAM / operating leverage, with numbers>"}},
|
| 4110 |
{{"topic": "Competitive landscape", "point": "<moat, share gains, pricing power, switching costs>"}},
|
|
@@ -4151,7 +4151,7 @@ Rules:
|
|
| 4151 |
- p_bear must be between 0.10 and 0.65 (you cannot dismiss the bear entirely or let it dominate)
|
| 4152 |
- p_bull must be between 0.10 and 0.65 (same constraint)
|
| 4153 |
- The final expected return will be computed MECHANICALLY from your probabilities — do NOT engineer a target number
|
| 4154 |
-
- Your reasoning
|
| 4155 |
|
| 4156 |
Do NOT simply average. Make a genuine judgment about which case is better supported by the data.
|
| 4157 |
|
|
@@ -4216,7 +4216,7 @@ Respond with ONLY this JSON:
|
|
| 4216 |
"recommendation": "<STRONG BUY|BUY|HOLD|SELL|STRONG SELL>",
|
| 4217 |
"confidence": <float: 0.0-1.0>,
|
| 4218 |
"direction": "<BULLISH|BEARISH|NEUTRAL>",
|
| 4219 |
-
"reasoning": "<
|
| 4220 |
"key_points": [
|
| 4221 |
{{"topic": "Business outlook", "point": "<bull & bear evidence on growth/demand, with numbers>"}},
|
| 4222 |
{{"topic": "Competitive landscape", "point": "<moat strength vs threats>"}},
|
|
@@ -4549,6 +4549,7 @@ def _parse_pm_synthesis(raw, tokens_in, tokens_out):
|
|
| 4549 |
"conviction": float(np.clip(data.get("conviction", 0.5), 0.1, 1.0)),
|
| 4550 |
"reasoning": str(data.get("reasoning", "")),
|
| 4551 |
"key_points": _coerce_key_points(data.get("key_points")),
|
|
|
|
| 4552 |
"risk_flags": list(data.get("risk_flags", [])),
|
| 4553 |
"override_ml": bool(data.get("override_ml", False)),
|
| 4554 |
"tokens_in": tokens_in,
|
|
|
|
| 4043 |
|
| 4044 |
As the RISK MANAGER, make the strongest possible bear case.
|
| 4045 |
In "key_points", include ONLY the topics that are material (drop any you have nothing specific for);
|
| 4046 |
+
each point states its conclusion first, then the number that proves it (1-2 sentences).
|
| 4047 |
Respond with ONLY this JSON:
|
| 4048 |
{{
|
| 4049 |
"expected_return_pct": <float: your bear-case return estimate, typically negative or low positive>,
|
|
|
|
| 4051 |
"recommendation": "<HOLD|SELL|STRONG SELL>",
|
| 4052 |
"confidence": <float: 0.0-1.0>,
|
| 4053 |
"direction": "<BEARISH|NEUTRAL>",
|
| 4054 |
+
"reasoning": "<your bear thesis in 2-3 sentences: the claim, the strongest reason, what the market is missing>",
|
| 4055 |
"key_points": [
|
| 4056 |
{{"topic": "Business outlook", "point": "<demand / growth / guidance credibility, with numbers>"}},
|
| 4057 |
{{"topic": "Competitive landscape", "point": "<moat erosion, share loss, pricing, disruptors>"}},
|
|
|
|
| 4096 |
|
| 4097 |
As the GROWTH ANALYST, make the strongest possible bull case.
|
| 4098 |
In "key_points", include ONLY the topics that are material (drop any you have nothing specific for);
|
| 4099 |
+
each point states its conclusion first, then the number that proves it (1-2 sentences).
|
| 4100 |
Respond with ONLY this JSON:
|
| 4101 |
{{
|
| 4102 |
"expected_return_pct": <float: your bull-case return estimate, typically positive>,
|
|
|
|
| 4104 |
"recommendation": "<HOLD|BUY|STRONG BUY>",
|
| 4105 |
"confidence": <float: 0.0-1.0>,
|
| 4106 |
"direction": "<BULLISH|NEUTRAL>",
|
| 4107 |
+
"reasoning": "<your bull thesis in 2-3 sentences: the claim, the strongest reason, what the market is missing>",
|
| 4108 |
"key_points": [
|
| 4109 |
{{"topic": "Business outlook", "point": "<demand drivers / TAM / operating leverage, with numbers>"}},
|
| 4110 |
{{"topic": "Competitive landscape", "point": "<moat, share gains, pricing power, switching costs>"}},
|
|
|
|
| 4151 |
- p_bear must be between 0.10 and 0.65 (you cannot dismiss the bear entirely or let it dominate)
|
| 4152 |
- p_bull must be between 0.10 and 0.65 (same constraint)
|
| 4153 |
- The final expected return will be computed MECHANICALLY from your probabilities — do NOT engineer a target number
|
| 4154 |
+
- Your reasoning is the decision thesis: state what you concluded and the evidence that decided it — not a recap of each analyst
|
| 4155 |
|
| 4156 |
Do NOT simply average. Make a genuine judgment about which case is better supported by the data.
|
| 4157 |
|
|
|
|
| 4216 |
"recommendation": "<STRONG BUY|BUY|HOLD|SELL|STRONG SELL>",
|
| 4217 |
"confidence": <float: 0.0-1.0>,
|
| 4218 |
"direction": "<BULLISH|BEARISH|NEUTRAL>",
|
| 4219 |
+
"reasoning": "<net assessment in 2-3 sentences: where the evidence points and the one thing each side gets right>",
|
| 4220 |
"key_points": [
|
| 4221 |
{{"topic": "Business outlook", "point": "<bull & bear evidence on growth/demand, with numbers>"}},
|
| 4222 |
{{"topic": "Competitive landscape", "point": "<moat strength vs threats>"}},
|
|
|
|
| 4549 |
"conviction": float(np.clip(data.get("conviction", 0.5), 0.1, 1.0)),
|
| 4550 |
"reasoning": str(data.get("reasoning", "")),
|
| 4551 |
"key_points": _coerce_key_points(data.get("key_points")),
|
| 4552 |
+
"tipping_point": (str(data.get("tipping_point"))[:300] if data.get("tipping_point") else None),
|
| 4553 |
"risk_flags": list(data.get("risk_flags", [])),
|
| 4554 |
"override_ml": bool(data.get("override_ml", False)),
|
| 4555 |
"tokens_in": tokens_in,
|