Typecast `OrderMode.staged.symbol: str` before `.copy()`!

rekt_pps
Tyler Goodlet 2023-03-21 22:28:26 -04:00
parent d62fb655eb
commit b6df83a0e9
1 changed files with 13 additions and 3 deletions

View File

@ -349,12 +349,22 @@ class OrderMode:
''' '''
if not order: if not order:
staged: Order = self._staged_order staged: Order = self._staged_order
# apply order fields for ems # apply order fields for ems
oid = str(uuid.uuid4()) oid = str(uuid.uuid4())
order = staged.copy()
order.oid = oid
order.symbol = order.symbol.fqme # we have to copy and slap in the `MktPair` first
# since we can't cast to it without being mega explicit
# with `msgspec.Struct`, which we're not yet..
fqme = staged.symbol
if not isinstance(fqme, str):
mkt = staged.symbol.copy()
fqme = mkt.fqme
staged.symbol = fqme
order = staged.copy()
order.symbol = fqme
order.oid = oid
lines = self.lines_from_order( lines = self.lines_from_order(
order, order,