Simple Stock Recommendation System based on Technical Trading Indicators (ta) using Python & SQL

Поделиться
HTML-код
  • Опубликовано: 21 май 2024
  • Thanks for watching :-) If you enjoyed the video please subscribe.
    This video is showing how to build a very simple stock recommendation system with Python based on technical trading indicators such as MACD and RSI / SMA using the ta library.
    Be kindly invited to let me know if you find stuff like this interesting.
    Get the Notebook/Source code by becoming a Tier-2 Channel member:
    / @algovibes
    Video on building a finance database:
    • Create your own Financ...
    Video on dataframes and sql:
    • Pandas Dataframes and ...
    Video on MACD:
    • Algorithmic Trading in...
    Video on RSI / SMA:
    • How to build a RSI Tra...
    Disclaimer: This video is not an investment advice. It is for educational and entertainment purposes only.
    0:00 - 01:36 Explanation of what is going to be done
    01:36 - 02:42 Recap of the SQL database
    02:42 - 04:35 DataBase connection & getting table names
    04:35 - 06:25 Get actual price data out of the database
    06:25 - 09:25 MACD function (using ta library)
    09:25 - 11:40 RSI / SMA function (using ta library)
    11:40 - 12:57 Apply the technical indicators to all stocks
    12:57 - 15:28 Result: Which stocks to buy? (no investment advice)
    15:28 - 17:53 OPTIONAL: How I updated the database
    17:53 - 19:15 OPTIONAL: Daily update of the database
    #Python #Trading #Stocks

