Intro to Python for Finance: A Beginner's Guide

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

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

  • @RyanOConnellCFA
    @RyanOConnellCFA  Год назад +5

    🎓 Tutor With Me: 1-On-1 Video Call Sessions Available
    ► Join me for personalized finance tutoring tailored to your goals: ryanoconnellfinance.com/finance-tutoring/
    💻 Find the Code Written In this Video Here:
    ► Access the code resources here: ryanoconnellfinance.com/python-for-stock-analysis/

  • @messiasmoretto7457
    @messiasmoretto7457 5 месяцев назад +5

    Extremely useful and straightforward video. Found some issues along the way, but could overcome them by myself. Thanks a lot

    • @RyanOConnellCFA
      @RyanOConnellCFA  3 месяца назад

      Part of learning to code is working through all those pesky errors and bugs! Good job

    • @koto-krollik7003
      @koto-krollik7003 20 дней назад

      hi. thank you for your job. i have one quesiotion - why you dont use the syntax "print" before command in 22:05 ?

  • @jamoladdinomonbaev4121
    @jamoladdinomonbaev4121 Год назад +7

    Thank you very much for these wonderful videos! I've been following you for more than a year, and your videos helped me a lot in my studies. Now I am doing CFA Level 1 and again, the videos you are posting are very helpful, especially this one as it relates to new additions of Level 1 exam. Thank you very much !

    • @RyanOConnellCFA
      @RyanOConnellCFA  Год назад +2

      Wow I really appreciate the feedback Jamoladdin! It's comments like these that give me motivation to keep putting work in. Thank you!

  • @Monika-uv2qp
    @Monika-uv2qp Год назад +4

    Have been following Ryan for quite some time now. Very helpful!! Kudos

  • @dannguyen239
    @dannguyen239 Год назад +2

    Thank you for the video. Please post more videos like this in the future.

  • @Chris-si4ox
    @Chris-si4ox Год назад +2

    great video - just getting back into coding and this is very helpful. Forgot how fiddly this stuff is.

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

      Glad it was helpful! Good luck brushing up on those skills. It is really fiddly how one thing out of place will break everything

  • @theemperor.188
    @theemperor.188 Год назад +3

    Bro Ur such a genious😉😉..Closely following in ur footsteps.

    • @RyanOConnellCFA
      @RyanOConnellCFA  Год назад +3

      Thanks, man! Just sharing what I know, and I'm stoked it's helping you out. Keep up the solid work on your end! 😎

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

      @theemperor.188 not as close as I am

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

    Thanks it is helping us a lot hope you will keep posting more videos like this in future

  • @edwinmauriciosanchezlanon6989
    @edwinmauriciosanchezlanon6989 2 месяца назад +1

    Thanks for this great video, Ryan!

  • @nicolassepulvedalozano9210
    @nicolassepulvedalozano9210 Год назад +2

    Hi. Awesome video for beginners. Thank you (sorry for bad English)

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

      Thank you Nicolas! And no worries, your English was perfect bro

  • @leander79416
    @leander79416 3 месяца назад +1

    wonderfully explained - many thanks

  • @igorelperin8277
    @igorelperin8277 5 месяцев назад +3

    Hi Ryan, thank for your work - much appreciated. Faced with problem to import all libraries specifically on the step
    from pandas_datereader import data as pdr
    all the time when python tries to interpret this line I have an error with
    ModuleNotFoundError: No module named 'distutils'
    Python version is 3.12, PyCharm, MacOS
    P.S. I checked - all libraries have been installed (you mentioned in your video and all problems with above mentioned line.
    Thanks

    • @gintama183
      @gintama183 3 месяца назад

      same prob here buddy!

    • @igorelperin8277
      @igorelperin8277 3 месяца назад +1

      @@gintama183 sorry to hear but anyway looks like Ryan is not gonna answer and help to fix this issue unfortunately

    • @wisitnigon1326
      @wisitnigon1326 2 месяца назад

      i just type all of the libraries into the environment

    • @jamesaderinwale7891
      @jamesaderinwale7891 10 дней назад

      ChatGpt fixed it for me

    • @Benjamin-pf1eb
      @Benjamin-pf1eb 7 дней назад

      you need to pip install pandas-datareader

  • @mmcatamm6668
    @mmcatamm6668 2 месяца назад +2

    couldn't make it beyond the import libraries - command prompt says everything is installed, but PyCharm tells me "ModuleNotFoundError: No module named 'yfinance'"

    • @RyanOConnellCFA
      @RyanOConnellCFA  2 месяца назад +1

      Did you go to the command prompt and type "pip install yfinance"?

  • @m.ssharma535
    @m.ssharma535 Год назад +2

    Hi Ryan. First question after binge watching your videos over the weekend. Please take a look. I have developed a stock value calculator that has 6000 stocks. I have 6 methods and created a dashboard for summary. But I want to get the results for 40 stocks (can get ticker in a text file) and it should be printed to another excel tab or PDF or Python screen. I can just print one row or two rows of summary for each stock ticker (no need of fancy dashboard). Meaning -I need to run the excel dashboard (or file) repeatedly 40 times (40 stock tickers with 2 inputs -ticker and market price) and get the valuation summary. What is the trick to do ? Kindly suggest a method. I think I can do this in Python by accessing Excel repeatedly. Excel or Python?

    • @RyanOConnellCFA
      @RyanOConnellCFA  Год назад +6

      Hi @m.ssharma535,
      Given your requirements, I'd recommend using Python over Excel for this task. Python can effortlessly loop over your 40 tickers, process the data, and store the results. Libraries like pandas can integrate directly with Excel, allowing you to read data, perform calculations, and then write back the results. For your scenario, you can use pandas to load the tickers, compute the valuations for each, and save the summaries to a new Excel tab or PDF. This approach offers automation, flexibility, and scalability compared to manually running processes in Excel.
      I hope this helps! Let me know if you need further clarification.

  • @BrittanyIsenhart
    @BrittanyIsenhart 13 дней назад

    This is great! Which certification program do you recommend on taking for someone who wants to be certified (I am a Finance professional)

  • @gloriabukachi1
    @gloriabukachi1 5 месяцев назад +2

    Wow! Thank you

  • @Dongnanjie
    @Dongnanjie 9 месяцев назад +1

    Love it. Thank you!

  • @d3yadav
    @d3yadav 6 месяцев назад +2

    Hi Ryan. This video is very interesting. I tried to install the yfinance package but I gets the error" there is no module named yfinance". I cross checked in site packages folder and I can see yfiance folder. Can you suggest any help?

  • @lordtony2054
    @lordtony2054 Год назад +3

    Absolute legend.

  • @NB233___
    @NB233___ Год назад +2

    anyone know why I get at 15:08 ?

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

      Hey! Make sure you've imported the datetime module and aliased it as dt
      If you're still getting an error similar to , that suggests that you may have inadvertently overridden the dt or datetime name in your code. Make sure you don't have any other variables or modules named datetime or dt that could be conflicting with the standard library module.

  • @user-cx3no4zb9w
    @user-cx3no4zb9w Год назад +1

    Excellent video, thx a lot!!

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

    Why would you use elif if you can just do another if statement underneath? Some sort of referencing insurance?

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

      There are scenarios in which you might opt to nest an 'if' statement within another or use an 'elseif' statement. The 'elseif' statement is versatile as it captures all subsequent conditions, whereas an 'if' statement addresses only the specific condition you're testing for.

  • @aarondelarosa3146
    @aarondelarosa3146 Год назад +2

    Excellent. Where do you write on the code "drop nan"?

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

      Thanks Aaron! I did not drop the "nan" values at all. It was not necessary to plot the values for me

  • @rayhanfitra
    @rayhanfitra 7 месяцев назад +1

    Hello Ryan, thanks for the video, i cant really see the graph after doing the code, would you give me a solution? thanks in advance

    • @RyanOConnellCFA
      @RyanOConnellCFA  7 месяцев назад

      My pleasure! You can copy the code straight from my website using the code to plot the results. If you have named all the variables the same, it should work fine

  • @SD-gw5vm
    @SD-gw5vm 5 месяцев назад +1

    Hi Ryan, When are the other videos being released?

    • @RyanOConnellCFA
      @RyanOConnellCFA  3 месяца назад

      Hey there, I will continue to release Python videos in the future. I do not have a set schedule for it however

  • @albertbala3235
    @albertbala3235 3 месяца назад

    first time coming here i thought its really for beginners

  • @amelcorporan1075
    @amelcorporan1075 9 месяцев назад +1

    Loved this!! How could I watch the graphic of cumulative_log_returns in Sublime Text?

    • @RyanOConnellCFA
      @RyanOConnellCFA  9 месяцев назад +1

      Thank you! Unfortunately I've never used that Python package before so I'm not certain

    • @amelcorporan1075
      @amelcorporan1075 9 месяцев назад

      Np, i made a GPT as it was a python expert and told it to give me excersises to be growing with this python for finance stuff, look at this:
      import yfinance as yf
      import pandas as pd
      import matplotlib.pyplot as plt
      #descargamos datos de la acción
      data = yf.download("GOOG", start = "2021-01-01", end = "2021-12-31")
      #calculamos el retorno diario
      data["Retorno"] = data ["Adj Close"].pct_change()
      #Calculamos retorno diario promedio y volatilidad
      retorno_promedio = data["Retorno"].mean()
      volatilidad = data["Retorno"].std()
      print(f"Retorno diario promedio: {retorno_promedio}")
      print(f"Volatilidad: {volatilidad}")
      #Creamos los gráficos
      data['Retorno'].plot(figsize=(10, 6))
      plt.title('Retorno Diario de GOOG en 2021')
      plt.xlabel('Fecha')
      plt.ylabel('Retorno Diario')
      plt.show()
      @@RyanOConnellCFA

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

    By the way, I've already installed VSC (Visual Studio Code on my computer). Can I run python code directly? I mean, without Anaconda platform?

    • @RyanOConnellCFA
      @RyanOConnellCFA  Год назад +2

      If you have Python and VS Code already installed then it should work for you. You should be able to put the same code in a normal python (.py) file and run it in the terminal. However, I'd recommend using a Jupyter Notebook file (.ipynb) to make it easier on yourself like I did in the video

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

      @@RyanOConnellCFA Well, It's not working. There's a connection with Kernel: Python 3.11.1. Activating Python environment. It's running activation now.

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

      Let me know if it gets up and running for you. It may be worth installing Anaconda just incase

  • @user-oe3nu8ym6q
    @user-oe3nu8ym6q Год назад +1

    Hello Ryan, after seeing your video I tried to download everything you showed, however when I try to import the libraries through the command prompt, my laptop doesn't recognize the 'pip' command. What should I do?
    Thank you in advance 😊

    • @RyanOConnellCFA
      @RyanOConnellCFA  Год назад +2

      Hey! This likely means that you do not have Python downloaded on your computer. I would go back to the first step of downloading Python if I were you

    • @user-oe3nu8ym6q
      @user-oe3nu8ym6q Год назад

      Thank you so much for answering!
      Now I have problems with actually running the commands. Even the "print" doesn't get me results. After hitting the "go" button, my cursor just transports to the search field.

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

      @@user-oe3nu8ym6q My pleasure! I'm guessing that means you need to select which version of Python you will run the code with. There will probably only be one option, just select that one

    • @user-oe3nu8ym6q
      @user-oe3nu8ym6q Год назад +1

      @@RyanOConnellCFA Sorry for bothering again, I hope this will be my last question, it's because I don't have an idea about programming in general. After installing everything in the command prompt as you showed, when i try to run this, it's giving me errors like "yfinance unknown word and datareader unknown word". In the command prompt when I try to install them again it says requirement already satisfied, so I suppose i completed this part correctly. Pandas, datetime and numpy are running without errors.

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

      @@user-oe3nu8ym6q No bother at all, I'm here to help! It sounds like you might not have imported the yfinance and datareader modules correctly in your Python script. Before using these modules, ensure to include lines at the beginning of your script to import them, like "import yfinance as yf" and "import pandas_datareader as dr". Give this a try and let me know how it goes!

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

    Ryan - Very good of explaining, which is understandable

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

      I really appreciate the feedback and I'm glad you enjoyed it!

  • @hetaswidave1171
    @hetaswidave1171 8 месяцев назад

    Hey Ryan!
    I tried installing the yfinance and the other packages but every time I press [Enter] I get a message stating "pip is not recognized as an internal or external command, operable program, or batch file." What should I do?

    • @RyanOConnellCFA
      @RyanOConnellCFA  8 месяцев назад

      Hey there! This error usually means that Python's package manager, pip, isn't added to your system's PATH. Try reinstalling Python and ensure that the "Add Python to PATH" option is checked during installation.

    • @hetaswidave1171
      @hetaswidave1171 8 месяцев назад

      @@RyanOConnellCFA Hey, Thank you! That worked to install the pip packages. Although when I enter "import yfinance as yf" and run it, I get an error saying 'ModuleNotFoundError'. I installed the package again but I still get the same error. Also, I'm using JupyterNotebook and not VS code.

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

    Finally code is working in VSC except for plot. Code can't plot cumulative log returns. I installed matplotlib on terminal as pip install matplotlib 3.7.1. However, cumulative log returns plot was not executed.

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

      What was the error message? Sounds like you're 99% of the way there

  • @sadiksidhu6406
    @sadiksidhu6406 10 месяцев назад +1

    so i got stuck along the way
    *********************100%%**********************] 3 of 3 completed
    1 Failed download:
    ['QQQ']: OperationalError('database is locked')

    • @RyanOConnellCFA
      @RyanOConnellCFA  10 месяцев назад +1

      That sounds to me like the problem is not something you did wrong but some bug in the API. Maybe try a different ticker (like AAPL) and see if it works

    • @jamesaderinwale7891
      @jamesaderinwale7891 10 дней назад

      It was successful, you only need one more line, >>> print(df)

  • @onwrdandupwrd5303
    @onwrdandupwrd5303 9 месяцев назад +1

    lol @ 22:34

  • @DeepVoiced
    @DeepVoiced 5 месяцев назад +1

    22:31 🤨😏