Yeah awesome 👏 , keep going on better and better ❤🎉. I’m just a newbie’s and self study so my path of learning programming seem to be not a good order but I found many useful things from your videos. I’m just an electrical engineer but I love programming for algo trade , finding stocks and for further may be a nice jobs of programming although now I’m 42 years old. Thank so much
Keep up the good work my friend, I'm following closely most of your videos and miniprojects. It's an outstanding job what you are doing, my congrats. Greetings from Spain
@Algovibes, Trying to run the code but getting an error at the end of recommendation stage. Can you pls help me with below error. 'str' object has no attributes called 'TABLE_NAME' I'm using the same code, all the stages are working fine except last recommendation.
Just to be clear in OOP when you want to use another method within a method like you do in getprices, I don't need to do anything in the constructor. The method gettables(self): method allows me to create an attribute in the getprices(self): module? Said differently ,why does the for loop in getprices work? for table, schema in zip(self.gettables().TABLE_NAME, self.gettables().Schema): In fact, it seems that the attributes "work" because in the gettables(self): method we created a dataframe that has columns TABLE_NAME and Schema thus the .TABLE_NAME and .Schema ending for the attribute in getprices(self): method for loop it seems. Could you expand on this perhaps?
I probably wouldn't code it like that anymore but rather call the method creating a necessary object in the constructor and define it. But it also works this way.
I would like to get a code that recommends stocks in the NASDAQ under $5 that have just experienced MACD crossover and 10 stocks at a time but where is best to run such python codes
That's correct and that is intended. Reason behind that is, those functions are doing data manipulations to a provided frame. There is no need to return anything.
Hi, many thanks for making this extremely useful video. I have a qs - when you say you updated the database to most recent date - can you show how do you it - is it a recurring code from python everyday to add price data or how can you avoid downloading same data time and time again. Many thanks
Hey, great video once again! Can you please tell how to program for usual case where there is no "." in stock price? You touch on at 8:21, but don't elaborate the exact steps. Thank you
@@Algovibes Basically I downloaded data for NASDAQ stocks but cannot properly adjust your code to it as Symbols of US stocks usually do not have “.” inside like Nifty, Bovespa, and RTSI stocks. Therefore can you say the adjustments to the code in such case starting from 8:21 of your video. I think this line that you describe at 8:21 is the ONLY thing I need to change. Thank you!
Thank you for the video! When you run the applytechnicals function in 23:22 I get an error message saying "numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.", have you come across this before? I believe the lines "df['Decision GC'] = df.Signal.diff()" generates that error.
@@Algovibes here, I could really use some help to resolve this: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in ----> 1 applytechnicals(nifty) in applytechnicals(which) 3 for frame in prices: 4 MACDdecision(frame) ----> 5 Goldencrossdecision(frame) 6 RSI_SMAdecision(frame) 7 return prices in Goldencrossdecision(df) 4 # The indicator triggers when the short term SMA is above the long term SMA 5 df['Signal'] = np.where(df['SMA20'] > df['SMA50'], True, False) ----> 6 df['Decision GC'] = df.Signal.diff() 7 ~\Anaconda3\lib\site-packages\pandas\core\series.py in diff(self, periods) 2549 dtype: float64 2550 """ -> 2551 result = algorithms.diff(com.values_from_object(self), periods) 2552 return self._constructor(result, index=self.index).__finalize__(self) 2553 ~\Anaconda3\lib\site-packages\pandas\core\algorithms.py in diff(arr, n, axis) 1975 out_arr[res_indexer] = result 1976 else: -> 1977 out_arr[res_indexer] = arr[res_indexer] - arr[lag_indexer] 1978 1979 if is_timedelta: TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
"df1=yf.download(name, start=date)[1:].reset_index() " this expression is updating rather than "df1=yf.download(name, start=date)[2:].reset_index() " not sure this could you look in this ....
Hi, thanks for watching and your comment. Can you elaborate your question? I am not quite sure what you want to compare. Thanks for clarifying in advance.
I am comparing current date with last record date and records are stored in string format, so I was getting an error however I that issue is clear. New issue comes with the download function.
brother I asked chatgpt to provide a code that screens for stocks under $5 which the MACD has just crossed over meaning the just experienced the crossover at that time and the stocks shouldn't be more that 10 could you do that for me and where is the to run this types of python codes
I'm implementing this in a different kind of way and also sending an email to myself EoD with the recommendations using smtplib and email.mime libs. Would be helpful to get some backtesting into this, so we could test new strategies or modify existing ones... nice vid.
Awesome man! Really good ideas, thanks a lot for sharing your thoughts and tools! Appreciate it a lot. Not quite sure if I am doing a backtest (which doesn't mean I will not but it is not on my priority list). I got some content on my channel where I am running some backtests (e.g. MACD), maybe you find something useful for you.
@@Algovibes Yeah, I watched it all hehe. But I was thinking on something more abstract, I know there's a lot of libs of backtesting but I always thought it could be better. The best way for me would be a function that receives a df with 3 columns (timestamp, closing price, volume, signals) and just return avg return (%) and accuracy (%), so it's decoupled of the strategy. Also, another suggestion which I think it's relevant content: a cronjob that executes everyday at EoD and updates your local db, applies strategies to get signals and send all the info on a e-mail (some other info might be helpful like highest/lowest daily return of all stocks you're watching or on your db). I got that already working if you'd like to take a look :) Cheers.
Extremely helpful and informative thank you! I was curious: Do you have any sources or further info for updating the mysql database using yfinance or any other method really? I have watched your previous video: "Simple Stock Recommendation System based on Technical Trading Indicators (ta) using Python & SQL" covering your method to update; however, I am still a bit lost. When I check the schema through mysql, I cannot find any updated new days added. Thank you so much!
Thanks for watching and your feedback. Truly appreciate it :-) Regarding the update I will probably add how to update the database on a regular base. Until then the easy way: you can just get rid of the created schemas and run the code from Part I from the starting point or any time horizon again. The hard way: Find out what is the last date in the database and update the DB accordingly.
@@Algovibes nice, I was also wondering about this. Would you go about it using crontab, or perhaps the schedule pip package?? regardless I would love to see an update on it at some point! keep up the great work!
Thanks for the suggestion and also thanks Golden Swan for sharing your thoughts. Really appreciate it. I will see if a streamlit deployment will make sense. It might be included in the next part.
@@Algovibes we can try to add functionalities in Django Webapp to build fully functional bot. It could open lots of probabilities if we can get live streaming data to play. Also database handling is simpler too. I am planning for this project. any guidance?
29:05, this result is very interesting. Despite having no know bias, it predicted really good stocks. Does anybody have any comment on bovespa and RTSI ? Are these recommendations good or bad? I know this is just a tutorial but still !!!
hi thanks for your great contents 😍 but your Golden Cross function is incorrect!!! because if for example df.signal for today is False and for previouse was True , then False minuse True = True and you get a wrong Signal!!!😱😱😱 do you agree with me?
What version of python are you using ? It seems to be that you py version is converting int back to bools. I'm using version=3.8.10, so if do "False-True" i get "-1". However, if i do "bool(False-True)" I get "True". BTW, you are not using using any explicit type conversion, right???
Other way to explain GoldenCross more clearly is to write : df['Decision GC'] = np.where((df['SMA20'] > df["SMA50"] ) & df['SMA20'].shift(1) < df["SMA50"] .shift(1), True,False) right ?
Yeah awesome 👏 , keep going on better and better ❤🎉. I’m just a newbie’s and self study so my path of learning programming seem to be not a good order but I found many useful things from your videos. I’m just an electrical engineer but I love programming for algo trade , finding stocks and for further may be a nice jobs of programming although now I’m 42 years old. Thank so much
Thank you so much for your comment Nguyen! Appreciate your positivity and your drive :-) Be kindly invited to check out my other stuff. Cheers!
Keep up the good work my friend, I'm following closely most of your videos and miniprojects. It's an outstanding job what you are doing, my congrats. Greetings from Spain
Thank you buddy :-) Recently have been to 🇪🇸 Check out my community post 2 months ago, maybe you recognize where it is :D
Thanks, this was very helpful to see how you apply all the methods into a class objects... much appreciated
Awesome :-) Thanks a lot for your feedback mate.
@Algovibes, Trying to run the code but getting an error at the end of recommendation stage. Can you pls help me with below error.
'str' object has no attributes called 'TABLE_NAME'
I'm using the same code, all the stages are working fine except last recommendation.
Just to be clear in OOP when you want to use another method within a method like you do in getprices, I don't need to do anything in the constructor. The method gettables(self): method allows me to create an attribute in the getprices(self): module?
Said differently ,why does the for loop in getprices work? for table, schema in zip(self.gettables().TABLE_NAME, self.gettables().Schema): In fact, it seems that the attributes "work" because in the gettables(self): method we created a dataframe that has columns TABLE_NAME and Schema thus the .TABLE_NAME and .Schema ending for the attribute in getprices(self): method for loop it seems.
Could you expand on this perhaps?
I probably wouldn't code it like that anymore but rather call the method creating a necessary object in the constructor and define it. But it also works this way.
I would like to get a code that recommends stocks in the NASDAQ under $5 that have just experienced MACD crossover and 10 stocks at a time but where is best to run such python codes
@19.22 MACDdecision function and Goldencrossdecision function is not returning anything!!!
That's correct and that is intended. Reason behind that is, those functions are doing data manipulations to a provided frame. There is no need to return anything.
Hi, sorry I am late, but can you use ISIN code instead of tickers for yfinance?
Unfortunately not. But there are libraries which do the transformation for you.
Hi, many thanks for making this extremely useful video. I have a qs - when you say you updated the database to most recent date - can you show how do you it - is it a recurring code from python everyday to add price data or how can you avoid downloading same data time and time again. Many thanks
Hi Puneet,
I did exactly that in Part III, didn't I?
Hey, great video once again!
Can you please tell how to program for usual case where there is no "." in stock price? You touch on at 8:21, but don't elaborate the exact steps.
Thank you
Thanks mate, what exactly do you need to know?
@@Algovibes Basically I downloaded data for NASDAQ stocks but cannot properly adjust your code to it as Symbols of US stocks usually do not have “.” inside like Nifty, Bovespa, and RTSI stocks. Therefore can you say the adjustments to the code in such case starting from 8:21 of your video. I think this line that you describe at 8:21 is the ONLY thing I need to change.
Thank you!
Thank you for the video!
When you run the applytechnicals function in 23:22 I get an error message saying "numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.", have you come across this before? I believe the lines "df['Decision GC'] = df.Signal.diff()" generates that error.
Welcome :-)
No, I don't get this error. Can you post the full error message? It should include the line which is causing the error.
@@Algovibes here, I could really use some help to resolve this:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 applytechnicals(nifty)
in applytechnicals(which)
3 for frame in prices:
4 MACDdecision(frame)
----> 5 Goldencrossdecision(frame)
6 RSI_SMAdecision(frame)
7 return prices
in Goldencrossdecision(df)
4 # The indicator triggers when the short term SMA is above the long term SMA
5 df['Signal'] = np.where(df['SMA20'] > df['SMA50'], True, False)
----> 6 df['Decision GC'] = df.Signal.diff()
7
~\Anaconda3\lib\site-packages\pandas\core\series.py in diff(self, periods)
2549 dtype: float64
2550 """
-> 2551 result = algorithms.diff(com.values_from_object(self), periods)
2552 return self._constructor(result, index=self.index).__finalize__(self)
2553
~\Anaconda3\lib\site-packages\pandas\core\algorithms.py in diff(arr, n, axis)
1975 out_arr[res_indexer] = result
1976 else:
-> 1977 out_arr[res_indexer] = arr[res_indexer] - arr[lag_indexer]
1978
1979 if is_timedelta:
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
can you try 1/0 instead of true/false in the np.where statement?
Thank you so much , it's very helpful.
Thank you mate, truly appreciate your feedback :-)
hi I am using strptime function on last date column and gives error for remaining zeros. Is there any efficient way to compare dates?
"df1=yf.download(name, start=date)[1:].reset_index()
"
this expression is updating rather than
"df1=yf.download(name, start=date)[2:].reset_index()
"
not sure this could you look in this ....
Hi, thanks for watching and your comment. Can you elaborate your question? I am not quite sure what you want to compare.
Thanks for clarifying in advance.
I am comparing current date with last record date and records are stored in string format, so I was getting an error however I that issue is clear. New issue comes with the download function.
@@harshadbhirud Can you elaborate? Thanks in advance!
brother I asked chatgpt to provide a code that screens for stocks under $5 which the MACD has just crossed over meaning the just experienced the crossover at that time and the stocks shouldn't be more that 10 could you do that for me and where is the to run this types of python codes
a piece of good work.Thanks
Thanks mate, appreciate your comment :-)
I'm implementing this in a different kind of way and also sending an email to myself EoD with the recommendations using smtplib and email.mime libs. Would be helpful to get some backtesting into this, so we could test new strategies or modify existing ones... nice vid.
Awesome man! Really good ideas, thanks a lot for sharing your thoughts and tools! Appreciate it a lot.
Not quite sure if I am doing a backtest (which doesn't mean I will not but it is not on my priority list). I got some content on my channel where I am running some backtests (e.g. MACD), maybe you find something useful for you.
@@Algovibes Yeah, I watched it all hehe. But I was thinking on something more abstract, I know there's a lot of libs of backtesting but I always thought it could be better. The best way for me would be a function that receives a df with 3 columns (timestamp, closing price, volume, signals) and just return avg return (%) and accuracy (%), so it's decoupled of the strategy.
Also, another suggestion which I think it's relevant content: a cronjob that executes everyday at EoD and updates your local db, applies strategies to get signals and send all the info on a e-mail (some other info might be helpful like highest/lowest daily return of all stocks you're watching or on your db). I got that already working if you'd like to take a look :)
Cheers.
good vid...
Happy you like it! Thanks for watching and your comment :-)
Extremely helpful and informative thank you!
I was curious:
Do you have any sources or further info for updating the mysql database using yfinance or any other method really? I have watched your previous video:
"Simple Stock Recommendation System based on Technical Trading Indicators (ta) using Python & SQL"
covering your method to update; however, I am still a bit lost. When I check the schema through mysql, I cannot find any updated new days added.
Thank you so much!
Thanks for watching and your feedback. Truly appreciate it :-)
Regarding the update I will probably add how to update the database on a regular base.
Until then the easy way: you can just get rid of the created schemas and run the code from Part I from the starting point or any time horizon again.
The hard way: Find out what is the last date in the database and update the DB accordingly.
@@Algovibes nice, I was also wondering about this. Would you go about it using crontab, or perhaps the schedule pip package?? regardless I would love to see an update on it at some point! keep up the great work!
It would be great if you could make a video on how to build a GUI/web-app for this recommendation system
You can use streamlit.
@@sherlock27 Yess a video on Streamlit would be helpful. Haven't used it till now
Thanks for the suggestion and also thanks Golden Swan for sharing your thoughts. Really appreciate it.
I will see if a streamlit deployment will make sense. It might be included in the next part.
@@Algovibes Thanks a lot. Waiting for the third part!
@@Algovibes we can try to add functionalities in Django Webapp to build fully functional bot. It could open lots of probabilities if we can get live streaming data to play. Also database handling is simpler too. I am planning for this project. any guidance?
Please do the deployment video also!!!!!!
Will see what I can do, thanks for your feedback again!
29:05, this result is very interesting. Despite having no know bias, it predicted really good stocks.
Does anybody have any comment on bovespa and RTSI ? Are these recommendations good or bad? I know this is just a tutorial but still !!!
Great content 👏👏👏👏
hi thanks for your great contents 😍
but your Golden Cross function is incorrect!!!
because if for example df.signal for today is False and for previouse was True , then False minuse True = True
and you get a wrong Signal!!!😱😱😱
do you agree with me?
Hi, very welcome! Can you pass me a timestamp please. Been quite a long time since I recorded this. Will have a look then. Thanks a lot!
What version of python are you using ? It seems to be that you py version is converting int back to bools. I'm using version=3.8.10, so if do "False-True" i get "-1". However, if i do "bool(False-True)" I get "True". BTW, you are not using using any explicit type conversion, right???
Thanks a lot for this update!
Thank YOU for watching and your comment :-)
Hi
Can you share the code in github? Thanks
Sorry for my late reply!
Didn't publish the code somewhere yet. If I do, it probably won't be on GitHub.
Other way to explain GoldenCross more clearly is to write :
df['Decision GC'] = np.where((df['SMA20'] > df["SMA50"] ) & df['SMA20'].shift(1) < df["SMA50"] .shift(1), True,False)
right ?
Also a good way to do that!
(BTW I didn't check the syntax but the idea should also work)