Skip to main content

Scheduling & Automation

Smart Curves are automatically rebuilt and cached by the platform based on a cache configuration set on the curve itself. This controls when the platform calculates and stores a new version of the curve — from never caching at all, through to rebuilding whenever dependencies are updated or on a fixed schedule.


Setting the Cache Type

Cache behaviour is configured via the cacheOptions.type property on the SmartCurve:

MY_OBJECT = Object()

sc = SmartCurve("ICE.NBP_M:SETTLE", "bootstrapCurve(BASE)")
sc.cacheOptions.type = "OnDependencies"

MY_OBJECT.CURVE = sc
save ${object:MY_OBJECT}

Cache Types

TypeDescription
NeverNever saves a cached version — the curve is always calculated on demand when requested
OnDemandCalculates and caches the curve the first time it is read
OnDependenciesBuilds and caches the curve automatically whenever its dependencies are updated
OnScheduleRebuilds and caches based on a cron schedule — typically used for realtime curves
ExternalCurve is built and saved by an external application; only triggered on dependencies or manually

OnDependencies

OnDependencies is the most common setting for end-of-day forward curves. The platform monitors the input data sources defined in the SmartCurve and automatically rebuilds the curve whenever new data arrives.

NBP_OBJECT = Object()

sc = SmartCurve("ICE.NBP_M:SETTLE", "bootstrapCurve(BASE, VAR1)")
sc.VAR1 = ref("data", "ICE.NBP_Q:SETTLE")
sc.cacheOptions.type = "OnDependencies"

NBP_OBJECT.CURVE = sc
save ${object:NBP_OBJECT}
tip

OnDependencies is ideal for curves that depend on exchange settlement prices — the curve will rebuild automatically as soon as the settlement data lands on the platform, with no manual intervention required.


OnDemand

OnDemand is a lightweight option that defers the build until the curve is first requested. The result is then cached for subsequent reads.

sc.cacheOptions.type = "OnDemand"
note

Use OnDemand for curves that are infrequently accessed or where you want to avoid rebuilding on every dependency update. The first read after a dependency changes will trigger a fresh build.


OnSchedule

OnSchedule rebuilds the curve on a fixed cron schedule, independent of when dependencies arrive. This is typically used for realtime or intraday curves that need to refresh at regular intervals.

sc.cacheOptions.type = "OnSchedule"
sc.cacheOptions.schedule = "0 * * * MON-FRI"
note

Cron expressions follow standard format: minute hour day month weekday. The example above rebuilds the curve every hour on weekdays.

Common scheduling patterns:

PatternCron Expression
Every hour on weekdays0 * * * MON-FRI
Weekdays at 18:000 18 * * MON-FRI
Daily at midnight0 0 * * *
Every 15 minutes*/15 * * * *

Never

Never disables caching entirely. The curve is recalculated from scratch on every request and no cached version is stored.

sc.cacheOptions.type = "Never"
note

Use Never during development or for diagnostic curves where you always want the latest calculation without any cached state.


External

External is used when an external application is responsible for building and saving the curve. The platform will only trigger a build on explicit request or when dependencies update — it will not build the curve automatically on its own schedule.

sc.cacheOptions.type = "External"

Full Example

Here is a complete Smart Curve definition using OnDependencies caching:

NBP_OBJECT = Object()
NBP_OBJECT.description = "NBP Gas Forward Curve - daily bootstrapped curve"

sc = SmartCurve("ICE.NBP_M:SETTLE", "bootstrapCurve(BASE, VAR1)")
sc.VAR1 = ref("data", "ICE.NBP_Q:SETTLE")
sc.cacheOptions.type = "OnDependencies"

NBP_OBJECT.CURVE = sc
save ${object:NBP_OBJECT}

Summary

Cache TypeWhen to Use
NeverDevelopment, diagnostics, or always-fresh on-demand calculation
OnDemandInfrequently accessed curves; defer build until first read
OnDependenciesEnd-of-day curves driven by incoming market data
OnScheduleRealtime or intraday curves on a fixed refresh interval
ExternalCurves built and managed by an external system