<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: WaburiBK</title>
    <description>The latest articles on DEV Community by WaburiBK (@waburibk).</description>
    <link>https://dev.to/waburibk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F701162%2Fd604c2f4-3fb5-4bd1-b6ac-eb2ba6606b1b.png</url>
      <title>DEV Community: WaburiBK</title>
      <link>https://dev.to/waburibk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waburibk"/>
    <language>en</language>
    <item>
      <title>Extracting Financial Data Using Python</title>
      <dc:creator>WaburiBK</dc:creator>
      <pubDate>Wed, 20 Oct 2021 13:49:51 +0000</pubDate>
      <link>https://dev.to/waburibk/extracting-financial-data-using-python-4eoi</link>
      <guid>https://dev.to/waburibk/extracting-financial-data-using-python-4eoi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Struggling with Virtual Environments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So before I was even able to pull financial data off Yahoo Finance using Python, I really struggled with remembering how to create a virtual environment (venv). I’ve always known that it is important to work on a venv so as to not interfere with the global Python environment. Additionally, it makes it easier to share my work with other developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Libraries and Dictionaries&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regardless, after being saved by tech Indian gurus on YouTube, I immediately got started on reviewing an article by &lt;a href="https://aroussi.com/post/python-yahoo-finance"&gt;Ran Aroussi&lt;/a&gt; , who developed the yfinance library. This library is able to reliably extract data from Yahoo Finance. &lt;br&gt;
After installation of the pip command (pip install yfinance), I had to pass an argument of the ticker symbol that I wish to extract information from. A ticker represents each stock/security uniquely for trading purposes. In this illustration, I wanted to extract Facebook’s financial data using the ticker “FB”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wHAX3uRC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bov29maeqvmoucnfijah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wHAX3uRC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bov29maeqvmoucnfijah.png" alt="Extracting Financial Data Using Python"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting keys from the dictionary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Company information is contained within the info dictionary. I was able to extract certain elements of the dictionary by printing the keys of the info dictionary. Examples of the keys I extracted include: ‘sector’, ‘address1’ and ‘fiftyTwoWeekHigh’.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Being Specific&lt;/strong&gt;&lt;br&gt;
Additionally, it is possible to extract daily prices over a specified period of time. This is possible through specifying the period. Valid entries include 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y and ytd(year to date).&lt;br&gt;
Furthermore, I was able to extract daily prices within a range of time. First, I had to import the datetime library. According to Python &lt;a href="https://docs.python.org/3/library/datetime.html"&gt;documentation&lt;/a&gt;, the datetime module supplies classes for manipulating dates and times. Specifically, the class datetime.datetime contains attributes of year, month, day, hour, minute, second, microsecond and tzinfo.&lt;br&gt;
I proceeded to define my start and end dates and got an output of daily prices between the specified dates. &lt;/p&gt;

&lt;h6&gt;
  
  
  Disclaimer: Here to share my thoughts in this self-taught journey.
&lt;/h6&gt;

</description>
      <category>python</category>
      <category>codenewbie</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
