Commitment of Traders
Obtains the CFTC Commitment of Traders (COT) report for the tickers the Toolkit was initialized with. Published weekly by the U.S. Commodity Futures Trading Commission, it breaks down open interest in futures markets by trader type – Non-Commercial (large speculators), Commercial (hedgers) and Non-Reportable (small traders) – and is widely used to gauge positioning and sentiment in commodity, currency, interest rate and stock index futures markets.
Note that this data is only available for CFTC-tracked futures markets. Tickers without a corresponding futures contract (e.g. most individual equities) return no data.
Also known as: COT report, CFTC positioning data, speculator/hedger positioning.
Commitment of Traders in Python
get_commitment_of_traders is part of the Toolkit module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_commitment_of_traders as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["NG", "GC"], api_key="FINANCIAL_MODELING_PREP_KEY")
commitment_of_traders = toolkit.get_commitment_of_traders()
commitment_of_traders.xs("NG", level=1, axis=1)[
["Open Interest", "Non-Commercial Long", "Non-Commercial Short", "Commercial Long", "Commercial Short"]
].tail()
Which returns:
| date | Open Interest | Non-Commercial Long | Non-Commercial Short | Commercial Long | Commercial Short |
|---|---|---|---|---|---|
| 2024-01-30 00:00:00 | 1471807 | 279539 | 382722 | 526952 | 450698 |
| 2024-02-06 00:00:00 | 1533041 | 301020 | 415251 | 539246 | 456560 |
| 2024-02-13 00:00:00 | 1554063 | 334504 | 471061 | 552780 | 453300 |
| 2024-02-20 00:00:00 | 1592460 | 356334 | 510206 | 567791 | 452247 |
| 2024-02-27 00:00:00 | 1500882 | 326328 | 467881 | 545380 | 433185 |
Parameters
get_commitment_of_traders accepts the following parameters:
- overwrite (bool): Defines whether to overwrite the existing data.