Drop unseralizable "sec tag" for now

msgspec_fixes
Tyler Goodlet 2021-06-14 00:02:23 -04:00
parent e52ecbe589
commit 588b5c317c
1 changed files with 10 additions and 2 deletions

View File

@ -282,7 +282,6 @@ class Client:
pattern: str, pattern: str,
# how many contracts to search "up to" # how many contracts to search "up to"
upto: int = 3, upto: int = 3,
asdicts: bool = True,
) -> Dict[str, ContractDetails]: ) -> Dict[str, ContractDetails]:
"""Search for stocks matching provided ``str`` pattern. """Search for stocks matching provided ``str`` pattern.
@ -304,11 +303,17 @@ class Client:
# XXX: if there is more then one entry in the details list # XXX: if there is more then one entry in the details list
details = {} details = {}
for details_set in results: for details_set in results:
# then the contract is so called "ambiguous". # then the contract is so called "ambiguous".
for d in details_set: for d in details_set:
con = d.contract con = d.contract
unique_sym = f'{con.symbol}.{con.primaryExchange}' unique_sym = f'{con.symbol}.{con.primaryExchange}'
details[unique_sym] = asdict(d) if asdicts else d
as_dict = asdict(d)
# nested dataclass we probably don't need and that won't IPC serialize
as_dict.pop('secIdList')
details[unique_sym] = as_dict
if len(details) == upto: if len(details) == upto:
return details return details
@ -1086,6 +1091,9 @@ async def stream_quotes(
syminfo = asdict(details) syminfo = asdict(details)
syminfo.update(syminfo['contract']) syminfo.update(syminfo['contract'])
# nested dataclass we probably don't need and that won't IPC serialize
syminfo.pop('secIdList')
# TODO: more consistent field translation # TODO: more consistent field translation
atype = syminfo['asset_type'] = asset_type_map[syminfo['secType']] atype = syminfo['asset_type'] = asset_type_map[syminfo['secType']]