dashee87 / blogScripts

Repository for code used in my blog posts
MIT License
386 stars 247 forks source link

Isn't graph of Random Walk test set wrong? #3

Open zfanswer opened 6 years ago

zfanswer commented 6 years ago

In bolack in[13], ax1.plot(market_info[market_info['Date']>= split_date]['Date'].astype(datetime.datetime), market_info[(market_info['Date']+ datetime.timedelta(days=1))>= split_date]['bt_Close'].values[1:] * (1+bt_random_steps), label='Predicted')

Why choose to use values[1:] here? shouldn't it be values[:-1]?

use values[1:] then no meaning to get data 1 day before split_date by (market_info['Date']+ datetime.timedelta(days=1))>= split_date, [1:] will skip the first day, start apply random walk on actual_data(t), not actual_date(t-1).

dashee87 commented 6 years ago

Apologies for the delay, I'm still getting through my Christmas backlog...

It wasn't immediately obvious to me why I went [1:], but it's actually because the dataframe is ordered by date in descending order. That's the default ordering on coinmarketcap. That means market_info[0] is actually the latest date, so we don't need to try to predict the day after it.

I think that resolves your issue. If not, please let me know!