Commitment Of Traders Report

Original (English)

Commitment Of Traders Report

The Commitments of Traders (COT) is a market report by the Commodity Futures Trading Commission (CFTC), listing the holdings of participants in futures of financial instruments, metals, and other commodities. It is believed by some traders to give insight into the upcoming development of those markets. The CFTC releases a new report every Friday at 3:30 p.m. Eastern Time, and the report reflects the commitments of traders on the prior Tuesday.

The following functions return selected parts of the COT report, and work likewise in backtest and live trading:

COT (int Handle, string Code, int Field): var

Downloads the COT report with the given Quandl Code and stores it in the dataset with the given Handle. Returns the position determined by the Field number for the time of the current bar. If the dataset already exists, the data is not loaded again, but only the position returned.

COT_CommercialPos (int Handle, string Code): int

As before, but returns the net commercials position, i.e. the difference producer + swap dealer longs - producer + swap dealer shorts.

COT_CommercialIndex (int Handle, string Code, int TimePeriod): var

As before, but returns the commercials net position normalized over the given TimePeriod and scaled to 0..100.

COT_OpenInterest (int Handle, string Code): var

As before, but returns the open interest.

Returns:

Positions, net positions, or index.

Parameters:

Handle Dataset handle for storing the report. Every report needs a dedicated handle.
Code The Quandl code number of the report; normally 6 digits or letters. Can be looked up under https://www.quandl.com/data/CFTC-Commodity-Futures-Trading-Commission-Reports. The "CTFC/" prefix and "_F_ALL" suffix of the Quandl database are automatically added.
Field The field of the report: 1 = open interest, 2 = producer long positions, 3 = producer short positions, 4 = swap dealer long positions, 5 = swap dealer short positions, 6 = noncommercials long positions, 7 = noncommercials short positions. 
TimePeriod The number of bars for normalizing the index.

 

Remarks:

  • For retrieving the COT report, Zorro S and a Quandl key is required (to be entered in Zorro.ini).
  • The report is only downloaded when needed at the begin of the strategy. Subsequent function calls access the dataset only. Downloaded reports are stored in the History folder.
  • The source code of COT functions can be found in contract.c, which must be included. Note that the functions use the new COT report structure with the field names listed in the comment. If you're downlaoding a COT report with a different structure, copy the COT functions in your script and adapt the conversion string as described under dataParse.

Example:

#include <contract.c>
    
    // Database symbols and codes below are just for illustration.
    // Current available symbols can be found on the Quandl / NASDAQ website.
    function run()
    {
      StartDate = 2018;
      EndDate = 2023;
      BarPeriod = 1440;
      LookBack = 12*20;
      set(PLOTNOW);
      
      assetAdd("GOLD","YAHOO:GC=F");
      asset("GOLD");
      string COT_Code = "088691";
      var Ind = COT_CommercialIndex(1,COT_Code,6*20); // gold COT report
      plot("Fast Index",Ind,NEW,RED);
      var Ind2 = COT_CommercialIndex(1,COT_Code,12*20);
      plot("Slow Index",Ind2,0,BLUE);
      var Ind3 = COT_OpenInterest(1,COT_Code);
      plot("Open Interest",Ind3,NEW,BLACK);
    }

See also:

asset, season, dataFromQuandl

► latest version online

Übersetzung (Deutsch)

Commitment Of Traders Bericht

Der Commitments of Traders (COT) ist ein Marktbericht der Commodity Futures Trading Commission (CFTC), der die Bestände der Teilnehmer an Futures für Finanzinstrumente, Metalle und andere Rohstoffe auflistet. Einige Trader glauben, dass er Einblicke in die bevorstehende Entwicklung dieser Märkte gibt. Die CFTC veröffentlicht jeden Freitag um 15:30 Uhr Eastern Time einen neuen Bericht, und der Bericht spiegelt die Commitments der Trader am vorherigen Dienstag wider.

Die folgenden Funktionen geben ausgewählte Teile des COT-Berichts zurück und funktionieren gleichermaßen im Backtest und im Live-Handel:

