Compare commits

..

No commits in common. "32786c58941b3dd97a740c686f025693fbc1fc6c" and "9e2af2838fdbb9fb79658aa872bf52d0f7c3df83" have entirely different histories.

2 changed files with 6 additions and 34 deletions

View File

@ -991,9 +991,6 @@ _statuses: dict[str, str] = {
# TODO: see a current ``ib_insync`` issue around this:
# https://github.com/erdewit/ib_insync/issues/363
'Inactive': 'pending',
# XXX, uhh wut the heck is this?
'ValidationError': 'error',
}
_action_map = {
@ -1066,19 +1063,8 @@ async def deliver_trade_events(
# TODO: for some reason we can receive a ``None`` here when the
# ib-gw goes down? Not sure exactly how that's happening looking
# at the eventkit code above but we should probably handle it...
event_name: str
item: (
Trade
|tuple[Trade, Fill]
|CommissionReport
|IbPosition
|dict
)
async for event_name, item in trade_event_stream:
log.info(
f'Relaying {event_name!r}:\n'
f'{pformat(item)}\n'
)
log.info(f'Relaying `{event_name}`:\n{pformat(item)}')
match event_name:
case 'orderStatusEvent':
@ -1089,12 +1075,11 @@ async def deliver_trade_events(
trade: Trade = item
reqid: str = str(trade.order.orderId)
status: OrderStatus = trade.orderStatus
status_str: str = _statuses.get(
status.status,
'error',
)
status_str: str = _statuses[status.status]
remaining: float = status.remaining
if status_str == 'filled':
if (
status_str == 'filled'
):
fill: Fill = trade.fills[-1]
execu: Execution = fill.execution
@ -1125,12 +1110,6 @@ async def deliver_trade_events(
# all units were cleared.
status_str = 'closed'
elif status_str == 'error':
log.error(
f'IB reported error status for order ??\n'
f'{status.status!r}\n'
)
# skip duplicate filled updates - we get the deats
# from the execution details event
msg = BrokerdStatus(

View File

@ -83,14 +83,7 @@ def has_holiday(
'''
tz: str = con_deats.timeZoneId
exch: str = con_deats.contract.primaryExchange
# XXX, ad-hoc handle any IB exchange which are non-std
# via lookup table..
std_exch: dict = {
'ARCA': 'ARCX',
}.get(exch, exch)
cal: ExchangeCalendar = xcals.get_calendar(std_exch)
cal: ExchangeCalendar = xcals.get_calendar(exch)
end: datetime = period.end
# _start: datetime = period.start
# ?TODO, can rm ya?