mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-22 15:54:24 +01:00
(feat) adapt visualizations to seconds
This commit is contained in:
@@ -15,7 +15,7 @@ def get_candlestick_trace(df):
|
|||||||
|
|
||||||
|
|
||||||
def get_bt_candlestick_trace(df):
|
def get_bt_candlestick_trace(df):
|
||||||
df.index = pd.to_datetime(df.timestamp, unit='ms')
|
df.index = pd.to_datetime(df.timestamp, unit='s')
|
||||||
return go.Scatter(x=df.index,
|
return go.Scatter(x=df.index,
|
||||||
y=df['close'],
|
y=df['close'],
|
||||||
mode='lines',
|
mode='lines',
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ from hummingbot.connector.connector_base import TradeType
|
|||||||
|
|
||||||
def add_executors_trace(fig, executors, row, col):
|
def add_executors_trace(fig, executors, row, col):
|
||||||
for executor in executors:
|
for executor in executors:
|
||||||
entry_time = pd.to_datetime(executor.timestamp, unit='ms')
|
entry_time = pd.to_datetime(executor.timestamp, unit='s')
|
||||||
entry_price = executor.custom_info["current_position_average_price"]
|
entry_price = executor.custom_info["current_position_average_price"]
|
||||||
exit_time = pd.to_datetime(executor.close_timestamp, unit='ms')
|
exit_time = pd.to_datetime(executor.close_timestamp, unit='s')
|
||||||
exit_price = executor.custom_info["close_price"]
|
exit_price = executor.custom_info["close_price"]
|
||||||
name = "Buy Executor" if executor.config.side == TradeType.BUY else "Sell Executor"
|
name = "Buy Executor" if executor.config.side == TradeType.BUY else "Sell Executor"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def get_bbands_traces(df, bb_length, bb_std):
|
|||||||
|
|
||||||
|
|
||||||
def get_volume_trace(df):
|
def get_volume_trace(df):
|
||||||
df.index = pd.to_datetime(df.timestamp, unit='ms')
|
df.index = pd.to_datetime(df.timestamp, unit='s')
|
||||||
return go.Bar(x=df.index, y=df['volume'], name="Volume", marker_color=theme.get_color_scheme()["volume"], opacity=0.7)
|
return go.Bar(x=df.index, y=df['volume'], name="Volume", marker_color=theme.get_color_scheme()["volume"], opacity=0.7)
|
||||||
|
|
||||||
def get_macd_traces(df, macd_fast, macd_slow, macd_signal):
|
def get_macd_traces(df, macd_fast, macd_slow, macd_signal):
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ def get_pnl_trace(executors):
|
|||||||
pnl = [e.net_pnl_quote for e in executors]
|
pnl = [e.net_pnl_quote for e in executors]
|
||||||
cum_pnl = np.cumsum(pnl)
|
cum_pnl = np.cumsum(pnl)
|
||||||
return go.Scatter(
|
return go.Scatter(
|
||||||
x=pd.to_datetime([e.close_timestamp for e in executors], unit="ms"),
|
x=pd.to_datetime([e.close_timestamp for e in executors], unit="s"),
|
||||||
y=cum_pnl,
|
y=cum_pnl,
|
||||||
mode='lines',
|
mode='lines',
|
||||||
line=dict(color='gold', width=2, dash="dash"),
|
line=dict(color='gold', width=2, dash="dash"),
|
||||||
|
|||||||
Reference in New Issue
Block a user