COT (int Handle, string Code, int Field): var

Lädt den COT-Bericht mit dem gegebenen Quandl Code herunter und speichert ihn im Datensatz mit dem gegebenen Handle. Gibt die Position zurück, die durch die Field-Nummer zum Zeitpunkt der aktuellen Bar bestimmt wird. Wenn der Datensatz bereits existiert, werden die Daten nicht erneut geladen, sondern nur die Position zurückgegeben.

COT_CommercialPos (int Handle, string Code): int

Wie zuvor, aber gibt die Nettoposition der Commercials zurück, d.h. die Differenz Produzenten + Swap-Dealer Long-Positionen - Produzenten + Swap-Dealer Short-Positionen.

COT_CommercialIndex (int Handle, string Code, int TimePeriod): var

Wie zuvor, aber gibt die Nettoposition der Commercials normalisiert über den gegebenen TimePeriod und auf 0..100 skaliert zurück.

COT_OpenInterest (int Handle, string Code): var

Wie zuvor, aber gibt das Open Interest zurück.

Rückgabewerte:

Positionen, Nettopositionen oder Index.

Parameter:

Handle Datensatz-Handle zum Speichern des Berichts. Jeder Bericht benötigt ein dediziertes Handle.
Code Die Quandl-Code-Nummer des Berichts; normalerweise 6 Stellen oder Buchstaben. Kann unter https://www.quandl.com/data/CFTC-Commodity-Futures-Trading-Commission-Reports nachgeschlagen werden. Der "CTFC/" Präfix und der "_F_ALL" Suffix der Quandl-Datenbank werden automatisch hinzugefügt.
Field Das Feld des Berichts: 1 = Open Interest, 2 = Produzenten Long-Positionen, 3 = Produzenten Short-Positionen, 4 = Swap-Dealer Long-Positionen, 5 = Swap-Dealer Short-Positionen, 6 = Noncommercials Long-Positionen, 7 = Noncommercials Short-Positionen. 
TimePeriod Die Anzahl der Bars zur Normalisierung des Index.

 

Anmerkungen:

  • Für das Abrufen des COT-Berichts sind Zorro S und ein Quandl-Schlüssel erforderlich (der in Zorro.ini eingegeben werden muss).
  • Der Bericht wird nur heruntergeladen, wenn er zu Beginn der Strategie benötigt wird. Nachfolgende Funktionsaufrufe greifen nur auf den Datensatz zu. Heruntergeladene Berichte werden im History Ordner gespeichert.
  • Der Quellcode der COT-Funktionen befindet sich in contract.c, das eingebunden werden muss. Beachten Sie, dass die Funktionen die neue COT Berichtsstruktur mit den im Kommentar aufgeführten Feldnamen verwenden. Wenn Sie einen COT-Bericht mit einer anderen Struktur herunterladen, kopieren Sie die COT Funktionen in Ihr Skript und passen Sie die Konvertierungszeichenfolge an, wie unter dataParse beschrieben.

Beispiel:

#include <contract.c>
    
    // Datenbanksymbole und Codes unten dienen nur zur Veranschaulichung.
    // Aktuell verfügbare Symbole finden Sie auf der Quandl / NASDAQ Webseite.
    function run()
    {
      StartDate = 2018;
      EndDate = 2023;
      BarPeriod = 1440;
      LookBack = 12*20;
      set(PLOTNOW);
      
      assetAdd("GOLD","YAHOO:GC=F");
      asset("GOLD");
      string COT_Code = "088691";
      var Ind = COT_CommercialIndex(1,COT_Code,6*20); // gold COT Bericht
      plot("Fast Index",Ind,NEW,RED);
      var Ind2 = COT_CommercialIndex(1,COT_Code,12*20);
      plot("Slow Index",Ind2,0,BLUE);
      var Ind3 = COT_OpenInterest(1,COT_Code);
      plot("Open Interest",Ind3,NEW,BLACK);
    }

Siehe auch:

asset, season, dataFromQuandl

► neueste Version online