Skip to contents

One horizontal bar per index, its change over the period in percent, green for rises and red for falls, the best at the top, from performance_data(). The VIX is left out: it measures the fear in the market rather than the value of shares, and its swings of tens of percent would squeeze the others.

Usage

plot_performance(
  summary,
  indices = get_indices(),
  period = performance_periods,
  mode = "light"
)

Arguments

summary

The result of index_summary().

indices

Data frame of indices from get_indices(); the indices without a currency, the VIX, are left out.

period

"day", "week", "month", "month3", "month6", "month9" (3, 6 and 9 months), "ytd" (year to date) or "year".

mode

"light" (the default) or "dark", to suit a light or dark page.

Value

A plotly object.

Examples

if (FALSE) { # interactive()
indices <- get_indices()
summary <- index_summary(get_history(indices$label, as.Date("2020-01-01")))
plot_performance(summary, indices, "ytd")
}