nTuple
nTuple

Reputation: 1

Download NSE (zipped and CSV ) data

require(curl) 
require(RCurl) 
require(downloader) 
temp <- tempfile()
sURL <- "http://www.nseindia.com/archives/equities/bhavcopy/pr/PR240915.zip"

download(sURL,dest="C:/Users/sayantan/Documents/Data",mode="wb")

con <- unzip(temp, extdir="C:/Data") 
data <- matrix(scan(con),ncol=4,byrow=TRUE) 
unlink(temp)

But this code is not working. Any hints would be appreciated.

Upvotes: 0

Views: 1246

Answers (2)

Nad Pat
Nad Pat

Reputation: 3173

You can use nser package.

library(nser)
bhav("12082020")

Upvotes: 1

Ravi chawla
Ravi chawla

Reputation: 1

Use Quantmod or Quandl to download data from NSE. I prefer Quandl over Quantmod, as Quandl directly downloads from NSE whereas Quantmod uses Yahoo to get data for Indian equities.

In Quandl simple use NSE's Ticker to get data For example type data <- Quandl("NSE/SBIN", start_date="2005-01-01", end_date="2015-12-31") to get SBI's daily data.

Upvotes: 0

Related Questions