Skip to content

danielsobrado/notebooks_invest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Market Notebooks

The objective of this repo is to analyze historical market data to gain insights that you can only get by doing your own experiments.

You should research them by analyzing historical data in order to have in-depth knowledge about the market.

Know how the market works by looking into the data from multiple angles, don't trust blindly other people's analysis and charts, do your own homework.

Data Sources

Data is key. Having good sources of data is a challenge, and also very important.

We'll use free data sources in these repositories, but you'll be able to extrapolate the analysis, to other commercial data, if required.

Investpy

Investpy is a Python package to retrieve data from Investing.com

Install it via pip with a Python3.5 version or higher:

$ pip install investpy

Kaggle

Kaggle is one amazing source of datasets, very dynamic and with a thriving community.

Huge Stock Market Dataset

Huge Stock Market Dataset full historical daily price and volume data for all US-based stocks and ETFs trading on the NYSE, NASDAQ, and NYSE MKT.

The data (last updated 11/10/2017) is presented in CSV format as follows: Date, Open, High, Low, Close, Volume, OpenInt. Note that prices have been adjusted for dividends and splits.

Financials as Reported 2010-2020 - SEC Filings

Source: Finnhub - Financials Reported

reported-financials The data is cleaned and sourced directly from SEC filings from 2010-2020.

SEC Filings 1994-2020

Source: Finnhub - Filings

SEC Filings 1994-2020 The data is cleaned and sourced directly from SEC filings from 1994-2020.

Senators Disclosure

S&P 500 futures tick data (SP)

Source: Finnhub

S&P 500 futures tick data S&P futures tick dataset from 2000-2019.

Historical stock data for all current S&P 500 companies

Historical stock prices (last 5 years) for all companies currently found on the S&P 500 index.

The script I used to acquire all of these .csv files can be found in this [GitHub repository] (https://github.com/CNuge/kaggle-code/tree/master/stock_data)

[Historical stock data for all current S&P 500 companies] (https://www.kaggle.com/camnugent/sandp500) The data from The Investor's Exchange api.

Stooq

Stooq Daily Hourly and 5 Minutes data for multiple markets (World, U.S., U.K., Japan, Hong Kong, Germany, Poland, Hungary and some Macroeconomy indicators).

Paid services with free allowance

Data Scrapping

  • FinViz
    • Scrap with: FinViz Finance
      • pip install finvizfinance
      • Sample Notebook:
  • [Graph Fundamentals] (http://graphfundamentals.com/) Free forever, they claim the source is the SEC fillings, I can see that the quality is not great, probably because of inconsistencies in the format of the fillings.

Shiller

Data used in the book: Irrational Exuberance [Princeton University Press 2000, Broadway Books 2001, 2nd ed., 2005]

Online DATA ROBERT SHILLER This data set consists of monthly stock price, dividends, and earnings data and the consumer price index (to allow conversion to real values), all starting January 1871.

FINRA Margin Statistics

Statistics

Seasonality

Day of the week

  • Sample Notebook:

Month of the year

  • Sample Notebook:

Sentiment

Insiders

One of the most famous investors of all time, Peter Lynch, said "insiders might sell their shares for any number of reasons, but they buy them for only one: they think the price will rise."

See: [Insiders] (https://github.com/danielsobrado/notebooks_invest/tree/master/insiders)

Insider Websites

Webs

SEC-Edgar

sec-edgar is a Python package to download all of a company’s periodic reports, filings and forms from the EDGAR database.

Install it via pip with:

$ pip install secedgar

SEC Edgar Downloader

[sec-edgar-downloader](pip install -U sec-edgar-downloader) is a Python package for downloading company filings from the SEC EDGAR database. Searches can be conducted either by stock ticker or Central Index Key (CIK).

Install it via pip with:

$ pip install -U sec-edgar-downloader

Constituents

  • Scrape ETF holdings:etf4u

Indicators

Moving averages

  • Sample Notebook:

RSI

  • Sample Notebook:

MACD

  • Sample Notebook:

Demark TD Sequential

Strategies

Buy & Hold

  • Sample Notebook:

Sector Rebalancing

Interesting Repos

Compilations

Visualization

Data

  • Postgres based DB to capture and store data: pySecMaster

Machine Learning

Interesting Links

Portfolio Optimization

Portfolio Allocation backtesting and simulations:

Blogs

Great blogs and aggregators to follow:

Disclaimer

Before using this software, be sure to understand and follow the terms of all data providers. I am not responsible for how you use this software, so please be responsible in your use of it! Please see the following links for some information:

For further information, please seek legal counsel.

License (GNU AGPLv3)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.