Skip to content

Commit

Permalink
1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nandp1 authored Feb 3, 2024
1 parent df4de78 commit 59fb7db
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 84 deletions.
48 changes: 23 additions & 25 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
Package: nser
Type: Package
Title: Bhavcopy and Live Market Data from National Stock Exchange (NSE)
& Bombay Stock Exchange (BSE) India
Version: 1.5.0
Date: 2023-08-15
Authors@R: person("Nandan", "Patil", email = "tryanother609@gmail.com", role = c("cre", "aut"))
Description: Download Current & Historical Bhavcopy. Get Live Market data from NSE India of Equities and Derivatives (F&O) segment. Data source <https://www.nseindia.com/>.
URL: https://github.com/nandp1/nser/
BugReports: https://github.com/nandp1/nser/issues
Language: en-US
License: GPL-3
Depends: R (>= 3.0)
Encoding: UTF-8
LazyData: true
Imports: utils, readr, magrittr, rvest, stringr, jsonlite,
RSelenium, googleVis, dplyr, lubridate, purrr, curl, reticulate, xml2
Suggests: rmarkdown, testthat (>= 3.0.0), knitr, reshape2
RoxygenNote: 7.2.3
VignetteBuilder: knitr
Packaged: 2023-03-09 16:13:00 UTC; ACER
Author: Nandan Patil [cre, aut]
Maintainer: Nandan Patil <tryanother609@gmail.com>
Repository: CRAN

Package: nser
Type: Package
Title: Bhavcopy and Live Market Data from National Stock Exchange (NSE)
& Bombay Stock Exchange (BSE) India
Version: 1.5.1
Date: 2024-02-03
Authors@R: person("Nandan", "Patil", email = "tryanother609@gmail.com", role = c("cre", "aut"))
Description: Download Current & Historical Bhavcopy. Get Live Market data from NSE India of Equities and Derivatives (F&O) segment. Data source <https://www.nseindia.com/>.
URL: https://github.com/nandp1/nser/
BugReports: https://github.com/nandp1/nser/issues
Language: en-US
License: GPL-3
Depends: R (>= 3.0)
Encoding: UTF-8
LazyData: TRUE
Imports: utils, readr, magrittr, rvest, stringr,
googleVis, dplyr, lubridate, purrr, curl, reticulate, xml2
Suggests: rmarkdown, testthat (>= 3.0.0), knitr, reshape2
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Author: Nandan Patil [cre, aut]
Maintainer: Nandan Patil <tryanother609@gmail.com>
Repository: CRAN
86 changes: 67 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,18 @@
<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- badges: start -->

