Package: pycot-reports
pycotpycot is a easy to use python library for interacting with theCFTC Commitment of Tradersreports.Installationpip install pycot-reportsRequirementspandasrequestsHow to usefrompycotimportreportsdf=reports.legacy_report(report_type="legacy_fut",contract_name=("FED FUNDS - CHICAGO BOARD OF TRADE","30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE"))How do I get cached results?If you want to retrieve data from the same report multiple times, you can use thecot_reportfunction. This will cache the results of the previous function call.Lets have a look at an example:frompycot.reportsimportcot_report,legacy_reportfed_funds_contract=("FED FUNDS - CHICAGO BOARD OF TRADE","30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE")fed_funds_df=cot_report(legacy_report(),fed_funds_contract)# will load the full report (~ 10-15 seconds)bbg_contract=("BBG COMMODITY - CHICAGO BOARD OF TRADE","BLOOMBERG COMMODITY INDEX - CHICAGO BOARD OF TRADE")bbg_df=cot_report(legacy_report(),bbg_contract)# cached, will not load the full report againReport TypesLegacy Report (All Contracts)frompycot.reportsimportlegacy_reportcontract_name=("FED FUNDS - CHICAGO BOARD OF TRADE","30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE")df=legacy_report("legacy_fut",contract_name)Output Example:Contract Name  Open Interest  ...  Net Change, Large Spec  Net % of OI, Large SpecDate                                                                      ...2023-07-11             FED FUNDS - CHICAGO BOARD OF TRADE      1440370.0  ...                -58101.0                    -11.52023-07-03             FED FUNDS - CHICAGO BOARD OF TRADE      1414525.0  ...                -17553.0                     -7.52023-06-27             FED FUNDS - CHICAGO BOARD OF TRADE      1746984.0  ...                 12437.0                     -5.12023-06-20             FED FUNDS - CHICAGO BOARD OF TRADE      1693141.0  ...                 84512.0                     -6.02023-06-13             FED FUNDS - CHICAGO BOARD OF TRADE      1556681.0  ...                 60704.0                    -12.0...                                                   ...            ...  ...                     ...                      ...1993-03-23  30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE        11298.0  ...                   106.0                      9.11993-03-16  30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE        11015.0  ...                    -8.0                      8.31993-03-09  30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE        10651.0  ...                   -51.0                      8.81993-03-02  30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE        10902.0  ...                  -190.0                      9.01993-02-23  30-DAY FEDERAL FUNDS - CHICAGO BOARD OF TRADE        12460.0  ...                   -83.0                      9.4...Disaggregated Report (Commodities)frompycot.reportsimportdisaggregated_reportcontract_name=("BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE","BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE EXCHANGE")df=disaggregated_report("disaggregated_futopt",contract_name)Output Example:Contract Name  Open Interest   ...  Net Change Managed Money  Net % of OI Managed MoneyDate                                                                           ...2023-07-11      BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE       138358.0   ...                  -2134.0                        -2.92023-07-03      BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE       130715.0   ...                   9436.0                        -1.42023-06-27      BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE       153190.0   ...                  -6135.0                        -7.42023-06-20      BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE       148800.0   ...                   2367.0                        -3.52023-06-13      BRENT LAST DAY - NEW YORK MERCANTILE EXCHANGE       147598.0   ...                  -3872.0                        -5.1...                                                       ...            ...                            ...                         ...2011-04-12  BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE...        20546.0   ...                   -484.0                        17.12011-04-05  BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE...        19533.0   ...                    655.0                        20.42011-03-29  BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE...        18178.0   ...                   -276.0                        18.42011-03-15  BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE...        20233.0   ...                    231.0                        17.92011-03-08  BRENT CRUDE OIL LAST DAY - NEW YORK MERCANTILE...        19639.0   ...                      NaN                        17.3...Financial Report (Financial Instruments)frompycot.reportsimportfinancial_reportcontract_name=("UST 10Y NOTE - CHICAGO BOARD OF TRADE","10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF TRADE","10 YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF TRADE")df=financial_report("traders_in_financial_futures_fut",contract_name)Output Example:Contract Name  Open Interest   ...  Net Change Lev Money  Net % of OI Lev MoneyDate                                                                           ...2023-07-11              UST 10Y NOTE - CHICAGO BOARD OF TRADE      4800091.0   ...              155532.0                  -26.82023-07-03              UST 10Y NOTE - CHICAGO BOARD OF TRADE      4737762.0   ...                7710.0                  -30.42023-06-27              UST 10Y NOTE - CHICAGO BOARD OF TRADE      4663919.0   ...              -51457.0                  -31.12023-06-20              UST 10Y NOTE - CHICAGO BOARD OF TRADE      4641767.0   ...              -53136.0                  -30.22023-06-13              UST 10Y NOTE - CHICAGO BOARD OF TRADE      4619668.0   ...               69602.0                  -29.1...                                                       ...            ...   ...                   ...                    ...2006-07-11  10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF...      2112145.0   ...               28199.0                    1.82006-07-03  10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF...      2136459.0   ...              -18122.0                    0.52006-06-27  10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF...      2194364.0   ...               13929.0                    1.32006-06-20  10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF...      2097072.0   ...              -27203.0                    0.62006-06-13  10-YEAR U.S. TREASURY NOTES - CHICAGO BOARD OF...      1912279.0   ...                   NaN                    2.2...Contract NamesThe only tricky part is the contract name.You can find the contract name in theCFTC Commitment of Tradersreports. The contract name is the first column in the report.You can also find a curated list of contract names in thecontract_names.jsonRelease SheduleThe CFTCreleasesthe reports every Friday at 3:30pm Eastern Time.