Need an example to retreive RHistory Data using RFA jar.
I need an equivalent of RHistory function present in EIKON in RFA/Elektron.
Need the example in Java/Scala.
RFA Java can consume history data i.e. Time Series One (TS1). However, it cannot provide the function equivalent to RHistory e.g. specific the fields or Start date and End date. RFA Java will retrieve all fields received from the feed according to the request with specific frequency i.e. daily, weekly, and monthly. To do the equivalent RHistory function, the application has to implement by itself after it receives historical data from RFA Java.
For detail of TS1; historical data that RFA Java consumes, please refer to TS1 Reference manual document,[RFAJ package]\Docs\TS1Data.pdf.
RFA Java provides the console application, TimeSeriesConsole , shows how to retrieve TS1 historical data from a remote service, decode it, and print it to the console. The source code and its help is in [RFAJ package]\Examples\com\reuters\rfa\example\omm\idn\tsconsole
An example command line running TimeSeriesConsole at [RFAJ package]\Examples to consume RIC PTT.BK in daily for 3 samples:
java -cp .;..\Libs\rfa.jar com.reuters.rfa.example.omm.idn.tsconsole.TimeSeriesConsole -session myNamespace::consSession -serviceName ELEKTRON -itemName PTT.BK -user pimchaya -count 3
For detail of each application’s parameter, please refer to package.html in the TimeSeriesConsole source code folder.
An example output:
The result is 3 days back from now. I run in the morning 5 Apr. Hence, it showed the history data of 4,3 and 2 Apr.
To set the frequency to be the other e.g. monthly or weekly, change the period in TS1TimeSeries parameter in processComplete() method of TimeSeriesConsole.java for example:
Set to monthly:
TS1TimeSeries timeseries = new TS1TimeSeries(_appContext, itemName, TS1Constants.MONTHLY_PERIOD, count);
Set to weekly:
TS1TimeSeries timeseries = new TS1TimeSeries(_appContext, itemName, TS1Constants.WEEKLY_PERIOD, count);
Then, compile and run it.
Unfortunately, there is no Scala example to retrieve historical data TS1. However, you can develop a Scala application by following TimeSeriesConsole application.