Spaces:
Paused
Paused
Update api.py
Browse files
api.py
CHANGED
|
@@ -305,21 +305,23 @@ def build_signal_response(df, cf, instrument_name="unknown"):
|
|
| 305 |
"signal": signal,
|
| 306 |
"instrument": instrument_name,
|
| 307 |
"stage1_tradeable": s1_p >= STAGE1_CONF,
|
| 308 |
-
"stage1_conf": round(s1_p
|
| 309 |
"stage2_direction": LABEL_MAP.get(2 if (dir_conf or 0)>0.5 else 0, "NO TRADE") if dir_conf else "N/A",
|
| 310 |
-
"stage2_conf": round(
|
| 311 |
"model3_signal": m3sig,
|
| 312 |
-
"model3_conf": round(float(m3p.max())
|
| 313 |
-
"prob_sell": round(float(m3p[0])
|
| 314 |
-
"prob_no_trade": round(float(m3p[1])
|
| 315 |
-
"prob_buy": round(float(m3p[2])
|
| 316 |
"gate_result": gate_note,
|
| 317 |
"regime": trend,
|
| 318 |
"trend_bars": regime["TREND_BARS"],
|
| 319 |
"ema50_side": "ABOVE" if regime["EMA50_SIDE"]>0 else "BELOW",
|
| 320 |
"ema200_side": "ABOVE" if regime["REGIME"]>0 else "BELOW",
|
| 321 |
-
"current_price": round(cf["current_price"],
|
| 322 |
-
"
|
|
|
|
|
|
|
| 323 |
"chronos_return": round(chronos_ret, 4),
|
| 324 |
"chronos_spread": round(cf["CHRONOS_SPREAD"], 4),
|
| 325 |
"chronos_agree": round(cf["CHRONOS_AGREE"], 2),
|
|
|
|
| 305 |
"signal": signal,
|
| 306 |
"instrument": instrument_name,
|
| 307 |
"stage1_tradeable": s1_p >= STAGE1_CONF,
|
| 308 |
+
"stage1_conf": round(s1_p, 4),
|
| 309 |
"stage2_direction": LABEL_MAP.get(2 if (dir_conf or 0)>0.5 else 0, "NO TRADE") if dir_conf else "N/A",
|
| 310 |
+
"stage2_conf": round(dir_conf, 4) if dir_conf else 0.0,
|
| 311 |
"model3_signal": m3sig,
|
| 312 |
+
"model3_conf": round(float(m3p.max()), 4),
|
| 313 |
+
"prob_sell": round(float(m3p[0]), 4),
|
| 314 |
+
"prob_no_trade": round(float(m3p[1]), 4),
|
| 315 |
+
"prob_buy": round(float(m3p[2]), 4),
|
| 316 |
"gate_result": gate_note,
|
| 317 |
"regime": trend,
|
| 318 |
"trend_bars": regime["TREND_BARS"],
|
| 319 |
"ema50_side": "ABOVE" if regime["EMA50_SIDE"]>0 else "BELOW",
|
| 320 |
"ema200_side": "ABOVE" if regime["REGIME"]>0 else "BELOW",
|
| 321 |
+
"current_price": round(cf["current_price"], 4),
|
| 322 |
+
"forecast_price": round(cf["predicted_price"], 4),
|
| 323 |
+
"predicted_price": round(cf["predicted_price"], 4),
|
| 324 |
+
"chronos_return_pct": round(chronos_ret, 4),
|
| 325 |
"chronos_return": round(chronos_ret, 4),
|
| 326 |
"chronos_spread": round(cf["CHRONOS_SPREAD"], 4),
|
| 327 |
"chronos_agree": round(cf["CHRONOS_AGREE"], 2),
|