Skip to main content

Python SDK for Therminal — Kalshi temperature prediction markets + NWS weather data

Project description

therminal-py

Python SDK for Therminal — Kalshi temperature prediction markets + NWS weather data + real-time METAR signaling.

Install

pip install therminal-py            # core
pip install therminal-py[pandas]    # + DataFrame + Parquet support
pip install therminal-py[ml]        # + scikit-learn ML features
pip install therminal-py[torch]     # + PyTorch Dataset
pip install therminal-py[cli]       # + CLI tool
pip install therminal-py[all]       # pandas + ml + cli

Requires Python 3.11+.

Quick Start

from therminal.weather import WeatherClient, LiveClient
from therminal.markets import MarketsClient

# Historical observations (via therminal-api)
weather = WeatherClient()
obs = weather.observations(station="NYC", units="metric", as_dataframe=True)

# Live METAR (direct from AWC — same Observation schema as historical)
live = LiveClient()
current = live.current("NYC")
print(current[0].temp_f)

# Batch: one AWC request for multiple stations
batch = live.current(["NYC", "ATL", "MDW", "LAX"])

# Market candles
markets = MarketsClient()
df = markets.candles(market="KXHIGHNY-26MAR20-T50", from_date="2026-03-01", as_dataframe=True)

Backward compatible: from therminal import TherminalClient still works.

Configuration

Create ~/.therminal.toml for sensible defaults:

[defaults]
units = "metric"
station = "NYC"

[api]
base_url = "https://api.mostlyright.xyz"

Resolution order: file < env vars (THERMINAL_UNITS, THERMINAL_TZ, THERMINAL_STATION) < per-call kwargs.

Live METAR (AWC Direct)

LiveClient fetches real-time METAR from the Aviation Weather Center. Returns Observation objects identical in schema to WeatherClient.observations(), eliminating train/serve skew for trading signals.

from therminal.weather import LiveClient

live = LiveClient()
obs = live.current(["NYC", "ATL"])         # batch: one request
history = live.latest("NYC", hours=3)      # last 3 hours
metric = live.current("NYC", units="metric")  # with conversion

ML Features (scikit-learn)

pip install therminal-py[ml]
from therminal.ml import WeatherFeatures, LOBFeatures
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import GradientBoostingRegressor

pipe = make_pipeline(
    WeatherFeatures(station="ATL", sources=["omo", "metar"], lookback_hours=24),
    StandardScaler(),
    GradientBoostingRegressor(),
)
pipe.fit(dates_train, y_train)
pipe.predict(dates_test)

Typed Models

All responses return frozen dataclasses with both attribute and dict-style access:

obs = weather.observations(station="NYC")[0]
obs.temp_f          # attribute access
obs["temp_f"]       # dict access (backward compat)
obs.get("temp_f")   # .get() with default
obs.to_dict()       # full dict with all 29 fields

Documentation

Full API reference with interactive playground: docs.mostlyright.xyz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

therminal_py-1.0.3.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

therminal_py-1.0.3-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file therminal_py-1.0.3.tar.gz.

File metadata

  • Download URL: therminal_py-1.0.3.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for therminal_py-1.0.3.tar.gz
Algorithm Hash digest
SHA256 771b62ffc937fff3233d332366e552ae358ef5597db17045ed0f2dbac782e0ac
MD5 7df819d2589a8b305cab9992afde9ce7
BLAKE2b-256 5ba7eccf6464dd411cc25471f0a5f7532316131fddf9f79a750ac66f37378807

See more details on using hashes here.

Provenance

The following attestation bundles were made for therminal_py-1.0.3.tar.gz:

Publisher: publish.yml on Tarabcak/therminal-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file therminal_py-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: therminal_py-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for therminal_py-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 af5c1d64feeeff22214eeccebf203aeba86231b74c9f468855e62164a12a9b6e
MD5 4d0a34a957c6217e6fc4332b909e8a39
BLAKE2b-256 f92b129edf54df14b312ba8e0e72758aacbff6c4e48d2b87f42f1820cfb5a701

See more details on using hashes here.

Provenance

The following attestation bundles were made for therminal_py-1.0.3-py3-none-any.whl:

Publisher: publish.yml on Tarabcak/therminal-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page