Use through lot digits, drop YSticky
parent
bf66eb0b3d
commit
890f932400
|
@ -32,6 +32,7 @@ import trio
|
||||||
from ._axes import (
|
from ._axes import (
|
||||||
DynamicDateAxis,
|
DynamicDateAxis,
|
||||||
PriceAxis,
|
PriceAxis,
|
||||||
|
YAxisLabel,
|
||||||
)
|
)
|
||||||
from ._graphics._cursor import (
|
from ._graphics._cursor import (
|
||||||
Cursor,
|
Cursor,
|
||||||
|
@ -43,7 +44,6 @@ from ._graphics._lines import (
|
||||||
)
|
)
|
||||||
from ._graphics._ohlc import BarItems
|
from ._graphics._ohlc import BarItems
|
||||||
from ._graphics._curve import FastAppendCurve
|
from ._graphics._curve import FastAppendCurve
|
||||||
from ._axes import YSticky
|
|
||||||
from ._style import (
|
from ._style import (
|
||||||
_font,
|
_font,
|
||||||
hcolor,
|
hcolor,
|
||||||
|
@ -647,14 +647,22 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
bg_color='bracket',
|
bg_color='bracket',
|
||||||
# retreive: Callable[None, np.ndarray],
|
) -> YAxisLabel:
|
||||||
) -> YSticky:
|
|
||||||
|
# if the sticky is for our symbol
|
||||||
|
# use the tick size precision for display
|
||||||
|
sym = self._lc.symbol
|
||||||
|
if name == sym.key:
|
||||||
|
digits = sym.digits()
|
||||||
|
else:
|
||||||
|
digits = 2
|
||||||
|
|
||||||
# add y-axis "last" value label
|
# add y-axis "last" value label
|
||||||
last = self._ysticks[name] = YSticky(
|
last = self._ysticks[name] = YAxisLabel(
|
||||||
chart=self,
|
chart=self,
|
||||||
parent=self.getAxis('right'),
|
parent=self.getAxis('right'),
|
||||||
# TODO: pass this from symbol data
|
# TODO: pass this from symbol data
|
||||||
digits=self._lc.symbol.digits(),
|
digits=digits,
|
||||||
opacity=1,
|
opacity=1,
|
||||||
bg_color=bg_color,
|
bg_color=bg_color,
|
||||||
)
|
)
|
||||||
|
@ -1096,11 +1104,13 @@ async def chart_from_quotes(
|
||||||
|
|
||||||
last, volume = ohlcv.array[-1][['close', 'volume']]
|
last, volume = ohlcv.array[-1][['close', 'volume']]
|
||||||
|
|
||||||
|
symbol = chart._lc.symbol
|
||||||
|
|
||||||
l1 = L1Labels(
|
l1 = L1Labels(
|
||||||
chart,
|
chart,
|
||||||
# determine precision/decimal lengths
|
# determine precision/decimal lengths
|
||||||
digits=max(float_digits(last), 2),
|
digits=symbol.digits(),
|
||||||
size_digits=min(float_digits(last), 3)
|
size_digits=symbol.lot_digits(),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
|
|
Loading…
Reference in New Issue