Giter VIP home page Giter VIP logo

gp1981 / sec_data_analysis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 1.22 MB

This repository contains R scripts for retrieving and analyzing company data from the U.S. Securities and Exchange Commission (SEC) filings.

Home Page: https://gp1981.github.io/SEC_data_analysis/

License: MIT License

R 97.26% CSS 2.74%
10k api filing financial-analysis financial-report fundamentals sec xbrl xbrl-parser

sec_data_analysis's Introduction

SEC Data Analysis

Overview

Welcome to the SEC Data Analysis project! This repository houses R scripts designed for retrieving and analyzing company data from U.S. Securities and Exchange Commission (SEC) filings. The primary objective is to offer a framework for accessing information about publicly traded companies and conducting educational data analysis based on their SEC filings.

Note: the project is under development. WIP indicates Work In Progress

Purpose

The main purpose of this project is to retrieve and analyze company data from SEC filings for educational and research purposes. It's crucial to note that the scripts provided here are intended for educational use only and should not be used for making investment decisions. Use these scripts at your own risk.

Project Structure

This project comprises two main components:

  1. R Scripts for Data Retrieval and Analysis:

    • main_script.R: Orchestrates data retrieval and analysis.
    • code/Functions/data_retrieval.R: Retrieves company data from SEC filings.
    • code/Functions/data_analysis.R: Processes and analyzes SEC data.
    • code/Functions/data_visualization.R: Processes, analyzes, and visualizes SEC data.
    • code/Functions/utils.R: Utility functions for processing, analyzing, and visualizing SEC data.
  2. Quarto Website Development:

    • The /quarto directory contains Quarto (.qmd) files, forming a website that serves as a guide to SEC data analysis with R.
    • index.qmd: Introduction and overview of the project.
    • 01_data_retrieval.qmd: Explains the process of retrieving financial data from SEC filings.
    • 02_data_exploration.qmd: Delves into the structure of the SEC data obtained from the API.
    • 03_data_analysis.qmd, 04_data_visualization.qmd, 06_advanced_topics.qmd: Currently placeholders for future content.
    • 11_AAPL.qmd: Placeholder for specific analysis on Apple Inc.
    • A1_main_script.qmd, A2_Functions.qmd: Placeholder for detailed explanations of the main script and functions.

Getting Started

  1. Clone the repository to your local machine:

    git clone https://github.com/gp1981/SEC_Data_Analysis.git
  2. Install the required R libraries by running the following command:

    install.packages(c("httr", "jsonlite", "tidyverse", "dplyr"))

Data analysis in R

Run the main_script.R script to retrieve and analyze SEC data.

Quarto Website

The Quarto website is part of this project. You can access the book at the following link:

Unlocking Financial Insights: A Guide to SEC Data Analysis with R - Link to the page created

Rendering the Quarto website Locally

To render the Quarto website on your local machine:

  1. Install Quarto:

    npm install -g quarto
  2. Render the Quarto website: Navigate to the /quarto directory and use the Quarto CLI to render the book:

    cd quarto
    quarto render

    Alternatively, in the quarto directory, you can open the index.qmd file and click "Render."

    The rendered website will be available in the docs directory.

Contribution

Contributions are welcome! If you have any ideas for improvements or new features, please open an issue or submit a pull request. For major changes, please discuss the changes first by opening an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

This script is intended for educational purposes only and should not be used for investment decisions. Use at your own risk.

Contact

For questions or feedback, feel free to contact gp1981.

Enjoy analyzing SEC data!

sec_data_analysis's People

Contributors

gp1981 avatar

Watchers

 avatar

Forkers

gordonleong

sec_data_analysis's Issues

Create dataframe of financial report Balancesheet

  • Report single company IS

  • Report single company BS

  • Report single company CF

  • last quarter

  • last 5 years

  • Standardize financial reports for analysis CF

  • Standardize financial reports for analysis IS

  • Standardize financial reports for analysis CF

Valuation

On the basis of Value Investing of Greenwald:

  • Asset
  • Earning Power
  • Growth
  • DCF

Calculate missing value in df_std_BS

For the same "fy", "fp", we need to add to df_std_BS the following rows before the pivot_wider:

 new row: if Total Current Assets does not exist then it creates a new row whose val is Total Assets - Total Long Term Assets and standardized_balancesheet_label is Total Current Assets

new row: if Other Current Assets does not exist then it creates a new row whose val is Total Current Assets - (Cash and Cash Equivalent + Marketable Securities, Current + Total Accounts Receivable + Total Inventory) and standardized_balancesheet_label is Other Current Assets

new row: if Total Long Term Assets does not exist then it creates a new row whose val is val of Total Assets - val of Total Current Assets and standardized_balancesheet_label is Total Long Term Assets

new row: if Other Non Current Assets does not exist then it creates a new row whose val is val of Total Long Term Assets - val of (Marketable Securities, Non Current + Property, Plant and Equipment+ Intangible Assets (excl. goodwill) + Goodwill) and standardized_balancesheet_label is Other Non Current Assets

new row: if Total Current Liabilities does not exist then it creates a new row whose val is val of Liabilities - val of Liabilities, Non Current and standardized_balancesheet_label is Total Current Liabilities

new row: if Other Current Liabilities does not exist then it creates a new row whose val is val of Total Current Liabilities - val of (Accounts Payable, Current + Taxes Payable, Current + Commercial Paper + Long Term Debt, Current Maturities + Operating

new row: if Total Long Term Liabilities does not exist then it creates a new row whose val is val of Total Liabilities - val of Total Current Liabilities and standardized_balancesheet_label is Total Long Term Liabilities

new row: if Other Long Term Liabilities does not exist then it creates a new row whose val is val of Total Long Term Liabilities - val of (Long Term Debts - Operating Lease, Liability, Non Current + Finance Lease, Liability, Non Current and standardized_balancesheet_label is Other Long Term Liabilities

new row: if Other Stockholders Equity does not exist then it creates a new row whose val is val of Total Company Stockholders Equity - val of (Common Stock + Additional Paid in Capital + Preferred Stock + Retained Earnings + Accumulated other comprehensive income (loss)) and standardized_balancesheet_label is Other Stockholders Equity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.