Rename fqsn -> fqme in ui mods
parent
c93d119873
commit
31a00eca94
|
@ -104,14 +104,14 @@ async def fsp_compute(
|
||||||
disabled=True
|
disabled=True
|
||||||
)
|
)
|
||||||
|
|
||||||
fqsn = symbol.fqme
|
fqme = symbol.fqme
|
||||||
out_stream = func(
|
out_stream = func(
|
||||||
|
|
||||||
# TODO: do we even need this if we do the feed api right?
|
# TODO: do we even need this if we do the feed api right?
|
||||||
# shouldn't a local stream do this before we get a handle
|
# shouldn't a local stream do this before we get a handle
|
||||||
# to the async iterable? it's that or we do some kinda
|
# to the async iterable? it's that or we do some kinda
|
||||||
# async itertools style?
|
# async itertools style?
|
||||||
filter_quotes_by_sym(fqsn, quote_stream),
|
filter_quotes_by_sym(fqme, quote_stream),
|
||||||
|
|
||||||
# XXX: currently the ``ohlcv`` arg
|
# XXX: currently the ``ohlcv`` arg
|
||||||
flume.rt_shm,
|
flume.rt_shm,
|
||||||
|
@ -271,7 +271,7 @@ async def cascade(
|
||||||
ctx: tractor.Context,
|
ctx: tractor.Context,
|
||||||
|
|
||||||
# data feed key
|
# data feed key
|
||||||
fqsn: str,
|
fqme: str,
|
||||||
|
|
||||||
src_shm_token: dict,
|
src_shm_token: dict,
|
||||||
dst_shm_token: tuple[str, np.dtype],
|
dst_shm_token: tuple[str, np.dtype],
|
||||||
|
@ -329,7 +329,7 @@ async def cascade(
|
||||||
# open a data feed stream with requested broker
|
# open a data feed stream with requested broker
|
||||||
feed: Feed
|
feed: Feed
|
||||||
async with data.feed.maybe_open_feed(
|
async with data.feed.maybe_open_feed(
|
||||||
[fqsn],
|
[fqme],
|
||||||
|
|
||||||
# TODO throttle tick outputs from *this* daemon since
|
# TODO throttle tick outputs from *this* daemon since
|
||||||
# it'll emit tons of ticks due to the throttle only
|
# it'll emit tons of ticks due to the throttle only
|
||||||
|
@ -339,7 +339,7 @@ async def cascade(
|
||||||
|
|
||||||
) as feed:
|
) as feed:
|
||||||
|
|
||||||
flume = feed.flumes[fqsn]
|
flume = feed.flumes[fqme]
|
||||||
symbol = flume.symbol
|
symbol = flume.symbol
|
||||||
assert src.token == flume.rt_shm.token
|
assert src.token == flume.rt_shm.token
|
||||||
profiler(f'{func}: feed up')
|
profiler(f'{func}: feed up')
|
||||||
|
|
|
@ -100,8 +100,8 @@ async def _async_main(
|
||||||
starting_done = sbar.open_status('starting ze sexy chartz')
|
starting_done = sbar.open_status('starting ze sexy chartz')
|
||||||
|
|
||||||
needed_brokermods: dict[str, ModuleType] = {}
|
needed_brokermods: dict[str, ModuleType] = {}
|
||||||
for fqsn in syms:
|
for fqme in syms:
|
||||||
brokername, *_ = unpack_fqme(fqsn)
|
brokername, *_ = unpack_fqme(fqme)
|
||||||
needed_brokermods[brokername] = brokers[brokername]
|
needed_brokermods[brokername] = brokers[brokername]
|
||||||
|
|
||||||
async with (
|
async with (
|
||||||
|
@ -120,7 +120,7 @@ async def _async_main(
|
||||||
|
|
||||||
# this internally starts a ``display_symbol_data()`` task above
|
# this internally starts a ``display_symbol_data()`` task above
|
||||||
order_mode_ready = await godwidget.load_symbols(
|
order_mode_ready = await godwidget.load_symbols(
|
||||||
fqsns=syms,
|
fqmes=syms,
|
||||||
loglevel=loglevel,
|
loglevel=loglevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ class GodWidget(QWidget):
|
||||||
|
|
||||||
def set_chart_symbols(
|
def set_chart_symbols(
|
||||||
self,
|
self,
|
||||||
group_key: tuple[str], # of form <fqsn>.<providername>
|
group_key: tuple[str], # of form <fqme>.<providername>
|
||||||
all_linked: tuple[LinkedSplits, LinkedSplits], # type: ignore
|
all_linked: tuple[LinkedSplits, LinkedSplits], # type: ignore
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -170,7 +170,7 @@ class GodWidget(QWidget):
|
||||||
|
|
||||||
async def load_symbols(
|
async def load_symbols(
|
||||||
self,
|
self,
|
||||||
fqsns: list[str],
|
fqmes: list[str],
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
reset: bool = False,
|
reset: bool = False,
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class GodWidget(QWidget):
|
||||||
'''
|
'''
|
||||||
# NOTE: for now we use the first symbol in the set as the "key"
|
# NOTE: for now we use the first symbol in the set as the "key"
|
||||||
# for the overlay of feeds on the chart.
|
# for the overlay of feeds on the chart.
|
||||||
group_key: tuple[str] = tuple(fqsns)
|
group_key: tuple[str] = tuple(fqmes)
|
||||||
|
|
||||||
all_linked = self.get_chart_symbols(group_key)
|
all_linked = self.get_chart_symbols(group_key)
|
||||||
order_mode_started = trio.Event()
|
order_mode_started = trio.Event()
|
||||||
|
@ -217,7 +217,7 @@ class GodWidget(QWidget):
|
||||||
self._root_n.start_soon(
|
self._root_n.start_soon(
|
||||||
display_symbol_data,
|
display_symbol_data,
|
||||||
self,
|
self,
|
||||||
fqsns,
|
fqmes,
|
||||||
loglevel,
|
loglevel,
|
||||||
order_mode_started,
|
order_mode_started,
|
||||||
)
|
)
|
||||||
|
@ -548,7 +548,7 @@ class LinkedSplits(QWidget):
|
||||||
# be no distinction since we will have multiple symbols per
|
# be no distinction since we will have multiple symbols per
|
||||||
# view as part of "aggregate feeds".
|
# view as part of "aggregate feeds".
|
||||||
self.chart = self.add_plot(
|
self.chart = self.add_plot(
|
||||||
name=symbol.fqsn,
|
name=symbol.fqme,
|
||||||
shm=shm,
|
shm=shm,
|
||||||
flume=flume,
|
flume=flume,
|
||||||
style=style,
|
style=style,
|
||||||
|
|
|
@ -1249,7 +1249,7 @@ class Viz(Struct):
|
||||||
i_step = lasts['index'] # last index-specific step.
|
i_step = lasts['index'] # last index-specific step.
|
||||||
i_step_t = lasts['time'] # last time step.
|
i_step_t = lasts['time'] # last time step.
|
||||||
|
|
||||||
# fqsn = self.flume.symbol.fqsn
|
# fqme = self.flume.symbol.fqme
|
||||||
|
|
||||||
# check if "last (is) in view" -> is a real-time update necessary?
|
# check if "last (is) in view" -> is a real-time update necessary?
|
||||||
if self.index_field == 'index':
|
if self.index_field == 'index':
|
||||||
|
@ -1304,7 +1304,7 @@ class Viz(Struct):
|
||||||
varz['i_last_append'] = i_step
|
varz['i_last_append'] = i_step
|
||||||
|
|
||||||
# print(
|
# print(
|
||||||
# f'DOING APPEND => {fqsn}\n'
|
# f'DOING APPEND => {fqme}\n'
|
||||||
# f'i_step: {i_step}\n'
|
# f'i_step: {i_step}\n'
|
||||||
# f'i_step_t: {i_step_t}\n'
|
# f'i_step_t: {i_step_t}\n'
|
||||||
# f'glast: {glast}\n'
|
# f'glast: {glast}\n'
|
||||||
|
|
|
@ -163,7 +163,7 @@ class DisplayState(Struct):
|
||||||
Chart-local real-time graphics state container.
|
Chart-local real-time graphics state container.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
fqsn: str
|
fqme: str
|
||||||
godwidget: GodWidget
|
godwidget: GodWidget
|
||||||
quotes: dict[str, Any]
|
quotes: dict[str, Any]
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ async def increment_history_view(
|
||||||
async for msg in istream:
|
async for msg in istream:
|
||||||
|
|
||||||
profiler = Profiler(
|
profiler = Profiler(
|
||||||
msg=f'History chart cycle for: `{ds.fqsn}`',
|
msg=f'History chart cycle for: `{ds.fqme}`',
|
||||||
delayed=True,
|
delayed=True,
|
||||||
disabled=not pg_profile_enabled(),
|
disabled=not pg_profile_enabled(),
|
||||||
ms_threshold=ms_slower_then,
|
ms_threshold=ms_slower_then,
|
||||||
|
@ -232,7 +232,7 @@ async def increment_history_view(
|
||||||
|
|
||||||
# l3 = ds.viz.shm.array[-3:]
|
# l3 = ds.viz.shm.array[-3:]
|
||||||
# print(
|
# print(
|
||||||
# f'fast step for {ds.flume.symbol.fqsn}:\n'
|
# f'fast step for {ds.flume.symbol.fqme}:\n'
|
||||||
# f'{list(l3["time"])}\n'
|
# f'{list(l3["time"])}\n'
|
||||||
# f'{l3}\n'
|
# f'{l3}\n'
|
||||||
# )
|
# )
|
||||||
|
@ -317,17 +317,17 @@ async def graphics_update_loop(
|
||||||
|
|
||||||
dss: dict[str, DisplayState] = {}
|
dss: dict[str, DisplayState] = {}
|
||||||
|
|
||||||
for fqsn, flume in feed.flumes.items():
|
for fqme, flume in feed.flumes.items():
|
||||||
ohlcv = flume.rt_shm
|
ohlcv = flume.rt_shm
|
||||||
hist_ohlcv = flume.hist_shm
|
hist_ohlcv = flume.hist_shm
|
||||||
symbol = flume.symbol
|
symbol = flume.symbol
|
||||||
fqsn = symbol.fqsn
|
fqme = symbol.fqme
|
||||||
|
|
||||||
# update last price sticky
|
# update last price sticky
|
||||||
fast_viz = fast_chart._vizs[fqsn]
|
fast_viz = fast_chart._vizs[fqme]
|
||||||
index_field = fast_viz.index_field
|
index_field = fast_viz.index_field
|
||||||
fast_pi = fast_viz.plot
|
fast_pi = fast_viz.plot
|
||||||
last_price_sticky = fast_pi.getAxis('right')._stickies[fqsn]
|
last_price_sticky = fast_pi.getAxis('right')._stickies[fqme]
|
||||||
last_price_sticky.update_from_data(
|
last_price_sticky.update_from_data(
|
||||||
*ohlcv.array[-1][[
|
*ohlcv.array[-1][[
|
||||||
index_field,
|
index_field,
|
||||||
|
@ -336,9 +336,9 @@ async def graphics_update_loop(
|
||||||
)
|
)
|
||||||
last_price_sticky.show()
|
last_price_sticky.show()
|
||||||
|
|
||||||
hist_viz = hist_chart._vizs[fqsn]
|
hist_viz = hist_chart._vizs[fqme]
|
||||||
slow_pi = hist_viz.plot
|
slow_pi = hist_viz.plot
|
||||||
hist_last_price_sticky = slow_pi.getAxis('right')._stickies[fqsn]
|
hist_last_price_sticky = slow_pi.getAxis('right')._stickies[fqme]
|
||||||
hist_last_price_sticky.update_from_data(
|
hist_last_price_sticky.update_from_data(
|
||||||
*hist_ohlcv.array[-1][[
|
*hist_ohlcv.array[-1][[
|
||||||
index_field,
|
index_field,
|
||||||
|
@ -346,7 +346,7 @@ async def graphics_update_loop(
|
||||||
]]
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
vlm_chart = vlm_charts[fqsn]
|
vlm_chart = vlm_charts[fqme]
|
||||||
vlm_viz = vlm_chart._vizs.get('volume') if vlm_chart else None
|
vlm_viz = vlm_chart._vizs.get('volume') if vlm_chart else None
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -381,8 +381,8 @@ async def graphics_update_loop(
|
||||||
fast_chart.show()
|
fast_chart.show()
|
||||||
last_quote_s = time.time()
|
last_quote_s = time.time()
|
||||||
|
|
||||||
dss[fqsn] = ds = linked.display_state = DisplayState(**{
|
dss[fqme] = ds = linked.display_state = DisplayState(**{
|
||||||
'fqsn': fqsn,
|
'fqme': fqme,
|
||||||
'godwidget': godwidget,
|
'godwidget': godwidget,
|
||||||
'quotes': {},
|
'quotes': {},
|
||||||
|
|
||||||
|
@ -454,11 +454,11 @@ async def graphics_update_loop(
|
||||||
|
|
||||||
last_quote_s = time.time()
|
last_quote_s = time.time()
|
||||||
|
|
||||||
for fqsn, quote in quotes.items():
|
for fqme, quote in quotes.items():
|
||||||
ds = dss[fqsn]
|
ds = dss[fqme]
|
||||||
ds.quotes = quote
|
ds.quotes = quote
|
||||||
|
|
||||||
rt_pi, hist_pi = pis[fqsn]
|
rt_pi, hist_pi = pis[fqme]
|
||||||
|
|
||||||
# chart isn't active/shown so skip render cycle and
|
# chart isn't active/shown so skip render cycle and
|
||||||
# pause feed(s)
|
# pause feed(s)
|
||||||
|
@ -466,14 +466,14 @@ async def graphics_update_loop(
|
||||||
fast_chart.linked.isHidden()
|
fast_chart.linked.isHidden()
|
||||||
or not rt_pi.isVisible()
|
or not rt_pi.isVisible()
|
||||||
):
|
):
|
||||||
print(f'{fqsn} skipping update for HIDDEN CHART')
|
print(f'{fqme} skipping update for HIDDEN CHART')
|
||||||
fast_chart.pause_all_feeds()
|
fast_chart.pause_all_feeds()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ic = fast_chart.view._in_interact
|
ic = fast_chart.view._in_interact
|
||||||
if ic:
|
if ic:
|
||||||
fast_chart.pause_all_feeds()
|
fast_chart.pause_all_feeds()
|
||||||
print(f'{fqsn} PAUSING DURING INTERACTION')
|
print(f'{fqme} PAUSING DURING INTERACTION')
|
||||||
await ic.wait()
|
await ic.wait()
|
||||||
fast_chart.resume_all_feeds()
|
fast_chart.resume_all_feeds()
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ def graphics_update_cycle(
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
profiler = Profiler(
|
profiler = Profiler(
|
||||||
msg=f'Graphics loop cycle for: `{ds.fqsn}`',
|
msg=f'Graphics loop cycle for: `{ds.fqme}`',
|
||||||
disabled=not pg_profile_enabled(),
|
disabled=not pg_profile_enabled(),
|
||||||
ms_threshold=ms_slower_then,
|
ms_threshold=ms_slower_then,
|
||||||
delayed=True,
|
delayed=True,
|
||||||
|
@ -509,7 +509,7 @@ def graphics_update_cycle(
|
||||||
# - use a streaming minmax algo and drop the use of the
|
# - use a streaming minmax algo and drop the use of the
|
||||||
# state-tracking ``multi_maxmin()`` routine from above?
|
# state-tracking ``multi_maxmin()`` routine from above?
|
||||||
|
|
||||||
fqsn = ds.fqsn
|
fqme = ds.fqme
|
||||||
chart = ds.chart
|
chart = ds.chart
|
||||||
vlm_chart = ds.vlm_chart
|
vlm_chart = ds.vlm_chart
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ def graphics_update_cycle(
|
||||||
# the true range? This way you can slap in orders outside the
|
# the true range? This way you can slap in orders outside the
|
||||||
# current L1 (only) book range.
|
# current L1 (only) book range.
|
||||||
main_vb: ChartView = main_viz.plot.vb
|
main_vb: ChartView = main_viz.plot.vb
|
||||||
this_viz: Viz = chart._vizs[fqsn]
|
this_viz: Viz = chart._vizs[fqme]
|
||||||
this_vb: ChartView = this_viz.plot.vb
|
this_vb: ChartView = this_viz.plot.vb
|
||||||
this_yr = this_vb._yrange
|
this_yr = this_vb._yrange
|
||||||
if this_yr:
|
if this_yr:
|
||||||
|
@ -600,7 +600,7 @@ def graphics_update_cycle(
|
||||||
profiler,
|
profiler,
|
||||||
)
|
)
|
||||||
|
|
||||||
profiler(f'{fqsn} `multi_maxmin()` call')
|
profiler(f'{fqme} `multi_maxmin()` call')
|
||||||
|
|
||||||
# iterate frames of ticks-by-type such that we only update graphics
|
# iterate frames of ticks-by-type such that we only update graphics
|
||||||
# using the last update per type where possible.
|
# using the last update per type where possible.
|
||||||
|
@ -828,7 +828,7 @@ def graphics_update_cycle(
|
||||||
|
|
||||||
# update any overlayed fsp flows
|
# update any overlayed fsp flows
|
||||||
if (
|
if (
|
||||||
curve_name != fqsn
|
curve_name != fqme
|
||||||
):
|
):
|
||||||
update_fsp_chart(
|
update_fsp_chart(
|
||||||
viz,
|
viz,
|
||||||
|
@ -939,7 +939,7 @@ def graphics_update_cycle(
|
||||||
liv and do_rt_update
|
liv and do_rt_update
|
||||||
or do_px_step
|
or do_px_step
|
||||||
)
|
)
|
||||||
and curve_name not in {fqsn}
|
and curve_name not in {fqme}
|
||||||
):
|
):
|
||||||
update_fsp_chart(
|
update_fsp_chart(
|
||||||
viz,
|
viz,
|
||||||
|
@ -1008,7 +1008,7 @@ async def link_views_with_region(
|
||||||
hist_pi.addItem(region, ignoreBounds=True)
|
hist_pi.addItem(region, ignoreBounds=True)
|
||||||
region.setOpacity(6/16)
|
region.setOpacity(6/16)
|
||||||
|
|
||||||
viz = rt_chart.get_viz(flume.symbol.fqsn)
|
viz = rt_chart.get_viz(flume.symbol.fqme)
|
||||||
assert viz
|
assert viz
|
||||||
index_field = viz.index_field
|
index_field = viz.index_field
|
||||||
|
|
||||||
|
@ -1035,7 +1035,7 @@ async def link_views_with_region(
|
||||||
# HFT/real-time chart.
|
# HFT/real-time chart.
|
||||||
rng = mn, mx = viewRange[0]
|
rng = mn, mx = viewRange[0]
|
||||||
|
|
||||||
# hist_viz = hist_chart.get_viz(flume.symbol.fqsn)
|
# hist_viz = hist_chart.get_viz(flume.symbol.fqme)
|
||||||
# hist = hist_viz.shm.array[-3:]
|
# hist = hist_viz.shm.array[-3:]
|
||||||
# print(
|
# print(
|
||||||
# f'mn: {mn}\n'
|
# f'mn: {mn}\n'
|
||||||
|
@ -1153,7 +1153,7 @@ _quote_throttle_rate: int = 60 - 6
|
||||||
|
|
||||||
async def display_symbol_data(
|
async def display_symbol_data(
|
||||||
godwidget: GodWidget,
|
godwidget: GodWidget,
|
||||||
fqsns: list[str],
|
fqmes: list[str],
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
order_mode_started: trio.Event,
|
order_mode_started: trio.Event,
|
||||||
|
|
||||||
|
@ -1176,9 +1176,9 @@ async def display_symbol_data(
|
||||||
# group_key=loading_sym_key,
|
# group_key=loading_sym_key,
|
||||||
# )
|
# )
|
||||||
|
|
||||||
for fqsn in fqsns:
|
for fqme in fqmes:
|
||||||
loading_sym_key = sbar.open_status(
|
loading_sym_key = sbar.open_status(
|
||||||
f'loading {fqsn} ->',
|
f'loading {fqme} ->',
|
||||||
group_key=True
|
group_key=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1197,7 +1197,7 @@ async def display_symbol_data(
|
||||||
# TODO: we should be able to increase this if we use some
|
# TODO: we should be able to increase this if we use some
|
||||||
# `mypyc` speedups elsewhere? 22ish seems to be the sweet
|
# `mypyc` speedups elsewhere? 22ish seems to be the sweet
|
||||||
# spot for single-feed chart.
|
# spot for single-feed chart.
|
||||||
num_of_feeds = len(fqsns)
|
num_of_feeds = len(fqmes)
|
||||||
mx: int = 22
|
mx: int = 22
|
||||||
if num_of_feeds > 1:
|
if num_of_feeds > 1:
|
||||||
# there will be more ctx switches with more than 1 feed so we
|
# there will be more ctx switches with more than 1 feed so we
|
||||||
|
@ -1213,18 +1213,18 @@ async def display_symbol_data(
|
||||||
|
|
||||||
feed: Feed
|
feed: Feed
|
||||||
async with open_feed(
|
async with open_feed(
|
||||||
fqsns,
|
fqmes,
|
||||||
loglevel=loglevel,
|
loglevel=loglevel,
|
||||||
tick_throttle=cycles_per_feed,
|
tick_throttle=cycles_per_feed,
|
||||||
|
|
||||||
) as feed:
|
) as feed:
|
||||||
|
|
||||||
# use expanded contract symbols passed back from feed layer.
|
# use expanded contract symbols passed back from feed layer.
|
||||||
fqsns = list(feed.flumes.keys())
|
fqmes = list(feed.flumes.keys())
|
||||||
# step_size_s = 1
|
# step_size_s = 1
|
||||||
# tf_key = tf_in_1s[step_size_s]
|
# tf_key = tf_in_1s[step_size_s]
|
||||||
godwidget.window.setWindowTitle(
|
godwidget.window.setWindowTitle(
|
||||||
f'{fqsns} '
|
f'{fqmes} '
|
||||||
# f'tick:{symbol.tick_size} '
|
# f'tick:{symbol.tick_size} '
|
||||||
# f'step:{tf_key} '
|
# f'step:{tf_key} '
|
||||||
)
|
)
|
||||||
|
@ -1276,7 +1276,7 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# for the "first"/selected symbol we create new chart widgets
|
# for the "first"/selected symbol we create new chart widgets
|
||||||
# and sub-charts for FSPs
|
# and sub-charts for FSPs
|
||||||
fqsn, flume = fitems[0]
|
fqme, flume = fitems[0]
|
||||||
|
|
||||||
# TODO NOTE: THIS CONTROLS WHAT SYMBOL IS USED FOR ORDER MODE
|
# TODO NOTE: THIS CONTROLS WHAT SYMBOL IS USED FOR ORDER MODE
|
||||||
# SUBMISSIONS, we need to make this switch based on selection.
|
# SUBMISSIONS, we need to make this switch based on selection.
|
||||||
|
@ -1287,7 +1287,7 @@ async def display_symbol_data(
|
||||||
hist_ohlcv: ShmArray = flume.hist_shm
|
hist_ohlcv: ShmArray = flume.hist_shm
|
||||||
|
|
||||||
symbol = flume.symbol
|
symbol = flume.symbol
|
||||||
fqsn = symbol.fqsn
|
fqme = symbol.fqme
|
||||||
|
|
||||||
hist_chart = hist_linked.plot_ohlc_main(
|
hist_chart = hist_linked.plot_ohlc_main(
|
||||||
symbol,
|
symbol,
|
||||||
|
@ -1304,9 +1304,9 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# ensure the last datum graphic is generated
|
# ensure the last datum graphic is generated
|
||||||
# for zoom-interaction purposes.
|
# for zoom-interaction purposes.
|
||||||
hist_viz = hist_chart.get_viz(fqsn)
|
hist_viz = hist_chart.get_viz(fqme)
|
||||||
hist_viz.draw_last(array_key=fqsn)
|
hist_viz.draw_last(array_key=fqme)
|
||||||
pis.setdefault(fqsn, [None, None])[1] = hist_chart.plotItem
|
pis.setdefault(fqme, [None, None])[1] = hist_chart.plotItem
|
||||||
|
|
||||||
# don't show when not focussed
|
# don't show when not focussed
|
||||||
hist_linked.cursor.always_show_xlabel = False
|
hist_linked.cursor.always_show_xlabel = False
|
||||||
|
@ -1322,8 +1322,8 @@ async def display_symbol_data(
|
||||||
'last_step_color': 'original',
|
'last_step_color': 'original',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rt_viz = rt_chart.get_viz(fqsn)
|
rt_viz = rt_chart.get_viz(fqme)
|
||||||
pis.setdefault(fqsn, [None, None])[0] = rt_chart.plotItem
|
pis.setdefault(fqme, [None, None])[0] = rt_chart.plotItem
|
||||||
|
|
||||||
# for pause/resume on mouse interaction
|
# for pause/resume on mouse interaction
|
||||||
rt_chart.feed = feed
|
rt_chart.feed = feed
|
||||||
|
@ -1338,7 +1338,7 @@ async def display_symbol_data(
|
||||||
has_vlm(ohlcv)
|
has_vlm(ohlcv)
|
||||||
and vlm_chart is None
|
and vlm_chart is None
|
||||||
):
|
):
|
||||||
vlm_chart = vlm_charts[fqsn] = await ln.start(
|
vlm_chart = vlm_charts[fqme] = await ln.start(
|
||||||
open_vlm_displays,
|
open_vlm_displays,
|
||||||
rt_linked,
|
rt_linked,
|
||||||
flume,
|
flume,
|
||||||
|
@ -1372,7 +1372,7 @@ async def display_symbol_data(
|
||||||
godwidget.resize_all()
|
godwidget.resize_all()
|
||||||
await trio.sleep(0)
|
await trio.sleep(0)
|
||||||
|
|
||||||
for fqsn, flume in fitems[1:]:
|
for fqme, flume in fitems[1:]:
|
||||||
# get a new color from the palette
|
# get a new color from the palette
|
||||||
bg_chart_color, bg_last_bar_color = next(palette)
|
bg_chart_color, bg_last_bar_color = next(palette)
|
||||||
|
|
||||||
|
@ -1380,18 +1380,18 @@ async def display_symbol_data(
|
||||||
hist_ohlcv: ShmArray = flume.hist_shm
|
hist_ohlcv: ShmArray = flume.hist_shm
|
||||||
|
|
||||||
symbol = flume.symbol
|
symbol = flume.symbol
|
||||||
fqsn = symbol.fqsn
|
fqme = symbol.fqme
|
||||||
|
|
||||||
hist_pi = hist_chart.overlay_plotitem(
|
hist_pi = hist_chart.overlay_plotitem(
|
||||||
name=fqsn,
|
name=fqme,
|
||||||
axis_title=fqsn,
|
axis_title=fqme,
|
||||||
)
|
)
|
||||||
|
|
||||||
hist_viz = hist_chart.draw_curve(
|
hist_viz = hist_chart.draw_curve(
|
||||||
fqsn,
|
fqme,
|
||||||
hist_ohlcv,
|
hist_ohlcv,
|
||||||
flume,
|
flume,
|
||||||
array_key=fqsn,
|
array_key=fqme,
|
||||||
overlay=hist_pi,
|
overlay=hist_pi,
|
||||||
pi=hist_pi,
|
pi=hist_pi,
|
||||||
is_ohlc=True,
|
is_ohlc=True,
|
||||||
|
@ -1402,26 +1402,26 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# ensure the last datum graphic is generated
|
# ensure the last datum graphic is generated
|
||||||
# for zoom-interaction purposes.
|
# for zoom-interaction purposes.
|
||||||
hist_viz.draw_last(array_key=fqsn)
|
hist_viz.draw_last(array_key=fqme)
|
||||||
|
|
||||||
# TODO: we need a better API to do this..
|
# TODO: we need a better API to do this..
|
||||||
# specially store ref to shm for lookup in display loop
|
# specially store ref to shm for lookup in display loop
|
||||||
# since only a placeholder of `None` is entered in
|
# since only a placeholder of `None` is entered in
|
||||||
# ``.draw_curve()``.
|
# ``.draw_curve()``.
|
||||||
hist_viz = hist_chart._vizs[fqsn]
|
hist_viz = hist_chart._vizs[fqme]
|
||||||
assert hist_viz.plot is hist_pi
|
assert hist_viz.plot is hist_pi
|
||||||
pis.setdefault(fqsn, [None, None])[1] = hist_pi
|
pis.setdefault(fqme, [None, None])[1] = hist_pi
|
||||||
|
|
||||||
rt_pi = rt_chart.overlay_plotitem(
|
rt_pi = rt_chart.overlay_plotitem(
|
||||||
name=fqsn,
|
name=fqme,
|
||||||
axis_title=fqsn,
|
axis_title=fqme,
|
||||||
)
|
)
|
||||||
|
|
||||||
rt_viz = rt_chart.draw_curve(
|
rt_viz = rt_chart.draw_curve(
|
||||||
fqsn,
|
fqme,
|
||||||
ohlcv,
|
ohlcv,
|
||||||
flume,
|
flume,
|
||||||
array_key=fqsn,
|
array_key=fqme,
|
||||||
overlay=rt_pi,
|
overlay=rt_pi,
|
||||||
pi=rt_pi,
|
pi=rt_pi,
|
||||||
is_ohlc=True,
|
is_ohlc=True,
|
||||||
|
@ -1434,9 +1434,9 @@ async def display_symbol_data(
|
||||||
# specially store ref to shm for lookup in display loop
|
# specially store ref to shm for lookup in display loop
|
||||||
# since only a placeholder of `None` is entered in
|
# since only a placeholder of `None` is entered in
|
||||||
# ``.draw_curve()``.
|
# ``.draw_curve()``.
|
||||||
rt_viz = rt_chart._vizs[fqsn]
|
rt_viz = rt_chart._vizs[fqme]
|
||||||
assert rt_viz.plot is rt_pi
|
assert rt_viz.plot is rt_pi
|
||||||
pis.setdefault(fqsn, [None, None])[0] = rt_pi
|
pis.setdefault(fqme, [None, None])[0] = rt_pi
|
||||||
|
|
||||||
rt_chart.setFocus()
|
rt_chart.setFocus()
|
||||||
|
|
||||||
|
@ -1452,7 +1452,7 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# greedily do a view range default and pane resizing
|
# greedily do a view range default and pane resizing
|
||||||
# on startup before loading the order-mode machinery.
|
# on startup before loading the order-mode machinery.
|
||||||
for fqsn, flume in feed.flumes.items():
|
for fqme, flume in feed.flumes.items():
|
||||||
|
|
||||||
# size view to data prior to order mode init
|
# size view to data prior to order mode init
|
||||||
rt_chart.main_viz.default_view(
|
rt_chart.main_viz.default_view(
|
||||||
|
@ -1495,7 +1495,7 @@ async def display_symbol_data(
|
||||||
)
|
)
|
||||||
|
|
||||||
# boot order-mode
|
# boot order-mode
|
||||||
order_ctl_fqme: str = fqsns[0]
|
order_ctl_fqme: str = fqmes[0]
|
||||||
mode: OrderMode
|
mode: OrderMode
|
||||||
async with (
|
async with (
|
||||||
open_order_mode(
|
open_order_mode(
|
||||||
|
@ -1522,7 +1522,7 @@ async def display_symbol_data(
|
||||||
hist_chart.main_viz.default_view(
|
hist_chart.main_viz.default_view(
|
||||||
do_min_bars=True,
|
do_min_bars=True,
|
||||||
)
|
)
|
||||||
hist_viz = hist_chart.get_viz(fqsn)
|
hist_viz = hist_chart.get_viz(fqme)
|
||||||
await trio.sleep(0)
|
await trio.sleep(0)
|
||||||
|
|
||||||
godwidget.resize_all()
|
godwidget.resize_all()
|
||||||
|
|
|
@ -398,7 +398,7 @@ class FspAdmin:
|
||||||
portal: tractor.Portal,
|
portal: tractor.Portal,
|
||||||
complete: trio.Event,
|
complete: trio.Event,
|
||||||
started: trio.Event,
|
started: trio.Event,
|
||||||
fqsn: str,
|
fqme: str,
|
||||||
dst_fsp_flume: Flume,
|
dst_fsp_flume: Flume,
|
||||||
conf: dict,
|
conf: dict,
|
||||||
target: Fsp,
|
target: Fsp,
|
||||||
|
@ -418,7 +418,7 @@ class FspAdmin:
|
||||||
cascade,
|
cascade,
|
||||||
|
|
||||||
# data feed key
|
# data feed key
|
||||||
fqsn=fqsn,
|
fqme=fqme,
|
||||||
|
|
||||||
# TODO: pass `Flume.to_msg()`s here?
|
# TODO: pass `Flume.to_msg()`s here?
|
||||||
# mems
|
# mems
|
||||||
|
@ -444,7 +444,7 @@ class FspAdmin:
|
||||||
|
|
||||||
# register output data
|
# register output data
|
||||||
self._registry[
|
self._registry[
|
||||||
(fqsn, ns_path)
|
(fqme, ns_path)
|
||||||
] = (
|
] = (
|
||||||
stream,
|
stream,
|
||||||
dst_fsp_flume.rt_shm,
|
dst_fsp_flume.rt_shm,
|
||||||
|
@ -484,11 +484,11 @@ class FspAdmin:
|
||||||
|
|
||||||
) -> (Flume, trio.Event):
|
) -> (Flume, trio.Event):
|
||||||
|
|
||||||
fqsn = self.flume.symbol.fqsn
|
fqme = self.flume.symbol.get_fqme(delim_char='')
|
||||||
|
|
||||||
# allocate an output shm array
|
# allocate an output shm array
|
||||||
key, dst_shm, opened = maybe_mk_fsp_shm(
|
key, dst_shm, opened = maybe_mk_fsp_shm(
|
||||||
fqsn,
|
fqme,
|
||||||
target=target,
|
target=target,
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
|
@ -519,7 +519,7 @@ class FspAdmin:
|
||||||
|
|
||||||
# if not opened:
|
# if not opened:
|
||||||
# raise RuntimeError(
|
# raise RuntimeError(
|
||||||
# f'Already started FSP `{fqsn}:{func_name}`'
|
# f'Already started FSP `{fqme}:{func_name}`'
|
||||||
# )
|
# )
|
||||||
|
|
||||||
complete = trio.Event()
|
complete = trio.Event()
|
||||||
|
@ -529,7 +529,7 @@ class FspAdmin:
|
||||||
portal,
|
portal,
|
||||||
complete,
|
complete,
|
||||||
started,
|
started,
|
||||||
fqsn,
|
fqme,
|
||||||
dst_fsp_flume,
|
dst_fsp_flume,
|
||||||
conf,
|
conf,
|
||||||
target,
|
target,
|
||||||
|
|
|
@ -125,7 +125,7 @@ async def update_pnl_from_feed(
|
||||||
|
|
||||||
# watch out for wrong quote msg-data if you muck
|
# watch out for wrong quote msg-data if you muck
|
||||||
# with backend feed subs code..
|
# with backend feed subs code..
|
||||||
# assert sym == quote['fqsn']
|
# assert sym == quote['fqme']
|
||||||
|
|
||||||
for tick in iterticks(quote, types):
|
for tick in iterticks(quote, types):
|
||||||
# print(f'{1/period} Hz')
|
# print(f'{1/period} Hz')
|
||||||
|
@ -417,7 +417,7 @@ class SettingsPane:
|
||||||
mode = self.order_mode
|
mode = self.order_mode
|
||||||
sym = mode.chart.linked.symbol
|
sym = mode.chart.linked.symbol
|
||||||
size = tracker.live_pp.size
|
size = tracker.live_pp.size
|
||||||
flume: Feed = mode.feed.flumes[sym.fqsn]
|
flume: Feed = mode.feed.flumes[sym.fqme]
|
||||||
pnl_value = 0
|
pnl_value = 0
|
||||||
|
|
||||||
if size:
|
if size:
|
||||||
|
@ -430,9 +430,9 @@ class SettingsPane:
|
||||||
|
|
||||||
# maybe start update task
|
# maybe start update task
|
||||||
global _pnl_tasks
|
global _pnl_tasks
|
||||||
fqsn = sym.fqme
|
fqme = sym.fqme
|
||||||
if fqsn not in _pnl_tasks:
|
if fqme not in _pnl_tasks:
|
||||||
_pnl_tasks[fqsn] = True
|
_pnl_tasks[fqme] = True
|
||||||
self.order_mode.nursery.start_soon(
|
self.order_mode.nursery.start_soon(
|
||||||
update_pnl_from_feed,
|
update_pnl_from_feed,
|
||||||
flume,
|
flume,
|
||||||
|
|
|
@ -639,10 +639,10 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
godw = self.godwidget
|
godw = self.godwidget
|
||||||
|
|
||||||
# first entry in the cache is the current symbol(s)
|
# first entry in the cache is the current symbol(s)
|
||||||
fqsns = set()
|
fqmes = set()
|
||||||
for multi_fqsns in list(godw._chart_cache):
|
for multi_fqmes in list(godw._chart_cache):
|
||||||
for fqsn in set(multi_fqsns):
|
for fqme in set(multi_fqmes):
|
||||||
fqsns.add(fqsn)
|
fqmes.add(fqme)
|
||||||
|
|
||||||
if keep_current_item_selected:
|
if keep_current_item_selected:
|
||||||
sel = self.view.selectionModel()
|
sel = self.view.selectionModel()
|
||||||
|
@ -650,7 +650,7 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
self.view.set_section_entries(
|
self.view.set_section_entries(
|
||||||
'cache',
|
'cache',
|
||||||
list(fqsns),
|
list(fqmes),
|
||||||
# remove all other completion results except for cache
|
# remove all other completion results except for cache
|
||||||
clear_all=only,
|
clear_all=only,
|
||||||
reverse=True,
|
reverse=True,
|
||||||
|
@ -722,18 +722,18 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
cidx, provider, symbol = value
|
cidx, provider, symbol = value
|
||||||
godw = self.godwidget
|
godw = self.godwidget
|
||||||
|
|
||||||
fqsn = f'{symbol}.{provider}'
|
fqme = f'{symbol}.{provider}'
|
||||||
log.info(f'Requesting symbol: {fqsn}')
|
log.info(f'Requesting symbol: {fqme}')
|
||||||
|
|
||||||
# assert provider in symbol
|
# assert provider in symbol
|
||||||
await godw.load_symbols(
|
await godw.load_symbols(
|
||||||
fqsns=[fqsn],
|
fqmes=[fqme],
|
||||||
loglevel='info',
|
loglevel='info',
|
||||||
)
|
)
|
||||||
|
|
||||||
# fully qualified symbol name (SNS i guess is what we're
|
# fully qualified symbol name (SNS i guess is what we're
|
||||||
# making?)
|
# making?)
|
||||||
fqsn = '.'.join([symbol, provider]).lower()
|
fqme = '.'.join([symbol, provider]).lower()
|
||||||
|
|
||||||
if clear_to_cache:
|
if clear_to_cache:
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
# LIFO order. this is normally only done internally by
|
# LIFO order. this is normally only done internally by
|
||||||
# the chart on new symbols being loaded into memory
|
# the chart on new symbols being loaded into memory
|
||||||
godw.set_chart_symbols(
|
godw.set_chart_symbols(
|
||||||
(fqsn,), (
|
(fqme,), (
|
||||||
godw.hist_linked,
|
godw.hist_linked,
|
||||||
godw.rt_linked,
|
godw.rt_linked,
|
||||||
)
|
)
|
||||||
|
@ -753,7 +753,7 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.bar.focus()
|
self.bar.focus()
|
||||||
return fqsn
|
return fqme
|
||||||
|
|
||||||
def space_dims(self) -> tuple[float, float]:
|
def space_dims(self) -> tuple[float, float]:
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -549,7 +549,7 @@ class OrderMode:
|
||||||
# XXX: seems to fail on certain types of races?
|
# XXX: seems to fail on certain types of races?
|
||||||
# assert len(lines) == 2
|
# assert len(lines) == 2
|
||||||
if lines:
|
if lines:
|
||||||
flume: Flume = self.feed.flumes[chart.linked.symbol.fqsn]
|
flume: Flume = self.feed.flumes[chart.linked.symbol.fqme]
|
||||||
_, _, ratio = flume.get_ds_info()
|
_, _, ratio = flume.get_ds_info()
|
||||||
|
|
||||||
for chart, shm in [
|
for chart, shm in [
|
||||||
|
@ -691,7 +691,7 @@ async def open_order_mode(
|
||||||
|
|
||||||
feed: Feed,
|
feed: Feed,
|
||||||
godw: GodWidget,
|
godw: GodWidget,
|
||||||
fqsn: str,
|
fqme: str,
|
||||||
started: trio.Event,
|
started: trio.Event,
|
||||||
loglevel: str = 'info'
|
loglevel: str = 'info'
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ async def open_order_mode(
|
||||||
# spawn EMS actor-service
|
# spawn EMS actor-service
|
||||||
async with (
|
async with (
|
||||||
open_ems(
|
open_ems(
|
||||||
fqsn,
|
fqme,
|
||||||
loglevel=loglevel,
|
loglevel=loglevel,
|
||||||
) as (
|
) as (
|
||||||
client,
|
client,
|
||||||
|
@ -734,7 +734,7 @@ async def open_order_mode(
|
||||||
trio.open_nursery() as tn,
|
trio.open_nursery() as tn,
|
||||||
|
|
||||||
):
|
):
|
||||||
log.info(f'Opening order mode for {fqsn}')
|
log.info(f'Opening order mode for {fqme}')
|
||||||
|
|
||||||
# annotations editors
|
# annotations editors
|
||||||
lines = LineEditor(godw=godw)
|
lines = LineEditor(godw=godw)
|
||||||
|
@ -1027,7 +1027,7 @@ async def process_trade_msg(
|
||||||
dialog: Dialog = mode.dialogs.get(oid)
|
dialog: Dialog = mode.dialogs.get(oid)
|
||||||
|
|
||||||
if dialog:
|
if dialog:
|
||||||
fqsn = dialog.symbol
|
fqme = dialog.symbol
|
||||||
|
|
||||||
match msg:
|
match msg:
|
||||||
case Status(
|
case Status(
|
||||||
|
@ -1050,16 +1050,16 @@ async def process_trade_msg(
|
||||||
assert msg.resp in ('open', 'dark_open'), f'Unknown msg: {msg}'
|
assert msg.resp in ('open', 'dark_open'), f'Unknown msg: {msg}'
|
||||||
|
|
||||||
sym = mode.chart.linked.symbol
|
sym = mode.chart.linked.symbol
|
||||||
fqsn = sym.fqme
|
fqme = sym.fqme
|
||||||
if (
|
if (
|
||||||
((order.symbol + f'.{msg.src}') == fqsn)
|
((order.symbol + f'.{msg.src}') == fqme)
|
||||||
|
|
||||||
# a existing dark order for the same symbol
|
# a existing dark order for the same symbol
|
||||||
or (
|
or (
|
||||||
order.symbol == fqsn
|
order.symbol == fqme
|
||||||
and (
|
and (
|
||||||
msg.src in ('dark', 'paperboi')
|
msg.src in ('dark', 'paperboi')
|
||||||
or (msg.src in fqsn)
|
or (msg.src in fqme)
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue