Use Artificial Intelligence (AI) to Predict the Stock Market with Python

  Рет қаралды 64,627

Computer Science (compsci112358)

Computer Science (compsci112358)

Күн бұрын

Пікірлер: 74
@leandrogoethals6599
@leandrogoethals6599 Жыл бұрын
How the flow of a forwardtest such prediction is: Step 1: Download the csv till current date Step 2: Delete the last 20% of the timestamps of the csv so if it's like data of 2000 till 2023 then cut till 2019 and save this as training_SP500.csv Step 3: Do the opposite of step 2 wich u cut the first 80% off and save it as future_Sp500.csv Step 4: train only on the data of training_SP500.csv Step 5: u test the the prediction for the missing 20% of the current data Step 6: on same chart plot the original data of the current s&p500 data And Voila a chart wich u can clearly see is those prediction where in the right direction!! Nice vid, good education
@itssardine5351
@itssardine5351 6 ай бұрын
So you’re just using 20% of available data to train? Seems like a whole lot of input is lost…
@leandrogoethals6599
@leandrogoethals6599 6 ай бұрын
@@itssardine5351 Well 20% of what u find adaquite ofcourse
@MyTopAnime
@MyTopAnime 5 ай бұрын
@@itssardine5351 If you know anything about AI, you generally use 20% as testing data and the rest as training data. Also sometimes too much data can cause overfitting. This means it can predict existing data with ease, but when it comes to new data, it will struggle to perform well.
@SPONGE2008
@SPONGE2008 4 ай бұрын
ima be so fr i dont know how to get the csv file its like 2am im so tired lol anyone can help? would be appreciated
@leandrogoethals6599
@leandrogoethals6599 4 ай бұрын
@@SPONGE2008 what u mean get "the" csv file u mean the one the video creator made(wath is his name again). I use my own csv wich is constructed by quering an api from a dataprovider, of course i don't wanna pay for data so i do this multiple times for diffrent time ranges and paste them togetther again
@joao_paiva
@joao_paiva Жыл бұрын
This type of algo is usefull just to predict the next time event. You have 70% accuracy but you are predicting just the next day price based in the last day price multiple times
@rjsingh4255
@rjsingh4255 Жыл бұрын
that is right mr future billionaire
@joao_paiva
@joao_paiva Жыл бұрын
​@@rjsingh4255 lmao, just to share information bro 😂
@leonli891
@leonli891 2 ай бұрын
so what? fake thing?
@benzhou9751
@benzhou9751 Жыл бұрын
How do I get it to predict more
@Mr._Cousin
@Mr._Cousin Жыл бұрын
should it be more reasonable to use the price the day before to predict the price next day in train and testing?
@sleepy9305
@sleepy9305 Жыл бұрын
Smart idea but one days data might not be enough to make a good prediction
@joao_paiva
@joao_paiva Жыл бұрын
it's what he did, the N day open price is equal to the N-1 day close price
@antonyhartley9586
@antonyhartley9586 Ай бұрын
@@joao_paiva Totally incorrect closing_price != opening_price_next_day, google it!
@pohu6296
@pohu6296 Жыл бұрын
Use Your prediction and check the return %, the results is very very poor. The prediction is basically noise with baseline of open price. You can just plot open price vs close price, the are similar to your prediction.
@AB_498
@AB_498 10 ай бұрын
that's true but i wonder why it still got an accuracy of 70% on test data
@kenhan168
@kenhan168 6 ай бұрын
@@AB_498 , because it feed in the current open price and the volume, which is not available in actual trading. You can only get Volume after the market close.
@vyacheslavfiodorov5738
@vyacheslavfiodorov5738 Жыл бұрын
Are you sure that it is not learning from the high and low prices of the current day that has not yet closed? How to make sure?
@kenhan168
@kenhan168 6 ай бұрын
For the volume, you can only get it after the market close. So putting current day of volume while the market is open has no much use, as the volume is changing throughout the day.
@codeline9387
@codeline9387 10 ай бұрын
actually thats almost useless prediction coz we know volume when only when close is known
@IkaroSampaioDj
@IkaroSampaioDj 10 ай бұрын
Stopped this video when he included 99% of the data in the train_data. Makes no sense
@sebastiangomez6593
@sebastiangomez6593 9 ай бұрын
Why , explain me I'm new in python
@mpregsonic5874
@mpregsonic5874 8 ай бұрын
Yeah it does. He is doing EXTRApolation where the future is being predicted. Predicting more than 1 times step into the future in this case compounds the margin of error greatly. This means you’ll want to train on all of the data up until the time period you are trying to predict. This is standard in time series. Even if you want to train on 70 percent to predict the remaining 30 percent you do it in what’s called a rolling forecast way which essentially retrains the model on all the data up to the point you’re trying to predict for every point within that original 30 percent. In machine learning where time series is not involved, an INTERpolation problem, training the model on 70 percent and testing on the remaining 30 is a lot more common and makes sense.
@hyrumnielsen4390
@hyrumnielsen4390 2 ай бұрын
Only predicting the next day (or time interval) for day traders.
@yourbestlifebrandi
@yourbestlifebrandi Жыл бұрын
Where or how did you produce the input file for historical data? Where can it be obtained?
@MeghanaHM
@MeghanaHM Жыл бұрын
Same question
@吳嘎
@吳嘎 11 ай бұрын
import pandas_datareader.data as web # Required steps to setup Yahoo Finance import yfinance as yfin yfin.pdr_override() aapl = web.get_data_yahoo('AAPL', start='2019-01-01', end='2020-01-01')@@MeghanaHM
@crackedatcurry
@crackedatcurry 8 ай бұрын
kaggle
@hamzazakaria2582
@hamzazakaria2582 Жыл бұрын
i keep getting an error at the "model.score" it says model is not defined
@luishernandezmatos2264
@luishernandezmatos2264 Жыл бұрын
you have to define the model ===> model = XGBRegressor() model.fit(train_data[features],train_data[TARGET]) y_pred = model.predict(test_data[features]) #Accuracy model.score(test_data[features], test_data[TARGET])
@kaushikmetha3429
@kaushikmetha3429 Жыл бұрын
This works only for one stock. Is there any way to design a neural network model that can be used to predict stock price of more than one stock?
@Stopinvadingmyhardware
@Stopinvadingmyhardware Жыл бұрын
No, there isn’t.
@AI_Vania
@AI_Vania Жыл бұрын
Yes, you can predict multidimensional stock returns with a nn by having one or more output nodes for each return series that you want to predict.
@GamingwithPortals
@GamingwithPortals Жыл бұрын
Just use threads and run the same program for many different stocks
@Stopinvadingmyhardware
@Stopinvadingmyhardware Жыл бұрын
@@AI_Vania No, there isn’t. You can’t predict, you’re only building a measurement based system that estimates risk and when to purchase and sell based on estimated risk.
@AI_Vania
@AI_Vania Жыл бұрын
@@Stopinvadingmyhardware What do you mean "you can't predict"? One can build a model to predict future prices or (maybe better) future price distributions. The NN doesn't necessarily make risk estimations or buy/sell decisions, those things may involve logic that is outside of the NN.
@Aether_46
@Aether_46 Жыл бұрын
Hope you had tutorial for deployment of this and for real time price to predit.
@taneti_sanjay
@taneti_sanjay 8 ай бұрын
Predicting real-time market prices presents significant challenges due to the need for up-to-date data. While it's theoretically possible to predict future prices, accessing real-time data is often limited by market closing times and costly data acquisition. APIs typically provide data once the market closes, hindering the ability to make real-time predictions. Moreover, obtaining live data usually incurs substantial expenses. Therefore, predicting prices for future points requires historical data for training models, making real-time prediction impractical in many cases. In addition to data accessibility challenges, there are inherent complexities in modeling financial markets that further complicate real-time predictions. Financial markets are influenced by a multitude of factors, including economic indicators, geopolitical events, investor sentiment, and market psychology. These factors can lead to sudden fluctuations and volatility, making it difficult to accurately forecast prices in real time. Furthermore, market dynamics are constantly evolving, with new information continuously being incorporated into prices. This makes it challenging for predictive models to adapt quickly enough to capture and react to these changes in real time. Moreover, the presence of noise and randomness in financial data adds another layer of complexity. Despite best efforts to develop sophisticated predictive models, there is always a degree of uncertainty inherent in predicting future prices accurately.
@JCCreatorStudio
@JCCreatorStudio 8 ай бұрын
im new to ML, the final plot only show some orange line near the end, what does it mean and where are the rest?
@GamingWithAJ175679
@GamingWithAJ175679 7 ай бұрын
the dataset had the entire data including the one at the end. However, he split the dataset into 2 parts. 1 big and 1 small (the one at the end). He fed the bigger chunk of data into the ml model and kept the smaller chunk aside. Once the thing was trained, he asked the model to predict the next prices which he then compared to the smaller chunk of data he did not allow the model to see.
@shilpabaranwal5913
@shilpabaranwal5913 7 ай бұрын
Nice Video but not useful for real time prediction, volume information will not be available beforehand
@2ncielkrommalzeme210
@2ncielkrommalzeme210 8 ай бұрын
way of Telling the program is brief . how can we get the csv files for example like yours SPY.csv
@gaurirajput9856
@gaurirajput9856 7 ай бұрын
you can download it from google or you can get it from google search
@modichanel16
@modichanel16 Жыл бұрын
great tutorials 👍👍👍👍👍
@rverm1000
@rverm1000 Жыл бұрын
typo? train_data= data.iloc[:int(.99 * len(data)), :] test_data= data.iloc[int(.99 * len(data)):,:]
@dansimon4056
@dansimon4056 Жыл бұрын
Hey, nice, can you do a tutorial for optimal execution on python using almgren kriss?
@Talangenz
@Talangenz Жыл бұрын
How do I, predict more, like not only the test set for example 3 years forward
@joao_paiva
@joao_paiva Жыл бұрын
this type of code is usefull just to predict the next time event
@ditoiuc
@ditoiuc Жыл бұрын
in the last 3 years we had : covid, war on ukraine. no python script could take that into account
@reynolrodriguez4982
@reynolrodriguez4982 Жыл бұрын
easy money 😂
@wuyanchu
@wuyanchu Ай бұрын
Thx and god bless 😊
@vladvol855
@vladvol855 Жыл бұрын
Very interesting! But, how could it be used in algotrading?
@jasonreviews
@jasonreviews Жыл бұрын
you can't it's 30-60% accurate. You can't predict black swan events or news.
@antonyhartley9586
@antonyhartley9586 Ай бұрын
shame there's no code (just pitching for sign-up), I'll just type it in:)
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 Ай бұрын
Hi antonyhartley9586, could you please elaborate on your statement?
@useradav
@useradav Жыл бұрын
I followed you step by step, but my historical chart is a downtrend for some reason.
@businesstodayve
@businesstodayve Жыл бұрын
check the indexes of your dataset
@robertobonani8571
@robertobonani8571 Жыл бұрын
Can see you are a programmer but not a data scientist
@OshpreetSinghJoshan
@OshpreetSinghJoshan Жыл бұрын
where to get dataset for this
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 Жыл бұрын
Hi, You can get the data set for this at patreon.com/computerscience
@harveychang6829
@harveychang6829 Жыл бұрын
yfinance
@王阿翰-j9r
@王阿翰-j9r Жыл бұрын
Overfitting bruh
@guillermogomez9731
@guillermogomez9731 9 ай бұрын
Pregunta que le hago a todos, para que te sirve esto xD. Para nada, no te da ninguna info
@vv9730
@vv9730 Жыл бұрын
etni jhak marane ke bad prediction acuuracy only 70 %....11:30..!!!
@tristeub997
@tristeub997 5 ай бұрын
It is totally useless wtf ??
@serg8483
@serg8483 9 ай бұрын
I'm surprised why this video is getting so many views and likes. You made a huge mistake in your logic. This is not the accuracy of your model. This is a coefficient of determination that does not play any useful role in building a trading strategy. The coefficient of determination shows how strongly you can describe the target variable using your features. If you take data from the previous day, and without a model. Your coefficient of determination will be 0.99 In short, it’s not accurate and it’s useless what you did
@tuanvulet.9776
@tuanvulet.9776 Жыл бұрын
thanks bro
I Built a Trading Bot with ChatGPT
18:33
Siraj Raval
Рет қаралды 1,9 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 15 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 116 МЛН
Triple kill😹
00:18
GG Animation
Рет қаралды 18 МЛН
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,6 МЛН
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 337 М.
Find Undervalued Stocks Using AI & Python
17:30
Computer Science (compsci112358)
Рет қаралды 7 М.
LSTM Top Mistake In Price Movement Predictions For Trading
9:48
CodeTrading
Рет қаралды 98 М.
A Machine Learning Stock Trading Strategy Using Python
26:18
Computer Science (compsci112358)
Рет қаралды 20 М.
How to Code a AI Trading bot (so you can make $$$)
35:09
Nicholas Renotte
Рет қаралды 678 М.
How To Self Study AI FAST
12:54
Tina Huang
Рет қаралды 589 М.
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 15 МЛН