Retrieving Dividend Adjusted/Unadjusted Daily Close and Minute Bar Data
I am implementing a strategy which involves calculating returns in several time frames: from yesterday close to today's open, and from several intraday time points the close. For example, the overnight return from holding AAPL from yesterday's close to today's open, or from 2:30pm to the close. Naturally I retrieve the daily bar and minute bar data from cloudquant to do these calculations.
I use the bar.daily_by_index function to retrieve the daily closing data, and the bar.minute_by_index to retrieve the intraday prices.
I notice that the daily closing prices I have retrieved appear to have been adjusted for dividends. On the other hand, the minute bar data appear to be unadjusted prices.
To do a correct calculation of the overnight return, I would need yesterday's closing price to be dividend adjusted (so the overnight return would include the impact of the ex-dividend amount). However, to do a correct calculation of the intraday to close return, I would need the daily closing price to be unadjusted, because the intraday minute bar data are also unadjusted.
So my questions are:
1. Is there a way to retrieve unadjusted daily closing prices ?
2. Is there a way to retrieve adjusted minute bar data ?
3. In live trading environment, by what time in the morning does the dividend adjustment get incorporated into the historical price data ? I notice that in some cases, the ex-dividend amount for some tickers may not be available in the public domain even by 9:30am.
Thanks.
Comments
The goal is to provide all data adjusted (both daily and minute bars). We'll check and update this ticket if there are any known open bugs.
In
md.stat
contains information related to the corporate actions for a given day.We would need some examples of dividend data being added late to verify how our vendors manages the situation. One example I know of is when SPY goes ex-dividend, the exact dividend is add until later in the day. We manually add the dividend as an estimate and adjust it when we get the correct information.
Thanks. Based on your explanation, I figure the easier way is for me to retrieve the corporate actions information and make the adjustments myself.
I tried accessing the md.stat object to retrieve corporate action data, using the sample script from cloudquant's website here:
https://cloudquant.com/application/#/glossary/docs?version=9664&group=api&path=9664%7Capi%7Ccloudquant%7Cmd%7Cstat
I ran it on the exact same date as shown in the documentation. It triggered an error:
File "job/CQe3e308ebeec3465fafbedd785beb5817.py", line 25, in on_start
print ' md.stat.split_ratio - ', md.stat.split_ratio
File "/opt/anaconda/lib/python2.7/site-packages/tradesim/market.py", line 1611, in getattr
return self._storage.stat[self._symbol, key]
File "/opt/anaconda/lib/python2.7/site-packages/tradesim/market.py", line 76, in getitem
return self._data[symbol][column]
KeyError: 'split_ratio'
md.stat.split_ratio -
Looks like the split_ratio attribute does not exist.
I have also tried the script using a different ticker, and on a different date (e.g. EEM on 12/21/2016, which is an ex-dividend date). I was looking for the md.stat.dividend_amount attribute, but again it looks like that attribute does not exist.
My questions are:
1. The documentation mentions that certain attributes (e.g. split ratio, dividend amount) only available for GP. Can you tell me what GP is ?
2. Does the case of, for example, EEM on 12/21/2016 falls under the GP category ? I am trying to see how I can get the ex-dividend dates and amounts for a range of tickers.
Thanks for your help.
We have made some upgrades to the historical minute bar and daily bar facility and believe that this should address your need to pull corporate action adjusted minute and daily bars from a point in time of query perspective walking backwards chronologically. We can investigate exposing the split_ratio attribute if you are still unable to accomplish your objectives.