Use new `Position.bsuid` field throughout

lifo_pps_ib
Tyler Goodlet 2022-06-14 16:22:30 -04:00
parent 412138a75b
commit 05a1a4e3d8
3 changed files with 12 additions and 4 deletions

View File

@ -23,10 +23,9 @@ from typing import Optional
from bidict import bidict from bidict import bidict
from pydantic import BaseModel, validator from pydantic import BaseModel, validator
from msgspec import Struct # from msgspec import Struct
from ..data._source import Symbol from ..data._source import Symbol
from ._messages import BrokerdPosition, Status
from ..pp import Position from ..pp import Position
@ -202,7 +201,12 @@ class Allocator(BaseModel):
if order_size < slot_size: if order_size < slot_size:
# compute a fractional slots size to display # compute a fractional slots size to display
slots_used = self.slots_used( slots_used = self.slots_used(
Position(symbol=sym, size=order_size, avg_price=price) Position(
symbol=sym,
size=order_size,
avg_price=price,
bsuid=sym,
)
) )
return { return {

View File

@ -264,6 +264,7 @@ class PaperBoi:
Symbol(key=symbol), Symbol(key=symbol),
size=pp_msg.size, size=pp_msg.size,
avg_price=pp_msg.avg_price, avg_price=pp_msg.avg_price,
uid=symbol.front_fqsn(),
) )
pp_msg.size, pp_msg.avg_price = pp.lifo_update(size, price) pp_msg.size, pp_msg.avg_price = pp.lifo_update(size, price)

View File

@ -33,10 +33,10 @@ import trio
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from .. import config from .. import config
from ..pp import Position
from ..clearing._client import open_ems, OrderBook from ..clearing._client import open_ems, OrderBook
from ..clearing._allocate import ( from ..clearing._allocate import (
mk_allocator, mk_allocator,
Position,
) )
from ._style import _font from ._style import _font
from ..data._source import Symbol from ..data._source import Symbol
@ -607,6 +607,9 @@ async def open_order_mode(
symbol=symbol, symbol=symbol,
size=0, size=0,
avg_price=0, avg_price=0,
# XXX: BLEH, do we care about this on the client side?
bsuid=symbol,
) )
msg = pps_by_account.get(account_name) msg = pps_by_account.get(account_name)
if msg: if msg: