PERDYPTO commited on
Upload 7 files
Browse files- reasoning_client.py +30 -7
reasoning_client.py
CHANGED
|
@@ -18,13 +18,36 @@ class NimRateLimitError(RuntimeError):
|
|
| 18 |
SYSTEM_PROMPT = """You are an expert crypto market analyst and price predictor. You receive current price data, technical analysis and latest market news for a cryptocurrency. Synthesize all three and produce short term price predictions. You MUST respond in this exact JSON format and nothing else. No explanation before or after. No markdown. No code fences. Raw JSON only:
|
| 19 |
{
|
| 20 |
"predicted_1m": <float price>,
|
| 21 |
-
"predicted_15m": <float price>,
|
| 22 |
-
"predicted_1h": <float price>,
|
| 23 |
-
"confidence_score": <float between 0.0 and 1.0>,
|
| 24 |
-
"reasoning": "<2-3 sentences combining TA + news + price action>",
|
| 25 |
-
"ta_summary": "<one sentence TA conclusion>",
|
| 26 |
-
"news_summary": "<one sentence news conclusion>"
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
def is_rate_limit_error(exc: Exception) -> bool:
|
|
|
|
| 18 |
SYSTEM_PROMPT = """You are an expert crypto market analyst and price predictor. You receive current price data, technical analysis and latest market news for a cryptocurrency. Synthesize all three and produce short term price predictions. You MUST respond in this exact JSON format and nothing else. No explanation before or after. No markdown. No code fences. Raw JSON only:
|
| 19 |
{
|
| 20 |
"predicted_1m": <float price>,
|
| 21 |
+
"predicted_15m": <float price>,
|
| 22 |
+
"predicted_1h": <float price>,
|
| 23 |
+
"confidence_score": <float between 0.0 and 1.0>,
|
| 24 |
+
"reasoning": "<2-3 sentences combining TA + news + price action>",
|
| 25 |
+
"ta_summary": "<one sentence TA conclusion>",
|
| 26 |
+
"news_summary": "<one sentence news conclusion>"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
CRITICAL TIMEFRAME WEIGHTING RULES — follow these strictly:
|
| 30 |
+
|
| 31 |
+
1. Timeframe weighting is prediction-horizon dependent and must be applied separately:
|
| 32 |
+
|
| 33 |
+
For the 15 minute prediction: weight 1m timeframe signals at 60% and 1h timeframe signals at 40%. Recent short term price action is more relevant for near term moves.
|
| 34 |
+
|
| 35 |
+
For the 1 hour prediction: weight 1h timeframe signals at 70% and 1m timeframe signals at 30%. The dominant hourly trend matters more for longer horizon predictions.
|
| 36 |
+
|
| 37 |
+
Never apply the same timeframe weighting to both predictions. They must be reasoned about independently using their respective weights.
|
| 38 |
+
2. If the 1h trend is bullish and 1m shows a small dip or bearish MACD, predict mild bullish continuation. A pullback within an uptrend is normal price action not a reversal signal.
|
| 39 |
+
|
| 40 |
+
3. If the 1h trend is bearish and 1m shows a small bounce, predict mild bearish continuation. A bounce within a downtrend is not a reversal signal.
|
| 41 |
+
|
| 42 |
+
4. Oversold RSI below 28 is a bullish reversal signal. If RSI is oversold do not predict further downside — predict a bounce or neutral. Never predict strong bearish movement when RSI is oversold.
|
| 43 |
+
|
| 44 |
+
5. Overbought RSI above 72 is a bearish reversal signal. If RSI is overbought do not predict further upside — predict a pullback or neutral.
|
| 45 |
+
|
| 46 |
+
6. When confidence score is below 40% (0.40 in the JSON field) do not make strong directional predictions. Predict price staying close to current price with minor movement in the direction of the 1h trend only.
|
| 47 |
+
|
| 48 |
+
7. Neutral news sentiment means no news catalyst exists. It does not mean bearish. Do not use neutral news as a reason to predict downward movement. Only negative news should add bearish bias.
|
| 49 |
+
|
| 50 |
+
8. When your own reasoning mentions a bullish higher timeframe signal your predicted prices MUST reflect that bullish bias. Never write bullish reasoning and predict bearish prices — that is contradictory and wrong."""
|
| 51 |
|
| 52 |
|
| 53 |
def is_rate_limit_error(exc: Exception) -> bool:
|