quantmod

quantmod adjustOHLC function - dividend adjusted prices

点点圈 提交于 2019-12-14 03:49:42
问题 I need help in explaining a discrepancy in dividend adjusted prices using quantmod::adjustOHLC . Get adjusted and unadjusted prices for AAPL: library(quantmod) getSymbols("AAPL") AAPL.adjusted <- adjustOHLC(AAPL, adjust=c("dividend"), symbol.name="AAPL") Last dividend for AAPL was on 2016-08-04 for 0.57 cents. div <- getDividends("AAPL", from = "1900-01-01") tail(div) # [,1] # 2015-05-07 0.52 # 2015-08-06 0.52 # 2015-11-05 0.52 # 2016-02-04 0.52 # 2016-05-05 0.57 # 2016-08-04 0.57 For the

Is get.hist.quote() still returning data with source=yahoo finance?

≯℡__Kan透↙ 提交于 2019-12-13 13:39:04
问题 HNY. As the question in the subject line implies, I'm getting errors trying to use the tseries package function get.hist.quote() . Can anyone shed light on my calling it incorrectly, or in a change of its signature/functionality? I noticed these errors starting at my work yesterday. Today on my home machine, same issue. Same results for various combinations of symbol, start/end dates, and granularity (day vs month). Here's an example: > spy = get.hist.quote(instrument= 'SPY', start = "2000-01

Error in as.POSIXlt.character(x, tz, …) : character string is not in a standard unambiguous format

扶醉桌前 提交于 2019-12-13 09:26:36
问题 I use a data set imported from excel: OBX <- read_excel("C:/Users/neri_/Desktop/OBX Weekly Return.xlsx") Date OBX 1 2010-12-28 0.0071366 2 2010-12-29 4.97265e-05 3 2010-12-30 -0.00452489 4 2011-01-03 0.00896603 5 2011-01-04 -0.0101488 6 2011-01-05 0.00520143 7 2011-01-06 -0.000422917 8 2011-01-07 -0.00301145 9 2011-01-10 -0.00341996 10 2011-01-11 0.013326 11 2011-01-12 0.00882484 I'm struggling with this error message, "Error in as.POSIXlt.character(x, tz, ...) : character string is not in a

Storing the xts object returned by getSymbols

馋奶兔 提交于 2019-12-13 01:09:01
问题 I'm trying to collect mutual fund performance data via open and close prices from quantmod. I have scraped a list of 5000 some funds and am trying to loop through and get one open and close price for each fund. I'm having difficulty calling the xts object yielded by getSymbols() as it is called invisibly into the environment. Since the object is stored as its ticker name, I tried calling it by its ticker name. Code so far: ## loop thru list and use quantmod to calculate performance from 1/2

chart_Series: How to format the x axis to remove the year?

那年仲夏 提交于 2019-12-13 00:45:03
问题 How can I remove the Year from the x axis so that it only shows the day and month? Also, is it possible to rotate the x axis dates by 90 degrees? library(quantmod) getSymbols("SPY", from="2013-01-01", to=Sys.Date()) chart_Series(SPY,theme=myTheme) 回答1: cspy <- chart_Series(SPY ) cspy$Env$actions[[3]] #------------------ expression(axt <- axTicksByTime(xdata[xsubset], format.labels = format.labels), axis(1, at = axt, labels = names(axt), las = 1, lwd.ticks = 1, mgp = c(3, 1.5, 0), tcl = -0.4,

Add Technical Indicator to chart.Posn

烈酒焚心 提交于 2019-12-12 12:54:51
问题 For some reason I cannot add a ROC signal to a blotter chart. In the documentation it should be allowed. I want to create a new chart bellow with this indicator. Can someone help? # plot performance for symbol chart.Posn(strategy_AbsMom, Symbol = 'SPY', Dates = '1998::',theme=myTheme) chart.Posn(strategy_AbsMom, Symbol = 'SPY', Dates = '1998::',theme=myTheme, TA='addROC(n=lookback,col=4)') 回答1: chart.Posn uses chart_Series (not chartSeries ) internally, so you have to use add_* functions (not

Coercing a POSIXct object to Date object

不打扰是莪最后的温柔 提交于 2019-12-12 11:18:43
问题 Reproducible code: # Loading quantmod library(quantmod) # Please, put in R this structure a <- structure(c(2.4, 2.35, 2.44, 2.44, 2.31, 2.32, 2.41, 2.43, 2.46, 2.42, 2.45, 2.39, 2.3, 2.41, 2.33, 2.37, 2.38, 2.4, 2.275, 2.235, -0.0300000000000002, -0.0499999999999998, 0.0899999999999999, 0, -0.13, 0.00999999999999979, 0.0900000000000003, 0.02, 0.0299999999999998, -0.04, 0.0300000000000002, -0.0600000000000001, -0.0900000000000003, 0.11, -0.0800000000000001, 0.04, 0.00999999999999979, 0.02, -0

Parsing 10-year federal note yield from the website

核能气质少年 提交于 2019-12-12 05:38:30
问题 Typically, this is the commonly advised way in R to download the 10-year federal note yield library(quantmod) getSymbols("DGS10",src='FRED') Fed<-last(DGS10) The problem is that the value retrieved is one day older than what is available on the treasury website https://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield Is there a way to parse the above webpage to retrieve the most recent 10 yr treasury note yield? 回答1: rvest is a good option, as

using getSymbols to load different start time variables (time series data)

余生颓废 提交于 2019-12-12 01:21:21
问题 getSymbols(c("PI","RSXFS", "TB3MS", src="FRED",from="1959-1-1", from="1992-1", from="1934-1-1") How can I load data by using getSymbols for different start dates for multiple variables? I needs 200 variables from FRED. I can download the FRED CODE easily, but the problem is that dates. Each variables have different starting date. First I load data set with time series format and then i will use window commend for fixing the same time period for all 200 data. 回答1: May be you are looking for

Plotting currencies given time and currency using quantmod and google finance

自作多情 提交于 2019-12-11 19:38:31
问题 My ui.r library(shiny) codes <- paste("CURRENCY:",currencies,sep="") currencies <- c("ARS","AUD","BRL","CAD","CHF", "CNY","DKK","EUR","GBP","IDR", "ILS","INR", "JPY","MXN","MYR", "NOK","NZD","PHP","RUB","SEK", "THB","TRY") shinyUI(fluidPage( titlePanel("Currency Charts"), sidebarLayout( sidebarPanel( helpText("Select a currency to examine. Information will be collected from Quandl."), selectInput("symb", label = "Choose a variable to display", choices = currencies, selected = "ARS"),