knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

nse2r

Fetch data from the National Stock Exchange, India.

CRAN_Status_Badge cran checks R build status Coverage
Status Lifecycle: stable

Overview

NSE (National Stock Exchange) is the leading stock exchange of India, located in the city of Mumbai. While users can manually download data from NSE through a browser, importing this data into R becomes cumbersome. The nse2r R package implements the retrieval of data from NSE and aims to reduce the pre-processing steps needed in analyzing such data.

nse2r is inspired by and a port of the Python package nsetools. The authors and contributors for this R package are not affiliated with NSE and NSE does not offer support for this R package.

With nse2r, you can fetch the following data related to:

Installation

You can install the development version of nse2r from GitHub with:

# install.packages("devtools")
devtools::install_github("rsquaredacademy/nse2r")

Usage

library(nse2r)

nse2r uses consistent prefix nse_ for easy tab completion.

Preprocessing

nse2r does basic data preprocessing which are listed below:

Users can retain the names and format as returned by NSE using the clean_names argument and setting it to FALSE.

Index

Fetch Indices Quote
nse_index_quote()

# retain original column names as returned by NSE
nse_index_quote(clean_names = FALSE)

Stock

Top gainers for the last trading session.
nse_stock_top_gainers()

# retain original column names as returned by NSE
nse_stock_top_gainers(clean_names = FALSE)
Stocks that have touched their 52 week highs during the day
nse_stock_year_high()

# retain original column names as returned by NSE
nse_stock_year_high(clean_names = FALSE)
Most actively traded stocks in a month
nse_stock_most_traded()

# retain original column names as returned by NSE
nse_stock_most_traded(clean_names = FALSE)

Futures & Options

Top futures and options gainers for the last trading session.
nse_fo_top_gainers()

# retain original column names as returned by NSE
nse_fo_top_gainers(clean_names = FALSE)

Pre Open Market Data

Fetch data of pre open session of Nifty Bank.
nse_preopen_nifty_bank()

# retain original column names as returned by NSE
nse_preopen_nifty(clean_names = FALSE)

Advances & Declines

nse_advances_declines()

# retain original column names as returned by NSE
nse_advances_declines(clean_names = FALSE)


rsquaredacademy/nse2r documentation built on Nov. 19, 2022, 10:16 p.m.