Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,8 @@ YF_TF = {
|
|
| 42 |
"1d": ("1d", "5y"),
|
| 43 |
}
|
| 44 |
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# ---------- Helpers ----------
|
| 47 |
def _sig(x):
|
|
@@ -74,12 +76,12 @@ def _rsi(c, p=14):
|
|
| 74 |
# ---------- yfinance Data Layer ----------
|
| 75 |
def fetch_pairs(n=30):
|
| 76 |
"""Return fixed 30-coin USDT list (yfinance)."""
|
| 77 |
-
out = COINS[:
|
| 78 |
print(f"[RCEA] {len(out)} yfinance pairs resolved", flush=True)
|
| 79 |
return out
|
| 80 |
|
| 81 |
|
| 82 |
-
def fetch_klines(inst_id, timeframe, target_bars=
|
| 83 |
"""
|
| 84 |
Fetch OHLCV from Yahoo Finance via yfinance.
|
| 85 |
For 4h, downloads 1h and resamples to 4H.
|
|
@@ -362,7 +364,7 @@ def run(timeframe, n_coins, thr, lam, mconf, maxhold, progress=gr.Progress()):
|
|
| 362 |
def err(msg, detail=""):
|
| 363 |
return msg, detail, pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), pd.DataFrame()
|
| 364 |
|
| 365 |
-
n_coins =
|
| 366 |
thr = max(0.0, min(1.0, float(thr)))
|
| 367 |
lam = max(0.0, min(0.99, float(lam)))
|
| 368 |
mconf = max(0.0, min(1.0, float(mconf)))
|
|
@@ -475,7 +477,7 @@ with gr.Blocks(title="RCEA Lite v1.0 — yfinance") as demo:
|
|
| 475 |
with gr.Row():
|
| 476 |
with gr.Column(scale=1):
|
| 477 |
tf = gr.Dropdown(["15m", "1h", "4h", "1d"], value="1h", label="Timeframe")
|
| 478 |
-
nc = gr.
|
| 479 |
thr_i = gr.Slider(0.0, 1.0, value=0.06, step=0.01, label="Evidence threshold")
|
| 480 |
lam_i = gr.Slider(0.0, 0.99, value=0.70, step=0.01, label="Memory λ")
|
| 481 |
mc_i = gr.Slider(0.0, 1.0, value=0.30, step=0.01, label="Min regime confidence")
|
|
|
|
| 42 |
"1d": ("1d", "5y"),
|
| 43 |
}
|
| 44 |
|
| 45 |
+
TARGET_BARS = 1000
|
| 46 |
+
|
| 47 |
|
| 48 |
# ---------- Helpers ----------
|
| 49 |
def _sig(x):
|
|
|
|
| 76 |
# ---------- yfinance Data Layer ----------
|
| 77 |
def fetch_pairs(n=30):
|
| 78 |
"""Return fixed 30-coin USDT list (yfinance)."""
|
| 79 |
+
out = COINS[:30]
|
| 80 |
print(f"[RCEA] {len(out)} yfinance pairs resolved", flush=True)
|
| 81 |
return out
|
| 82 |
|
| 83 |
|
| 84 |
+
def fetch_klines(inst_id, timeframe, target_bars=TARGET_BARS):
|
| 85 |
"""
|
| 86 |
Fetch OHLCV from Yahoo Finance via yfinance.
|
| 87 |
For 4h, downloads 1h and resamples to 4H.
|
|
|
|
| 364 |
def err(msg, detail=""):
|
| 365 |
return msg, detail, pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), pd.DataFrame()
|
| 366 |
|
| 367 |
+
n_coins = 30 # sabit — yfinance 30 parite
|
| 368 |
thr = max(0.0, min(1.0, float(thr)))
|
| 369 |
lam = max(0.0, min(0.99, float(lam)))
|
| 370 |
mconf = max(0.0, min(1.0, float(mconf)))
|
|
|
|
| 477 |
with gr.Row():
|
| 478 |
with gr.Column(scale=1):
|
| 479 |
tf = gr.Dropdown(["15m", "1h", "4h", "1d"], value="1h", label="Timeframe")
|
| 480 |
+
nc = gr.Number(value=30, label="Coins (fixed 30)", interactive=False)
|
| 481 |
thr_i = gr.Slider(0.0, 1.0, value=0.06, step=0.01, label="Evidence threshold")
|
| 482 |
lam_i = gr.Slider(0.0, 0.99, value=0.70, step=0.01, label="Memory λ")
|
| 483 |
mc_i = gr.Slider(0.0, 1.0, value=0.30, step=0.01, label="Min regime confidence")
|