Skip to content

@livefolio/sdk / periodKey

Function: periodKey()

periodKey(t, freq): string

Defined in: tactical/from-spec.ts:80

Returns a stable string key that identifies the rebalance period containing date t for the given freq. Two dates that map to the same key belong to the same period and therefore produce the same rebalance decision. Used internally by isRebalanceDay to detect period boundaries.

Parameters

ParameterTypeDescription
tDateThe date to classify.
freqRebalanceFrequencyRebalance cadence (see RebalanceFrequency).

Returns

string

A compact string such as '2024-3' (monthly), '2024-W14' (weekly), or '2024-1' (quarterly Q2).

Released under the MIT License.