Can I get bid and ask prices in a single ITimeSeriesDataService.SetupDataRequest?

Based on the code in the `DataApiUsageExampleTimeSeries` I am building a request like this:

            request = timeSeries.SetupDataRequest(ric)
.WithView("BID")
.WithAllFields()
.WithInterval(CommonInterval.Daily)
.From(from)
.To(to)
.OnDataReceived((dc) => { tcs.SetResult(dc); })
.CreateAndSend();

Is it possible to also get ask prices in the same request and if yes, how do I get them out of the response?

Best Answer

  • @robert.hardy

    There is a way to do this, you need to specify a different view in the WithView() function:

          request = timeSeries.SetupDataRequest("EUR=")
    .WithView("NDA_RAW")
    .WithAdjustedPrice(true)
    .WithAllFields()
    .WithInterval(CommonInterval.Daily)
    .WithNumberOfPoints(10)
    .OnDataReceived(DataReceivedCallback)
    .CreateAndSend();

    Here is a piece from the tutorials explaining the views:

    Every entry has a set of Views, or field definitions, that specify which data points are collected and stored. The views are largely tailored to a specific asset class of the financial instruments, but by default there will be:

    • Common or default view, that will carry a timestamp and the Open-High-Low-Close information for a default field (e.g. Trade for equities, Bid quote for the OTC instruments, etc.);
    • Raw view, containing all of the fields stored in the database for the selected instrument.

    Supported intervals can be divided into three groups:

    • Evenly spaced intra-day: 1, 5, 10, 30 and 60 minutes;
    • Unevenly spaced intra-day: Tick, Quotes, Trades, Trades And Quotes;
    • Evenly spaced inter-day: Daily, Weekly, Monthly, Quarterly and Yearly.

    You can get more information on this in the tutorial.