Machine Learning for Trading

Logo

A comprehensive introduction to how ML can add value to the design and execution of algorithmic trading strategies

View the Project on GitHub stefan-jansen/machine-learning-for-trading

02 API access to market data

There are several options to access market data via API using Python.

pandas datareader

The notebook 01_pandas_datareader_demo presents a few sources built into the pandas library.

yfinance: Yahoo! Finance market and fundamental data

The notebook yfinance_demo shows how to use yfinance to download a variety of data from Yahoo! Finance. The library works around the deprecation of the historical data API by scraping data from the website in a reliable, efficient way with a Pythonic API.

LOBSTER tick data

The notebook 03_lobster_itch_data demonstrates the use of order book data made available by LOBSTER (Limit Order Book System - The Efficient Reconstructor), an online limit order book data tool that aims to provide easy-to-use, high-quality limit order book data.

Since 2013 LOBSTER acts as a data provider for the academic community, giving access to reconstructed limit order book data for the entire universe of NASDAQ traded stocks. More recently, it started offering a commercial service.

Qandl

The notebook 03_quandl_demo shows how Quandl uses a very straightforward API to make its free and premium data available. See documentation for more details.

zipline & Qantopian

The notebook [contains the notebook zipline_data briefly introduces the backtesting library zipline that we will use throughout this book and show how to access stock price data while running a backtest. For installation please refer to the instructions here.