[![CRAN status](https://www.r-pkg.org/badges/version-ago/nser)](https://CRAN.R-project.org/package=nser)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable-1)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/nser)](https://cran.r-project.org/package=nser)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/nser)](https://cran.r-project.org/package=nser)
[![Lifecycle:
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable-1)
![Downloads](http://cranlogs.r-pkg.org/badges/nser)
[![](https://cranlogs.r-pkg.org/badges/grand-total/nser)](https://cran.r-project.org/package=nser)
[<img src="https://zenodo.org/badge/383885771.svg" alt="DOI" width="186"/>](https://zenodo.org/badge/latestdoi/383885771)


<!-- badges: end -->

# Latest Version `1.5.0`
### The package is now on CRAN...
# Latest Version `1.5.1`

Functions `bhav`, `fobhav`, `nselive`, `nseopen` and `nsetree` are revised & fully functional.
### Upcoming functions
* Bringing back `optbanknifty` and `optnifty` to get option chain data of BANKNIFTY and NIFTY.
* Correcting `nseipo` function

## NOTE
`nselive`, `nseopen` `nseindex` and `nsetree` obtain data from NSE using python scripts. Thus, you need to install Python modules `pandas` and `requests` in R,
`nselive`, `nseopen` `nseindex`, `nsetree`, `optbanknifty` and `optnifty` obtain data from NSE using python scripts. Thus, you need to install Python modules `pandas` and `requests` in R,

Following steps should help you to get started,
* Install latest version of `Python`, `Ananconda` and `Miniconda`. And add Python as PATH variable.
Expand All @@ -40,7 +32,7 @@ You should be good to go now...
# Introduction

`nser` helps you to download historical bhavcopy of Equities and F&O
segment as easy as possible.
segment easily.

Package website [nser](https://nandp1.github.io/nser/)

Expand Down Expand Up @@ -101,11 +93,54 @@ nseopen("fo")

## Example 6. Current and Upcoming IPO’s

library(nser)
nseipo()
library(nser)
nseipo()

## Example 7. RSelenium to Download Equity Bhavcopy

``` r
library(nser)
library(RSelenium)

# Start a selenium server and browser
# For Google Chrome (Update Chrome to latest version)

driver <- rsDriver(browser = c("chrome"), port = 3163L, chromever = "91.0.4472.101")
remDr <- driver$client

# or for Firefox
driver <- rsDriver(browser = c("firefox"), port = 3799L)

# Download Equity Bhavcopy zip file
bhavs("03012000", 2)

# Close the Browser
remDr$close()
```

## Example 8. RSelenium to Download F&O Bhavcopy

``` r
library(nser)
library(RSelenium)

# Start a selenium server and browser
# For Google Chrome (Update Chrome to latest version)

driver <- rsDriver(browser = c("chrome"), port = 3163L, chromever = "91.0.4472.101")
remDr <- driver$client

# or for Firefox
driver <- rsDriver(browser = c("firefox"), port = 3799L)

# Download Equity Bhavcopy zip file
bhavfos("03012000", 2)

# Close the Browser
remDr$close()
```

## Example 7. NSE Treemap
## Example 9. NSE Treemap

``` r
library(nser)
Expand All @@ -116,14 +151,27 @@ nsetree()
nsetree("fo")
```

## Example 8. Daily data to Weelkly data
## Example 10. Daily data to Weelkly data

library(nser)
data(dailydata)
daytoweek(dailydata)

## Example 9. Daily data to Monthly data
## Example 11. Daily data to Monthly data

library(nser)
data(dailydata)
daytomonth(dailydata)

## Example 12. Option chain Nifty 50

library(nser)
optnifty()

## Example 12. Option chain Banknifty

library(nser)
optbanknifty()



33 changes: 33 additions & 0 deletions inst/nseoption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import requests

headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '
'x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36'}

main_url = "https://www.nseindia.com/"
response = requests.get(main_url, headers=headers)
#print(response.status_code)
cookies = response.cookies

new_url = 'https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY'
bank_nifty_oi_data = requests.get(new_url, headers=headers, cookies=cookies)
dat = bank_nifty_oi_data.json()

dat1 = dat['filtered']
dat1 = dat1['data']

###

headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '
'x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36'}

main_url = "https://www.nseindia.com/"
response = requests.get(main_url, headers=headers)
#print(response.status_code)
cookies = response.cookies

new_url1 = 'https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY'
bank_nifty_oi_data_1 = requests.get(new_url1, headers=headers, cookies=cookies)
dat2 = bank_nifty_oi_data_1.json()

dat2 = dat2['filtered']
dat2 = dat2['data']
2 changes: 1 addition & 1 deletion man/bhavtoday.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/daytoweek.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/fdii.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fobhav.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/nseindex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/nseipo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/nselive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions man/nsetree.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions man/optbanknifty.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions man/optnifty.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/daytomonth.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ knitr::opts_chunk$set(

## Introduction

Convert the Daily OHLC data of a stock to Monthly data. The dataframe should contain six columns named `SYMBOL`, `OPEN`, `HIGH`, `LOW`, `CLOSE`, `DATE`.
Convert the Daily OHLC data of a stock to Monthly data. The data frame should contain six columns named `SYMBOL`, `OPEN`, `HIGH`, `LOW`, `CLOSE`, `DATE`.


```
Expand Down
1 change: 1 addition & 0 deletions vignettes/fdii.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Get the latest FII (Foreign Institutional Investor) and DII (Domestic Institutio

```
library(nser)
fdii()
```
5 changes: 2 additions & 3 deletions vignettes/nsetree.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ library(nser)

# Example
#Treemap of NIFTY50 securities
#nsetree()
nsetree()


#Treemap of F&O securities
#nsetree("fo")
nsetree("fo")


```
3 changes: 0 additions & 3 deletions vignettes/optbanknifty.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@ Option chain of NSE BANKNIFTY.
library(nser)
# BANKNIFTY option chain table
optbanknifty()

### Only the raw data
optbanknifty(raw_data = TRUE)
```
Loading

0 comments on commit 59fb7db

Please sign in to comment.