Skip to content

Multi Market Analysis

Victor Kaiuki edited this page Jun 16, 2026 · 1 revision

Multi-Market Analysis

from cftc_cot import COTClient, COTAnalysis

client = COTClient()

# Compare energy complex
markets = ["CRUDE OIL", "NATURAL GAS", "HEATING OIL"]
df = client.legacy().markets_in(*markets).last_n_weeks(4).execute()

# Compute net across all
analysis = COTAnalysis(df, classification="legacy")
df = analysis.net_positions()

# Pivot to compare
pivot = df.pivot(index="report_date_as_yyyy_mm_dd", 
                 columns="market_and_exchange_names", 
                 values="noncomm_net")
print(pivot.head())

Clone this wiki locally