我有一个烛台对象的列表,每个对象有6个值(开、高、低、关闭、体积、时间戳)。我想用matplotlib.finance.candlestick2_ohlc(ax,opens,high,lows,closes,width=4,colorup='k',colordown='r',alpha=0.75)函数来绘制此数据。问题是,如何将我的列表细分为开盘、涨停、低开和收盘,以便将其加载到这个函数中?在
这是我的烛台课:class Candle:
#Candlestick chart object
def __init__(self, open, high, low, close, volume, timeStamp):
self.open = open
self.high = high
self.low = low
self.close = close
self.volume = volume
self.timestamp = timeStamp
def __str__(self):
return """
Open: %s
High: %s
Low: %s
Close: %s
Volume : %s
Timestamp: %s""" %(self.open, self.high, self.low, self.close, self.volume, self.timestamp)
我的施工方法如下:
^{pr2}$