Skip to content

Instantly share code, notes, and snippets.

@fnneves
Created May 11, 2021 16:37
Show Gist options
  • Save fnneves/a2cb7862f142ef3a4693901ac48c3e2f to your computer and use it in GitHub Desktop.
Save fnneves/a2cb7862f142ef3a4693901ac48c3e2f to your computer and use it in GitHub Desktop.
indicators_ptf = go.Figure()
indicators_ptf.layout.template = CHART_THEME
indicators_ptf.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_portfolio7d_pct,
number = {'suffix': " %"},
title = {"text": "<br><span style='font-size:0.7em;color:gray'>7 Days</span>"},
delta = {'position': "bottom", 'reference': kpi_sp500_7d_pct, 'relative': False},
domain = {'row': 0, 'column': 0}))
indicators_ptf.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_portfolio15d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>15 Days</span>"},
delta = {'position': "bottom", 'reference': kpi_sp500_15d_pct, 'relative': False},
domain = {'row': 1, 'column': 0}))
indicators_ptf.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_portfolio30d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>30 Days</span>"},
delta = {'position': "bottom", 'reference': kpi_sp500_30d_pct, 'relative': False},
domain = {'row': 2, 'column': 0}))
indicators_ptf.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_portfolio200d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>200 Days</span>"},
delta = {'position': "bottom", 'reference': kpi_sp500_200d_pct, 'relative': False},
domain = {'row': 3, 'column': 1}))
indicators_ptf.update_layout(
grid = {'rows': 4, 'columns': 1, 'pattern': "independent"},
margin=dict(l=50, r=50, t=30, b=30)
)
indicators_sp500 = go.Figure()
indicators_sp500.layout.template = CHART_THEME
indicators_sp500.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_sp500_7d_pct,
number = {'suffix': " %"},
title = {"text": "<br><span style='font-size:0.7em;color:gray'>7 Days</span>"},
domain = {'row': 0, 'column': 0}))
indicators_sp500.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_sp500_15d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>15 Days</span>"},
domain = {'row': 1, 'column': 0}))
indicators_sp500.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_sp500_30d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>30 Days</span>"},
domain = {'row': 2, 'column': 0}))
indicators_sp500.add_trace(go.Indicator(
mode = "number+delta",
value = kpi_sp500_200d_pct,
number = {'suffix': " %"},
title = {"text": "<span style='font-size:0.7em;color:gray'>200 Days</span>"},
domain = {'row': 3, 'column': 1}))
indicators_sp500.update_layout(
grid = {'rows': 4, 'columns': 1, 'pattern': "independent"},
margin=dict(l=50, r=50, t=30, b=30)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment