Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,6 @@ import numpy as np
|
|
9 |
|
10 |
logging.basicConfig(level=logging.INFO)
|
11 |
|
12 |
-
########################################
|
13 |
-
# OKX endpoints & utility
|
14 |
-
########################################
|
15 |
-
|
16 |
OKX_TICKERS_ENDPOINT = "https://www.okx.com/api/v5/market/tickers?instType=SPOT"
|
17 |
OKX_CANDLE_ENDPOINT = "https://www.okx.com/api/v5/market/candles"
|
18 |
|
@@ -81,9 +77,6 @@ def create_technical_charts(df):
|
|
81 |
|
82 |
return fig1, fig2, fig3
|
83 |
|
84 |
-
########################################
|
85 |
-
# OKX Data Fetching Functions
|
86 |
-
########################################
|
87 |
|
88 |
def fetch_okx_symbols():
|
89 |
"""
|
@@ -202,9 +195,7 @@ def fetch_okx_candles(symbol, timeframe="1H", total=2000):
|
|
202 |
logging.info(f"Fetched {len(df_all)} rows for {symbol}.")
|
203 |
return df_all, ""
|
204 |
|
205 |
-
|
206 |
-
# Prophet Pipeline
|
207 |
-
########################################
|
208 |
|
209 |
def prepare_data_for_prophet(df):
|
210 |
if df.empty:
|
@@ -273,9 +264,7 @@ def prophet_wrapper(
|
|
273 |
future_only = full_forecast.loc[len(df_prophet):, ["ds", "yhat", "yhat_lower", "yhat_upper"]]
|
274 |
return future_only, ""
|
275 |
|
276 |
-
|
277 |
-
# Plotting Functions
|
278 |
-
########################################
|
279 |
|
280 |
def create_forecast_plot(forecast_df):
|
281 |
if forecast_df.empty:
|
@@ -324,9 +313,7 @@ def create_forecast_plot(forecast_df):
|
|
324 |
)
|
325 |
return fig
|
326 |
|
327 |
-
|
328 |
-
# Main Prediction Function
|
329 |
-
########################################
|
330 |
|
331 |
def predict(
|
332 |
symbol,
|
@@ -401,9 +388,14 @@ def main():
|
|
401 |
symbols = fetch_okx_symbols()
|
402 |
|
403 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
|
|
404 |
with gr.Row():
|
405 |
gr.Markdown("# CryptoVision")
|
406 |
-
|
|
|
|
|
|
|
|
|
407 |
with gr.Row():
|
408 |
with gr.Column(scale=1):
|
409 |
with gr.Group():
|
|
|
9 |
|
10 |
logging.basicConfig(level=logging.INFO)
|
11 |
|
|
|
|
|
|
|
|
|
12 |
OKX_TICKERS_ENDPOINT = "https://www.okx.com/api/v5/market/tickers?instType=SPOT"
|
13 |
OKX_CANDLE_ENDPOINT = "https://www.okx.com/api/v5/market/candles"
|
14 |
|
|
|
77 |
|
78 |
return fig1, fig2, fig3
|
79 |
|
|
|
|
|
|
|
80 |
|
81 |
def fetch_okx_symbols():
|
82 |
"""
|
|
|
195 |
logging.info(f"Fetched {len(df_all)} rows for {symbol}.")
|
196 |
return df_all, ""
|
197 |
|
198 |
+
|
|
|
|
|
199 |
|
200 |
def prepare_data_for_prophet(df):
|
201 |
if df.empty:
|
|
|
264 |
future_only = full_forecast.loc[len(df_prophet):, ["ds", "yhat", "yhat_lower", "yhat_upper"]]
|
265 |
return future_only, ""
|
266 |
|
267 |
+
|
|
|
|
|
268 |
|
269 |
def create_forecast_plot(forecast_df):
|
270 |
if forecast_df.empty:
|
|
|
313 |
)
|
314 |
return fig
|
315 |
|
316 |
+
|
|
|
|
|
317 |
|
318 |
def predict(
|
319 |
symbol,
|
|
|
388 |
symbols = fetch_okx_symbols()
|
389 |
|
390 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
391 |
+
|
392 |
with gr.Row():
|
393 |
gr.Markdown("# CryptoVision")
|
394 |
+
|
395 |
+
gr.HTML("""<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fopenfree-CryptoVision.hf.space">
|
396 |
+
<img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fopenfree-CryptoVision.hf.space&countColor=%23263759" />
|
397 |
+
</a>""")
|
398 |
+
|
399 |
with gr.Row():
|
400 |
with gr.Column(scale=1):
|
401 |
with gr.Group():
|