0vergeared commited on
Commit
28370a2
·
verified ·
1 Parent(s): 113793a

Update app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +33 -0
app/app.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dash import Dash, dcc, html
2
+ import plotly.graph_objs as go
3
+ import pandas as pd
4
+ import ccxt
5
+
6
+ app = Dash(__name__)
7
+ symbol = "BTC/USDT"
8
+ timeframe = "1h"
9
+
10
+ def fetch_data(symbol, timeframe):
11
+ binance = ccxt.binance()
12
+ ohlcv = binance.fetch_ohlcv(symbol, timeframe=timeframe)
13
+ df = pd.DataFrame(ohlcv, columns=["timestamp", "open", "high", "low", "close", "volume"])
14
+ df["timestamp"] = pd.to_datetime(df["timestamp"], unit="ms")
15
+ return df
16
+
17
+ df = fetch_data(symbol, timeframe)
18
+
19
+ fig = go.Figure(data=[go.Candlestick(
20
+ x=df["timestamp"],
21
+ open=df["open"],
22
+ high=df["high"],
23
+ low=df["low"],
24
+ close=df["close"]
25
+ )])
26
+
27
+ app.layout = html.Div([
28
+ html.H2("Crypto Signal Generator (Docker Dash)"),
29
+ dcc.Graph(id="candlestick-chart", figure=fig)
30
+ ])
31
+
32
+ if __name__ == "__main__":
33
+ app.run_server(debug=False, host="0.0.0.0", port=7860)