Skip to main content
Ultra Feature. Requires an Ultra subscription. Get started at api.mathematicalcompany.com

Calendar Events

Major economic events (FOMC decisions, CPI releases) cause sharp moves in prediction markets. Horizon’s calendar module provides a live event feed, bundled FOMC/CPI dates through 2026, and pipeline functions for time-decay sizing and pre-event risk reduction. The feed maps event data to standard FeedSnapshot fields for seamless pipeline integration.

Overview

Event Feed

CalendarFeed tracks the nearest event with seconds-to-event countdown.

Time Decay

hz.time_decay() reduces position size as events approach.

Event Countdown

hz.event_countdown() exposes event data for downstream use.

Pre-Event Strategy

hz.pre_event_strategy() automatically reduces exposure before events.

Feed

CalendarFeed

Parses bundled or custom event data and tracks the nearest future event.
import horizon as hz

# Uses bundled FOMC + CPI dates automatically
feed = hz.CalendarFeed()

# Or with a custom API
feed = hz.CalendarFeed(api_url="https://api.example.com/events")
ParameterTypeDefaultDescription
events_jsonstrbundled datesJSON array of event objects
api_urlstr""Optional REST API for event data
intervalfloat300.0Poll interval in seconds
Bundled events include FOMC meeting dates and CPI release dates from 2024 through 2026. FeedSnapshot mapping:
  • price = urgency score (0.0 to 1.0, higher as event approaches)
  • bid = seconds to next event
  • ask = event type code (FOMC=1.0, CPI=2.0, NFP=3.0, GDP=4.0, EARNINGS=5.0)
  • volume_24h = days to next event
  • source = "calendar:EVENT_NAME"

Pipeline Functions

hz.time_decay

Reduce position size as events approach.
decay = hz.time_decay(
    calendar_feed="calendar",
    max_days=30.0,
    decay_type="linear",  # or "exponential", "sqrt"
)
ParameterTypeDefaultDescription
calendar_feedstr"calendar"Feed name for calendar data
max_daysfloat30.0Days at which decay factor reaches 1.0
decay_typestr"linear"Decay curve: linear, exponential, or sqrt
Returns each cycle:
{
    "time_decay_factor": 0.67,   # multiply position size by this
    "days_to_event": 20.0,
    "event_urgency": 0.33,
    "event_type_code": 1.0,      # FOMC
}

hz.event_countdown

Expose raw event countdown data for downstream pipeline use.
countdown = hz.event_countdown(calendar_feed="calendar")
ParameterTypeDefaultDescription
calendar_feedstr"calendar"Feed name
Returns each cycle:
{
    "seconds_to_event": 172800.0,
    "event_name": "FOMC 2026-03-18",
    "event_type_code": 1.0,
    "urgency": 0.33,
    "days_to_event": 2.0,
}

hz.pre_event_strategy

Automatically reduce exposure as events approach, with a linear ramp.
pre_event = hz.pre_event_strategy(
    calendar_feed="calendar",
    reduce_hours=24.0,      # start reducing 24h before
    reduce_factor=0.5,      # minimum 50% of normal size
)
ParameterTypeDefaultDescription
calendar_feedstr"calendar"Feed name
reduce_hoursfloat24.0Hours before event to start reducing
reduce_factorfloat0.5Minimum size multiplier at event time
Returns each cycle:
{
    "size_multiplier": 0.75,
    "pre_event": True,
    "seconds_to_event": 43200.0,
    "event_name": "FOMC 2026-03-18",
}

Examples

Event-Aware Trading

import horizon as hz

def my_strategy(ctx):
    if ctx.feed is None or ctx.feed.price <= 0:
        return []
    multiplier = ctx.params.get("size_multiplier", 1.0)
    size = int(10 * multiplier)
    if size < 1:
        return []
    return hz.quotes(fair=ctx.feed.price, spread=0.04, size=size)

hz.run(
    name="event_aware",
    exchange=hz.Polymarket(),
    feeds={
        "market": hz.PolymarketBook("will-fed-cut-rates"),
        "calendar": hz.CalendarFeed(),
    },
    pipeline=[
        hz.pre_event_strategy(reduce_hours=24, reduce_factor=0.3),
        hz.time_decay(max_days=7, decay_type="sqrt"),
        my_strategy,
    ],
)

Custom Event Data

import json
import horizon as hz

events = [
    {"name": "Earnings AAPL", "timestamp": 1711900800, "type": "earnings"},
    {"name": "Custom Event", "timestamp": 1712000000, "type": "other"},
]

feed = hz.CalendarFeed(events_json=json.dumps(events))

Event Type Codes

CodeEvent Type
1.0FOMC
2.0CPI
3.0NFP (Non-Farm Payrolls)
4.0GDP
5.0Earnings
6.0PPI
7.0PCE
99.0Other