From c9e6c81459e20cd027271570ab3641d652979015 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 19 Mar 2022 13:48:04 -0400 Subject: [PATCH] Expect fqsn input to paper clearing engine --- piker/clearing/_ems.py | 3 +-- piker/clearing/_paper_engine.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 1ebab7ce..5ea19726 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -417,8 +417,7 @@ async def open_brokerd_trades_dialogue( # actor to simulate the real IPC load it'll have when also # pulling data from feeds open_trades_endpoint = paper.open_paperboi( - broker=broker, - symbol=symbol, + fqsn='.'.join([symbol, broker]), loglevel=loglevel, ) diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index f87e2203..2ea639c0 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -32,6 +32,7 @@ from dataclasses import dataclass from .. import data from ..data._normalize import iterticks +from ..data._source import uncons_fqsn from ..log import get_logger from ._messages import ( BrokerdCancel, BrokerdOrder, BrokerdOrderAck, BrokerdStatus, @@ -446,7 +447,7 @@ async def trades_dialogue( ctx: tractor.Context, broker: str, - symbol: str, + fqsn: str, loglevel: str = None, ) -> None: @@ -455,8 +456,7 @@ async def trades_dialogue( async with ( data.open_feed( - broker, - [symbol], + [fqsn], loglevel=loglevel, ) as feed, @@ -491,15 +491,16 @@ async def trades_dialogue( @asynccontextmanager async def open_paperboi( - broker: str, - symbol: str, + fqsn: str, loglevel: str, ) -> Callable: - '''Spawn a paper engine actor and yield through access to + ''' + Spawn a paper engine actor and yield through access to its context. ''' + broker, symbol, expiry = uncons_fqsn(fqsn) service_name = f'paperboi.{broker}' async with ( @@ -518,7 +519,7 @@ async def open_paperboi( async with portal.open_context( trades_dialogue, broker=broker, - symbol=symbol, + fqsn=fqsn, loglevel=loglevel, ) as (ctx, first):