Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
34fac36
Add default YAxisLable.x_offset: int`
goodboy Nov 13, 2022
31af7a2
Add `Axis.add_sticky()` for creating axis labels
goodboy Nov 14, 2022
9217610
Simplify OHLC graphic color instance var name
goodboy Nov 14, 2022
00be100
Initial chart widget adjustments for agg feeds
goodboy Nov 14, 2022
a39c980
Allocate our internal `Axis` subtype in our `PlotItem` override
goodboy Nov 14, 2022
727c7ce
Adjust L1 labels to expect `.pi: PlotItem`
goodboy Nov 14, 2022
ae0f311
Pass plotitem to axis from cursor
goodboy Nov 14, 2022
36a81cb
Only add plot to cursor set if not an overlay
goodboy Nov 15, 2022
58b42d6
Passthrough fqsns list directly to `.load_symbols()`
goodboy Nov 14, 2022
d57bc6c
Adjust to using `PlotItem`s for axis sticky mgmt
goodboy Jan 31, 2023
6100bd1
Adjust search to handle multi-sym results
goodboy Nov 15, 2022
936a85a
Copy timestamps from source to FSP dest buffer
goodboy Nov 26, 2022
81cd0bd
Only update pnl label on quotes with an fqsn match
goodboy Nov 14, 2022
f245489
Drop the legacy `relayed_from` cruft from our view box
goodboy Nov 14, 2022
33249cf
Make graphics-update-loop multi-sym aware B)
goodboy Nov 15, 2022
f5cc310
Adjust FSP UI/mgmt apis to be `Flume` oriented
goodboy Nov 15, 2022
398c619
Drop tick frame builder loop for now
goodboy Nov 15, 2022
e42be4c
Make `PlotItemOverlay` add items inwards->out
goodboy Nov 16, 2022
386d635
Assign pnl calc output for use when debugging
goodboy Nov 16, 2022
d6bfe67
Define a single `ChartPlotWidget.feed: Feed` for pause/resume
goodboy Nov 16, 2022
b66a440
Factor setup loop, 1 FSP chain, colors, throttling
goodboy Nov 16, 2022
b2b3338
Brighter last OHLC graphics datum by default
goodboy Nov 16, 2022
113f468
Update/improve qt screen script
goodboy Nov 17, 2022
1cf9f63
Factor info print into func
goodboy Nov 17, 2022
6bbc5e9
Expect and update from by-type tick frames
goodboy Nov 17, 2022
28da5f6
Max out per symbol throttle @ 22Hz
goodboy Nov 22, 2022
b427ba5
Pass `Flume`s throughout FSP-ui and charting APIs
goodboy Nov 24, 2022
5a19da3
Adjust order mode to use `Flume.get_index()`
goodboy Nov 24, 2022
ba75825
Rename `Flow` -> `Viz`
goodboy Nov 24, 2022
e23bc74
Rename `.ui._flows.py` -> `.ui._render.py`
goodboy Nov 24, 2022
48f4482
Move `ui._compression`/`._pathops` to `.data` subpkg
goodboy Nov 24, 2022
dc07009
Go back to hard-coded index field
goodboy Nov 25, 2022
32df80a
`Order.symbol` is a `str`..
goodboy Nov 25, 2022
4712f6c
Add breakpoint on -ve range for now
goodboy Nov 28, 2022
e3e0a14
Make `Viz.slice_from_time()` take input array
goodboy Nov 28, 2022
5dcac70
Add `Viz.bars_range()` (moved from chart API)
goodboy Nov 28, 2022
39bf433
Pepper render routines with time-slice calls
goodboy Nov 28, 2022
f43b0e7
First attempt, field-index agnostic formatting
goodboy Nov 28, 2022
4919bf0
TOSQUASH: f3d757c2 (flow->viz)
goodboy Nov 28, 2022
a85791e
Simplify formatter update methodology
goodboy Nov 29, 2022
e0f33d3
Attempt to make `.default_view()` time-index ready
goodboy Nov 29, 2022
10a25c9
Facepalm: pass correct flume to each FSP chart group..
goodboy Nov 29, 2022
83753a2
TOSQUASH: 2dc706aa (.default_view w time)
goodboy Nov 29, 2022
102c94e
Expect `index_field: str` in all graphics objects
goodboy Nov 30, 2022
a3cdaec
Add `Viz.index_field: str`, pass to graphics objs
goodboy Nov 30, 2022
3964de2
Fix `.default_view()` to view-left-of-data
goodboy Nov 30, 2022
162b63f
TOSQUASH: f5dcf1dc (viz index field)
goodboy Nov 30, 2022
26fadd3
Call `Viz.bars_range()` from display loop
goodboy Nov 30, 2022
66ced33
Comment out bps for time indexing
goodboy Nov 30, 2022
00b9f5b
Don't disable non-enabled vlm chart y-autoranging
goodboy Nov 30, 2022
30616d3
Enable/disable vlm chart yranging (TO SQUASH)
goodboy Nov 30, 2022
34e3fcc
Explicitly enable chart widget yranging in display init
goodboy Nov 30, 2022
41e9b1d
Drop diff state tracking in formatter
goodboy Nov 30, 2022
c5e46c4
Move path ops routines to top of mod
goodboy Nov 30, 2022
3a0060b
Move old label sizing cruft to label mod
goodboy Nov 30, 2022
173b983
Fix from-time index slicing?
goodboy Nov 30, 2022
8311407
Look up "index field" in display cycles
goodboy Nov 30, 2022
58812be
Rename `.ui._pathops.py` -> `.ui._formatters.py
goodboy Nov 30, 2022
563e7ab
Move qpath-ops routines back to separate mod
goodboy Nov 30, 2022
c11ceed
Move (unused) path gen routines to `.ui._pathops`
goodboy Dec 1, 2022
fc4dc7d
Go with explicit `.data._m4` mod name
goodboy Dec 1, 2022
2506e1e
Facepalm: actually return latest index on time slice fail..
goodboy Dec 1, 2022
9d417c3
TOSQUASH: 552a8c298cd (return index for arrow..)
goodboy Dec 1, 2022
f90b966
Facepalm: put graphics cycle in `do_ds: bool` block..
goodboy Dec 2, 2022
261edc2
Markup OHLC->path gen with `numba` issue #
goodboy Dec 2, 2022
981176a
Facepalm**2: fix array-read-slice, like actually..
goodboy Dec 2, 2022
24d361d
Delegate formatter `.index_field` to the parent `Viz`
goodboy Dec 3, 2022
cbd5c94
Drop `index_field` input to renders, add `.read()` profiling
goodboy Dec 3, 2022
0227cb6
Move `Flume.slice_from_time()` to `.data._pathops` mod func
goodboy Dec 3, 2022
da2ce81
Use step size to determine last datum bar gap
goodboy Dec 3, 2022
4546094
Use step size to determine bar gaps
goodboy Dec 3, 2022
4cd7f37
Use index (time) step to calc OHLC bar/line uppx threshold
goodboy Dec 3, 2022
56ac86d
Rewrite `slice_from_time()` using `numba`
goodboy Dec 3, 2022
3f647e8
Adjust all `slice_from_time()` calls to not expect mask
goodboy Dec 3, 2022
2eee2e9
Flip over to epoch-time based x-domain indexing
goodboy Dec 4, 2022
0284186
Make `.default_view()` time step aware
goodboy Dec 5, 2022
ff38021
Use uniform step arithmetic in `slice_from_time()`
goodboy Dec 6, 2022
146690a
Drop `_slice_from_time()`
goodboy Dec 6, 2022
654de12
Drop old breakpoint
goodboy Dec 6, 2022
b9b5ac7
Drop `Flume.view_data()`
goodboy Dec 6, 2022
3f82a1a
Add `.x_last()` meth to flow graphics
goodboy Dec 7, 2022
1a0a9af
Add gap detection for `stop_t`, though only report atm
goodboy Dec 7, 2022
b0a0c17
Re-implement `.default_view()` on `Viz`
goodboy Dec 7, 2022
79e2655
Delegate to `Viz.default_view()` on chart
goodboy Dec 7, 2022
4853e55
Use `Curve.x_last()` for zoom focal point
goodboy Dec 7, 2022
a4476de
Draw last datums on boot
goodboy Dec 7, 2022
ac20f97
Implement `stop_t` gap adjustments; the good lord said it is the problem
goodboy Dec 8, 2022
65fac9b
Block out `do_print` stuff inside `Viz.maxmin()`
goodboy Dec 8, 2022
167e758
Add back `.default_view()` slice logic for `int` indexing
goodboy Dec 8, 2022
9466d1e
Drop passing `render_data` to `Curve.draw_last_datum()`
goodboy Dec 8, 2022
920e992
Slicec to an extra index around each timestamp input
goodboy Dec 8, 2022
67e4511
Add some commented debug prints for default fmtr
goodboy Dec 8, 2022
7ce28c5
Restore coord-cache resetting
goodboy Dec 8, 2022
cd313e4
Handle time-indexing for fill arrows
goodboy Dec 9, 2022
721256d
Fix formatter xy ndarray first prepend case
goodboy Dec 13, 2022
919fc02
Right, do index lookup for int-index as well..
goodboy Dec 13, 2022
d6b2fd3
Drop unused `read_src_from_key: bool` to `.format_to_1d()`
goodboy Dec 13, 2022
d6d8f27
Fix line -> bars on 6x UPPX
goodboy Dec 14, 2022
9c3d59d
Move `Viz` layer to new `.ui` mod
goodboy Dec 14, 2022
5263ab8
Move `DisplayState.incr_info()` -> `Viz`
goodboy Dec 14, 2022
aee46fc
Add global `i_step` per overlay to `DisplayState`
goodboy Dec 14, 2022
64d4d89
Make `LinearRegion` link using epoch-time index
goodboy Dec 15, 2022
57ce59e
Ugh, use `bool` flag to determine index field..
goodboy Dec 15, 2022
e916e3a
Set `path_arrays_from_ohlc(use_time_index=True)` on epoch indexing
goodboy Dec 16, 2022
a4ddae0
`Viz._index_field` a `typing.Literal[str]`
goodboy Dec 16, 2022
81aa81a
Adjust OHLC bar x-offsets to be time span matched
goodboy Dec 16, 2022
f71da99
Add `IncrementalFormatter.x_offset: np.ndarray`
goodboy Dec 16, 2022
2e89e0c
Align step curves the same as OHLC bars
goodboy Dec 16, 2022
7be6067
Use array-`int`-indexing on single feed
goodboy Dec 16, 2022
9651a3c
Make `Viz.incr_info()` sample rate agnostic
goodboy Dec 17, 2022
b03dfb8
Add `ChartPlotWidget.main_viz: Viz` convenience `@property`
goodboy Dec 17, 2022
cad2afa
Drop coordinate cacheing from `BarItems`, causes weird jitter on pan
goodboy Dec 19, 2022
fc8c866
Add type annots to vars inside `Render.render()`
goodboy Dec 19, 2022
b786f2c
Fix gap detection on RHS; always bin-search on overshot time range
goodboy Dec 19, 2022
0a9b400
Rename `reset` -> `reset_cache`
goodboy Dec 19, 2022
d26df2b
Make `Viz.incr_info()` do treading with time-index, and appending wit…
goodboy Dec 19, 2022
c6f0212
Make `.increment_view()` take in a `datums: int` and always scale it …
goodboy Dec 19, 2022
812314f
Fix overlayed slow chart "treading"
goodboy Dec 19, 2022
447a0a4
Enable the experimental `QPrivatePath` functionality from latest `pyq…
goodboy Dec 19, 2022
8635192
Use `np.diff()` on last 16 samples instead of only last datum pair
goodboy Dec 21, 2022
a670ac7
Add commented append slice-len sanity check
goodboy Dec 22, 2022
2cbb27f
Fix x-axis labelling when using an epoch domain
goodboy Dec 23, 2022
ab79336
Simplify L1 labels for multicharts
goodboy Dec 23, 2022
b107a4c
Don't set y-axis label colors to curve's, use the default from global…
goodboy Dec 23, 2022
330f473
Set cursor label color to "bracket"
goodboy Dec 23, 2022
afa6c66
TOSQUASH: 84f19308 (l1 rework)
goodboy Dec 23, 2022
95ce947
Handle empty `indexes` input edge case..
goodboy Dec 23, 2022
1d45bec
Drop l1 labels attr from chart widget
goodboy Dec 23, 2022
347b08d
Just-offset-from-arrow-marker on slow chart
goodboy Dec 24, 2022
08a6efd
Add a parent-type for graphics: `FlowGraphic`
goodboy Dec 26, 2022
09af816
Use static `L1Label._x_br_offset` as l1 label length
goodboy Dec 27, 2022
f2403c6
Use left-style index search on RHS scan as well
goodboy Dec 27, 2022
6e17df9
Drop edge case from `slice_from_time()`
goodboy Dec 28, 2022
fb83b27
Make `FlowGraphic.x_last()` be optionally `None`
goodboy Dec 28, 2022
a124bb3
Further fixes `Viz.default_view()` and `.index_step()`
goodboy Dec 28, 2022
fcecbfd
Drop `._index_step` from formatters and instead defer to `Viz.index_s…
goodboy Dec 28, 2022
26505f9
Modernize optional path variable type annots
goodboy Dec 28, 2022
e58d91c
Mouse interaction tweaks
goodboy Dec 28, 2022
d04c92e
Repair auto-y-ranging to always include L1 spread
goodboy Jan 2, 2023
a519924
Better index step value scanning by checking with our expected set
goodboy Jan 2, 2023
857a369
Move $vlm y-axis to LHS
goodboy Jan 2, 2023
b690f20
Correctly load order mode for first fqsn in overlay set
goodboy Jan 2, 2023
74adc01
Make $vlm axis color same as clears
goodboy Jan 2, 2023
1c895d2
Fix indent level
goodboy Jan 3, 2023
3b45ffa
Do full marker width after line
goodboy Jan 3, 2023
bd7832e
Always zero-on-step $vlm
goodboy Jan 3, 2023
ed1e858
Add back another panes resize during startup
goodboy Jan 3, 2023
c072c94
Drop `Flume.index_stream()`, `._sampling.open_sample_stream()` replac…
goodboy Jan 5, 2023
81d1a89
Use `open_sample_stream()` in display loop
goodboy Jan 5, 2023
cb3348a
Fix query-mode cursor labels to work with epoch-indexing
goodboy Jan 5, 2023
f7258fe
Drop bp blocks from formatters mod
goodboy Jan 5, 2023
fe163c8
Handle last-in-view time slicing edge case
goodboy Jan 5, 2023
55acd65
Clean a buncha cruft from render mod
goodboy Jan 5, 2023
939ac1f
Take outer-interval values in `Viz.datums_range()`
goodboy Jan 6, 2023
16bc3bd
Make (cache) search-results a `set` and avoid overlay duplicate entries
goodboy Jan 6, 2023
7c701c1
Lol, pull hist chart from the display state
goodboy Jan 6, 2023
6dbb830
Attempt to keep selected item highlighted
goodboy Jan 9, 2023
e72dd26
Downthrottle to 16Hz on multi-feed charts
goodboy Jan 12, 2023
87b476a
Breakpoint bad (-ve or too large) x-ranges to m4
goodboy Jan 12, 2023
8716be4
Comment bad x-range bp for now
goodboy Jan 13, 2023
a8c45e5
Fix history array name
goodboy Jan 13, 2023
652c1c2
Fix `open_trade_ledger()` enter value type annot
goodboy Jan 13, 2023
df87670
Passthrough `tractor` kwargs directly
goodboy Jan 13, 2023
f4c2a21
Only handle hist discrepancies when market is open
goodboy Jan 13, 2023
1b11816
Drop multi mxmn from display mod
goodboy Jan 14, 2023
55f980d
Drop x-range query from `ChartPlotWidget.maxmin()`
goodboy Jan 14, 2023
ebdc866
Use (modern) literal type annots in view code
goodboy Jan 14, 2023
fb601e2
Add back coord-caching to ohlc graphic
goodboy Jan 15, 2023
9b4ac78
Add first-draft `PlotItemOverlay.group_maxmin()`
goodboy Jan 15, 2023
cea7695
Always cache `read_slc` alongside y-mnmx values
goodboy Jan 16, 2023
4bf5c75
Set a `PlotItem.viz` for interaction lookup
goodboy Jan 16, 2023
38fb49a
Use `Viz` over charts where possible in display loop
goodboy Jan 16, 2023
bb3e0c5
Use latest `asks`
goodboy Jan 16, 2023
f1b9c6f
Use `Viz.update_graphics()` throughout remainder of graphics loop whe…
goodboy Jan 17, 2023
1c1b147
Ensure full hist OHLC path is drawn on tread
goodboy Jan 17, 2023
f7c1a0f
Only update last datum graphic(s) on clear ticks
goodboy Jan 17, 2023
a6ab2e5
Only draw up to 2nd last datum for OHLC bars paths
goodboy Jan 17, 2023
ac81da9
Add cached refs to last 1d xy outputs
goodboy Jan 17, 2023
02732d0
Use `Viz.draw_last()` inside `.update_graphics()`
goodboy Jan 17, 2023
998a4ac
More thoroughly profile the display loop
goodboy Jan 17, 2023
c536d1a
Drop `ChartView._maxmin()` idea, use `Viz.maxmin()`
goodboy Jan 18, 2023
f89debd
Drop `ChartView._maxmin()` usage in `.ui._fsp`
goodboy Jan 18, 2023
40c0eaa
Backlink subchart views to "main chart" in `.add_plot()`
goodboy Jan 18, 2023
5316761
Support read-slice input to `Viz.maxmin()`
goodboy Jan 18, 2023
31dc16a
Adjust vlm fsp code to new `Viz.update_graphics()` output sig
goodboy Jan 18, 2023
3b55a8a
Drop Qt interaction signal usage
goodboy Jan 18, 2023
7be2a1c
Rework display loop maxmin-ing with `Viz` pipelining
goodboy Jan 18, 2023
bfe9bd1
Document `Viz.incr_info()` outputs
goodboy Jan 18, 2023
52ea90d
Right, handle y-ranging multiple paths per plot
goodboy Jan 19, 2023
45884e7
Drop masked `._maxmin()` override code from fsp stuff
goodboy Jan 19, 2023
ac33eb3
Fix `Viz.draw_last()` to divide by `.flat_index_ratio` for uppx index…
goodboy Jan 19, 2023
b3fa06c
Disable coordinate caching on OHLC ds curves to avoid smearing
goodboy Jan 19, 2023
813fd88
Rename `.maybe_downsample_graphics()` -> `.interact_graphics_cycle()`
goodboy Jan 19, 2023
78e4fb7
Fix profiler f-strings
goodboy Jan 19, 2023
8e17bf9
First draft, group y-minmax transform algo
goodboy Jan 19, 2023
3ada192
2nd try: dispersion normalize y-ranges around median
goodboy Jan 20, 2023
31b1adc
3rdz the charm: log-linearize minor y-ranges to a major
goodboy Jan 20, 2023
fd60aba
Clean up cross-curve intersect point indexing
goodboy Jan 21, 2023
6893e35
Drop `.group_maxmin()`
goodboy Jan 21, 2023
e837579
Only remove axis from scene when in one
goodboy Jan 21, 2023
7c18c5c
Move axis hiding into `.overlay_plotitem()`
goodboy Jan 21, 2023
f45475c
Only set the major curve's range once (per render cycle)
goodboy Jan 22, 2023
eccf4b5
Just warn log on bad intersect indexing errors (for now)
goodboy Jan 22, 2023
469e28d
Drop `update_graphics_from_flow()`
goodboy Jan 22, 2023
4159636
Return `in_view: bool` from `Viz.update_graphics()`
goodboy Jan 22, 2023
7e973c1
When only one curve is in view, skip group ranging
goodboy Jan 22, 2023
cf48e4a
Factor curve-dispersion sorting into primary loop
goodboy Jan 22, 2023
90260cb
Fix intersect detection using time indexing
goodboy Jan 23, 2023
313438c
Factor color and cache mode settings into `FlowGraphics`
goodboy Jan 23, 2023
e6d94e4
Add back `.prepareGeometryChange()`, seems faster?
goodboy Jan 23, 2023
ccce03f
Make profiler work when nested and not?
goodboy Jan 23, 2023
3bccbb5
Add full profiling to `.interact_graphics_cycle()`
goodboy Jan 24, 2023
72c14c6
Use normal pen when last-datum color not provided
goodboy Jan 24, 2023
b59dadf
Support chart draw-api-kwargs-passthrough in lined plot meths
goodboy Jan 24, 2023
2e9aed1
Speed up ranging in display loop
goodboy Jan 24, 2023
b9ff9cf
Add `Viz.median_from_range()`
goodboy Jan 24, 2023
6088088
Use new cached median method in overlay scaling
goodboy Jan 24, 2023
04a57f6
Fix `do_px_step` output for epoch step sizing
goodboy Jan 24, 2023
b16ca82
Add linked charts guard-flag for use in display loop
goodboy Jan 24, 2023
e7f8394
Don't skip overlay scaling in disp-loop for now
goodboy Jan 24, 2023
87dfc9f
Don't scale overlays on linked from display loop
goodboy Jan 24, 2023
5bde123
Fix return type annot for `slice_from_time()`
goodboy Jan 24, 2023
a10bd5f
Use `._pathops.slice_from_time()` for overlay intersects
goodboy Jan 24, 2023
cff2dbf
Return fast on bad range in `.default_view()`
goodboy Jan 24, 2023
46200bc
Lul, actually scaled main chart from linked set
goodboy Jan 24, 2023
4424b39
Comment out all median usage, turns out it's uneeded..
goodboy Jan 24, 2023
437dcde
Drop old loop and wait on fsp engine tasks startups
goodboy Jan 24, 2023
a3301db
Better handle dynamic registry sampler broadcasts
goodboy Jan 25, 2023
ec7fc1e
`ib`: make commodities search and feeds work again..
goodboy Jan 26, 2023
b3ac63a
Update profile msgs to new apis
goodboy Jan 30, 2023
f1f1515
Fix profiler f-string
goodboy Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion piker/_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async def open_piker_runtime(
# and spawn the service tree distributed per that.
start_method: str = 'trio',

tractor_kwargs: dict = {},
**tractor_kwargs,

) -> tuple[
tractor.Actor,
Expand Down
13 changes: 11 additions & 2 deletions piker/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ def __new__(
# don't do anything
return cls._disabledProfiler

# create an actual profiling object
cls._depth += 1
obj = super(Profiler, cls).__new__(cls)
obj._msgs = []

# create an actual profiling object
if cls._depth < 1:
cls._msgs = []

obj._name = msg or func_qualname
obj._delayed = delayed
obj._markCount = 0
Expand All @@ -174,8 +179,12 @@ def __call__(self, msg=None):

self._markCount += 1
newTime = perf_counter()
tot_ms = (newTime - self._firstTime) * 1000
ms = (newTime - self._lastTime) * 1000
self._newMsg(" %s: %0.4f ms", msg, ms)
self._newMsg(
f" {msg}: {ms:0.4f}, tot:{tot_ms:0.4f}"
)

self._lastTime = newTime

def mark(self, msg=None):
Expand Down
36 changes: 26 additions & 10 deletions piker/brokers/ib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,17 @@ def __init__(self):
'CME',
'CMECRYPTO',
'COMEX',
'CMDTY', # special name case..
# 'CMDTY', # special name case..
'CBOT', # (treasury) yield futures
)

_adhoc_cmdty_set = {
# metals
# https://misc.interactivebrokers.com/cstools/contract_info/v3.10/index.php?action=Conid%20Info&wlId=IB&conid=69067924
'xauusd.cmdty', # london gold spot ^
'xagusd.cmdty', # silver spot
}

_adhoc_futes_set = {

# equities
Expand All @@ -186,16 +193,12 @@ def __init__(self):
# raw
'lb.comex', # random len lumber

# metals
# https://misc.interactivebrokers.com/cstools/contract_info/v3.10/index.php?action=Conid%20Info&wlId=IB&conid=69067924
'xauusd.cmdty', # london gold spot ^
'gc.comex',
'mgc.comex', # micro

# oil & gas
'cl.comex',

'xagusd.cmdty', # silver spot
'ni.comex', # silver futes
'qi.comex', # mini-silver futes

Expand Down Expand Up @@ -259,6 +262,7 @@ def __init__(self):
'FUNDSERV',
'SWB2',
'PSE',
'PHLX',
}

_enters = 0
Expand Down Expand Up @@ -514,15 +518,18 @@ async def search_symbols(
except ConnectionError:
return {}

dict_results: dict[str, dict] = {}
for key, deats in results.copy().items():

tract = deats.contract
sym = tract.symbol
sectype = tract.secType
deats_dict = asdict(deats)

if sectype == 'IND':
results[f'{sym}.IND'] = tract
results.pop(key)
key = f'{sym}.IND'
results[key] = tract
# exch = tract.exchange

# XXX: add back one of these to get the weird deadlock
Expand Down Expand Up @@ -559,20 +566,25 @@ async def search_symbols(
# if cons:
all_deats = await self.con_deats([con])
results |= all_deats
for key in all_deats:
dict_results[key] = asdict(all_deats[key])

# forex pairs
elif sectype == 'CASH':
results.pop(key)
dst, src = tract.localSymbol.split('.')
pair_key = "/".join([dst, src])
exch = tract.exchange.lower()
results[f'{pair_key}.{exch}'] = tract
results.pop(key)
key = f'{pair_key}.{exch}'
results[key] = tract

# XXX: again seems to trigger the weird tractor
# bug with the debugger..
# assert 0

return results
dict_results[key] = deats_dict

return dict_results

async def get_fute(
self,
Expand Down Expand Up @@ -1036,7 +1048,11 @@ def con2fqsn(
# TODO: option symbol parsing and sane display:
symbol = con.localSymbol.replace(' ', '')

case ibis.Commodity():
case (
ibis.Commodity()
# search API endpoint returns std con box..
| ibis.Contract(secType='CMDTY')
):
# commodities and forex don't have an exchange name and
# no real volume so we have to calculate the price
suffix = con.secType
Expand Down
Loading