QuantRocket

PRICE and MARKETCAP Sharadar data


#1

Hi - I’m playing with the sharadar datasets and trying to work through some of the code along blocks. I’ve got some things working pretty well - but i don’t understand some of the metrics being used in the fundamentals ones. It looks like the metrics being used are semi-static - i understand that EPS data for example is only updated quarterly, but things like MARKETCAP/EV/PRICE when querying quarterly fundamentals are only updated quarterly. I guess this is part of the reindex like forward fill that is happening - but it means in the code along that it is not updating for price changes when calculating daily metrics? Or am I missing something obvious? Can see what i mean in the code below from the code library - ev/ebit doesn’t change? Is there a better way than to recalculate the market cap every day from actual prices and the reported shares outstanding? Thanks for any understanding, i must be missing something.

from quantrocket.fundamental import get_sharadar_fundamentals_reindexed_like

Request EV/EBIT. The dimension “ART” (= “As reported - trailing twelve months”) excludes restatements.

fundamentals = get_sharadar_fundamentals_reindexed_like(closes, fields=[“EVEBIT”], dimension=“ART”, domain=“sharadar”)
enterprise_multiples = fundamentals.loc[“EVEBIT”]

Ignore negative enterprise multiples, which indicate negative earnings

enterprise_multiples = enterprise_multiples.where(enterprise_multiples > 0)

enterprise_multiples.tail()
ConId 113652 113738 113756 113760 113761 113764 113787 113810 113837 113892 … 199962 199972 199976 199977 199984 199989 199990 199997 199998 9198200
Date
2015-12-24 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN … 66.0 13.0 NaN 13.0 13.0 20.0 21.0 14.0 NaN 22.0
2015-12-28 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN … 66.0 13.0 NaN 13.0 13.0 20.0 21.0 14.0 NaN 22.0
2015-12-29 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN … 66.0 13.0 NaN 13.0 13.0 20.0 21.0 14.0 NaN 22.0
2015-12-30 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN … 66.0 13.0 NaN 13.0 13.0 20.0 21.0 14.0 NaN 22.0
2015-12-31 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN … 66.0 13.0 NaN 13.0 13.0 20.0 21.0 14.0 NaN


#2

If you want the metrics to update daily, you should calculate them using the daily prices, which is pretty easy to do since you have the daily prices and since Sharadar provides the formulas to use in the docs:

fundamentals = get_sharadar_fundamentals_reindexed_like(
    closes, 
    fields=["SHARESBAS", "SHAREFACTOR"], dimension="ART", domain="sharadar")

shares = fundamentals.loc["SHARESBAS"]
factors = fundamentals.loc["SHAREFACTOR"]
market_caps = shares * factors * closes

#3

Urgh that makes so much sense - thank you. Not used to the coding logic and way to approach problems yet. Thanks, apols for what was dumb question in hindsight. Thank you for patience.


#4

Hi Brian,
I’m learning masses working through this, thank you for your help. One thing i’m falling over at is the use of the the calendar date to denote the relevant quarterly reporting period. i want to check that for example revenue is up in the most recently reported quarter vs the corresponding quarter 1 year ago. the time shift doesnt work quite right as not always the same days between reporting for different stocks, and as the dataset has the calendar date field, seems that should be the one to use. but i cant get the logic of how to compare todays date row value for revenue in most recent quarter number with the same quarter a year ago by nicely selecting it back based on the calendar date field. any help with logic happily received. Thank you.


#5

That requires a bit of pandas kung-fu. There is some example code in the docs (different dataset but same principle).


#6

Thank you very much - a real dataset and some real problems helping me immensely learn the kung-fu. thanks - have a great weekend.


#7

Hi - apologies for likely another dumb question - i’m running the following chunk of code from the docs to get prices, and have fields ‘Close’ and ‘CloseUnadj’ - and i get the same numbers for each. Eg DHR is 199122, i think went ex 03/26/20 but i get these numbers for both close and close unadj. Same for the others I have spot checked.

Field Date 199122
Close 3/23/2020 121.39
Close 3/24/2020 129.15
Close 3/25/2020 129.32
Close 3/26/2020 138.66
Close 3/27/2020 138.58
Close 3/30/2020 140.82
CloseUnadj 3/23/2020 121.39
CloseUnadj 3/24/2020 129.15
CloseUnadj 3/25/2020 129.32
CloseUnadj 3/26/2020 138.66
CloseUnadj 3/27/2020 138.58
CloseUnadj 3/30/2020 140.82

from quantrocket import get_prices

DB = ‘sharadar-1d’
UNIVERSES = [‘securities’,‘mega-caps’,‘large-caps’]
EXCLUDE_UNIVERSES = [‘utilities’, ‘nano-caps’, ‘micro-caps’, ‘small-caps’, ‘mid-caps’]

test_prices = get_prices(DB,
start_date=‘2019-10-31’,
end_date=‘2020-04-30’,
universes=UNIVERSES,
exclude_universes=EXCLUDE_UNIVERSES,
fields=[‘Close’,‘CloseUnadj’,‘Volume’])
test_prices.head()

Does one need a different set of subscriptions from the ones i have? or have i missed something obvious?!
Thanks, Dave


#8

That particular dataset is split-adjusted but not dividend-adjusted. Dividends are provided in a separate column. There is a snippet of code in the v2 docs that shows how to apply dividend adjustments in pandas. This code will also work for the current version.

In the current version of the software, the only dataset that is already dividend adjusted is from IBKR using the bar type ADJUSTED_LAST. In version 2 of the software (forthcoming in June), there are several data options that are already dividend adjusted.


#9

Thanks - i emailed the [email protected]… email yesterday to try and arrange a phone call to talk about custom development/ongoing support and other datasets with you at some point - let me know if thats possible?
Dave


#10

Sorry - just seen your reply - was stuck in a firewall filter.