mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2026-01-04 14:04:26 +01:00
(feat) separate live candles from bt candles
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from plotly.subplots import make_subplots
|
||||
from frontend.visualization.candles import get_candlestick_trace
|
||||
from frontend.visualization.candles import get_bt_candlestick_trace, get_candlestick_trace
|
||||
from frontend.visualization.executors import add_executors_trace
|
||||
from frontend.visualization.pnl import get_pnl_trace
|
||||
from frontend.visualization.theme import get_default_layout
|
||||
@@ -12,7 +12,7 @@ def create_backtesting_figure(df, executors, config):
|
||||
row_heights=[0.7, 0.3])
|
||||
|
||||
# Add candlestick trace
|
||||
fig.add_trace(get_candlestick_trace(df), row=1, col=1)
|
||||
fig.add_trace(get_bt_candlestick_trace(df), row=1, col=1)
|
||||
|
||||
# Add executors trace
|
||||
fig = add_executors_trace(fig, executors, row=1, col=1)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import plotly.graph_objects as go
|
||||
import pandas as pd
|
||||
|
||||
from frontend.visualization import theme
|
||||
|
||||
|
||||
def get_candlestick_trace(df):
|
||||
df.index = pd.to_datetime(df.timestamp, unit='ms')
|
||||
return go.Candlestick(x=df.index,
|
||||
@@ -9,4 +12,13 @@ def get_candlestick_trace(df):
|
||||
low=df['low'],
|
||||
close=df['close'],
|
||||
name="Candlesticks",
|
||||
increasing_line_color='#2ECC71', decreasing_line_color='#E74C3C')
|
||||
increasing_line_color='#2ECC71', decreasing_line_color='#E74C3C',)
|
||||
|
||||
|
||||
def get_bt_candlestick_trace(df):
|
||||
df.index = pd.to_datetime(df.timestamp, unit='ms')
|
||||
return go.Scatter(x=df.index,
|
||||
y=df['close'],
|
||||
mode='lines',
|
||||
line=dict(color=theme.get_color_scheme()["price"]),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user