Class DayTypeProfiles<T>
java.lang.Object
com.quantfinlib.microstructure.DayTypeProfiles<T>
- Type Parameters:
T- the per-day-type profile, typicallyVolumeCurve,VolatilityCurveorSpreadForecaster
Day-type-aware seasonality: not every trading day has the same shape.
Options-expiry days trade 2-3x normal volume with a violent close;
half days compress the whole U-curve into a morning; FX fixing days
(month-end, the 4pm London WM/R window) concentrate flow around the
fix. A single averaged profile is wrong on exactly the days that
matter most, so this container holds one independently-learned curve
per day type — one
VolumeCurve, VolatilityCurve, or
SpreadForecaster each — and the caller selects today's profile
once at session start.
// 0=regular, 1=expiry, 2=half day (the caller owns the taxonomy)
var volume = new DayTypeProfiles<>(3, () -> new VolumeCurve(78, 0.1));
VolumeCurve today = volume.profile(calendar.isExpiry(date) ? 1 : 0);
today.onVolume(bucket, qty); // learns ONLY the expiry-day shape
The trade-off is honest and unavoidable: a per-type profile learns from only that type's sessions, so rare types (12 expiries a year) converge slowly. Seed a new type from the regular-day profile via the curve's own seeding method when one exists, or accept the slower ramp. All profiles are constructed eagerly up front — selection is allocation-free and hot-path safe; the curves themselves keep their own single-writer contracts.
-
Constructor Summary
ConstructorsConstructorDescriptionDayTypeProfiles(int dayTypes, IntFunction<T> factory) Variant whose factory sees the day-type index it is building for.DayTypeProfiles(int dayTypes, Supplier<T> factory) -
Method Summary
-
Constructor Details
-
DayTypeProfiles
-
DayTypeProfiles
Variant whose factory sees the day-type index it is building for.
-
-
Method Details
-
profile
The independently-learned profile fordayType. -
dayTypes
public int dayTypes()
-