Build / Prediction markets

Weather contract research bot (Kalshi-style)

For temperature, rain and snow style contracts: pulls current weather and forecast hours for the cities you trade and writes a file your own model can read.

PythonrequestsCSV
Weather contract research bot (Kalshi-style): illustrative mockup with sample data
Example build (illustrative). Sample data, not a real product, not real results.

What it does

You list the cities. The script asks the API for current conditions and a few forecast hours for each one, then appends the numbers to signals.csv. That is all it does. It places no orders, holds no exchange keys and does not say what to buy. Your model, your sizing and your orders stay yours. Not affiliated with Kalshi or any other exchange.

  • Contract rules differ by market, and they define which station and which reading counts. Read them. The API gives gridded model and radar data for a point, not any exchange's official settlement source.
  • Forecasts can be wrong. Nothing here shows or promises results of any kind.

GetFixn sells data, not trading advice. Nothing here is investment advice. Forecasts can be wrong. You are responsible for your own strategies and for following the rules of any exchange or market you use. No profit, return or accuracy is promised, and nothing on this page shows trading results.

API calls

Set your key once: export TFX_KEY=tfx_live_.... Free previews need no key.

Current conditions and one forecast hour, per city

request
curl "https://data.truefixr.com/v1/data?dataset=weather&lat=40.78&lon=-73.97&hours_ahead=24"

Optional: county forecast grade for all your cities in one call

request
curl -X POST -H "Authorization: Bearer $TFX_KEY" -H "Content-Type: application/json" -d '{"locations":[{"lat":40.78,"lon":-73.97,"label":"NYC"}],"window":"24h"}' https://data.truefixr.com/v1/portfolio/risk

Code (Python)

Cut down on purpose. Print the real response keys on your first call before you map fields.

kalshi-weather-bot.py
import csv
import os
import time

import requests

API = "https://data.truefixr.com/v1/data"
CITIES = [
    {"label": "NYC", "lat": 40.78, "lon": -73.97},
    {"label": "CHI", "lat": 41.88, "lon": -87.63},
    {"label": "AUS", "lat": 30.27, "lon": -97.74},
]
HOURS = [0, 6, 12, 24, 48]  # hours_ahead accepts 0 to 48
FIELDS = ["ts_utc", "label", "hours_ahead", "valid_time", "temperature_f", "precip_in", "wind_gust_mph", "billed"]


def fetch(city: dict, hours: int) -> dict:
    params = {"dataset": "weather", "lat": city["lat"], "lon": city["lon"], "hours_ahead": hours}
    r = requests.get(API, params=params, timeout=30)
    r.raise_for_status()
    return r.json()


def main() -> None:
    ts = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
    new_file = not os.path.exists("signals.csv")
    with open("signals.csv", "a", newline="") as f:
        out = csv.DictWriter(f, FIELDS)
        if new_file:
            out.writeheader()
        for city in CITIES:
            for h in HOURS:
                d = fetch(city, h)
                out.writerow({
                    "ts_utc": ts, "label": city["label"], "hours_ahead": h,
                    "valid_time": d.get("valid_time"), "temperature_f": d.get("temperature_f"),
                    "precip_in": d.get("precip_in"), "wind_gust_mph": d.get("wind_gust_mph"),
                    "billed": d.get("billed"),
                })
                time.sleep(1.1)  # free previews allow 60 requests a minute per IP


if __name__ == "__main__":
    main()