-
Notifications
You must be signed in to change notification settings - Fork 0
Analyzing Positions
Victor Kaiuki edited this page Jun 20, 2026
·
2 revisions
from cftc_cot import COTClient, COTAnalysis
client = COTClient()
df = client.legacy().market("Crude Oil").last_n_weeks(156).execute()
analysis = COTAnalysis(df, classification="legacy")
# 1. Net Positions (long - short) per category
df_net = analysis.net_positions()
# 2. Z-Scores (rolling, standardized)
df_z = analysis.z_scores(window=52)
# 3. COT Index (classic 0-100 normalized positioning)
df_index = analysis.cot_index(window=156)
# 4. Extremes (bullish/bearish flags off the COT Index)
df_extremes = analysis.extremes(threshold=0.9)
# 5. Long/Short ratios
df_ratios = analysis.long_short_ratios()
# 6. Week-over-week change in net positions
df_wow = analysis.wow_change()
# 7. Percentile rank of the latest non-commercial net position
pct = analysis.percentile_rank("noncomm_net")
print(f"Current non-commercial net is in the {pct:.0%} percentile of its history")Each enrichment method returns the same internal DataFrame, so you can build up the columns you need. See COTAnalysis for the full method reference and the columns each one adds.
Getting Started
API Reference
Field Reference
Guides
Reference