A skill that searches Kalshi markets for one directional arbitrage
Looks for Arbitrage Opportunities in Kalshi where a game market can never be trading higher than a futures market.
If you haven't installed dependencies yet (or you're in a fresh virtual environment), install them from requirements.txt (it's safe to re-run):
python -m pip install -r requirements.txt
Run the market fetching script that will collect all the potential markets for this task:
python scripts/kalshi_markets.py
This will output all the markets and their primary and secondary rules in a json format. The rules will define the nature of the market.
Assume each market is represented as a JSON object with (at least) the following fields:
ticker (string): unique market identifierrules_primary (string): main resolution rule text (use this as the primary source of truth)rules_secondaryExample market object:
{
"ticker": "KXMLBF5TOTAL-26MAR252005NYYSF-7",
"rules_primary": "If New York Y and San Francisco collectively score more than 6.5 runs in the first 5 innings of the New York Y vs San Francisco professional baseball game originally scheduled for Mar 25, 2026 at 8:05 PM EDT, then the market resolves to Yes.",
"rules_secondary": "If this game is postponed or delayed, the market will remain open and close after the rescheduled game has finished (within two days)."
}
Compare every possible pair of markets to determine if they could end up being a matching market pair. Use these rules to check if this could possibly happen:
For each market (primarily using rules_primary), extract and normalize:
Only consider two markets a plausible matching pair if all are true:
Reject candidate pairs when any of these differ materially:
Treat rules_secondary clauses (e.g., postponement/reschedule windows) as settlement mechanics; they typically do not change the underlying event identity.
Kalshi market titles/rules may use different naming conventions for the same underlying league/team.
Before deciding whether two markets are about the same sport/league/team, normalize the text (especially inside rules_primary) using the alias map.
Basic normalization (apply before alias lookup):
League aliases:
Team aliases:
Notes:
The actual relationship should go be one where the game market for a particular team/player should be less than or equal to a futures market. Some examples of this are:
When proposing a matching market pair, include:
ticker valuesPrint each candidate pair on its own, and keep reasoning concise and specific.