Created
June 16, 2022 19:11
-
-
Save intrinio-gists/135603bab8bf9dee334e87fb3786d89a to your computer and use it in GitHub Desktop.
Constructs DataFrames for Daily Returns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _daily_returns_dataset( | |
historic_prices, | |
): | |
daily_returns_dataset = historic_prices.pct_change() | |
daily_returns_dataset = daily_returns_dataset.fillna( | |
0, | |
inplace=False | |
) | |
return daily_returns_dataset | |
def _folio_daily_returns_dataset( | |
daily_returns_dataset, | |
ticker_weights_dataset, | |
): | |
folio_daily_returns_dataset = daily_returns_dataset.dot( | |
ticker_weights_dataset["weight"] | |
) | |
return folio_daily_returns_dataset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment