Skip to content
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

Bug/Unnecessary code in backtest.py #15

Closed
z123 opened this issue Feb 12, 2015 · 2 comments
Closed

Bug/Unnecessary code in backtest.py #15

z123 opened this issue Feb 12, 2015 · 2 comments

Comments

@z123
Copy link

z123 commented Feb 12, 2015

There seems to be a bug in this block of code.

timestamps = prices.index.to_series().loc[start:]

# Check if the last day doesn't have data yet
# Like if it was early in the morning
if not timestamps[-1] in prices:
    timestamps = timestamps[:-1]

See https://github.com/Emsu/prophet/blob/master/prophet/backtest.py#L64-L69.

  1. That if statement will always pass. When using the in keyword with DataFrames it only checks the columns of the DataFrame. I think what you were trying to do is check the index of the DataFrame.

  2. I am not really sure why you are doing this. You grab the timestamps from the prices and then you proceed to check if timestamp[-1] is not in prices (which will never happen).

@Emsu
Copy link
Owner

Emsu commented Feb 13, 2015

@z123 Thanks I'm not really sure why I did that either. I have a hunch timestamps was probably calculated a different way at some point. Anyways, I'll fix that, thanks!

@z123
Copy link
Author

z123 commented Feb 13, 2015

No problem.

@Emsu Emsu closed this as completed Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants