ib: multiline stylings, typing, timeout report
parent
b994dd85af
commit
ae7cd8df7c
|
|
@ -943,6 +943,7 @@ class Client:
|
||||||
)
|
)
|
||||||
if tkr:
|
if tkr:
|
||||||
break
|
break
|
||||||
|
|
||||||
except TimeoutError as err:
|
except TimeoutError as err:
|
||||||
timeouterr = err
|
timeouterr = err
|
||||||
await asyncio.sleep(0.01)
|
await asyncio.sleep(0.01)
|
||||||
|
|
@ -951,7 +952,9 @@ class Client:
|
||||||
else:
|
else:
|
||||||
if not warnset:
|
if not warnset:
|
||||||
log.warning(
|
log.warning(
|
||||||
f'Quote req timed out..maybe venue is closed?\n'
|
f'Quote req timed out..\n'
|
||||||
|
f'Maybe the venue is closed?\n'
|
||||||
|
f'\n'
|
||||||
f'{asdict(contract)}'
|
f'{asdict(contract)}'
|
||||||
)
|
)
|
||||||
warnset = True
|
warnset = True
|
||||||
|
|
@ -963,9 +966,11 @@ class Client:
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if timeouterr and raise_on_timeout:
|
if (
|
||||||
import pdbp
|
timeouterr
|
||||||
pdbp.set_trace()
|
and
|
||||||
|
raise_on_timeout
|
||||||
|
):
|
||||||
raise timeouterr
|
raise timeouterr
|
||||||
|
|
||||||
if not warnset:
|
if not warnset:
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,11 @@ def pack_position(
|
||||||
symbol=fqme,
|
symbol=fqme,
|
||||||
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)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -562,7 +566,7 @@ async def open_trade_dialog(
|
||||||
ledgers: dict[str, TransactionLedger] = {}
|
ledgers: dict[str, TransactionLedger] = {}
|
||||||
tables: dict[str, Account] = {}
|
tables: dict[str, Account] = {}
|
||||||
order_msgs: list[Status] = []
|
order_msgs: list[Status] = []
|
||||||
conf = get_config()
|
conf: dict = get_config()
|
||||||
accounts_def_inv: bidict[str, str] = bidict(
|
accounts_def_inv: bidict[str, str] = bidict(
|
||||||
conf['accounts']
|
conf['accounts']
|
||||||
).inverse
|
).inverse
|
||||||
|
|
|
||||||
|
|
@ -1083,7 +1083,8 @@ async def stream_quotes(
|
||||||
con: Contract = details.contract
|
con: Contract = details.contract
|
||||||
first_ticker: Ticker|None = None
|
first_ticker: Ticker|None = None
|
||||||
|
|
||||||
with trio.move_on_after(1.6) as quote_cs:
|
timeout: float = 1.6
|
||||||
|
with trio.move_on_after(timeout) as quote_cs:
|
||||||
first_ticker: Ticker = await proxy.get_quote(
|
first_ticker: Ticker = await proxy.get_quote(
|
||||||
contract=con,
|
contract=con,
|
||||||
raise_on_timeout=False,
|
raise_on_timeout=False,
|
||||||
|
|
@ -1092,7 +1093,9 @@ async def stream_quotes(
|
||||||
# XXX should never happen with this ep right?
|
# XXX should never happen with this ep right?
|
||||||
# but if so then, more then likely mkt is closed?
|
# but if so then, more then likely mkt is closed?
|
||||||
if quote_cs.cancelled_caught:
|
if quote_cs.cancelled_caught:
|
||||||
await tractor.pause()
|
log.warning(
|
||||||
|
f'First quote req timed out after {timeout!r}s'
|
||||||
|
)
|
||||||
|
|
||||||
if first_ticker:
|
if first_ticker:
|
||||||
first_quote: dict = normalize(first_ticker)
|
first_quote: dict = normalize(first_ticker)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue