Compare commits
10 Commits
b58a714965
...
a06fe473cf
| Author | SHA1 | Date |
|---|---|---|
|
|
a06fe473cf | |
|
|
01fc1d3887 | |
|
|
056128de0b | |
|
|
69154f9ee2 | |
|
|
2fa4ed969c | |
|
|
49f75318be | |
|
|
4a5096c78d | |
|
|
6727cce1fc | |
|
|
68f629d306 | |
|
|
0fb47de4b5 |
|
|
@ -991,9 +991,6 @@ _statuses: dict[str, str] = {
|
||||||
# TODO: see a current ``ib_insync`` issue around this:
|
# TODO: see a current ``ib_insync`` issue around this:
|
||||||
# https://github.com/erdewit/ib_insync/issues/363
|
# https://github.com/erdewit/ib_insync/issues/363
|
||||||
'Inactive': 'pending',
|
'Inactive': 'pending',
|
||||||
|
|
||||||
# XXX, uhh wut the heck is this?
|
|
||||||
'ValidationError': 'error',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_action_map = {
|
_action_map = {
|
||||||
|
|
@ -1066,19 +1063,8 @@ async def deliver_trade_events(
|
||||||
# TODO: for some reason we can receive a ``None`` here when the
|
# TODO: for some reason we can receive a ``None`` here when the
|
||||||
# ib-gw goes down? Not sure exactly how that's happening looking
|
# ib-gw goes down? Not sure exactly how that's happening looking
|
||||||
# at the eventkit code above but we should probably handle it...
|
# 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:
|
async for event_name, item in trade_event_stream:
|
||||||
log.info(
|
log.info(f'Relaying `{event_name}`:\n{pformat(item)}')
|
||||||
f'Relaying {event_name!r}:\n'
|
|
||||||
f'{pformat(item)}\n'
|
|
||||||
)
|
|
||||||
match event_name:
|
match event_name:
|
||||||
case 'orderStatusEvent':
|
case 'orderStatusEvent':
|
||||||
|
|
||||||
|
|
@ -1089,12 +1075,11 @@ async def deliver_trade_events(
|
||||||
trade: Trade = item
|
trade: Trade = item
|
||||||
reqid: str = str(trade.order.orderId)
|
reqid: str = str(trade.order.orderId)
|
||||||
status: OrderStatus = trade.orderStatus
|
status: OrderStatus = trade.orderStatus
|
||||||
status_str: str = _statuses.get(
|
status_str: str = _statuses[status.status]
|
||||||
status.status,
|
|
||||||
'error',
|
|
||||||
)
|
|
||||||
remaining: float = status.remaining
|
remaining: float = status.remaining
|
||||||
if status_str == 'filled':
|
if (
|
||||||
|
status_str == 'filled'
|
||||||
|
):
|
||||||
fill: Fill = trade.fills[-1]
|
fill: Fill = trade.fills[-1]
|
||||||
execu: Execution = fill.execution
|
execu: Execution = fill.execution
|
||||||
|
|
||||||
|
|
@ -1125,12 +1110,6 @@ async def deliver_trade_events(
|
||||||
# all units were cleared.
|
# all units were cleared.
|
||||||
status_str = 'closed'
|
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
|
# skip duplicate filled updates - we get the deats
|
||||||
# from the execution details event
|
# from the execution details event
|
||||||
msg = BrokerdStatus(
|
msg = BrokerdStatus(
|
||||||
|
|
|
||||||
|
|
@ -83,14 +83,7 @@ def has_holiday(
|
||||||
'''
|
'''
|
||||||
tz: str = con_deats.timeZoneId
|
tz: str = con_deats.timeZoneId
|
||||||
exch: str = con_deats.contract.primaryExchange
|
exch: str = con_deats.contract.primaryExchange
|
||||||
|
cal: ExchangeCalendar = xcals.get_calendar(exch)
|
||||||
# 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)
|
|
||||||
end: datetime = period.end
|
end: datetime = period.end
|
||||||
# _start: datetime = period.start
|
# _start: datetime = period.start
|
||||||
# ?TODO, can rm ya?
|
# ?TODO, can rm ya?
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,7 @@ from piker.brokers import NoData
|
||||||
from piker.accounting import (
|
from piker.accounting import (
|
||||||
MktPair,
|
MktPair,
|
||||||
)
|
)
|
||||||
from piker.log import (
|
from piker.log import get_logger
|
||||||
get_logger,
|
|
||||||
get_console_log,
|
|
||||||
)
|
|
||||||
from ..data._sharedmem import (
|
from ..data._sharedmem import (
|
||||||
maybe_open_shm_array,
|
maybe_open_shm_array,
|
||||||
ShmArray,
|
ShmArray,
|
||||||
|
|
@ -1371,10 +1368,6 @@ async def manage_history(
|
||||||
engages.
|
engages.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
get_console_log(
|
|
||||||
name=__name__,
|
|
||||||
level=loglevel,
|
|
||||||
)
|
|
||||||
# TODO: is there a way to make each shm file key
|
# TODO: is there a way to make each shm file key
|
||||||
# actor-tree-discovery-addr unique so we avoid collisions
|
# actor-tree-discovery-addr unique so we avoid collisions
|
||||||
# when doing tests which also allocate shms for certain instruments
|
# when doing tests which also allocate shms for certain instruments
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue