Reply To: Neuralstem [CUR, US64127R4011] – another stock for a gambler-investor

Home Forums Stocks American Stocks Neuralstem [CUR, US64127R4011] – another stock for a gambler-investor Reply To: Neuralstem [CUR, US64127R4011] – another stock for a gambler-investor

#3143
Vasily Nekrasov
Participant

Code to generate the last chart using data from AlphaVantage



  avUrl = paste0("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=CUR&outputsize=FULL&apikey=<yourAPIkey>")
    dat <- fromJSON(avUrl)
    nms = names(dat$"Time Series (Daily)")
    N = length(nms)
    dates = as.POSIXlt(nms)
    OHLCV = array(0.0, dim=c(N,8))
    for(n in 1:N)
    {
      OHLCV[n, 1] = as.double((dat$"Time Series (Daily)")[[n]]$"1. open")
      OHLCV[n, 2] = as.double((dat$"Time Series (Daily)")[[n]]$"2. high") 
      OHLCV[n, 3] = as.double((dat$"Time Series (Daily)")[[n]]$"3. low")
      OHLCV[n, 4] = as.double((dat$"Time Series (Daily)")[[n]]$"4. close")
      OHLCV[n, 6] = as.double((dat$"Time Series (Daily)")[[n]]$"5. adjusted close")
      OHLCV[n, 5] = as.double((dat$"Time Series (Daily)")[[n]]$"6. volume")
      OHLCV[n, 7] = as.double((dat$"Time Series (Daily)")[[n]]$"7. dividend amount")
      OHLCV[n, 8] = as.double((dat$"Time Series (Daily)")[[n]]$"8. split coefficient")
    }

curStock = as.quantmod.OHLC(zoo(OHLCV[, 1:6], order.by=dates), col.names = c("Open", "High", "Low", "Close", "Volume", "Adjusted"))
chartSeries(curStock)