Book Image

Hands-On Financial Trading with Python

By : Jiri Pik, Sourav Ghosh
Book Image

Hands-On Financial Trading with Python

By: Jiri Pik, Sourav Ghosh

Overview of this book

Creating an effective system to automate your trading can help you achieve two of every trader’s key goals; saving time and making money. But to devise a system that will work for you, you need guidance to show you the ropes around building a system and monitoring its performance. This is where Hands-on Financial Trading with Python can give you the advantage. This practical Python book will introduce you to Python and tell you exactly why it’s the best platform for developing trading strategies. You’ll then cover quantitative analysis using Python, and learn how to build algorithmic trading strategies with Zipline using various market data sources. Using Zipline as the backtesting library allows access to complimentary US historical daily market data until 2018. As you advance, you will gain an in-depth understanding of Python libraries such as NumPy and pandas for analyzing financial datasets, and explore Matplotlib, statsmodels, and scikit-learn libraries for advanced analytics. As you progress, you’ll pick up lots of skills like time series forecasting, covering pmdarima and Facebook Prophet. By the end of this trading book, you will be able to build predictive trading signals, adopt basic and advanced algorithmic trading strategies, and perform portfolio optimization to help you get —and stay—ahead of the markets.
Table of Contents (15 chapters)
1
Section 1: Introduction to Algorithmic Trading
3
Section 2: In-Depth Look at Python Libraries for the Analysis of Financial Datasets
9
Section 3: Algorithmic Trading in Python

Initial setup

To set up the Python environment, follow these steps:

  1. Download and install Anaconda Python from https://www.anaconda.com/products/individual if you do not have it installed yet.
  2. git clone the repository:
    git clone XXXXX
  3. Change the current directory to the cloned GitHub repository.
  4. Run the following code:
    conda env create -f handson-algorithmic-trading-with-python\environment.yml -n handson-algorithmic-trading-with-python
  5. Change the active environment:
    conda activate handson-algorithmic-trading-with-python
  6. Set the global environmental variables for market access:
    Figure 1 – Table of various variable names and where to obtain free token

    Figure 1 – Table of various variable names and where to obtain free token

  7. Using Window's Control Panel, set the system environment:
    Figure 2 – How to find the Environment dialog in MS Windows

    Figure 2 – How to find the Environment dialog in MS Windows

    Then, choose Edit the system environment variables:

    Figure 3 – The steps for setting up a MS Windows environmental variable

    Figure 3 – The steps for setting up a MS Windows environmental variable

    Then, specify the variable in the Environment Variables...