Handle vwap overlay with shm
parent
8a4528c006
commit
d4eb5ccca4
|
@ -379,7 +379,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
def update(index: int) -> None:
|
def update(index: int) -> None:
|
||||||
label.setText(
|
label.setText(
|
||||||
"{name}[{index}] -> O:{} H:{} L:{} C:{} V:{}".format(
|
"{name}[{index}] -> O:{} H:{} L:{} C:{} V:{}".format(
|
||||||
*self._array[index].item()[2:],
|
*self._array[index].item()[2:8],
|
||||||
name=name,
|
name=name,
|
||||||
index=index,
|
index=index,
|
||||||
)
|
)
|
||||||
|
@ -423,9 +423,6 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
self.addItem(curve)
|
self.addItem(curve)
|
||||||
|
|
||||||
# register overlay curve with name
|
# register overlay curve with name
|
||||||
if not self._graphics and name is None:
|
|
||||||
name = 'a_stupid_line_bby'
|
|
||||||
|
|
||||||
self._graphics[name] = curve
|
self._graphics[name] = curve
|
||||||
|
|
||||||
# XXX: How to stack labels vertically?
|
# XXX: How to stack labels vertically?
|
||||||
|
@ -485,6 +482,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
array: np.ndarray,
|
array: np.ndarray,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> pg.GraphicsObject:
|
) -> pg.GraphicsObject:
|
||||||
|
if name not in self._overlays:
|
||||||
self._array = array
|
self._array = array
|
||||||
|
|
||||||
graphics = self._graphics[name]
|
graphics = self._graphics[name]
|
||||||
|
@ -712,10 +710,7 @@ async def chart_from_quotes(
|
||||||
last_price_sticky.update_from_data(*last[['index', 'close']])
|
last_price_sticky.update_from_data(*last[['index', 'close']])
|
||||||
chart._set_yrange()
|
chart._set_yrange()
|
||||||
|
|
||||||
vwap = quote.get('vwap')
|
if vwap_in_history:
|
||||||
if vwap and vwap_in_history:
|
|
||||||
last['vwap'] = vwap
|
|
||||||
print(f"vwap: {quote['vwap']}")
|
|
||||||
# update vwap overlay line
|
# update vwap overlay line
|
||||||
chart.update_from_array('vwap', ohlcv.array['vwap'])
|
chart.update_from_array('vwap', ohlcv.array['vwap'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue