diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index aca62fe0..24362456 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -1554,13 +1554,19 @@ async def display_symbol_data( ''' sbar = godwidget.window.status_bar loading_sym_key = sbar.open_status( - f'loading {sym}.{provider} -> ', + f'loading {sym}.{provider} ->', group_key=True ) # historical data fetch brokermod = brokers.get_brokermod(provider) + # ohlc_status_done = sbar.open_status( + # 'retreiving OHLC history.. ', + # clear_on_next=True, + # group_key=loading_sym_key, + # ) + async with( data.open_feed( diff --git a/piker/ui/_editors.py b/piker/ui/_editors.py index a3b36b7c..17b39b5d 100644 --- a/piker/ui/_editors.py +++ b/piker/ui/_editors.py @@ -86,22 +86,14 @@ class ArrowEditor: self.chart.plotItem.removeItem(arrow) -# global store of order-lines graphics -# keyed by uuid4 strs - used to sync draw -# order lines **after** the order is 100% -# active in emsd -_order_lines: dict[str, LevelLine] = {} - - @dataclass class LineEditor: '''The great editor of linez. ''' - _order_lines: field(default_factory=_order_lines) chart: 'ChartPlotWidget' = None # type: ignore # noqa + _order_lines: dict[str, LevelLine] = field(default_factory=dict) _active_staged_line: LevelLine = None - _stage_line: LevelLine = None def stage_line( self, @@ -128,8 +120,6 @@ class LineEditor: symbol = chart._lc.symbol - # line = self._stage_line - # if not line: # add a "staged" cursor-tracking line to view # and cash it in a a var if self._active_staged_line: diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index f4e58329..a4e55862 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -30,7 +30,7 @@ from pydantic import BaseModel import trio from ._graphics._lines import LevelLine, position_line -from ._editors import LineEditor, ArrowEditor, _order_lines +from ._editors import LineEditor, ArrowEditor from ._window import MultiStatus, main_window from ..clearing._client import open_ems, OrderBook from ..data._source import Symbol @@ -54,6 +54,8 @@ class OrderMode: This is the default mode that pairs with "follow mode" (when wathing the rt price update at the current time step) and allows entering orders using mouse and keyboard. + This object is chart oriented, so there is an instance per + chart / view currently. Current manual: a -> alert @@ -70,6 +72,7 @@ class OrderMode: lines: LineEditor arrows: ArrowEditor status_bar: MultiStatus + name: str = 'order' _colors = { 'alert': 'alert_yellow', @@ -290,6 +293,9 @@ class OrderMode: ) def cancel_all_orders(self) -> list[str]: + '''Cancel all orders for the current chart. + + ''' return self.cancel_orders_from_lines( self.lines.all_lines() ) @@ -355,7 +361,7 @@ async def open_order_mode( ): status_bar: MultiStatus = main_window().status_bar view = chart._vb - lines = LineEditor(chart=chart, _order_lines=_order_lines) + lines = LineEditor(chart=chart) arrows = ArrowEditor(chart, {}) log.info("Opening order mode") @@ -400,7 +406,7 @@ async def start_order_mode( - begin order handling loop ''' - done = chart.window().status_bar.open_status('Starting order mode...') + done = chart.window().status_bar.open_status('starting order mode..') # spawn EMS actor-service async with (