Re: [R-SIG-Finance] Equities Data
Hi Ralph, You question does not have much to do with R... BUT your question must be much more specific than that to have meaningful replies: (1) what data are you after (prices? intraday or end of day?, fundamentals?,, etc.) (2) what is your budget if any if unlimited buddget just get a Factset or bloomberg license (the ones I know best) and you are covered. If you are after free data, well look at quantmod its API to yahoo finance (which does split adjustment), google finance etc., if personal use kind of budget only looking for end of day prices ( may be some fundamentals) I had a look at eoddata.com some time ago found it good value for money (never compared to BBG / Factset like though) and I believe they do provide corporate action info HTH, Julien Date: Wed, 5 Sep 2012 23:17:28 -0700 From: junzh...@yahoo.com To: r-sig-finance@r-project.org; rvinc...@gmail.com Subject: Re: [R-SIG-Finance] Equities Data For US market, a good source of equity data is from CRSP of University of Chicago. The data is historical only and well cleaned. It costs about 20-30k per year. For global equity data, bloomberg and reuters are two good sources. J. Zhu --- On Wed, 9/5/12, Ralph Vince rvinc...@gmail.com wrote: From: Ralph Vince rvinc...@gmail.com Subject: [R-SIG-Finance] Equities Data To: r-sig-finance@r-project.org Date: Wednesday, September 5, 2012, 8:39 PM I'm looking for a reliable vendor of equity data, one that also provides information regarding corporate actions (dividends, splits, ex-dates, etc). Anyone know of any good sources? R. Vince ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Hi Ralph are you the same Ralph Vince who promotes the optimal f criterion ? cheers Sidharth On Thu, Sep 6, 2012 at 1:33 PM, julien cuisinier j_cuisin...@hotmail.comwrote: Hi Ralph, You question does not have much to do with R... BUT your question must be much more specific than that to have meaningful replies: (1) what data are you after (prices? intraday or end of day?, fundamentals?,, etc.) (2) what is your budget if any if unlimited buddget just get a Factset or bloomberg license (the ones I know best) and you are covered. If you are after free data, well look at quantmod its API to yahoo finance (which does split adjustment), google finance etc., if personal use kind of budget only looking for end of day prices ( may be some fundamentals) I had a look at eoddata.com some time ago found it good value for money (never compared to BBG / Factset like though) and I believe they do provide corporate action info HTH, Julien Date: Wed, 5 Sep 2012 23:17:28 -0700 From: junzh...@yahoo.com To: r-sig-finance@r-project.org; rvinc...@gmail.com Subject: Re: [R-SIG-Finance] Equities Data For US market, a good source of equity data is from CRSP of University of Chicago. The data is historical only and well cleaned. It costs about 20-30k per year. For global equity data, bloomberg and reuters are two good sources. J. Zhu --- On Wed, 9/5/12, Ralph Vince rvinc...@gmail.com wrote: From: Ralph Vince rvinc...@gmail.com Subject: [R-SIG-Finance] Equities Data To: r-sig-finance@r-project.org Date: Wednesday, September 5, 2012, 8:39 PM I'm looking for a reliable vendor of equity data, one that also provides information regarding corporate actions (dividends, splits, ex-dates, etc). Anyone know of any good sources? R. Vince ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince On Thu, Sep 6, 2012 at 6:48 AM, FJ M chicagobrownb...@hotmail.com wrote: Tickdata provides daily and intraday data very early the next morning. Their 1-minute intraday data is cheaper than every single trade data. Tickdata.com Yahoo Finance provides daily data available between 7 PM CST and 9 PM each evening. Google Finance provides daily data also, not sure about when it is available. Dividend adjusted data is problematic. If you want just log normal price returns, you will want to exclude the dividend from the close on ex-dividend eve when calculating the return on ex-dividend day. If you are looking to calculate your cost basis by subtracting out the cumulative dividend, you need to pick a starting point. If you want the cumulative return you can add the dividend to the stock price, but you need to pick a starting point. If you want to re-invest the dividend, you will need to keep track of both the dividend, the pay date to be accurate and pick a start date. Yahoo Finance provides the dividend on the ex-dividend date. I do not have a source for the pay date. I suspect most analysts re-invest the dividend on the ex-dividend date at the ex-dividend price. Good luck. Date: Wed, 5 Sep 2012 21:39:04 -0400 From: rvinc...@gmail.com To: r-sig-finance@r-project.org Subject: [R-SIG-Finance] Equities Data I'm looking for a reliable vendor of equity data, one that also provides information regarding corporate actions (dividends, splits, ex-dates, etc). Anyone know of any good sources? R. Vince ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
On Thu, Sep 6, 2012 at 8:02 AM, Ralph Vince rvinc...@gmail.com wrote: Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince library(quantmod) ?getDividends ?getSplits ?adjRatios ?getQuote ?yahooQF That is much more on topic that can someone tell me where to get some data? ;-) Best, Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Ah, thank you! It must be in the Quantmod API / Thank you. Ralph Vince On Thu, Sep 6, 2012 at 9:05 AM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 8:02 AM, Ralph Vince rvinc...@gmail.com wrote: Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince library(quantmod) ?getDividends ?getSplits ?adjRatios ?getQuote ?yahooQF That is much more on topic that can someone tell me where to get some data? ;-) Best, Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Also in quantmod, there is `getFinancials` if you want financial statements In qmao (https://r-forge.r-project.org/R/?group_id=1113), there's `getEarnings` which will give you historic analyst estimates and actual earnings numbers `getEarningsCalendar` will show you all stocks (U.S. and non-U.S.) that report earnings. It supports from and to arguments. `getDividendsCalendar` will show you all stocks that go Ex-Div today (although it also supports from and to if you want to see historic calendars) `getEconomicCalendar` shows the calendar of economic number releases `getMergersCalendar` shows mergers/acquisitions -Garrett On Thu, Sep 6, 2012 at 8:18 AM, Ralph Vince rvinc...@gmail.com wrote: Ah, thank you! It must be in the Quantmod API / Thank you. Ralph Vince On Thu, Sep 6, 2012 at 9:05 AM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 8:02 AM, Ralph Vince rvinc...@gmail.com wrote: Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince library(quantmod) ?getDividends ?getSplits ?adjRatios ?getQuote ?yahooQF That is much more on topic that can someone tell me where to get some data? ;-) Best, Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[R-SIG-Finance] sufficient n for a binomial option pricing model
Hi, I have a question regarding the selection of n, the number of time steps, in a binomial option pricing model. I suppose my question is not strictly related to R. As larger values should be more accurate, what I've read on the subject simply suggests that you use a sufficiently large value for your purposes. So I've been trying to evaluate what is a sufficiently large value of n for my purposes. Is there any rule of thumb regarding the value of n? When using the fOptions package CRRBinomialTreeOption function, with varying n, the price oscillates back and forth converging on a price. This can be clearly seen through plotting. require(fOptions) x - function(n) { CRRBinomialTreeOption(TypeFlag = ca, S = 50, X = 50, Time = 1/12, r = 0.02, b = 0.02, sigma = 0.18, n = n)@price } y - sapply(1:100, x) # mean(y) == 1.079693 plot(y) Given this oscillation, my question is whether it would be better to compute two prices using two smaller, consecutive values of n rather than one large value? Or is there some other better way? For example, using n =1000 or 1001, the option prices are within 5 hundredths of a cent, but the calculation is extremely slow for either. x(1000)# 1.077408 x(1001)# 1.077926 mean(sapply(1000:1001, x)) # 1.077667 Comparatively, taking the mean of n= 40 and 41 yields a value very close to the middle of the range, yet is much faster. mean(sapply(40:41, x)) # 1.0776 It seems like averaging two smaller, consecutive values of n is basically as accurate and far faster than using large values of n. I was hoping someone might have some insight into why this might or might not be a valid approach. Thanks. James ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] sufficient n for a binomial option pricing model
One way to terminate is to look at the consecutive differences between the averages and terminate if the difference is less than your tolerance. However, you should guard against the case where the consecutive differences are never less than the tolerance. In this case, just put in a maximum number of steps n and log the last average, the number of steps, and a message. This allows the user to determine whether they want to accept or reject the result. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mail: dale.sm...@fiserv.com www.fiserv.com -Original Message- From: r-sig-finance-boun...@r-project.org [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of J Toll Sent: Thursday, September 06, 2012 10:25 AM To: r-sig-finance@r-project.org Subject: [R-SIG-Finance] sufficient n for a binomial option pricing model Hi, I have a question regarding the selection of n, the number of time steps, in a binomial option pricing model. I suppose my question is not strictly related to R. As larger values should be more accurate, what I've read on the subject simply suggests that you use a sufficiently large value for your purposes. So I've been trying to evaluate what is a sufficiently large value of n for my purposes. Is there any rule of thumb regarding the value of n? When using the fOptions package CRRBinomialTreeOption function, with varying n, the price oscillates back and forth converging on a price. This can be clearly seen through plotting. require(fOptions) x - function(n) { CRRBinomialTreeOption(TypeFlag = ca, S = 50, X = 50, Time = 1/12, r = 0.02, b = 0.02, sigma = 0.18, n = n)@price } y - sapply(1:100, x) # mean(y) == 1.079693 plot(y) Given this oscillation, my question is whether it would be better to compute two prices using two smaller, consecutive values of n rather than one large value? Or is there some other better way? For example, using n =1000 or 1001, the option prices are within 5 hundredths of a cent, but the calculation is extremely slow for either. x(1000)# 1.077408 x(1001)# 1.077926 mean(sapply(1000:1001, x)) # 1.077667 Comparatively, taking the mean of n= 40 and 41 yields a value very close to the middle of the range, yet is much faster. mean(sapply(40:41, x)) # 1.0776 It seems like averaging two smaller, consecutive values of n is basically as accurate and far faster than using large values of n. I was hoping someone might have some insight into why this might or might not be a valid approach. Thanks. James ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
I don't think this is going to do what I'm trying to accomplish here, which is determine the next, future, pending ex-date for dividends or splits, if there is one announced, so that I can prepare the systems for this in advance. It seems to be an nasty problem and I'm trying to get out of maintaining this by hand! On Thu, Sep 6, 2012 at 9:05 AM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 8:02 AM, Ralph Vince rvinc...@gmail.com wrote: Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince library(quantmod) ?getDividends ?getSplits ?adjRatios ?getQuote ?yahooQF That is much more on topic that can someone tell me where to get some data? ;-) Best, Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
That data is expensive, but your prime broker will probably provide it for free. Otherwise, qmao::getDividendsCalendar can do it, but it's inefficient. You'd have to get the dividends calendar for future dates, and look for your symbols. Keep in mind that the local symbol will be used even if the stock also trades in the U.S. (i.e. BMW.DE instead of BMW) Good luck, Garrett On Thu, Sep 6, 2012 at 10:45 AM, Ralph Vince rvinc...@gmail.com wrote: I don't think this is going to do what I'm trying to accomplish here, which is determine the next, future, pending ex-date for dividends or splits, if there is one announced, so that I can prepare the systems for this in advance. It seems to be an nasty problem and I'm trying to get out of maintaining this by hand! On Thu, Sep 6, 2012 at 9:05 AM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 8:02 AM, Ralph Vince rvinc...@gmail.com wrote: Thanks for the replies. I'm not looking for data adjusted for splits and dividends, but rather the ex-dates when the dividend or split will be affecting prices, and the amount of the dividends/ splits. It appears Yahoo finance might have this information, Im just not sure how, in R, to extract anything other than prices in R. Ralph Vince library(quantmod) ?getDividends ?getSplits ?adjRatios ?getQuote ?yahooQF That is much more on topic that can someone tell me where to get some data? ;-) Best, Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
On 09/06/2012 10:45 AM, Ralph Vince wrote: I don't think this is going to do what I'm trying to accomplish here, which is determine the next, future, pending ex-date for dividends or splits, if there is one announced, so that I can prepare the systems for this in advance. It seems to be an nasty problem and I'm trying to get out of maintaining this by hand! The only way I know of to get out of maintaining it by hand is to pay for data. On the GUI side, Bloomberg, Factset, and Reuters have all been mentioned already I think. Rbbg of course talks to Bloomberg. On the other vendor side, I think Interactive Brokers has this data, and it may be available via the IBrokers package if it is available via the IB API. Additional vendors, such as CSIdata, tickdata.com, Reuters, CRSP, Telekurs, etc all sell this data, at varying prices and quality. Regards, - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Yes, I'm willing to pay for it, but I would like to get it automatically into a format I can parse and use, not even sure where that exists at the moment. (Doesn't Yahoo Finance get their data from CSI?) Ralph Vince On Thu, Sep 6, 2012 at 12:04 PM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 10:54 AM, Brian G. Peterson br...@braverock.com wrote: The only way I know of to get out of maintaining it by hand is to pay for data. On the GUI side, Bloomberg, Factset, and Reuters have all been mentioned already I think. Rbbg of course talks to Bloomberg. On the other vendor side, I think Interactive Brokers has this data, and it may be available via the IBrokers package if it is available via the IB API. Additional vendors, such as CSIdata, tickdata.com, Reuters, CRSP, Telekurs, etc all sell this data, at varying prices and quality. Interactive Brokers does provide an Upcoming Dividend Schedule for stocks, but it is a rough estimate that is often wrong. Also, I don't think you can get it from their API (although if someone knows how, please speak up). I think you have to go into the GUI, right-click a stock and select Dividend Schedule. -Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
On Thu, Sep 6, 2012 at 12:56 PM, Ralph Vince rvinc...@gmail.com wrote: THis looks pretty good, and could be parsed -- I just wish they had it for cash dividends as well; http://biz.yahoo.com/c/s.html Ralph Vince They do. Please look at library(qmao) ?getDividendsCalendar I think I've mentioned this before... Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
THis looks pretty good, and could be parsed -- I just wish they had it for cash dividends as well; http://biz.yahoo.com/c/s.html Ralph Vince On Thu, Sep 6, 2012 at 1:44 PM, Ralph Vince rvinc...@gmail.com wrote: Hi Jeff, Yes, but they only offer dividends not splits. I;ve been working off of sites like this and looking to automate it somehow, hopefully through R. On Thu, Sep 6, 2012 at 12:15 PM, Jeff Ryan jeff.a.r...@gmail.com wrote: You might be able to use this: http://www.dividend.com/ex-dividend-dates.php Jeff On Thu, Sep 6, 2012 at 11:13 AM, Ralph Vince rvinc...@gmail.com wrote: Yes, I'm willing to pay for it, but I would like to get it automatically into a format I can parse and use, not even sure where that exists at the moment. (Doesn't Yahoo Finance get their data from CSI?) Ralph Vince On Thu, Sep 6, 2012 at 12:04 PM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 10:54 AM, Brian G. Peterson br...@braverock.com wrote: The only way I know of to get out of maintaining it by hand is to pay for data. On the GUI side, Bloomberg, Factset, and Reuters have all been mentioned already I think. Rbbg of course talks to Bloomberg. On the other vendor side, I think Interactive Brokers has this data, and it may be available via the IBrokers package if it is available via the IB API. Additional vendors, such as CSIdata, tickdata.com, Reuters, CRSP, Telekurs, etc all sell this data, at varying prices and quality. Interactive Brokers does provide an Upcoming Dividend Schedule for stocks, but it is a rough estimate that is often wrong. Also, I don't think you can get it from their API (although if someone knows how, please speak up). I think you have to go into the GUI, right-click a stock and select Dividend Schedule. -Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. -- Jeffrey Ryan jeffrey.r...@lemnica.com www.lemnica.com ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Garrett, This is great. Do you think it would be possible to pass in a given ticker to get that informatoin, rather than getting the whole gulp? Ralph Vince On Thu, Sep 6, 2012 at 2:27 PM, G See gsee...@gmail.com wrote: Ralph, This will parse that yahoo link you provided. I'll add it (along with a wrapper) to the qmao package tonight. .getSplitsCalendar - function(YM=format(Sys.Date(), %Y%m)) { stopifnot(length(YM) == 1) if (is.timeBased(YM) || nchar(YM) == 10) { YM - format(as.Date(YM), %Y%m) } else if (nchar(YM) == 5) { YM - paste0(substr(YM, 1, 4), 0, substr(YM, 5, 5)) } else if (nchar(YM) == 7 length(grep(-, YM) == 1)) { YM - sub(-, , YM) } if (nchar(YM) != 6) stop('YM' should be 6 digits or a Date) Y - substr(YM, 3, 4) M - as.numeric(substr(YM, 5, 6)) # there is a different URL for the current month than for other months URL - if (identical(format(Sys.Date(), %Y%m), YM)) { http://biz.yahoo.com/c/s.html; } else paste0(http://biz.yahoo.com/c/;, Y, /s, M, .html) rt - try(readHTMLTable(URL, stringsAsFactors=FALSE), silent=TRUE) if (inherits(rt, 'try-error')) return(NULL) dat - rt[[which.max(sapply(rt, nrow))]] colnames(dat) - make.names(dat[1, ]) dat - dat[-c(1,2), -NCOL(dat)] #read.zoo(dat, index.column=1:2 dat[[1]] - as.Date(paste(substr(YM, 1, 4), dat[[1]]), %Y %b %d) dat[[2]] - as.Date(paste(substr(YM, 1, 4), dat[[2]]), %Y %b %d) dat[, NCOL(dat)] - as.Date(paste(substr(YM, 1, 4), dat[, NCOL(dat)]), %Y %b %d) dat } R .getSplitsCalendar() PayableEx.Date Company Symbol Optionable. Ratio Announced 3 2012-09-07 2012-09-10 Old Dominion ODFL Y 3-2 2012-08-13 4 2012-09-18 2012-09-19 LKQLKQ Y 2-1 2012-08-17 5 2012-09-21 2012-09-24 Medivation MDVN Y 2-1 2012-08-28 R .getSplitsCalendar('201208') PayableEx.DateCompany Symbol Optionable. Ratio Announced 3 2012-08-10 2012-08-13 Brown-Forman BF.B Y 3-2 2012-06-14 4 NA 2012-08-13 Coca-Cola KO Y 2-1 2012-04-25 5 2012-08-14 2012-08-15 Oi SA OIBR Y 3-1 2012-08-10 6 2012-08-21 2012-08-22 Schweitzer-MauduitSWM Y 2-1 2012-08-01 getDividendsCalendar gets it's data from earnings.com which is Reuters data. So, it should be good (except that it's way too much data if you only want to know the dividend date of a particular ticker) Regards, Garrett On Thu, Sep 6, 2012 at 12:56 PM, Ralph Vince rvinc...@gmail.com wrote: THis looks pretty good, and could be parsed -- I just wish they had it for cash dividends as well; http://biz.yahoo.com/c/s.html Ralph Vince On Thu, Sep 6, 2012 at 1:44 PM, Ralph Vince rvinc...@gmail.com wrote: Hi Jeff, Yes, but they only offer dividends not splits. I;ve been working off of sites like this and looking to automate it somehow, hopefully through R. On Thu, Sep 6, 2012 at 12:15 PM, Jeff Ryan jeff.a.r...@gmail.com wrote: You might be able to use this: http://www.dividend.com/ex-dividend-dates.php Jeff On Thu, Sep 6, 2012 at 11:13 AM, Ralph Vince rvinc...@gmail.com wrote: Yes, I'm willing to pay for it, but I would like to get it automatically into a format I can parse and use, not even sure where that exists at the moment. (Doesn't Yahoo Finance get their data from CSI?) Ralph Vince On Thu, Sep 6, 2012 at 12:04 PM, G See gsee...@gmail.com wrote: On Thu, Sep 6, 2012 at 10:54 AM, Brian G. Peterson br...@braverock.com wrote: The only way I know of to get out of maintaining it by hand is to pay for data. On the GUI side, Bloomberg, Factset, and Reuters have all been mentioned already I think. Rbbg of course talks to Bloomberg. On the other vendor side, I think Interactive Brokers has this data, and it may be available via the IBrokers package if it is available via the IB API. Additional vendors, such as CSIdata, tickdata.com, Reuters, CRSP, Telekurs, etc all sell this data, at varying prices and quality. Interactive Brokers does provide an Upcoming Dividend Schedule for stocks, but it is a rough estimate that is often wrong. Also, I don't think you can get it from their API (although if someone knows how, please speak up). I think you have to go into the GUI, right-click a stock and select Dividend Schedule. -Garrett ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list
[R-SIG-Finance] Performance Analytics table.AnnualizedReturns
Hi all, I am using the t(table.AnnualizedReturns(tradedata$daily.pnl.norm[2003/2010],Rf=0,geometric=TRUE)) at the Performance Analytics package to calculate the annualized returns, stdev and sharpe for the strategies output. The function returns a table like the one below for all the years included at the dataseries: Annualized Return Annualized Std Dev Annualized Sharpe (Rf=0%) daily.pnl.norm0.1018 0.0617 1.649 I was wondering if there is a way to calculate the same metrics on a yearly basis. As an example: Annualized Return Annualized Std Dev Annualized Sharpe (Rf=0%) daily.pnl.norm[2003]0.1018 0.0617 1.649 daily.pnl.norm[2004]0.0200 0.0200 1.000 daily.pnl.norm[2005]0.0100 0.0200 0.500 . . . . Is there any table that i can use to calculate the above table? Thank you, Nikos [[alternative HTML version deleted]] ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
Garrett, this is really great. So I only need to get the latest qmao to do this? It's in CRAN? Ralph VInce On Thu, Sep 6, 2012 at 2:49 PM, G See gsee...@gmail.com wrote: I guess since you really only care about the future, this would be more appropriate sc - getSplitsCalendar(from='2012-09-05', to='2012-12-31') sc[sc$Symbol ==LKQ, ] PayableEx.Date Company Symbol Optionable. Ratio Announced 4 2012-09-18 2012-09-19 LKQLKQ Y 2-1 2012-08-17 On Thu, Sep 6, 2012 at 1:44 PM, G See gsee...@gmail.com wrote: That's not really how the website is setup. So, I don't think that's how the function should be setup by default. But, you can easily filter the results by Symbol. Here is the wrapper I mentioned. getSplitsCalendar - function(from, to) { qmao:::getCalendarByMonth(.getSplitsCalendar, from=from, to=to) } This allows you to get and merge several months of splits calendars. sc - getSplitsCalendar(from='2012-01-01', to='2012-08-31') Now you have the splits calendar from January to August. You can filter that by the symbol you care about. sc[sc$Symbol == ALK, ] PayableEx.DateCompany Symbol Optionable. Ratio Announced 52 2012-03-16 2012-03-19 Alaska AirALK Y 2-1 2012-02-16 Good enough? Garrett On Thu, Sep 6, 2012 at 1:34 PM, Ralph Vince rvinc...@gmail.com wrote: Garrett, This is great. Do you think it would be possible to pass in a given ticker to get that informatoin, rather than getting the whole gulp? Ralph Vince ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Equities Data
You should be able to install it with this command install.packages(qmao, repos=http://R-Forge.R-project.org;) If for some reason that does not work, see this link: http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages Garrett On Thu, Sep 6, 2012 at 6:31 PM, Ralph Vince rvinc...@gmail.com wrote: Garrett, this is really great. So I only need to get the latest qmao to do this? It's in CRAN? Ralph VInce On Thu, Sep 6, 2012 at 2:49 PM, G See gsee...@gmail.com wrote: I guess since you really only care about the future, this would be more appropriate sc - getSplitsCalendar(from='2012-09-05', to='2012-12-31') sc[sc$Symbol ==LKQ, ] PayableEx.Date Company Symbol Optionable. Ratio Announced 4 2012-09-18 2012-09-19 LKQLKQ Y 2-1 2012-08-17 On Thu, Sep 6, 2012 at 1:44 PM, G See gsee...@gmail.com wrote: That's not really how the website is setup. So, I don't think that's how the function should be setup by default. But, you can easily filter the results by Symbol. Here is the wrapper I mentioned. getSplitsCalendar - function(from, to) { qmao:::getCalendarByMonth(.getSplitsCalendar, from=from, to=to) } This allows you to get and merge several months of splits calendars. sc - getSplitsCalendar(from='2012-01-01', to='2012-08-31') Now you have the splits calendar from January to August. You can filter that by the symbol you care about. sc[sc$Symbol == ALK, ] PayableEx.DateCompany Symbol Optionable. Ratio Announced 52 2012-03-16 2012-03-19 Alaska AirALK Y 2-1 2012-02-16 Good enough? Garrett On Thu, Sep 6, 2012 at 1:34 PM, Ralph Vince rvinc...@gmail.com wrote: Garrett, This is great. Do you think it would be possible to pass in a given ticker to get that informatoin, rather than getting the whole gulp? Ralph Vince ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] sufficient n for a binomial option pricing model
On Thu, Sep 6, 2012 at 9:40 AM, Smith, Dale dale.sm...@fiserv.com wrote: One way to terminate is to look at the consecutive differences between the averages and terminate if the difference is less than your tolerance. However, you should guard against the case where the consecutive differences are never less than the tolerance. In this case, just put in a maximum number of steps n and log the last average, the number of steps, and a message. This allows the user to determine whether they want to accept or reject the result. Dale, Thanks for the suggested method. Actually, that's probably overkill for what I'm trying to do, but it definitely puts the process in perspective and gives some insight into what I could be doing to boost the reliability of my pricing. Thanks again. Best, James -Original Message- From: r-sig-finance-boun...@r-project.org [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of J Toll Sent: Thursday, September 06, 2012 10:25 AM To: r-sig-finance@r-project.org Subject: [R-SIG-Finance] sufficient n for a binomial option pricing model Hi, I have a question regarding the selection of n, the number of time steps, in a binomial option pricing model. I suppose my question is not strictly related to R. As larger values should be more accurate, what I've read on the subject simply suggests that you use a sufficiently large value for your purposes. So I've been trying to evaluate what is a sufficiently large value of n for my purposes. Is there any rule of thumb regarding the value of n? When using the fOptions package CRRBinomialTreeOption function, with varying n, the price oscillates back and forth converging on a price. This can be clearly seen through plotting. require(fOptions) x - function(n) { CRRBinomialTreeOption(TypeFlag = ca, S = 50, X = 50, Time = 1/12, r = 0.02, b = 0.02, sigma = 0.18, n = n)@price } y - sapply(1:100, x) # mean(y) == 1.079693 plot(y) Given this oscillation, my question is whether it would be better to compute two prices using two smaller, consecutive values of n rather than one large value? Or is there some other better way? For example, using n =1000 or 1001, the option prices are within 5 hundredths of a cent, but the calculation is extremely slow for either. x(1000)# 1.077408 x(1001)# 1.077926 mean(sapply(1000:1001, x)) # 1.077667 Comparatively, taking the mean of n= 40 and 41 yields a value very close to the middle of the range, yet is much faster. mean(sapply(40:41, x)) # 1.0776 It seems like averaging two smaller, consecutive values of n is basically as accurate and far faster than using large values of n. I was hoping someone might have some insight into why this might or might not be a valid approach. Thanks. James ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.