Damien Pierlot
·
Follow
Published in
Python in Plain English
·
6 min read
·
Sep 1, 2023
39
live plotting — yellow plot is a savgol filter applied to the ohlc close datas. You can refer to this article to get more information: https://medium.com/dev-genius/enhancing-trading-strategies-with-kalman-filter-an-advanced-approach-8a912ad3ca6
Introduction:
Welcome to this new real-time trading adventure with Matplotlib! This article follows in the footsteps of our previous journey into the world of algorithmic trading, which you can explore in the previous article available here. Feel free to check it out for additional information on trading strategies.
In this new episode, we will explore another exciting aspect of real-time trading. You will discover how to create real-time OHLC (Open, High, Low, Close) charts with Matplotlib, an essential skill for traders looking to simulate strategies under conditions close to reality.
Chapter 1: Setting the Stage
Before diving into the world of real-time OHLC plotting, let’s prepare the ground. We will explore the essential components and libraries you’ll need, including Matplotlib, NumPy, Pandas, and many others. We will also introduce the concept of timeframes and why it is crucial when plotting OHLC data.
import time
import uuid
import hashlib
import hmac
from datetime import datetime, timedelta
import requests
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from colorama import Fore
from scipy.signal import savgol_filter
from mplfinance.original_flavor import candlestick2_ohlc
import talib as ta
import warnings