Generate contiguous price-interval schedules from a coerced URPX rate plan.
price-schedule walks a [start, end) instant window in the rate plan's
local timezone, calls urpx.price/resolve-prices at each step, and
merges adjacent steps whose ledger resolutions are identical.
Output is a vector of interval maps each carrying :tick/beginning and
:tick/end (java.time.Instants) plus the full urpx.price resolved
structure under :urpx.interval/resolved. Suitable for feeding to a
consumer like the price-server's TariffFetcher, which can extract a
single $/kWh value per interval via urpx.price/marginal-unit-rate.
Default step is 1 hour, anchored to the start-of-hour of start. Pass
{:step (Duration/ofMinutes 15)} etc. for finer granularity when a rate
plan defines sub-hour TOU bracket transitions.
Generate contiguous price-interval schedules from a coerced URPX rate plan.
`price-schedule` walks a [start, end) instant window in the rate plan's
local timezone, calls `urpx.price/resolve-prices` at each step, and
merges adjacent steps whose ledger resolutions are identical.
Output is a vector of interval maps each carrying `:tick/beginning` and
`:tick/end` (java.time.Instants) plus the full `urpx.price` resolved
structure under `:urpx.interval/resolved`. Suitable for feeding to a
consumer like the price-server's TariffFetcher, which can extract a
single $/kWh value per interval via `urpx.price/marginal-unit-rate`.
Default step is 1 hour, anchored to the start-of-hour of `start`. Pass
`{:step (Duration/ofMinutes 15)}` etc. for finer granularity when a rate
plan defines sub-hour TOU bracket transitions.(price-schedule rate-plan start end zone)(price-schedule rate-plan start end zone opts)Generate a vector of merged price intervals across [start, end) in zone.
Each entry is: {:tick/beginning Instant :tick/end Instant :urpx.interval/resolved <full price/resolve-prices result>}
Adjacent steps with identical ledger resolution are merged.
Optional opts map:
:step java.time.Duration — granularity at which the window is
walked. Default: (Duration/ofHours 1). Use a smaller
step for plans with sub-hour TOU bracket transitions.
:holiday? predicate (LocalDate -> bool) passed through to
urpx.price/resolve-prices (matches urpx:holiday brackets).
Generate a vector of merged price intervals across `[start, end)` in `zone`.
Each entry is:
{:tick/beginning Instant
:tick/end Instant
:urpx.interval/resolved <full price/resolve-prices result>}
Adjacent steps with identical ledger resolution are merged.
Optional `opts` map:
:step java.time.Duration — granularity at which the window is
walked. Default: `(Duration/ofHours 1)`. Use a smaller
step for plans with sub-hour TOU bracket transitions.
:holiday? predicate `(LocalDate -> bool)` passed through to
`urpx.price/resolve-prices` (matches urpx:holiday brackets).(price-schedule-days rate-plan start days zone)(price-schedule-days rate-plan start days zone opts)Convenience: generate a price-schedule covering days days starting from
start. Accepts the same opts as price-schedule.
Convenience: generate a `price-schedule` covering `days` days starting from `start`. Accepts the same `opts` as `price-schedule`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |