Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pykrx import stock
- def 지수수익률(df):
- 기간수익률 = df['종가'][-1]/df['종가'][0]
- N = (df.index[-1] - df.index[0]).days / 365
- return (기간수익률 ** (1/N)) - 1
- df = stock.get_index_ohlcv_by_date("19800104", "20200831", "1001")
- CAGR = 지수수익률(df)
- print(CAGR)
Advertisement
Add Comment
Please, Sign In to add comment