Simple plots of market data
In the following examples, we will use historical data only. We will learn how to plot live data received from a broker later in this chapter.
There are many ways to read and handle market data, some of which were considered in Chapter 5, Retrieving and Handling Market Data with Python. Now, we are going to learn some alternative approaches so that you can best choose what suits your current research and development needs.
Let’s start with the most straightforward approach, which uses only native Python data structures. As we saw in Chapter 5, the preferred way of storing and manipulating market data is a dictionary because of its full compatibility with the JSON standard and the ability to extract the necessary data by keywords. We will start with dictionaries as well:
- First, we still need to do some imports:
import matplotlib.pyplot as plt
import csv
The csv
module contains very convenient methods to read and parse comma-separated...