nepse_index: Nepal Stock Exchange Index Quote

Description Usage Arguments Details Value Author(s) References Examples

View source: R/nepse_index.R

Description

nepse_index downloads the index/subindex values from Nepal Stock Exchange.

Usage

1
nepse_index(index = NULL)

Arguments

index

a character string specifying the index id of the index to be loaded

Details

The nepse_index downloads the nepse index/sub-index for the given index id from Nepal Stock Exchange .The nepse_index will first check whether the entered index id is valid. The valid index id ranges from 51 to 63 and index names corresponding to these ids are Banking, Hotels, Others, HydroPower, Development_Bank, Manufacturing, Sensitive, NEPSE, Insurance, Finance, Trading, Float, and Sensitive_Float, respectively. The nepse_index will return an error if the index id is not valid. The data for valid index id starts from "2015-01-08" to the most recent transaction date.

Value

nepse_index will return the object of class dataframe with 3 variables: index_date, index_name, and index_value

Author(s)

Nayan Krishna Joshi

References

http://www.nepalstock.com.np/

Examples

 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
## Not run: 
# index value for an invalid index id; issues an error with message
# nepse_index('70')

# index value for a valid index id; returns a dataframe
nepse_index("58")

# draw an interactive time series chart of an index value for a valid index id
require(xts)
require(dygraphs)
data_index1 <- nepse_index(58)
data_index1 <- xts(data_index1[, -1], order.by = data_index1[, 1])
nepse_index_graph <- dygraph(data_index1[, "index_value"],
                             main = "Time series graph of Nepse index")
dyRangeSelector(nepse_index_graph, height = 20, strokeColor = "darkred")

# compute daily, weekly, monthly, quartely, and yearly returns of index values
require(xts)
require(quantmod)
data_index2 <- nepse_index(58)
data_index2 <- data_index2[, c("index_date", "index_value")]
data_index2 <- xts(data_index2[, -1], order.by = data_index2[, 1])
# arithmetic returns
nepse_index_re_arithm <- allReturns(data_index2)
# logarithmic returns
nepse_index_re_log <- allReturns(data_index2, type = "log")

## End(Not run)

nayanj/NPdata documentation built on May 23, 2019, 12:24 p.m.