(feat) format visualizations

This commit is contained in:
cardosofede
2024-07-16 18:36:50 +03:00
parent e7eba7ed09
commit f12357048f
8 changed files with 19 additions and 12 deletions

View File

@@ -24,7 +24,9 @@ def get_bbands_traces(df, bb_length, bb_std):
def get_volume_trace(df):
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):
tech_colors = theme.get_color_scheme()
@@ -38,7 +40,8 @@ def get_macd_traces(df, macd_fast, macd_slow, macd_signal):
go.Scatter(x=df.index, y=df[macd_s], line=dict(color=tech_colors['macd_signal']),
name='MACD Signal'),
go.Bar(x=df.index, y=df[macd_hist], name='MACD Histogram',
marker_color=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].apply(lambda x: '#FF6347' if x < 0 else '#32CD32'))
marker_color=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].apply(
lambda x: '#FF6347' if x < 0 else '#32CD32'))
]
return traces
@@ -79,4 +82,3 @@ def get_supertrend_traces(df, length, multiplier):
]
return traces