-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 6: Code line "S_0 = adj_close[train.index[-1].date()]" #9
Comments
Hi, are you encountering the error while executing the code from the Notebook in this repo or after some changes done by yourself? This will already be helpful with potential debugging :) Cheers |
Many thanks for getting back! I simply copied the code into a Jupyter Notebook. Since the code & result seem to work leaving the ".date()" component out, I do not want you to bother with the issue I raised. Since I would like to use it in a business (Risk Management) context, I wanna make sure I do not ignore a vital part of the code. Do you think I can just proceed without the ".date()" part? Thanks again |
If relevant: One thing I noticed that the error message "KeyError: datetime.date(2019, 6, 28)" relates to the last trading day in "train" period. |
Hi @randommarko, indeed it seems that due to changing the date to If this solves the issue, please close it :) |
Many thanks for the fast reply! Defo resolved, thanks for clarifying. May I ask you a follow up question on Monte Carlo? Do you happen to know of an easy way in Python to define a percentile? Say of 100 similations, id like the 95th simulation on the downside, similar as a Value at Risk. Thanks again for your time. |
No worries :) I believe it's covered in a later part of the book. You can either sort the values and the x-th or use numpy. Cheers! |
many thanks again eryk! 👍 |
Hello,
when I type the following code line, I get the below error message:
S_0 = adj_close[train.index[-1].date()]
However, when I remove the part ".date()" the code works fine.
Did anyone experience the same behaviour?
Thanks
The text was updated successfully, but these errors were encountered: