Predict Bitcoin Prices With Machine Learning And Python [W/Full Code]

preview_player
Показать описание
We'll predict the future price of Bitcoin using historical price and sentiment data. We'll use data on the USD/BTC price from Yahoo Finance, along with data from Wikipedia about edits to the Bitcoin page.

We'll merge and combine this data, then use it to train a random forest model that will tell us if Bitcoin prices will increase or decrease tomorrow. We'll then switch to an XGBoost model and better predictors to improve accuracy.

We'll develop a backtesting system and use a robust error metric so we can tell if the algorithm is performing well. This system will also be able to make next-day predictions.

This project can be extended to other cryptocurrencies, or be used to predict multiple days ahead.

Chapters

0:00 Project overview
02:33 Downloading edits from Wikipedia
04:57 Finding the sentiment of page edits
14:17 Converting sentiment data into a DataFrame
19:32 Downloading Bitcoin price data
23:49 Preparing data for machine learning
27:38 Training our baseline ML model
32:07 Evaluating error with backtesting
37:05 Using an XGBoost model
39:12 Improving precision with trends
46:03 Generating future predictions
46:56 Next steps to improve the model

---------------------------------
Join 1M+ Dataquest learners today!
Master data skills and change your life.
Рекомендации по теме
Комментарии
Автор

For anyone stuck trying to merge the wiki and btc history data frames, if you get a time-zone error (Cannon merge tz-naive with tz-aware), you will need to edit the datetime index of the btc history data frame after converting it to a datetime object to make it time-zone naive. Here was my fix:
btc.index = pd.to_datetime(btc.index) [Original Code from Vik]
btc.index = btx.index.tz_localize(None) [Fix to make index time-zone naive]

DanielGarcia-uqyz
Автор

For those stuck in cell 7, be aware that one data entry has no comment (20:44, 10 September 2022‎ Staxringold)
You have to delete that entry with "del revs[x]" being x the position. It depends on when you obtain the data.

atenea
Автор

Thank you for the video. It helped me alot better than my boot camp course.

ricebarbie
Автор

Great one Vik. please keep them coming

mahmoodhossainfarsim
Автор

Vik, thanks for creating these and sharing your knowledge.

gudttnq
Автор

are you putting look ahead bias using trend variable, because you sum the target and in the current bar you dont have the bar closed so in real time wont have the trend predictor

sunday-thequant
Автор

working on this for my undergraduate project and my aim is to improve the efficiency of this model. Is there a publication of the work in order to reference it?

iamboom
Автор

I also found that rolling by 15 instead of 30 increases the accuracy in 0.5 points

atenea
Автор

Aren't you leaking data by using the Close Value as a predictor? I mean the algorithm just have to look at this to predict next day. Can you reason about it?

channelguy
Автор

if you had other variables such as indices, commodity prices would you need to take differences of the variables in order to make the dataset stationary?

ahmetselmanayberkbozkurt
Автор

awesome videos! keep it up! have you tried using transformers for timeseries? also, in your experience, what's your opinion on training using technical indicators (let's say RSI, CCI, stochastic, etc) and VIX, rates (could be us 10 years yield for example)?. an idea I'm exploring is trying to figure out how to use also the rolling correlation with a set of assets (let's say you are fiting for QQQ comparing or correlating with dxy, gold or any other asset to check if the rolling correlation impacts in any way)... take care!

cacus_
Автор

Amazing video. Thank you so much for sharing, I was able to modify it and develop it further to predict the price of Ethereum! Thanks for the inspiration.

pranitchand
Автор

hi! enjoying making this great video, it's the first time I incorporated sentiment analysis at all (in my ML journey). *I'm having a problem with the history attribute/method of yf!* Anyone else?

ashanbandaranayeke
Автор

Awesome video, I learned a lot. Thanks!

it_s_just_me
Автор

Would/Can you build me one for a certain crypto coin?

chriscoleman
Автор

you can use timeseries cross validation technique

merterselcuk
Автор

the mwclient somehow it gives an error

wmgallo
Автор

line 56:Cannot join tz-naive with tz-aware DatetimeIndex.Any solution?

abhinavab
Автор

i am trying your tutorial in 2024 and yfinance shows that it has no data regarding bitcoin

Who-ue
Автор

how can we show the predection in 54 rather than 0.54

LXS
visit shbcf.ru