Комментарии • 92

  • @its_sharan54
    @its_sharan54 2 года назад +11

    I have no regrets in saying that u r the best youtube channel regarding 'Python for finance'

    • @Algovibes
      @Algovibes  2 года назад

      There are surely a lot of other great ones but I highly appreciate your kind comment :-)

    • @sz8558
      @sz8558 2 года назад

      Agreed...its easy to tell the ones that just copy others work.

  • @victorbartolo287
    @victorbartolo287 3 года назад +2

    Another example of elegant finance programming. You make it look so clean and efficient. Well done and hope to see the full scale version.

    • @Algovibes
      @Algovibes  3 года назад +1

      Thanks a lot for your kind words and your feedback. Anyhow it is important to me that people understand there is some preparation behind my videos. The work process is usually looking like this: Have an idea -> code it -> test it -> review it -> simplify it so that even people with little coding background can follow along. I am sometimes improvising while recording but trying to stick to my prepared code.
      Even if it looks smooth I can assure you from time to time I have some pain here and there while preparing the code :-)

    • @victorbartolo287
      @victorbartolo287 3 года назад

      @@Algovibes thank you for replying and for being honest about the pains of programming. For me, sometimes one line of code locks me in a jam and it gets frustrating as I feel I am wasting time. But in the end when it works I feel happy at my success. I am always glad to see your work as it is very informative and educational and I appreciate you dedicate a lot of time not only for the development of the programs but also to understand finance and to create the video/educational material. I thank you sincerley and wish you best of luck with your programming.

  • @MathaGoram
    @MathaGoram 2 года назад +2

    Love your step-wise refinement of the code. Helps us newbies to keep up with the concepts. Many thanks!

    • @Algovibes
      @Algovibes  2 года назад

      Thanks a lot for watching my stuff mate :-)

  • @FRANKWHITE1996
    @FRANKWHITE1996 3 года назад +2

    Im python newbie and your videos are great source of knowledge for me. Thanks!!!

    • @Algovibes
      @Algovibes  3 года назад

      Great to have a real thug on board. Increases my street credibility. Jokes aside: Thank you very much for your support. Appreciate having you on my channel :-)

  • @koz.b1741
    @koz.b1741 3 года назад +1

    this is the video i was waiting for since i subbed you. thank you for the great content.

    • @Algovibes
      @Algovibes  3 года назад +1

      Thank YOU for watching, your kind words and subscribing. Really appreciate it :-)

  • @rraul
    @rraul 3 года назад +1

    Your content is pure gold. Thank you!

    • @Algovibes
      @Algovibes  3 года назад +1

      Thanks for your support! I really appreciate having you on board :-)

  • @AnandSharma-vr3gy
    @AnandSharma-vr3gy 2 года назад +1

    You're amazing bro thanks for uploading these!!

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for watching and your comment buddy :-)

  • @anilmm2005
    @anilmm2005 Год назад +1

    Thanks a lot for wonderful explanation for using python for finance. Really helpful and please keep up good work

  • @k2icc
    @k2icc 2 года назад +1

    Very nice of you. Thanks.

    • @Algovibes
      @Algovibes  2 года назад

      Very nice of you comment :-) Thanks for watching!

  • @husam5036
    @husam5036 3 года назад +2

    Great content, simple explanations very much interested more similar contents

    • @Algovibes
      @Algovibes  3 года назад

      Thank you very much for watching and your feedback :-) Appreciate it.

  • @konturgestalter
    @konturgestalter 3 года назад +2

    yes,.... definitely wanna see the heavy weight version too!,,

    • @Algovibes
      @Algovibes  3 года назад

      Awesome! Thanks a alot for your feedback.

  • @SP-db6sh
    @SP-db6sh 3 года назад +1

    First on RUclips for this topic ! Great efforts . God bless you !

    • @Algovibes
      @Algovibes  3 года назад

      Thank you very much for your support :-) Really appreciate your contribution!

  • @FingonCelebrindal
    @FingonCelebrindal 2 года назад +1

    Awesome work.

  • @rajendramehra3158
    @rajendramehra3158 2 года назад +1

    Great men............ this is owesome video

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for your kind words :-)

  • @PavelSumik
    @PavelSumik 3 года назад +1

    Perfect, thankx

    • @Algovibes
      @Algovibes  3 года назад

      Thank YOU for watching and your appreciative comment :-)

  • @elat16
    @elat16 Год назад +1

    I like so much this idea! TBH I'm very very interesting in this topics. Very helpful! Yeah...as someone said "u r the best youtube channel regarding 'Python for finance'"!! Just a challenge for you...what about make the same video using Fib retracement, support resistance level (e.g. when a stock is near to a support level) or candlestick pattern (doji, hammer etc...) ?

    • @Algovibes
      @Algovibes  Год назад

      Thanks a lot for your kind words Enrico! Also thanks for the suggestions.

  • @mindhive-musicmeditationlu8270
    @mindhive-musicmeditationlu8270 3 года назад +1

    super mate,make more like these

    • @Algovibes
      @Algovibes  3 года назад

      Thank you very much for watching and your kind comment mate. Appreciate it! Investing my spare time to produce more whenever I can :-)

  • @forecaststatistics8496
    @forecaststatistics8496 3 года назад +1

    Complimenti ottimo lavoro. Grazie

    • @Algovibes
      @Algovibes  3 года назад +1

      Understood the second part but had to translate the first part :-D Grazie mille for your kind words. Appreciate it :-)

    • @forecaststatistics8496
      @forecaststatistics8496 3 года назад +1

      @@Algovibes Good job. Tks 😀

  • @maciekpaciarski9343
    @maciekpaciarski9343 3 года назад +1

    great job

    • @Algovibes
      @Algovibes  3 года назад

      Thanks for watching and your kind words :-) Appreciate it!

  • @russnagel1
    @russnagel1 3 года назад +1

    More great content. Keep up the good work. Can you show how to set up a cron job so the database is updated after market close every day?

    • @Algovibes
      @Algovibes  3 года назад

      First of all thanks for watching and your comment :-) Cool suggestion, thank you! Will see if I am doing it in a separate video or in the recommender one.

  • @wrd4412
    @wrd4412 2 года назад +1

    great content

  • @kumarlavanya6393
    @kumarlavanya6393 3 года назад +1

    Thanks for another great tutorial, informative and educational. As a beginner I am finding it easy to understand. Can you make a video on buy recommendation based on SUPERTREND Indicator?

    • @Algovibes
      @Algovibes  3 года назад +1

      Thanks for your feedback, truly appreciate it! I am doing my best to produce content which is accessible for beginners but also interesting for experienced people. Thanks for your suggestion regarding supertrend. Will see what I can do :-)

    • @lavanyahouse1372
      @lavanyahouse1372 2 года назад +1

      @@Algovibes many thanks for your reply. Waiting for more new tutorials.

  • @uchechidozie4802
    @uchechidozie4802 Год назад

    Hi, I'd like to first salute your work. Its been an immense resource on my path. I attempted implementing your example but keep getting the following error "AttributeError: module 'pymysql' has no attribute 'install_as_MySQL_db'"...
    Are there any pointers you have that may help me resolve this error? Thank you

  • @konturgestalter
    @konturgestalter 3 года назад +1

    love it

    • @Algovibes
      @Algovibes  3 года назад

      Incredibly happy to hear that :-) Thanks for watching.

  • @tohando
    @tohando 3 года назад +3

    Great Video! Would be interesting to implement an ai, to figure out what a buy signal is, Instead of coding it. keep up the good Work!

    • @Algovibes
      @Algovibes  3 года назад

      Haha yes :-D I am trying to cover some more Machine Learning as well.
      I have planned on implementing a simple logit regression - link: ruclips.net/video/X9jjyh0p7x8/видео.html in the larger scale stock recommender.

  • @gokhalesadan
    @gokhalesadan 2 года назад +1

    helpful

    • @Algovibes
      @Algovibes  2 года назад

      Happy to hear man. Thanks for your comment!

  • @alvinleongcw
    @alvinleongcw 3 года назад +1

    Please consider doing a cross sectional momentum/ accelerate dual momentum strategy since your channel is kind of about quant trading

    • @Algovibes
      @Algovibes  3 года назад

      Thank you very much for your suggestion! :-)
      I will see what I can do. I covered a lot of momentum strategies in the last time and don't want to bore the people :-D Dual mom is on my list.

  • @steeltormentors
    @steeltormentors 2 года назад +1

    What a great content and crystal clear video!
    I've successfully replicated the steps in the video to about 700 stocks, however the issue is speed: it took 13seconds for all the process to complete.
    Is there anything can be done to speed up the process where speed is essential?
    I'm thinking of just let the stock prices for all stocks in 1 Dataframe and then use applymap function so this way we avoid the for loop.
    I got the idea in my head from watching videos on vectorization and efficient pandas, but I don't know how to put it out code-wise and get it done LOL..can you help in a short update video how to speed up the process?
    Thanks!

    • @Algovibes
      @Algovibes  2 года назад

      Thanks a lot man!
      Yea vectorization would be my first guess as well.
      Maybe I am covering a similar topic in the future, yes. But I didn't plan on that yet.

    • @foobarAlgorithm
      @foobarAlgorithm Год назад

      Use VectorBT library, which is my go to for these cases. Moreover in other cases you can use feather library for other formats.

  • @jitkadyan
    @jitkadyan 3 года назад +1

    another great video sir, pls add how to update live data in SQL in a live market and then fetch data and put indicator and place order in the live market or search stock matching our entry and exit condition.

    • @Algovibes
      @Algovibes  3 года назад

      Thanks a lot for your feedback and the suggestion! :-)

    • @hardikpatel5916
      @hardikpatel5916 2 года назад

      Thanks for the video I am also locking for

  • @hardikpatel5916
    @hardikpatel5916 2 года назад +1

    Thanks very much for great video
    My request to you please make video on how to update database automatically every day after market closing.

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for watching buddy :-)
      I have already covered that here:
      ruclips.net/video/FkZNUj36Jcc/видео.html
      In a nutshell you can set up a cronjob which should be executed after the market close.
      Video on cronjobs:
      ruclips.net/video/uEn1uZtPMzw/видео.html

    • @hardikpatel5916
      @hardikpatel5916 2 года назад

      Thanks for really I will check

  • @richardpitt7900
    @richardpitt7900 3 года назад +1

    What do you think about the probabilistic momentum?

    • @Algovibes
      @Algovibes  3 года назад

      Was stumbling over it some time ago and just had a refreshing read.
      Thank you very much for sharing - sounds incredibly interesting. Definitely will test that on my own. Maybe releasing something about it in the future.
      Do you already have some insights you want to share? Would really appreciate an answer!

  • @ahmetsuatyildiz4836
    @ahmetsuatyildiz4836 2 года назад +1

    What is the difference Sqlalchemy and Sqlite3? In the first video, you started with sqlite3 and then shifted to sqlalchemy.

    • @Algovibes
      @Algovibes  2 года назад

      You can use a bunch of SQL systems (sqlite, mysql, mssql,...) with sqlalchemy. More info here: www.sqlalchemy.org

    • @ahmetsuatyildiz4836
      @ahmetsuatyildiz4836 2 года назад

      @@Algovibes df.to_sql(name,engine, if_exists='append',index=False). This code duplicates the data written in the database during data feed, if it worked 2 times. How can it be solved? or Should it be solved? What happens if I have several rows with the same date and price data?

  • @adityashinde2878
    @adityashinde2878 3 года назад +3

    Eagerly waiting for the heavyweight one my man🤜

    • @Algovibes
      @Algovibes  3 года назад +2

      Thanks for watching and your feedback :-) Helps me a a lot!
      I will see that I am releasing it soon.

  • @meghapal02
    @meghapal02 2 года назад +1

    This tutorial is for MAC OS. Can the same code and technique be used for Windows OS?

    • @Algovibes
      @Algovibes  2 года назад +1

      Hi Meghan, No this tutorial is not using anything related to MacOS. Can you elaborate? Should work the exact same way on a windows / linux machine.

    • @meghapal02
      @meghapal02 2 года назад +1

      @@Algovibes Actually you pretty much cleared the doubt. I just wanted to know if the code is runnable on Windows OS.

  • @udayakumara5500
    @udayakumara5500 Год назад

    Value error index scaler error how to resolve this

  • @Anomity
    @Anomity 3 года назад +1

    Add on a feature that it should give a notification on email.

    • @Algovibes
      @Algovibes  3 года назад

      Awesome idea! Can't promise to include it but if it fits in I will see what I can do :-)

  • @Anomity
    @Anomity 3 года назад +1

    Also try to add EMA conditions

    • @Algovibes
      @Algovibes  3 года назад

      I saw your kind comment which was blocked (for whatsoever reason) and I want to thank you alot for your kind words :-)
      Can you please specify what you mean with EMA conditions? The EMAs are already included when using the MACD diff or am I getting you wrong?

    • @Anomity
      @Anomity 3 года назад +1

      @@Algovibes you must add on a feature in this script... Which gives notification on email. .. when is a bit and sell ... And by ema mean the Crossing of ema lines like in pine script which gives buy and sell signals . I hope you make it ❤️
      All the best... Waiting for your next video .

    • @Algovibes
      @Algovibes  3 года назад

      Yes I know technically how to program it but need to see if a email notifier fits in in terms of length of the video :-)

    • @Anomity
      @Anomity 3 года назад

      @@Algovibes I do have some accurate values for intraday buy and sell signal ..
      Hope those might help you... But those are in a pine script !

    • @nikhilsalunke7019
      @nikhilsalunke7019 3 года назад

      @@Algovibes it would be really helpful if you share EMA and email.
      Do you have any github handle?