Add smart money event calendar enrichment
This commit is contained in:
parent
6108aea166
commit
6b794ec7ac
11 changed files with 270 additions and 8 deletions
|
|
@ -55,4 +55,58 @@ describe("smart money parent events", () => {
|
|||
expect(event.primary_profile_id).toBeNull();
|
||||
expect(event.suppressed_reasons).toContain("stale_or_missing_quote_context");
|
||||
});
|
||||
|
||||
it("uses timestamp-available event calendar matches for event-driven scoring", () => {
|
||||
const packet = buildFlowPacket({
|
||||
id: "flowpacket:event-driven",
|
||||
source_ts: Date.parse("2025-01-15T15:00:00Z"),
|
||||
features: {
|
||||
option_contract_id: "AAPL-2025-02-07-225-C",
|
||||
underlying_id: "AAPL",
|
||||
count: 1,
|
||||
window_ms: 450,
|
||||
total_size: 1800,
|
||||
total_premium: 160_000,
|
||||
total_notional: 16_000_000,
|
||||
nbbo_coverage_ratio: 0.5,
|
||||
nbbo_aggressive_ratio: 0.4,
|
||||
nbbo_aggressive_buy_ratio: 0.4,
|
||||
nbbo_aggressive_sell_ratio: 0.1,
|
||||
nbbo_inside_ratio: 0.08,
|
||||
underlying_mid: 224
|
||||
}
|
||||
});
|
||||
|
||||
const event = buildSmartMoneyEventFromPacket(packet, {
|
||||
eventCalendarMatch: {
|
||||
underlying_id: "AAPL",
|
||||
event_ts: Date.parse("2025-01-31T21:00:00Z"),
|
||||
event_kind: "earnings",
|
||||
announced_ts: Date.parse("2024-12-20T21:00:00Z"),
|
||||
days_to_event: 16.25
|
||||
}
|
||||
});
|
||||
|
||||
expect(event.features.days_to_event).toBeCloseTo(16.25);
|
||||
expect(event.features.expiry_after_event).toBe(true);
|
||||
expect(event.primary_profile_id).toBe("event_driven");
|
||||
});
|
||||
|
||||
it("keeps event-calendar features neutral when no match is available", () => {
|
||||
const packet = buildFlowPacket({
|
||||
id: "flowpacket:no-calendar",
|
||||
source_ts: Date.parse("2025-01-15T15:00:00Z"),
|
||||
features: {
|
||||
option_contract_id: "AAPL-2025-02-07-225-C",
|
||||
underlying_id: "AAPL",
|
||||
total_premium: 160_000,
|
||||
nbbo_coverage_ratio: 0.92
|
||||
}
|
||||
});
|
||||
|
||||
const event = buildSmartMoneyEventFromPacket(packet);
|
||||
expect(event.features.days_to_event).toBeNull();
|
||||
expect(event.features.expiry_after_event).toBeNull();
|
||||
expect(event.features.pre_event_concentration).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue