Visualizing live market data
Before we move on, I strongly recommend you reread the Working with saved and live data – keep your app universal section in Chapter 5, Retrieving and Handling Market Data with Python, and the Sliding windows section in Chapter 7, Technical Analysis and Its Implementation in Python. We are going to use the same architecture to create live plots of market data.
Important reminder
Whatever data we receive from a live data source should go into a queue. This should be done in a separate thread. Then, data is read from the queue into a sliding window that controls the actual amount of data – for any processing or plotting.
When we worked with static historical data, we used very convenient methods that allowed us to read an entire dataset into memory in one line of code and then navigate through it. Of course, any convenience is always paid for, and in this case, the fee is running the risk of peeking ahead (see the Trading logic –...