Skip to content
Victor Kaiuki edited this page Jun 20, 2026 · 1 revision

Command-Line Interface

Installing the package registers the cftc-cot command for quick lookups without writing Python.

cftc-cot --help

Subcommands

Command Description
latest Latest report for a market.
history N-week history for a market.
markets List available markets for a dataset.
index COT Index history for a market.
cftc-cot latest  --dataset legacy --market "Crude Oil"
cftc-cot history --dataset legacy --market "Crude Oil" --weeks 52
cftc-cot markets --dataset legacy
cftc-cot index   --dataset legacy --market "Crude Oil" --window 156 --weeks 156

Global options

These apply to every subcommand and may be placed before or after the subcommand:

Option Choices / default Description
--app-token Socrata API app token for higher rate limits.
--cache memory, disk Enable response caching.
--format table (default), csv, json Output format.
# Equivalent invocations:
cftc-cot --format json latest --dataset legacy --market "Gold"
cftc-cot latest --dataset legacy --market "Gold" --format json

# JSON output, in-memory cache:
cftc-cot --cache memory --format json history --dataset legacy --market "Gold" --weeks 26

Notes

  • --market is a case-insensitive prefix match, so a broad term like "Crude Oil" may match several contracts. Use a more specific name to narrow the result.
  • The index command fetches --weeks of history (default 156) and computes the COT Index with the given --window. See COTAnalysis for the formula.

Clone this wiki locally