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 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 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 is one amazing source of datasets, very dynamic and with a thriving community.
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.
Source: Finnhub - Financials Reported
reported-financials The data is cleaned and sourced directly from SEC filings from 2010-2020.
Source: Finnhub - Filings
SEC Filings 1994-2020 The data is cleaned and sourced directly from SEC filings from 1994-2020.
Source: Finnhub
S&P 500 futures tick data S&P futures tick dataset from 2000-2019.
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 Daily Hourly and 5 Minutes data for multiple markets (World, U.S., U.K., Japan, Hong Kong, Germany, Poland, Hungary and some Macroeconomy indicators).
- FinViz
- Scrap with: FinViz Finance
pip install finvizfinance
- Sample Notebook:
- Scrap with: FinViz Finance
- [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.
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.
- [Margin Statistics] https://www.finra.org/investors/learn-to-invest/advanced-investing/margin-statistics
- Sample Notebook:
- Sample Notebook:
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)
- Sec Api
- Sample Notebook:
- Insider Monitor
- Sample Notebook:
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](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
- Scrape ETF holdings:etf4u
- Sample Notebook:
- Sample Notebook:
- Sample Notebook:
- Sample Notebook: References:
- Example from: finplot
- Example from: AdhamAlHarazi See: https://github.com/txjohnny5/Tom-Demark-Indicator/blob/master/TD_plotter.py Study on TD Sequential and improvements: cloudquant
- Sample Notebook:
- Compilation of resources Quant Machine Learning: Awesome Quant Machine Learning Trading
- Compilation of resources Deep Learning Trading: Awesome Deep Trading
- Visual analysis of financial data: Matplotlib Finance
pip install --upgrade mplfinance
- [Finance Plotter] (https://github.com/highfestiva/finplot)
pip install finplot
- Altair and Vega: [Altair] (https://altair-viz.github.io/)
pip install altair_viewer
conda install vega
jupyter nbextension install --sys-prefix --py vega
jupyter nbextension enable vega --py --sys-prefix
jupyter labextension install @jupyterlab/vega5-extension
- Plotly: [Plotly] (https://pypi.org/project/plotly/)
pip install plotly==4.14.3
pip install "notebook>=5.3" "ipywidgets>=7.5"
- Postgres based DB to capture and store data: pySecMaster
- Reinforcement Learning for trading: FinRL: A Deep Reinforcement Learning Library for Quantitative Finance
- MlFinlab: MlFinlab
- Gary Antonacci’s Dual Momentum Explained: Dual Momentum
Portfolio Allocation backtesting and simulations:
- Portfolio Charts: https://portfoliocharts.com/portfolios/
- Portfolio Visualizer: https://www.portfoliovisualizer.com/
- Backtest: https://backtest.curvo.eu/
Great blogs and aggregators to follow:
- Quantdare
- Quantocracy
- Alpha Architect
- Milton Financial Market Research Institute
- [Cesar Alvarez](https://alvarezquanttrading.com
- The Barometer is interesting.
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.
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/.