Pass labels to form builder, toy with broadcast consumer task

fsp_feeds
Tyler Goodlet 2021-08-10 17:04:19 -04:00
parent a40205728f
commit 7295ceb51a
1 changed files with 29 additions and 19 deletions

View File

@ -344,9 +344,7 @@ class LinkedSplits(QWidget):
def focus(self) -> None: def focus(self) -> None:
if self.chart is not None: if self.chart is not None:
print("FOCUSSING CHART")
self.chart.focus() self.chart.focus()
# self.chart.parent().show()
def unfocus(self) -> None: def unfocus(self) -> None:
if self.chart is not None: if self.chart is not None:
@ -390,8 +388,8 @@ class LinkedSplits(QWidget):
# style? # style?
self.chart.setFrameStyle( self.chart.setFrameStyle(
QtWidgets.QFrame.StyledPanel | QFrame.StyledPanel |
QtWidgets.QFrame.Plain QFrame.Plain
) )
return self.chart return self.chart
@ -1064,7 +1062,7 @@ class ChartPlotWidget(pg.PlotWidget):
self.scene().leaveEvent(ev) self.scene().leaveEvent(ev)
_clear_throttle_rate: int = 35 # Hz _clear_throttle_rate: int = 60 # Hz
_book_throttle_rate: int = 16 # Hz _book_throttle_rate: int = 16 # Hz
@ -1394,14 +1392,14 @@ async def run_fsp(
parent=linkedsplits.godwidget, parent=linkedsplits.godwidget,
fields_schema={ fields_schema={
'name': { 'name': {
'key': '**fsp**:', 'label': '**fsp**:',
'type': 'select', 'type': 'select',
'default_value': [ 'default_value': [
f'{display_name}' f'{display_name}'
], ],
}, },
'period': { 'period': {
'key': '**period**:', 'label': '**period**:',
'type': 'edit', 'type': 'edit',
'default_value': 14, 'default_value': 14,
}, },
@ -1637,8 +1635,7 @@ async def display_symbol_data(
# ) # )
async with( async with(
data.feed.open_feed(
data.open_feed(
provider, provider,
[sym], [sym],
loglevel=loglevel, loglevel=loglevel,
@ -1647,8 +1644,21 @@ async def display_symbol_data(
tick_throttle=_clear_throttle_rate, tick_throttle=_clear_throttle_rate,
) as feed, ) as feed,
trio.open_nursery() as n,
): ):
async def print_quotes():
async with feed.stream.subscribe() as bstream:
last_tick = time.time()
async for quotes in bstream:
now = time.time()
period = now - last_tick
for sym, quote in quotes.items():
ticks = quote.get('ticks', ())
if ticks:
print(f'{1/period} Hz')
last_tick = time.time()
n.start_soon(print_quotes)
ohlcv: ShmArray = feed.shm ohlcv: ShmArray = feed.shm
bars = ohlcv.array bars = ohlcv.array
@ -1829,6 +1839,8 @@ async def _async_main(
sbar = godwidget.window.status_bar sbar = godwidget.window.status_bar
starting_done = sbar.open_status('starting ze sexy chartz') starting_done = sbar.open_status('starting ze sexy chartz')
# generate order mode side-pane UI
async with ( async with (
trio.open_nursery() as root_n, trio.open_nursery() as root_n,
@ -1838,7 +1850,6 @@ async def _async_main(
parent=godwidget, parent=godwidget,
fields_schema={ fields_schema={
'account': { 'account': {
'key': '**account**:',
'type': 'select', 'type': 'select',
'default_value': [ 'default_value': [
'paper', 'paper',
@ -1846,8 +1857,8 @@ async def _async_main(
# 'ib.paper', # 'ib.paper',
], ],
}, },
'allocator': { 'size_unit': {
'key': '**allocate**:', 'label': '**allocate**:',
'type': 'select', 'type': 'select',
'default_value': [ 'default_value': [
'$ size', '$ size',
@ -1855,18 +1866,17 @@ async def _async_main(
'# shares' '# shares'
], ],
}, },
'disti_policy': { 'disti_weight': {
'key': '**weight**:', 'label': '**weight**:',
'type': 'select', 'type': 'select',
'default_value': ['uniform'], 'default_value': ['uniform'],
}, },
'dollar_size': { 'size': {
'key': '**$size**:', 'label': '**size**:',
'type': 'edit', 'type': 'edit',
'default_value': '5k', 'default_value': 5000,
}, },
'slots': { 'slots': {
'key': '**slots**:',
'type': 'edit', 'type': 'edit',
'default_value': 4, 'default_value': 4,
}, },