How to use api get OpenInterest of history bar data

How to get openInterest of history daily bar data?

image

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    Use WithView("OPINT_1") method of ITimeSeriesDataRequestSetup interface when setting up the request. See "Views and intervals" section in Timeseries tutorial for more details.

    You will also need to modify the callback for OnDataReceived event, as the timeseries for open interest cannot be converted to bar records, since only the close open interest is available. Instead of processing bar records in OnDataReceived event callback you can use something like

    foreach (IData record in chunk.Records)
    {
          foreach (string key in record.AllFields.Keys)
          {
              Console.WriteLine(key + " : " + record.AllFields[key]);
          }
    }