This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
nse-fo.R
62 lines (54 loc) · 1.56 KB
/
nse-fo.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#' Top F&O gainers and losers
#'
#' Top futures and options gainers and losers for the last trading session.
#'
#' @param clean_names Logical; if \code{TRUE}, makes the column names
#' descriptive and uses snake_case.
#'
#' @examples
#' \donttest{
#' # top gainers
#' nse_fo_top_gainers()
#'
#' # retain original column names as returned by NSE
#' nse_fo_top_gainers(clean_names = FALSE)
#'
#' # top losers
#' nse_fo_top_losers()
#'
#' # retain original column names as returned by NSE
#' nse_fo_top_losers(clean_names = FALSE)
#' }
#'
#' @return A tibble with the following columns:
#'
#' \item{symbol}{NSE ticker.}
#' \item{series}{Equity (EQ).}
#' \item{last_corp_announcement_date}{Last corporate announcement date.}
#' \item{last_corp_announcement}{Last corporate announcement.}
#' \item{open_price}{Open price.}
#' \item{high_price}{High price.}
#' \item{low_price}{Low price.}
#' \item{last_traded_price}{Last traded price.}
#' \item{prev_close_price}{Previous close price.}
#' \item{percent_change}{Percentage change in price.}
#' \item{traded_quantity}{Total traded quantity.}
#' \item{turnover}{Turnover in lakhs.}
#'
#' @name nse_fo
#'
NULL
#' @rdname nse_fo
#' @export
#'
nse_fo_top_gainers <- function(clean_names = TRUE) {
url <- "https://www1.nseindia.com/live_market/dynaContent/live_analysis/gainers/fnoGainers1.json"
nse_fo_base(url, clean_names)
}
#' @rdname nse_fo
#' @export
#'
nse_fo_top_losers <- function(clean_names = TRUE) {
url <- "https://www1.nseindia.com/live_market/dynaContent/live_analysis/losers/fnoLosers1.json"
nse_fo_base(url, clean_names)
}