Slapp in exchange suffix position msg key; avoid symbol aliasing on `in` check
parent
fa88d91b8d
commit
28b6882725
|
@ -1295,10 +1295,14 @@ def pack_position(pos: Position) -> dict[str, Any]:
|
||||||
else:
|
else:
|
||||||
symbol = con.symbol
|
symbol = con.symbol
|
||||||
|
|
||||||
|
symkey = '.'.join([
|
||||||
|
symbol.lower(),
|
||||||
|
(con.primaryExchange or con.exchange).lower(),
|
||||||
|
])
|
||||||
return BrokerdPosition(
|
return BrokerdPosition(
|
||||||
broker='ib',
|
broker='ib',
|
||||||
account=pos.account,
|
account=pos.account,
|
||||||
symbol=symbol,
|
symbol=symkey,
|
||||||
currency=con.currency,
|
currency=con.currency,
|
||||||
size=float(pos.position),
|
size=float(pos.position),
|
||||||
avg_price=float(pos.avgCost) / float(con.multiplier or 1.0),
|
avg_price=float(pos.avgCost) / float(con.multiplier or 1.0),
|
||||||
|
|
Loading…
Reference in New Issue