Treasury Yield Curve
Prediction market positions tie up capital that could earn risk-free yield in Treasuries. When rates are high, a trade needs more edge to justify the opportunity cost. Horizon’s treasury module provides a live yield curve feed (via FRED), yield-adjusted Kelly sizing, breakeven edge calculation, and collateral optimization. All math is in Rust.Overview
Yield-Adjusted Kelly
hz.yield_adjusted_kelly() reduces Kelly size by the risk-free rate opportunity cost.Opportunity Cost
hz.opportunity_cost() and hz.breakeven_edge() quantify the hurdle rate for a trade.Live Yield Feed
TreasuryFeed polls FRED for the full yield curve (1M through 30Y).Collateral Optimizer
hz.collateral_optimizer() adjusts capital allocation based on curve steepness.Core Functions
All math runs in Rust. Every output is guarded against NaN/Inf.hz.yield_adjusted_kelly
Standard Kelly fraction minus the annualized opportunity cost of locked capital.
Returns 0.0 if the edge does not exceed the opportunity cost.
hz.yield_adjusted_kelly_size
Convert yield-adjusted Kelly fraction to a dollar position size.hz.opportunity_cost
Dollar cost of locking capital at the risk-free rate.hz.breakeven_edge
Minimum edge required to beat the risk-free rate.Feed
TreasuryFeed
Polls the Federal Reserve Economic Data (FRED) API for yield curve data.
Default series: DGS1MO, DGS3MO, DGS6MO, DGS1, DGS2, DGS5, DGS10, DGS20, DGS30.
FeedSnapshot mapping:
price= primary series yield (decimal)bid= short-term yield (DGS3MO)ask= long-term yield (DGS30)volume_24h= curve slope in basis points (long - short)
Pipeline Functions
hz.yield_adjusted_sizer
Size positions using yield-adjusted Kelly each cycle.
Returns each cycle:
hz.opportunity_cost_filter
Skip trades where edge does not justify the opportunity cost.hz.collateral_optimizer
Adjusts capital allocation based on yield curve steepness.
Steeper curves reduce allocation (higher opportunity cost of capital).
Examples
Yield-Aware Market Making
Mathematical Background
Yield-Adjusted Kelly
Yield-Adjusted Kelly
Standard Kelly: f = (p - q) / (b - 1)* where p is probability, q = 1-p, and b is the payout odds.Yield adjustment subtracts the annualized opportunity cost:f_adj = max(0, f - rfr * duration / 365) * fraction*When the risk-free rate is high relative to the edge, the adjusted fraction drops to zero, meaning the trade is not worth taking.
Breakeven Edge
Breakeven Edge
The minimum edge that justifies locking capital:breakeven = rfr * duration / 365At 5% rates and a 30-day hold, the breakeven is about 0.41%. Any edge below that is better invested in T-bills.
Opportunity Cost
Opportunity Cost
Dollar cost of capital deployment:cost = notional * rfr * duration / 365This represents the forgone interest on the locked collateral.