Skip to content

isValidRollConvention

isValidRollConvention(convention: unknown): convention is RollConvention

Return true when convention is a RollConvention that rollDate implements.

  • Valid conventions are "following", "modifiedFollowing", "preceding", "modifiedPreceding", "endOfMonth" and "none". The first three are the conventions ISDA 2006 Definitions §4.12(a) defines in (i)–(iii); "modifiedPreceding" is FpML’s BusinessDayConventionEnum MODPRECEDING, which §4.12(a) does not define; "none" is Strata’s NO_ADJUST; and "endOfMonth" is GMT’s own. The camelCase spelling is GMT’s — no standard fixes the identifiers, only the behaviour.
  • Matching is exact: case, spacing and abbreviations are not normalised.
  • Accepts any input type and returns false for non-string values.
  • rollDate returns "" for a convention it does not recognise — the same sentinel it returns for a bad date or calendar. Check the convention here to tell a misconfigured contract term apart from bad data.
ParameterTypeDescription
conventionunknowncandidate value of any type

boolean indicating validity

import { isValidRollConvention } from "@northguild/gmt/calendar/validate";
isValidRollConvention("modifiedFollowing") // true
output 

calendar/validate/isValidRollConvention.ts