`ib`: various type-annot, multiline styling and todos updates
parent
d17160519e
commit
0b123c9af9
|
@ -547,7 +547,10 @@ async def open_trade_dialog(
|
|||
),
|
||||
|
||||
# TODO: do this as part of `open_account()`!?
|
||||
open_symcache('ib', only_from_memcache=True) as symcache,
|
||||
open_symcache(
|
||||
'ib',
|
||||
only_from_memcache=True,
|
||||
) as symcache,
|
||||
):
|
||||
# Open a trade ledgers stack for appending trade records over
|
||||
# multiple accounts.
|
||||
|
@ -556,7 +559,9 @@ async def open_trade_dialog(
|
|||
tables: dict[str, Account] = {}
|
||||
order_msgs: list[Status] = []
|
||||
conf = get_config()
|
||||
accounts_def_inv: bidict[str, str] = bidict(conf['accounts']).inverse
|
||||
accounts_def_inv: bidict[str, str] = bidict(
|
||||
conf['accounts']
|
||||
).inverse
|
||||
|
||||
with (
|
||||
ExitStack() as lstack,
|
||||
|
@ -706,7 +711,11 @@ async def open_trade_dialog(
|
|||
# client-account and build out position msgs to deliver to
|
||||
# EMS.
|
||||
for acctid, acnt in tables.items():
|
||||
active_pps, closed_pps = acnt.dump_active()
|
||||
active_pps: dict[str, Position]
|
||||
(
|
||||
active_pps,
|
||||
closed_pps,
|
||||
) = acnt.dump_active()
|
||||
|
||||
for pps in [active_pps, closed_pps]:
|
||||
piker_pps: list[Position] = list(pps.values())
|
||||
|
@ -722,6 +731,7 @@ async def open_trade_dialog(
|
|||
)
|
||||
if ibpos:
|
||||
bs_mktid: str = str(ibpos.contract.conId)
|
||||
|
||||
msg = await update_and_audit_pos_msg(
|
||||
acctid,
|
||||
pikerpos,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# piker: trading gear for hackers
|
||||
# Copyright (C) Tyler Goodlet (in stewardship for pikers)
|
||||
# Copyright (C) 2018-forever Tyler Goodlet (in stewardship for pikers)
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -13,10 +13,12 @@
|
|||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
Data feed endpoints pre-wrapped and ready for use with ``tractor``/``trio``.
|
||||
|
||||
"""
|
||||
'''
|
||||
Data feed endpoints pre-wrapped and ready for use with `tractor`/`trio`
|
||||
via "infected-asyncio-mode".
|
||||
|
||||
'''
|
||||
from __future__ import annotations
|
||||
import asyncio
|
||||
from contextlib import (
|
||||
|
@ -895,6 +897,13 @@ def normalize(
|
|||
return data
|
||||
|
||||
|
||||
# ?TODO? feels like this task-fn could be factored to reduce some
|
||||
# indentation levels?
|
||||
# -[ ] the reconnect while loop on ib-gw "data farm connection.."s
|
||||
# -[ ] everything embedded under the `async with aclosing(stream):`
|
||||
# as the "meat" of the quote delivery once the connection is
|
||||
# stable.
|
||||
#
|
||||
async def stream_quotes(
|
||||
|
||||
send_chan: trio.abc.SendChannel,
|
||||
|
|
Loading…
Reference in New Issue