Allocate pp config with new actory, drop old line update method

fsp_feeds
Tyler Goodlet 2021-07-24 16:09:42 -04:00
parent e8e9e20124
commit a2b61a67b5
1 changed files with 17 additions and 38 deletions

View File

@ -35,7 +35,7 @@ from ._editors import LineEditor, ArrowEditor
from ._lines import LevelLine from ._lines import LevelLine
from ._position import PositionTracker from ._position import PositionTracker
from ._window import MultiStatus from ._window import MultiStatus
from ._text_entry import LabeledTextInput from ._text_entry import FieldsForm, mk_form
log = get_logger(__name__) log = get_logger(__name__)
@ -83,7 +83,7 @@ class OrderMode:
arrows: ArrowEditor arrows: ArrowEditor
multistatus: MultiStatus multistatus: MultiStatus
pp: PositionTracker pp: PositionTracker
pp_config: LabeledTextInput pp_config: FieldsForm
name: str = 'order' name: str = 'order'
@ -95,43 +95,9 @@ class OrderMode:
_action: str = 'alert' _action: str = 'alert'
_exec_mode: str = 'dark' _exec_mode: str = 'dark'
_size: float = 100.0 _size: float = 100.0
_position: Dict[str, Any] = field(default_factory=dict)
# _position_line: dict = None
dialogs: dict[str, OrderDialog] = field(default_factory=dict) dialogs: dict[str, OrderDialog] = field(default_factory=dict)
# def on_position_update(
# self,
# size: float,
# price: float,
# ) -> None:
# line = self._position_line
# if line is None and size:
# # create and show a pp line
# line = self._position_line = position_line(
# self.chart,
# level=price,
# size=size,
# )
# line.show()
# elif line:
# if size != 0.0:
# line.set_level(price)
# line.update_labels({'size': size})
# line.show()
# else:
# # remove pp line from view
# line.delete()
# self._position_line = None
def uuid(self) -> str: def uuid(self) -> str:
return str(uuid.uuid4()) return str(uuid.uuid4())
@ -423,7 +389,15 @@ async def run_order_mode(
pp.hide() pp.hide()
# insert order mode config to left of mode label # insert order mode config to left of mode label
pp_config = LabeledTextInput(chart.linked.godwidget) pp_config = mk_form(
parent=chart.linked.godwidget,
fields={
'**$size**:': 5000,
'**divisor**:': 4,
# '**policy**:': 'uniform',
# '**type**:': 'live-buy',
},
)
sb = chart.window().statusBar() sb = chart.window().statusBar()
sb.insertPermanentWidget(0, pp_config) sb.insertPermanentWidget(0, pp_config)
pp_config.hide() pp_config.hide()
@ -479,7 +453,12 @@ async def run_order_mode(
done() done()
# start async input handling for chart's view # start async input handling for chart's view
async with chart._vb.open_async_input_handler(): async with (
chart._vb.open_async_input_handler(),
# TODO: config form handler nursery
):
# signal to top level symbol loading task we're ready # signal to top level symbol loading task we're ready
# to handle input since the ems connection is ready # to handle input since the ems connection is ready