ledgr_calendar() creates the explicit annualization calendar used by metric
contexts. It represents a uniform session model as
trading_days_per_year * bars_per_day.
ledgr_calendar_us_equity() defaults to daily bars and can represent common
minute bars with ledgr_calendar_us_equity(bars_per_day = 390L).
ledgr_calendar_crypto() is explicit crypto calendar support; ledgr does not
infer crypto annualization from ticker symbols.
Usage
ledgr_calendar(
trading_days_per_year,
bars_per_day = 1L,
label = NULL,
source = "custom"
)
ledgr_calendar_us_equity(bars_per_day = 1L)
ledgr_calendar_crypto(bars_per_day = 1L)Articles
vignette("metrics-and-accounting", package = "ledgr")
system.file("doc", "metrics-and-accounting.html", package = "ledgr")
Examples
ledgr_calendar(trading_days_per_year = 252, bars_per_day = 1)
#> ledgr_calendar
#> ==============
#> Source: custom
#> Days/year: 252
#> Bars/day: 1
#> Bars/year: 252
ledgr_calendar_us_equity(bars_per_day = 390L)
#> ledgr_calendar
#> ==============
#> Label: US equity custom bars
#> Source: us_equity
#> Days/year: 252
#> Bars/day: 390
#> Bars/year: 98,280
ledgr_calendar_crypto()
#> ledgr_calendar
#> ==============
#> Label: crypto daily
#> Source: crypto
#> Days/year: 365
#> Bars/day: 1
#> Bars/year: 365