I am trying to get the last price for a specific instrument, but I want the price to include prices from extended hours. I have tried two fields: CF_LAST and IRGPRC. The first does not include trades from extended hours, whereas IRGPRC is reset every day, so if no trades have occured today, zero is returned. From excel I have been advised to use the Rhistory function as follows:
=RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Value;TRDPRC_1.Count","NBROWS:1 ADJUSTED:NO INTERVAL:TAS",,,I7),
since no live data field can give me what I am after, but I have not been able to translate this into a AdxRtHistory query. I have been able to create a historic query using the historic .net api, but I have only been able to do it by requesting data from a specific timestamp and potentially this can be a lot of data. Do you have any suggestions?
@jeppe which RIC are you trying to query? Extended traded sessions may affect the live RIC differently on different exchanges.
AdxRtHistory only supports inter-day data, so requesting intraday time series will not work, so the only only API that might be of use for you is .NET.
You're on the right track with this: "I have been able to create a historic query using the historic .net api, but I have only been able to do it by requesting data from a specific timestamp and potentially this can be a lot of data." When setting up timeseries request use the following methods of ITimeSeriesDataRequestSetup interface:
.WithInterval(CommonInterval.Trades) .To(DateTime.Now) .WithNumberOfPoints(1)
This will allow you to retrieve the single latest trade.
That does the trick of getting the latest trades. Thank you. Unfortunately, I get some strange behavior. My request looks like this:
request = timeSeries.SetupDataRequest("MSFT.O")
With this request I get back 59 data points, but they do not include trades from extended trading hours. If I specify 58 number of points, zero data points are returned. If I instead use .To(DateTime.Today), the requested number of points is returned (still missing extended hours), but by adding seconds (.To(DateTime.Today.AddSeconds(12))) I sometimes get zero sometimes the requested number of data points depending on the requested number and the added seconds.
All the examples in the downloads section on this API are console applications:
Have you seen these? Anything in particular you're struggling with? There are numerous ways to start Windows message pump. The technique used in the above examples is one way, there are several others, e.g. using Application.Run method.