Skip to main content

Python SDK for CFTC Commitments of Traders data

Project description

CFTC COT SDK

PyPI License: MIT

A robust, verified Python SDK for accessing, querying, and analyzing CFTC Commitments of Traders (COT) data.

Overview

The cftc-cot SDK provides a fluent, production-ready interface for the CFTC's SODA2 API. It simplifies the complexity of querying 6 different CFTC datasets, handles API-specific naming quirks, and provides powerful post-fetch analysis tools.

Key Features

  • Fluent API: Chainable query building for intuitive data retrieval.
  • Production-Tested: Verified field mappings and API interactions against live CFTC data.
  • Advanced Analysis: Built-in metrics including Net Positions, Z-Scores, and extreme positioning detection.
  • Robust Field Handling: Preserves official API quirks (typos, naming inconsistencies) using structured field constants.
  • Production Ready: Full type hinting, comprehensive exception hierarchy, and rate-limiting support via app tokens.

Installation

pip install cftc-cot-soda

Quick Start

from cftc_cot import COTClient, COTAnalysis

# Initialize client
client = COTClient()

# Query: 52-week history of Crude Oil positioning
df = client.legacy().market("Crude Oil").last_n_weeks(52).execute()

# Analyze: Compute net positions and Z-scores
analysis = COTAnalysis(df, classification="legacy")
df_analyzed = analysis.z_scores()

print(df_analyzed[['report_date_as_yyyy_mm_dd', 'noncomm_net', 'noncomm_net_zscore']].tail())

Documentation

For a complete API reference, guides, and dataset specifications, please visit our GitHub Wiki.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

cftc_cot_soda-0.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

cftc_cot_soda-0.1.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file cftc_cot_soda-0.1.1.tar.gz.

File metadata

  • Download URL: cftc_cot_soda-0.1.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for cftc_cot_soda-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b091184b7621fc016e64570bdb00f6516af61e3dfedaee97701d75ee567f691a
MD5 18e680833703bc8096e29d8bd1128a7b
BLAKE2b-256 cf2f8387b8c17eff1a95e8541accb3b4b3c7f658849be099752c3f9158502786

See more details on using hashes here.

File details

Details for the file cftc_cot_soda-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cftc_cot_soda-0.1.1-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.13.5

File hashes

Hashes for cftc_cot_soda-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4291d6d1e69f81d598e4de82e8336b74cfd4b3637a183fe912417741d941a5c1
MD5 8e11ffe04ac8e3ea9cb8fb4f385644bc
BLAKE2b-256 90765e59e7ebd091e68e27a65f7ae99f4c77293e691e480c2658c08f6b1d2fa7

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