This code constructs a matplotlib figure, gets data using the get_data function from a webpage in the open, high, low, close format and appends these values to a list every five minutes using FuncAnimation which then updates a candlestick chart. However, the y axis values are not correct as they display only 1-7 and should be current S&P prices of around 2500. How to fix?
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick2_ohlc
import matplotlib.animation as animation
from matplotlib import style
from es_cme_quote import get_data
import numpy as np
style.use('ggplot')
fig=plt.figure()
ax= fig.add_subplot(111)
o_array=[]
h_array=[]
l_array=[]
c_array=[]
def update(dummy):
[O,H,L,C]=get_data()
def append_var(x,y):
y.append(x)
append_var(O[0],o_array)
append_var(H[0],h_array)
append_var(L[0],l_array)
append_var(C[0],c_array)
ax.clear()
candlestick2_ohlc(ax,o_array,h_array,l_array,c_array,
width=.8,colorup='g',colordown='r',alpha=1.0)
anime=animation.FuncAnimation(fig,update,interval=300000)
plt.show()