Skip to Content
Octopus Energy Packages

Anchor Date

Resolution functions for finding the best starting date

Use this entry point to resolve the best starting date for measurement views.

import { resolveAnchorDate } from "@octopus-energy/measurements/anchor-date";

resolveAnchorDate

Async function for server-side anchor date resolution (outside of React). Call this in getServerSideProps, Server Components, or route handlers.

import { resolveAnchorDate } from "@octopus-energy/measurements/anchor-date";
resolveAnchorDate

Prop

Type

import { resolveAnchorDate } from "@octopus-energy/measurements/anchor-date";
import { fetchMarketSupplyPoints } from "@octopus-energy/measurements/market-supply-points";

const marketSupplyPoints = await fetchMarketSupplyPoints(client, {
  accountNumber,
  propertyId,
  utilityMarkets,
});

const anchorDate = await resolveAnchorDate(client, {
  propertyId,
  marketSupplyPoints,
  period,
  lookbackDays: 7,
  timezone: "Europe/London",
});
ResolveAnchorDateOptions

Prop

Type


Configuration

OptionDefaultDescription
marketSupplyPointsrequiredSupply points to include in the availability lookup.
period"week"The user-facing period value. Together with interval, determines the reading frequency threshold.
interval"week"The custom interval when period is "custom". Ignored for other period values.
lookbackDays2Number of days to search backwards from yesterday. Increase if data gaps are common.
readingDirectionsundefinedElectricity reading directions to include in the lookup.
readingFrequenciesundefinedCustom reading frequency overrides per range. Merged with defaults.
minReadingspackage thresholdsOverride minimum-reading thresholds by range. Defaults are derived from the resolved frequency.
pageSize100Number of measurement edges to fetch per page.
timezonerequiredIANA timezone for availability boundaries. Use the same timezone for the resolved timeframe.

On this page