Skip to main content

Python SDK for Snowtrail Research API - commodities intelligence for systematic trading.

Project description

Snowtrail Python SDK

Python SDK for the Snowtrail Research API - commodities intelligence for systematic trading.

Installation

pip install snowtrail

Quick Start

from snowtrail import Snowtrail

# Initialize the client (uses SNOWTRAIL_API_KEY env var if set)
client = Snowtrail(api_key="your-api-key")

# Get latest GBSI-US system stress signal
df = client.gbsi_us.system_stress()
print(df)

# Get historical data
df = client.gbsi_us.system_stress(
    start="2024-01-01",
    end="2024-12-31",
    limit=500
)

Authentication

Set your API key via environment variable (recommended):

export SNOWTRAIL_API_KEY="your-api-key"
from snowtrail import Snowtrail

# Automatically uses SNOWTRAIL_API_KEY
client = Snowtrail()
df = client.gbsi_us.system_stress()

Or pass it directly:

client = Snowtrail(api_key="your-api-key")

Products

Product Description Frequency
gbsi_us US Natural Gas Balance Stress Index Weekly
gbsi_eu EU Natural Gas Balance Stress Index Daily
pemi Power Event Market Intelligence Daily
glmi Global LNG Market Intelligence Weekly
wrsi Weather Risk Signal Intelligence Daily
wssi_us Weather Storage Shock Index Daily

Usage Examples

GBSI-US (US Natural Gas)

# Signals
df = client.gbsi_us.system_stress()

# Features
df = client.gbsi_us.balance_momentum()
df = client.gbsi_us.storage_inventory()
df = client.gbsi_us.supply_elasticity()
df = client.gbsi_us.features()

# Events
df = client.gbsi_us.storage_surprise()
df = client.gbsi_us.regime_shift()

GBSI-EU (EU Natural Gas)

# Filter by country
df = client.gbsi_eu.system_stress(country="DE")
df = client.gbsi_eu.composite(country="NL")
df = client.gbsi_eu.dispersion()

WRSI (Weather Risk)

# Filter by geography
df = client.wrsi.weather_risk(geography="US")
df = client.wrsi.forecast_dynamics(region_type="state")

Historical Data

All endpoints support date range queries:

# Get history instead of latest
df = client.gbsi_us.system_stress(
    latest=False,
    start="2023-01-01",
    end="2024-01-01",
    limit=1000
)

Error Handling

The SDK automatically retries failed requests (rate limits, server errors) with exponential backoff.

from snowtrail import Snowtrail, AuthenticationError, RateLimitError, NotFoundError, APIError

client = Snowtrail(api_key="your-api-key")

try:
    df = client.gbsi_us.system_stress()
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded after retries")
except NotFoundError:
    print("Endpoint not found")
except APIError as e:
    print(f"API error: {e}")

API Reference

Full API documentation: https://api.snowtrail.ai/docs

Product documentation: https://docs.snowtrail.ai

Support

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

snowtrail-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

snowtrail-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file snowtrail-0.1.0.tar.gz.

File metadata

  • Download URL: snowtrail-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for snowtrail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 103ccdd70e2fc5b732278e0cf5013642e258685ca125e76a00e8b898abbaecb1
MD5 58da905f73543efc03bc0bfeb2925552
BLAKE2b-256 d501a6932ac7d1c833341921a7aa081efdabf7bc787a37122e977a1666b7c93d

See more details on using hashes here.

File details

Details for the file snowtrail-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: snowtrail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for snowtrail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8736f9f9b15dd66003095dc93c98a9d03bc4a0c2d49d0b671b51c51761d8e4d
MD5 64e97e173e5cc40cd2fe0efb98f418f2
BLAKE2b-256 3d6ae3f4d6486aea2ff1eb5f112bd7e265f4508db7ed1a68da64d457d39ee51e

See more details on using hashes here.

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