Skip to content

Instantly share code, notes, and snippets.

View tom-wagner's full-sized avatar

Tom Wagner tom-wagner

View GitHub Profile
@tom-wagner
tom-wagner / kalshiNFL.md
Last active September 28, 2025 21:57
Kalshi NFL workflow

Full Order Pipeline Overview

This pipeline turns market data and probabilistic forecasts into executable orders by fusing rating inputs, Monte Carlo simulations, and Kalshi order book intelligence into a single automated run.

  1. Assemble Inputs – Pull team power ratings, load the win distribution tables published by Inpredict NFL to anchor game-level priors, and ingest the latest Kalshi win-total, exact-win, and futures order books.
  2. Run Season Simulationsnfl/scripts/bash/simulate_win_totals_and_exact_wins_and_futures runs a league-wide Monte Carlo that samples the Inpredict odds, applies custom tie-breaker logic for division and conference standings, and stores outcome frequencies for every team and market tenor.
  3. Summarize Outputs – The simulator exports distributions for season win totals, exact win counts, and futures probabilities, which become the quantitative inputs for pricing edges against Kalshi markets.
  4. Refresh Position State – `scrip
@tom-wagner
tom-wagner / draftkings.js
Last active November 7, 2024 16:01
Draftkings instructions
// const axios = require('axios');
// const cheerio = require('cheerio');
// const fs = require('fs')
// Set headers
const headers = {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9,la;q=0.8",
// "priority": "u=1, i",
"sec-ch-ua": "\"Chromium\";v=\"130\", \"Google Chrome\";v=\"130\", \"Not?A_Brand\";v=\"99\"",
"sec-ch-ua-mobile": "?0",
# raw data as of 5:01pm EST on 10/31
raw_data = {'status': {'cd': 0, 'mg': 'successful', 'tp': 'A'},
'value': {
'L:101': {'so': 0, 'pl': [{'cd': '9', 'cn': 89, 'tc': 556}]},
'L:103': {'so': 0, 'pl': [{'cd': '9', 'cn': 94, 'tc': 519}]},
'L:105': {'so': 0, 'pl': [{'cd': '9', 'cn': 89, 'tc': 656}]},
'L:107': {'so': 0, 'pl': [{'cd': '3', 'cn': 31, 'tc': 537}]},
'L:108': {'so': 0, 'pl': [{'cd': '3', 'cn': 0, 'tc': 701}]},
'L:109': {'so': 0, 'pl': [{'cd': '2', 'cn': 18, 'tc': 534},
@tom-wagner
tom-wagner / likelihoods.py
Created August 23, 2019 05:33
Likelihoods used to run CFB simulations
LIKELIHOODS = {0.0: 0.5, 0.1: 0.5, 0.2: 0.5, 0.3: 0.5, 0.4: 0.5, 0.5: 0.5, 0.6: 0.5, 0.7: 0.52, 0.8: 0.52, 0.9: 0.52,
1.0: 0.52, 1.1: 0.52, 1.2: 0.52, 1.3: 0.52, 1.4: 0.52, 1.5: 0.52, 1.6: 0.52, 1.7: 0.52, 1.8: 0.52,
1.9: 0.52, 2.0: 0.52, 2.1: 0.52, 2.2: 0.55, 2.3: 0.55, 2.4: 0.55, 2.5: 0.55, 2.6: 0.55, 2.7: 0.55,
2.8: 0.55, 2.9: 0.55, 3.0: 0.55, 3.1: 0.55, 3.2: 0.55, 3.3: 0.58, 3.4: 0.58, 3.5: 0.58, 3.6: 0.58,
3.7: 0.58, 3.8: 0.58, 3.9: 0.58, 4.0: 0.58, 4.1: 0.58, 4.2: 0.58, 4.3: 0.58, 4.4: 0.58, 4.5: 0.58,
4.6: 0.58, 4.7: 0.58, 4.8: 0.61, 4.9: 0.61, 5.0: 0.61, 5.1: 0.61, 5.2: 0.61, 5.3: 0.61, 5.4: 0.61,
5.5: 0.61, 5.6: 0.61, 5.7: 0.61, 5.8: 0.61, 5.9: 0.61, 6.0: 0.61, 6.1: 0.61, 6.2: 0.61, 6.3: 0.61,
6.4: 0.64, 6.5: 0.64, 6.6: 0.64, 6.7: 0.64, 6.8: 0.64, 6.9: 0.64, 7.0: 0.64, 7.1: 0.64, 7.2: 0.64,
7.3: 0.64, 7.4: 0.64, 7.5: 0.64, 7.6: 0.64, 7.7: 0.64, 7.8: 0.64, 7.9: 0.64, 8.0: 0.64, 8.1:
@tom-wagner
tom-wagner / pg.py
Last active March 12, 2019 00:28
python set playground
# Let's write some functions to explore set math a bit more.
# We're going to be using this COURSES dict in all of the examples. Don't change it, though!
# So, first, write a function named covers that accepts a single parameter, a set of topics.
# Have the function return a list of courses from COURSES where the supplied set and the course's value (also a set) overlap.
# For example, covers({"Python"}) would return ["Python Basics"].
COURSES = {
"Python Basics": {"Python", "functions", "variables",
"booleans", "integers", "floats",
"arrays", "strings", "exceptions",
@tom-wagner
tom-wagner / sprintly11.py
Last active March 11, 2019 18:24
sprintly11.py
import re
def rotate_if_letter(char):
if re.search('[a-zA-Z]', char):
return chr(ord(char) + 13) if re.search('[a-mA-M]', char) else chr(ord(char) - 13)
return char
def rot13(message):
return ''.join([rotate_if_letter(char) for char in message])
@tom-wagner
tom-wagner / sprintly10.js
Created March 4, 2019 22:27
sprintly 10!!
// iterative solution --> time complexity O(width * height * height) aka n^3
const gridSum = (grid) => {
const upsideDownGrid = grid.reverse();
let maxSum = 0;
for (let i = 0; i < upsideDownGrid.length; i++) {
let currSum = 0;
let maxForRow = 0;
for (let j = 0; j < upsideDownGrid[i].length; j++) {
if (upsideDownGrid[i][j] === 1) {
const generateNextIteration = (arr, patterns) => {
return arr.map((val, idx) => {
const currentPattern = arr[idx - 2] + arr[idx - 1] + arr[idx] + arr[idx + 1] + arr[idx + 2];
return patterns.hasOwnProperty(currentPattern) ? patterns[currentPattern] : '.';
});
};
const pad50 = () => new Array(50).fill('.');
const addPadding = (arr) => [...pad50(), ...arr, ...pad50()];
// let arr = [
// { position: [9, 1], velocity: [0, 2] },
// { position: [7, 0], velocity: [-1, 0] },
// { position: [3, -2], velocity: [-1, 1] },
// { position: [6, 10], velocity: [-2, -1] },
// { position: [2, -4], velocity: [2, 2], },
// { position: [-6, 10], velocity: [2, -2] },
// { position: [1, 8], velocity: [1, -1] },
// { position: [1, 7], velocity: [1, 0] },
// { position: [-3, 11], velocity: [1, -2] },
const polymer = (string) => {
const arr = string.split('');
const stack = [];
for (let i = 0; i < arr.length; i++) {
let lastStackVal = stack[stack.length - 1];
let currOppositeCase = arr[i] === arr[i].toUpperCase() ? arr[i].toLowerCase() : arr[i].toUpperCase();
if (lastStackVal === currOppositeCase) {
stack.pop();
} else {
stack.push(arr[i]);