Real Time Stock Price Scraping with Python and Beautiful Soup

Поділитися
Вставка
  • Опубліковано 15 лис 2024

КОМЕНТАРІ • 243

  • @MMphego
    @MMphego 4 роки тому +62

    1st female tech tutorial ive seen on UA-cam in 2020...
    Proud of you, please post more videos like this,

  • @user-lh4hv3tx8b
    @user-lh4hv3tx8b 4 роки тому +3

    This was very good and to the point. For those with getting 'nonetype' errors, changing 'xml' to 'lxml' made it work perfectly.

  • @AndariReksi
    @AndariReksi 4 роки тому +27

    Thank you for this tutorial, you explained everything clearly! I can imagine with your skill level there are many things that are very obvious to you, yet you never skipped to explain the meaning of every code.

    • @straightcode
      @straightcode  4 роки тому +2

      So glad that you found it useful 😄
      We will make more content like this!

  • @rickymacharm9867
    @rickymacharm9867 4 роки тому +1

    Lovely start for me...was reading a book on it with my eyes glazed over...but this was lovely. Thanks for sharing.

  • @hanst7218
    @hanst7218 4 роки тому

    Very nice. Intra day data is very rare and valuable to a lot of people.

  • @ketonicm8504
    @ketonicm8504 4 роки тому +8

    Could you make a tutorial for an Amazon Webscaper that can catch the price for a specific version of a product? (for example the green version of in ear headphones that is 10$ cheaper then the black version that is still listed under the same url)
    There are already amazon price tracker videos on youtube but only for simple products where you can't choose between different versions and some of them don't even work, so your tutorial could become really popular.

  • @tylergramling424
    @tylergramling424 4 роки тому +1

    Thank you for making this tutorial and keeping it simple. Very great quality and exactly what I was looking for. Thanks again!!

  • @Amitkumar12300
    @Amitkumar12300 3 роки тому +1

    A beautiful Soup from aa beeuutifuul girl, thanks dear for your hard work to humanity

  • @rverm1000
    @rverm1000 4 роки тому +14

    Yes it works. Had to change "xml" to features="html.parser"

    • @eu.pedroleon
      @eu.pedroleon 4 роки тому

      THANKS FOR THE COMMENT, MAKE MY CODE WORKS !

    • @eder8170
      @eder8170 4 роки тому

      thanks mate .. works after that

    • @camilotjee_504
      @camilotjee_504 4 роки тому

      EDER why does my code say function_stock_price at 0x7f80a964b3a0

    • @salahgouzi2458
      @salahgouzi2458 4 роки тому

      @@camilotjee_504 you forgot to return the price from the function

  • @BillyBoi7644
    @BillyBoi7644 4 роки тому +3

    if your "soup.find" isn't working, try changing BeautifulSoup(r.text, 'xml') to BeautifulSoup(r.text, 'html.parser')

  • @forager1955
    @forager1955 5 років тому +3

    Thank you for such a clear and succint explanation. I understand the beautifulsoup better thanks to your work.

  • @armaanchawdhary9427
    @armaanchawdhary9427 4 роки тому

    This is good stuff. How to get day's high and low and check in real time for multiple stocks. It will be great if you can make a video on this too.

  • @鳳梨酥土
    @鳳梨酥土 3 роки тому

    That was amazing !!
    I'm so bad at programming. I've watched the entire video for so many times which ended out a lot of questions and errors. I'm now doing a visualization of stock's program, wish me luck~~

    • @blubaylon
      @blubaylon 2 роки тому

      5 months later, hope it worked out!

  • @kamilia4802
    @kamilia4802 3 роки тому

    That's very lovely from you this video was very helpful

  • @leonardosantisteban8397
    @leonardosantisteban8397 4 роки тому

    GOOD STUFF! LIVE STOCKS FOR MY APP! THANK YOU SO MUCH!!! WORKS GREAT A LITTLE MOD IN SCRIPT BUT GREAT WHEN ALL ERRORS CLEARED UP! WORKS AS INTENDED.

  • @qle278
    @qle278 4 роки тому +2

    Really cool!!! This is very inspiring to see such a simple breakdown of the initial steps of a more complicated program. I am subscribing!

  • @rverm1000
    @rverm1000 4 роки тому

    Down to earth. Straightforward explanation. YES DO MORE VIDEOS

  • @dano2169
    @dano2169 5 років тому +1

    One improvement would be to have a list of user agent strings and in your function, choose a random user agent string. I would also choose a random sleep interval between every request. The way you are doing it now may get you banned.

  • @astro-zodiac
    @astro-zodiac 3 роки тому +1

    Thank you so much. It really helped me a lot.

  • @YK-jn2kp
    @YK-jn2kp 5 років тому

    I clicked on this video only to check on you. I'm glad I did :D

  • @OddityArts
    @OddityArts 4 роки тому +2

    This is really good! :D

  • @f_bomb_3000
    @f_bomb_3000 5 років тому +3

    Thank you for this. I've been interested in programming a bot for technical analysis in Python but haven'f found much info on the subject. Keep them coming :)

    • @vishwabhushan9704
      @vishwabhushan9704 5 років тому

      hey, I am currently working on same subject, it will be good if I find some help from you.

  • @winnieyxl2262
    @winnieyxl2262 2 роки тому

    Love your video alot! With clear explanation and the logic behind is explained too!

  • @atharvashirode9711
    @atharvashirode9711 4 роки тому +1

    Superb . Small logic but great result...

  • @aidilrazak8548
    @aidilrazak8548 4 роки тому

    Love everything about this vid, especially the explanation, subscribe on the spot!

  • @GodGuy8
    @GodGuy8 5 років тому

    Thank you! This stuff is pretty cool. Will say there’s not many female programmer/traders you’re the first I’ve seen. Like a unicorn lol

    • @y.z.6517
      @y.z.6517 4 роки тому +1

      Actually, it's more common in some Asian countries where everyone is heavily drilled with math-y subjects in school.

    • @GodGuy8
      @GodGuy8 4 роки тому

      Y. Z. Yeah they get a lot of motivation from their parents to start learning at like 3! Lol

  • @BrandonJacobson
    @BrandonJacobson 4 роки тому

    Great video! This video is doing excellent! I have a few python for finance videos on my channel too, but they aren't doing as well.

  • @martinkaspar5095
    @martinkaspar5095 3 роки тому

    great rundown on a scraper-job: explained very good and clearly - keep up the great work - it rocks!: By the way - it seems that you work with spider. I like this technique with the divided "editor windows" - This is very convincing since you go step by step in the process; I guess that i can reproduce it here too - with spyder - or with Jupyter!?
    Look forward to hear from you

  • @rverm1000
    @rverm1000 4 роки тому

    In the video I noticed you have a particular way of coding. Testing out individual lines of code before putting them your program. I known this may sound awkward, but is that the way you code everyday?

  • @maryamkhalidshah2160
    @maryamkhalidshah2160 4 роки тому +1

    Thank you SO much! This was extremely helpful.

  • @abhilleo82
    @abhilleo82 3 роки тому

    Beautifully explained. One query though - the stock price takes a long time to reflect the change in price, any specific reason. Thanks

  • @zachirefaeli4309
    @zachirefaeli4309 4 роки тому

    Great explanation ! looking for the next one

  • @toddmaggio2032
    @toddmaggio2032 3 роки тому

    Thank you for the tutorial. Do we need Yahoo's API to scrape stock data?

  • @dominicdannies7482
    @dominicdannies7482 3 роки тому

    if you do it like in 10:15 will you not get banned from yahoo quite quickly ? Because you have a lot of request in a pretty short time span ?

  • @gambet0007
    @gambet0007 4 роки тому +1

    Thanks, hope you keep up with the projects. Its much easier to learn relevant code through doing projects than to watch 4-5hrs long Python A-Z video.lol
    Also, if possible, please make a code appear little bigger, I don't know how to do it, but maybe you know some ways.

  • @chandlervincent4073
    @chandlervincent4073 3 роки тому

    im completely new to coding and I have only done Hello world so far but im gonna be trying this soon, anything you would suggest differently now?

  • @phantomsixtrading7094
    @phantomsixtrading7094 3 роки тому

    I went through this video course twice on VSCode and it didn't work either time. Is there a difference in syntax between Spyder and VSCode that maybe wouldn't translate and is why I keep getting errors?

  • @vijaybatham3366
    @vijaybatham3366 4 роки тому

    Great Job Mam !!!!

  • @bowboycode2114
    @bowboycode2114 4 роки тому

    I subscribed ! Great Video..Very clear... Thanks

  • @dominicdannies7482
    @dominicdannies7482 5 років тому +1

    I hope you make a lot more videos. Instantly subbed for this type of content

  • @sumukhjadhav3227
    @sumukhjadhav3227 4 роки тому +1

    If you are having issues, use lxml instead of xml

  • @hinomuratomisaburo4901
    @hinomuratomisaburo4901 3 роки тому

    Very good and cool... Good work girl 😃👍

  • @fineas4
    @fineas4 3 роки тому

    Hi Alice! It‘s looking very nice, thank you. Do you know how it‘s possible to get an update only if the price is different than previous? And maybe send this values via Telegram to different users? And/or creating an app/website/software where you get all this information in? Also refreshing the url vecause the data is not refreshed in real time (like flash)

  • @mw7185
    @mw7185 Рік тому

    Inlcude a sleep statement inside the loop. So that you can wait like 30 seconds before you get the next current price.

  • @whatamidoing1811
    @whatamidoing1811 4 роки тому

    not trying to be sexist or anything but this is the first female coding tutorial ive seen

  • @chaks2432
    @chaks2432 4 роки тому

    thanks, took me a bit, but I managed to modify the code to show the current, highest and lowest prices for multiple stocks I follow, as well as showing the time for each loop run. Now I'm gonna try and get it to send me an email notification if a stock drops too much or something

  • @vickyonline
    @vickyonline 3 роки тому

    Thanks , works wonderful.

  • @samanjalinous721
    @samanjalinous721 4 роки тому

    that's great, but is there a better way to capture the price of stocks with high fluctuations ??

  • @philliplan6330
    @philliplan6330 4 роки тому

    Super easy to follow along! Thanks for the tutorial!

  • @mahdirasouli6005
    @mahdirasouli6005 4 роки тому +1

    Is there any solution for scrapping data from tradingview?

  • @1skeeta4u
    @1skeeta4u 5 років тому +1

    Team notification. Need more videos please. 🥺👍

  • @redcabinstudios7248
    @redcabinstudios7248 5 років тому

    Good video, really straight, simple and effective.

  • @klaidaspetrevicius3265
    @klaidaspetrevicius3265 4 роки тому +1

    Thank you very much, this is exactly what I needed!

  • @lucksimi3320
    @lucksimi3320 2 роки тому

    Hi
    Is it possible to get realtime data live( how long it will take) for ALL Hong Kong stocks and get a BUY alert when price> 10ema, 10ema> 20 ena and 20ema> 40ema? Thanks

  • @nycstev428
    @nycstev428 4 роки тому

    this was super helpful, thank you!

  • @onuberonly7846
    @onuberonly7846 5 років тому +6

    Nice I was looking for something like this! I would add a clear screen before display and maybe a delay timer of 100ms or something like that.

    • @kjartanwettergreenh.s.3187
      @kjartanwettergreenh.s.3187 5 років тому

      How do you add delay timer for it to work in, say the code above?

    • @mihirmirchandani1449
      @mihirmirchandani1449 4 роки тому +3

      @@kjartanwettergreenh.s.3187 You can
      import time
      at the very top and then inside the while loop simply type:
      time.sleep(1)
      this will delay every second
      import time
      while True:
      time.sleep(1)
      print('the current price of FB is ' + str(parsePrice()))

  • @eskinsa
    @eskinsa 4 роки тому

    This was a very interesting and practical tutorial, thank you very much for this.

    • @straightcode
      @straightcode  4 роки тому +1

      Thanks shumash! We will put out more over time.

  • @lloydthomas8962
    @lloydthomas8962 4 роки тому +1

    really useful video thankyou:)

  • @nrz197
    @nrz197 3 роки тому

    Hi, thanks for this video. Your tone made it easy to follow. I did an inspect on the website price and based on that result I used the following command: "soup.find("div", {"class": "price-large"}). However, that gives the following result - " $21,094.79

  • @SPEEDKILLAR
    @SPEEDKILLAR 4 роки тому +1

    Great teacher!

  • @speedio521
    @speedio521 3 роки тому

    What is that tab on the right with all those In [ ], I only have the tab on the left

  • @dogons2k12
    @dogons2k12 4 роки тому

    This is a Great video! What video editing software(s) did you use to create your video? Need to make a badazz video presentation soon.

  • @francisowino6985
    @francisowino6985 3 роки тому

    Well explained. Thank You

  • @znagy1041
    @znagy1041 5 років тому +1

    good and easy to understand tutorial

  • @hilmymohamed7495
    @hilmymohamed7495 3 роки тому +1

    it's fetch whole page every time loop run, it is not acceptable

  • @fubrian2945
    @fubrian2945 4 роки тому

    This is a great video. Do you have tutorials on how to do the things you mentioned near the end?

  • @matthewsilver5455
    @matthewsilver5455 5 років тому

    Really Helpful!!! Thank you very much for sharing!

  • @maurocruz1824
    @maurocruz1824 3 роки тому

    What about of using an API? What do you think?

  • @pinisi_official
    @pinisi_official 4 роки тому

    wow that's awesome , but how to place that stock to our own website (im using woocommerce wordpress)? any tutorial plz? thx

  • @rony3044
    @rony3044 4 роки тому

    i am doing this but for a different website but I am not getting the price inside the p tag. why is that? i would appreciate your help

  • @jamesdavidson8911
    @jamesdavidson8911 4 роки тому +2

    great video! well done :)

  • @FinnishArmy
    @FinnishArmy 3 роки тому

    Now how do I get this on my website in HTML?

  • @HadoukenMaster
    @HadoukenMaster 3 роки тому

    How do you get the output. I can only put in inputs but can’t get outputs

  • @truchartsczar
    @truchartsczar 5 років тому

    Excellent job and video.. Still need some more detail.. but it worked..

  • @campagnaa
    @campagnaa 4 роки тому

    Could you do a tutorial but to reflect this into a webpage instead of the console? Thanks!

  • @Amitkumar12300
    @Amitkumar12300 3 роки тому

    Dear how can we scrap from broker webpage, if they have double authentication like - first is login second is PIN to enter?

  • @cptbrncls7050
    @cptbrncls7050 3 роки тому

    Hi, very useful - I'd love to learn how to incorporate this script into javascript for use in a webpage

  • @Gh05t666nero
    @Gh05t666nero 3 роки тому

    Hi, can you make a way to scrap the tags on the dashboard (must log in first)

  • @CantBelieveitsOntv
    @CantBelieveitsOntv 3 роки тому

    I get this issue when trying to import bs4 into spyder. That it doesnt recognize the module. Any idea?

  • @nilsdaemelt1018
    @nilsdaemelt1018 5 років тому

    Thanks for the video! Have you tried to get the price data directly from the chart? I tried this wihout success, maybe you can help?

  • @augustosj
    @augustosj 4 роки тому

    can you do this for other websites like for example binance. and is it legal?

  • @tsven3932
    @tsven3932 4 роки тому

    is there any way to make this print/update faster, if any would help id be very happy! thanks

  • @rverm1000
    @rverm1000 3 роки тому

    This no longer works they have changed the web page. I tried replacing the 6px with 36px but it still didn't work

  • @patryk7195
    @patryk7195 4 роки тому

    Hi ! Can I use this module to import a actual time from url ??

  • @gunnyu0012
    @gunnyu0012 3 роки тому

    Thank you Alice

  • @AlexJaeger716
    @AlexJaeger716 4 роки тому

    Can you do this same video for scraping live prices on trading view?

  • @shantanurauthan9318
    @shantanurauthan9318 3 роки тому +2

    Nice and Precise . Learned something new today
    Meanwhile Inner Me: Whos here to code , imma here to checkout the girl, shes kinda cute

  • @gstanchau
    @gstanchau 4 роки тому

    Thank you! Very practical!

  • @martinpratto1475
    @martinpratto1475 5 років тому

    Great video!! Really amazing! _I have only a question, how can update the current price automatically? or i must to click every second the function to have the current price?. Thanks a lot!!

    • @dan-cj1rr
      @dan-cj1rr 4 роки тому

      It's in a while loop which is calling the function all the time ? it does it already so i dont get your question

  • @klskygamers
    @klskygamers 3 роки тому

    I love you, Many thanks!!

  • @Gullinnova
    @Gullinnova 5 років тому

    thank you! This video helped me finally figure out how to use the .text portion to remove the HTML. every other example i found was not helpful as this one.

  • @lucksimi3320
    @lucksimi3320 2 роки тому

    Hi
    Can i contact you to create a reatime Hong Kong stocks scan with some strategies?

  • @tomstravelingadventures
    @tomstravelingadventures 4 роки тому +1

    Thank you for the vid! Liked & Subscribed :-)

  • @fubrian2945
    @fubrian2945 4 роки тому

    You never call the parseprice() function, how come it still executed?

  • @takisally
    @takisally Рік тому

    Does anyone know why this exact technique doesn`t work for Forex or BTC on yahoo finance? URL does not seem to work, only for these cases..

  • @TON-vz3pe
    @TON-vz3pe 5 років тому

    What she did, I did that already. But it's no use to have a late response of stock price in order to see the volume breakout , as python is really slow. Check yourself. If you are planning to use, just to gather time independent data as collection of information in some format them this is good

    • @y.z.6517
      @y.z.6517 4 роки тому

      This is for automatic trading. Plus, web scraping is much faster than GUI.

  • @nicholasg9804
    @nicholasg9804 5 років тому +7

    im getting index out of range error

    • @newzoel
      @newzoel 4 роки тому +1

      Hi, would've been nice if u can share the workaround

    • @igorpaiva9304
      @igorpaiva9304 4 роки тому

      @@newzoelThis is what shows up when I try to run:
      Traceback (most recent call last):
      File "/home/igor/Documentos/WebStraping/teste.py", line 21, in
      print('the current price: '+str(parsePrice()))
      File "/home/igor/Documentos/WebStraping/teste.py", line 17, in parsePrice
      price=soup.find_all('div',{'class':'My(6px) Pos(r) smartphone_Mt(6px)'})[0].find('span').text
      IndexError: list index out of range

    • @newzoel
      @newzoel 4 роки тому +1

      @@igorpaiva9304 hi igor, i've found the workaround. Instead using "xml" try using "lxml". Then try to point directly to span header where the price exists, without pointing the div class. Hopes this help

    • @igorpaiva9304
      @igorpaiva9304 4 роки тому +2

      ​@@newzoel dude, thanks a lot!

    • @ricardoibarra4267
      @ricardoibarra4267 4 роки тому

      @@igorpaiva9304 Hi,
      Can you explain why this worked?

  • @RenatoEsquarcit
    @RenatoEsquarcit 4 роки тому

    SUBSCRIBED IMMEDIATELY

  • @divyanshsharma4574
    @divyanshsharma4574 4 роки тому

    How to store these real time values of the stock into an excel file or csv file??

  • @stewiegriffin8384
    @stewiegriffin8384 4 роки тому

    straight code indeed.. thank youu