Open
Description
Hi Derek, thanks for your awesome videos!
In Python for Finance
https://www.youtube.com/watch?v=nNkKTJTu-mU&list=PLGLfVvz_LVvTHOWIEBAl-YOr_FC8lRmWX
your output shows that Amazon's stock price rose by ~18% in 2020; I think by your calculation in
def get_return_defined_time:
the number should be 0.6166401575831238
The bug is in your date formatting. Where you compare a date formatted like this:
start = f"{syear}-{smonth}-{sday}"
which look like this:
2020-1-1
with dates in your dataframes that look like this:
2020-01-01
your date comparison fails much of the time.
I think if you change your date formatting from this:
start = f"{syear}-{smonth}-{sday}"
to this
start = dt.datetime(syear, smonth, sday).strftime("%Y-%m-%d")
you will be good to go!
Metadata
Metadata
Assignees
Labels
No labels