MCPcopy Create free account
hub / github.com/QuantFans/quantdigger / CandleWindow

Class CandleWindow

quantdigger/widgets/mplotwidgets/widgets.py:228–314  ·  view source on GitHub ↗

画蜡烛线。

Source from the content-addressed store, hash-verified

226
227
228class CandleWindow(object):
229 """
230 画蜡烛线。
231
232 """
233 def __init__(self, name, data, wdlength, min_wdlength):
234 """
235 Create a slider from *valmin* to *valmax* in axes *ax*
236
237 """
238 #AxesWidget.__init__(self, ax)
239 self.name = name
240 self.wdlength = wdlength
241 self.min_wdlength = min_wdlength
242 self.voffset = 0
243
244 # 当前显示的范围。
245 #self.xmax = len(data)
246 #self.xmin = max(0, self.xmax-self.wdlength)
247 #self.ymax = np.max(data.high[self.xmin : self.xmax].values) + self.voffset
248 #self.ymin = np.min(data.low[self.xmin : self.xmax].values) - self.voffset
249
250 self.cnt = 0
251 self.observers = {}
252 self.data = data
253 self.main_plot = None
254
255 def set_parent(self, parent, ith_axes):
256 """docstring for init_widget"""
257 self.ax = parent.axes[ith_axes]
258 #ax.set_xlim((self.xmin, self.xmax))
259 #ax.set_ylim((self.ymin, self.ymax))
260 candles = Candles(None, self.data, self.name)
261 parent.register_plot(ith_axes, candles)
262 self.lines, self.rects = candles.plot(self.ax)
263 self.main_plot = candles
264 self.connect()
265
266
267 def on_slider(self, val, event):
268 #'''docstring for update(val)'''
269 pass
270 #val = int(val)
271 #self.xmax = val
272 #self.xmin = max(0, self.xmax-self.wdlength)
273 #self.ymax = np.max(self.data.high[val-self.wdlength : val].values) + self.voffset
274 #self.ymin = np.min(self.data.low[val-self.wdlength : val].values) - self.voffset
275
276 #self.ax.set_xlim((val-self.wdlength, val))
277 #self.ax.set_ylim((self.ymin, self.ymax))
278
279
280 def connect(self):
281 #self.ax.figure.canvas.mpl_connect('key_release_event', self.enter_axes)
282 pass
283
284
285 def _update(self, event):

Callers 2

k.pyFile · 0.85
tech.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected