I'm working on a project which analyzes financial data. I download the price and dividend information for the SPY ETF which tracks the S&P 500:
price = FinancialData["SPY", "RawClose", {"Jan 1, 2010", "July 31, 2015"}]
div = FinancialData["SPY", "Dividend", {"Jan 1, 2010", "July 31, 2015"}]
I want to find what the prices on the dividend dates were:
index = Position[price, p_ /; MemberQ[div[[All, 1]], p[[1]]], 1]
That gives the correct result. However it also give an error message:
Part::partd: Part specification List[[1]] is longer than depth of object.
How can I get rid of that?
Heads -> False, that isPosition[price, p_ /; MemberQ[div[[All, 1]], p[[1]]], 1, Heads -> False]– kirma Aug 02 '15 at 13:51