API ReferenceDomain
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";resolveAnchorDateProp
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",
});ResolveAnchorDateOptionsProp
Type
Configuration
| Option | Default | Description |
|---|---|---|
marketSupplyPoints | required | Supply 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. |
lookbackDays | 2 | Number of days to search backwards from yesterday. Increase if data gaps are common. |
readingDirections | undefined | Electricity reading directions to include in the lookup. |
readingFrequencies | undefined | Custom reading frequency overrides per range. Merged with defaults. |
minReadings | package thresholds | Override minimum-reading thresholds by range. Defaults are derived from the resolved frequency. |
pageSize | 100 | Number of measurement edges to fetch per page. |
timezone | required | IANA timezone for availability boundaries. Use the same timezone for the resolved timeframe. |
Related
- Guide: Avoid Empty Charts: resolution strategies for different setups
- API Reference: React Query:
using
anchorDateQueryOptionswith TanStack Query - API Reference: Timeframe:
passing
defaults.datetouseTimeframe