[R] CandlestickCharts of any listed stock and fetching stock prices into R

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Sat Dec 18 22:00:10 CET 2021


Hi Winod,
Your first error message seems to be saying that you are passing a
function that returns an "ohic" object rather than the object. Maybe:

ohic<-get.ohlc.yahoo("GOOG",start="2020-12-18",end="2021-12-17")
candlestickChart(ohic,..)

would get you a bit further. Also it's obvious that the function wants
character dates with quotes around them. There seem to be quite a few
YouTube tutorials on candlestick charts.

Jim

On Sun, Dec 19, 2021 at 1:15 AM Winod Dhamnekar
<vinoddhamnekar11 using gmail.com> wrote:
>
> Hello,
> R users community,
>  I want to plot candlestickCharts of any stock prices of listed companies
> on any stock exchange (Indian or  worldwide) into r by using
> candlestickchart command in 'FinCal' r package. But I could not plot
> candlestic charts. R showed me errors.
>
>
>  candlestickChart(ohlc,2020-12-18,2021-12-17,"Google")
> Error in as.Date(ohlc$date) : object 'ohlc' not found
> > candlestickChart(get.ohlc.google,2020-12-18,2021-12-17,"Google")
> Error: object of type 'closure' is not subsettable
> > candlestickChart(get.ohlc.google,2020-12-18,2021-12-17,"Google")
> Error: object of type 'closure' is not subsettable
>
>
> What is the suitable syntax to use candlestickchart command from 'FinCal' r
> package?
>
> I also tried to fetch stock prices of listed companies on any stock
> exchange (wordwide or Indian) But I could not fetch stock prices.
>   # google <- get.ohlc.yahoo("GOOG",start="2014-07-01",end="2014-08-01");
> candlestickChart(google)
>  # google <- get.ohlc.yahoo("GOOG",start="2020-12-18",end="2021-12-17");
> candlestickChart(google)
> > candlestickChart(ohlc,2020-12-18,2021-12-17,"Google")
> Error in as.Date(ohlc$date) : object 'ohlc' not found
> > candlestickChart(get.ohlc.google,2020-12-18,2021-12-17,"Google")
> Error: object of type 'closure' is not subsettable
> > candlestickChart(get.ohlc.google,2020-12-18,2021-12-17,"Google")
> Error: object of type 'closure' is not subsettable
>
>  get.ohlc.yahoo("BOM:532504", 18-12-2021,17-12-2021,d)
> Error in strsplit(start, "-") : non-character argument
> > get.ohlc.yahoo('BOM:532504', 18-12-2021,17-12-2021,d)
> Error in strsplit(start, "-") : non-character argument
> > get.ohlc.yahoo(BOM:532504, 18-12-2021,17-12-2021,d)
> Error in strsplit(start, "-") : non-character argument
>  # google <- get.ohlc.yahoo("GOOG",start="2020-12-18",end="2021-12-17");
> candlestickChart(google)
> > candlestickChart(ohlc,2020-12-18,2021-12-17,"Google")
> Error in as.Date(ohlc$date) : object 'ohlc' not found
> > candlestickChart(get.ohlc.google,2020-12-18,2021-12-17,"Google")
> Error: object of type 'closure' is not subsettable
>  candlestickChart(ohlc,2020-12-18,2021-12-17,"Google")
> Error in as.Date(ohlc$date) : object 'ohlc' not found
>
>   How can I plot candlestickchart and fetch stock prices of any period with
> any frequency of time intervals?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list