C# COT Report

Discussion in 'Silver' started by Niveka, May 27, 2015.

  1. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I don't know if there are any other C# programmers out there but I thought I would offer up a class I have just written for anyone who may use it. It's a COTReport class, when you create an instance of the class it goes out to the CFTC site and pulls down the latest COT data. I've written a small application that uses the class to keep a running history of the COT reports, of course there is only one report showing in the image because I just wrote the app but as new reports come out they will be displayed in chronological order grouped by commodity type. Here is an image of the app.

    [​IMG]

    Let me know if you want the source to the COTReport class, or I suppose I could also share the app for non-programmers if there is any interest. Also, if you have any suggestions for improving the app I'd be interested.
     
  2. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I made some changes to include the Net positions divided by Supply & Demand based on Pirocco's guidence. Thanks Pirocco.

    [​IMG]
     
  3. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I added data on the demand side for the Non-Reportable category. Notice now that the Net Change is the same (except for inverted) for both Supply & Demand. Thanks again Pirocco.

    [​IMG]
     
  4. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    Some have asked if it would be possible to process all the historical COT reports. I have added this feature:

    [​IMG]
     
  5. willrocks

    willrocks Well-Known Member Silver Stacker

    Joined:
    May 10, 2012
    Messages:
    7,778
    Likes Received:
    7,199
    Trophy Points:
    113
    Can you put it on Github, or somewhere public?
     
  6. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I can definitely do that soon. I banged this out in a day so I will want to spend the weekend polishing it first. Also, if you you have any suggestions on how to make it better now's the time.
     
  7. willrocks

    willrocks Well-Known Member Silver Stacker

    Joined:
    May 10, 2012
    Messages:
    7,778
    Likes Received:
    7,199
    Trophy Points:
    113
    Export to Excel or CSV would be good.
     
  8. BlackSheep

    BlackSheep Well-Known Member Silver Stacker

    Joined:
    Aug 26, 2011
    Messages:
    1,038
    Likes Received:
    113
    Trophy Points:
    63
    Location:
    Queensland
    Looks good at a glance Niveka, great idea :)

    +1 to Willrocks suggestion
     
  9. Pirocco

    Pirocco Well-Known Member

    Joined:
    May 24, 2011
    Messages:
    4,873
    Likes Received:
    155
    Trophy Points:
    63
    Location:
    EUSSR
    An idea could be adding the long term min and max values of the total net position for that commodity.
    That helps alot to give the figure a meaning, as to make it recognizable as high, low or common.
    I once had as signature,
    14/01/2014 silver $21.81: Comex now 195 Moz 19.5% of annual traded [15y range: 20-350 Moz]
    14/01/2014 gold $1205.30: Comex now 4.5 Moz 3.5% of annual traded [15y range: 1.9-30 Moz]
    That Moz figure is derived from the total net position multiplied by the ounces per position (100 for gold, 5000 for silver). And then as a % of the total supply/demand as shown on silverinstitute.
    Of course, that requires the availability (in the data) of all historical data, so some source datafile and some routine to pick out the min and max from it. So it only becomes an option after all the work to collect the data.

    Another idea could be calculating the amount dollars that the futures market chewed out the underlying cash market. That is a function of the total net position and the duration it lasts. Or graphically described: the surface between the green trendline on finviz.com and the zero axis. The bigger it is, the more dollars were chewed out over that period.
    That amount is what hedging delivered, and what those on the cash market paid too much due to the bogus (they have a very high % of delivery in dollars instead of metal) orders of those on the futures market. It's a zero sum market, one has to lose for another to win, and refusing to pay those artificially/easily driven up prices is a first step to make your dollars go to metal instead of their pockets. Especially in the case silver market, with the bogus orders making up such a high % of total supply/demand.
     
  10. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I have added some more features based on suggestions from you guys. You can now save to Excel, customize the appearance of the app (skins), and filter the display set by Commodity Type, Start Date, & End Date. Here is an image:

    [​IMG]
     
  11. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I added a "Percent of Range" column to the Totals to show how large/small the Net Change is in relation to the minimum/maximum change for the display set:

    [​IMG]
     
  12. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
  13. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I added some features. You can now filter on Net Change & Net Change Percent. I also pulled in historical spot data for Silver, Gold, Platinum, & Palladium, so now for those commodities I can chart the spot price for the same period of time. When you select a particular COT Report in the grid the current spot price will be marked on the chart.

    [​IMG]
     
  14. Niveka

    Niveka New Member

    Joined:
    Jan 15, 2015
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    0
    I think I'm done adding features for the first cut. You can now select multiple COT reports in the grid and the spot price for that time period will be marked on the chart. The chart will also zoom into a timespan surrounding the currently selected COT reports.

    [​IMG]
     

Share This Page