Skip to content

About

Collected and analyzed financial data using APIs and web scraping, with data cleaning and visualization in Python.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Stock Data Extraction (APIs & Web Scraping)

A data analysis project demonstrating how to extract, clean, and visualize financial data using APIs and web scraping techniques.


Project Overview

This project focuses on collecting stock price and revenue data from multiple sources using different data extraction methods:

  • Alpha Vantage API – raw financial data extraction using HTTP requests
  • yfinance – simplified access to Yahoo Finance data
  • Macrotrends – revenue data collected via web scraping

The goal is to demonstrate real-world data collection workflows, including API handling, JSON parsing, HTML scraping, and time series visualization.


Technologies Used

  • Python
  • Jupyter Notebook
  • pandas
  • matplotlib
  • requests
  • BeautifulSoup
  • yfinance

Project Structure

├── Stock_Data_Extraction.ipynb
└── README.md

Data Extraction and Analysis

1. API Data Extraction — Alpha Vantage

  • Retrieved stock price (Apple) data using REST API requests
  • Parsed nested JSON responses into pandas DataFrames
  • Worked with daily time series data

Limitations: The free tier of Alpha Vantage allows up to 25 requests per day. When limits are exceeded, the API returns informational messages instead of data. Certain Alpha Vantage endpoints require a paid premium subscription. When unavailable, alternative data sources such as yfinance can be used to complement analysis.

2. Data Extraction using yfinance

  • Retrieved historical stock prices (Tesla)
  • Extracted financial statements and revenue data
  • Leveraged built-in DataFrame outputs for efficient analysis

3. Web Scraping — Macrotrends

  • Extracted revenue data (GameStop) from HTML tables
  • Parsed webpage content using BeautifulSoup
  • Cleaned and structured scraped data into pandas DataFrames
  • Identified and inspected tables within the webpage

Visualization

  • Time series plots for stock prices
  • Revenue trends

API Key Security

API keys are treated as sensitive credentials and are not stored directly in the code. Instead, they should be managed using environment variables or configuration files excluded from version control to prevent unauthorized access.


Key Skills Demonstrated

  • Working with REST APIs
  • JSON parsing and data transformation
  • Web scraping with BeautifulSoup
  • Data cleaning and preprocessing
  • Time series visualization

Disclaimer

This project is for educational purposes only. Financial data from external sources may contain inaccuracies or delays.


License

This project is licensed under the MIT License.


About

Collected and analyzed financial data using APIs and web scraping, with data cleaning and visualization in Python.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages