I am a quite new with R programming and now developing a system that is suppose to interact with R. My question is :
How to get quotes from hard coded from the scripts rather than from various sources like “yahoo” “google” etc?
Why do I need quotes hard coded in the script?
I am using Rserve as my downstream system, the main system does fetching of data and will perform other portfolio checks then it makes a call to R-TTR-quantmod
packages for calculation of financial numbers. So I don’t want R to refetch those quotes so I want the quotes to be hardcoded and sent from my system to Rserve
where it gets executed and results is returned from there. This way my code would rely on standard calculation on R and user can focus on other business logic.
Why am I not using csv file approach ?
I am in a realtime system and file io would take huge time and would slow down my system.
FOR EXAMPLE:
library(quantmod)
library(TTR)
Pull S&P500 index data from Yahoo! Finance
getSymbols("^RIL", from="2000-01-01", to="2008-12-07")
Calculate the RSI indicator
rsi <- RSI(Cl(RIL),2)
So this is what I need:
- Rather than calling
getSymbol
I would like to pass the data as a variable in the script. - I assume the data may be very large at time or very small at times.
- So what should I do in this scenario?