Port oustanding parts of codebase to `unpack_fqme()`

rekt_pps
Tyler Goodlet 2023-04-18 19:12:14 -04:00
parent 4129d693be
commit adb62dc7b4
6 changed files with 24 additions and 12 deletions

View File

@ -676,8 +676,8 @@ class Client:
# fqsn parsing stage
# ------------------
if '.ib' in pattern:
from ..accounting._mktinfo import unpack_fqsn
_, symbol, expiry = unpack_fqsn(pattern)
from ..accounting._mktinfo import unpack_fqme
_, symbol, venue, expiry = unpack_fqme(pattern)
else:
symbol = pattern
@ -857,8 +857,17 @@ class Client:
self,
symbol: str,
) -> tuple[Contract, Ticker, ContractDetails]:
) -> tuple[
Contract,
Ticker,
ContractDetails,
]:
'''
Get summary (meta) data for a given symbol str including
``Contract`` and its details and a (first snapshot of the)
``Ticker``.
'''
contract = (await self.find_contracts(symbol))[0]
ticker: Ticker = self.ib.reqMktData(
contract,

View File

@ -28,7 +28,7 @@ from ..service import maybe_spawn_brokerd
from . import _event
from ._exec import run_qtractor
from ..data.feed import install_brokerd_search
from ..accounting._mktinfo import unpack_fqsn
from ..accounting._mktinfo import unpack_fqme
from . import _search
from ._chart import GodWidget
from ..log import get_logger
@ -101,7 +101,7 @@ async def _async_main(
needed_brokermods: dict[str, ModuleType] = {}
for fqsn in syms:
brokername, *_ = unpack_fqsn(fqsn)
brokername, *_ = unpack_fqme(fqsn)
needed_brokermods[brokername] = brokers[brokername]
async with (

View File

@ -14,10 +14,10 @@
# 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/>.
"""
Position info and display
'''
Position (pos) info and display to track ur PnLz B)
"""
'''
from __future__ import annotations
from copy import copy
from dataclasses import dataclass

View File

@ -1002,7 +1002,10 @@ async def process_trade_msg(
)
tracker = mode.trackers[msg['account']]
tracker.live_pp.update_from_msg(msg)
tracker.update_from_pp(set_as_startup=True) # status/pane UI
tracker.update_from_pp(
set_as_startup=True,
)
# status/pane UI
mode.pane.update_status_ui(tracker)
if tracker.live_pp.size:

View File

@ -79,7 +79,7 @@ async def order_and_and_wait_for_ppmsg(
'''
sent: list[Order] = []
broker, key, suffix = unpack_fqme(fqme)
broker, mktep, venue, suffix = unpack_fqme(fqme)
order = Order(
exec_mode=exec_mode,

View File

@ -15,7 +15,7 @@ from piker.data import (
)
from piker.data.flows import Flume
from piker.accounting._mktinfo import (
unpack_fqsn,
unpack_fqme,
)
@ -54,7 +54,7 @@ def test_multi_fqsn_feed(
brokers = set()
for fqme in fqmes:
brokername, key, suffix = unpack_fqsn(fqme)
brokername, *_ = unpack_fqme(fqme)
brokers.add(brokername)
async def main():