diff --git a/piker/clearing/__init__.py b/piker/clearing/__init__.py index 06a9212e..bd95a8ab 100644 --- a/piker/clearing/__init__.py +++ b/piker/clearing/__init__.py @@ -18,9 +18,12 @@ Market machinery for order executions, book, management. """ +from ..log import get_logger from ._client import open_ems __all__ = [ 'open_ems', ] + +log = get_logger(__name__) diff --git a/piker/clearing/_client.py b/piker/clearing/_client.py index 7c79c3ea..14c77d54 100644 --- a/piker/clearing/_client.py +++ b/piker/clearing/_client.py @@ -27,8 +27,10 @@ import trio import tractor from tractor.trionics import broadcast_receiver +from ._util import ( + log, # sub-sys logger +) from ..accounting._mktinfo import unpack_fqme -from ..log import get_logger from ..data.types import Struct from ..service import maybe_open_emsd from ._messages import ( @@ -44,9 +46,6 @@ if TYPE_CHECKING: ) -log = get_logger(__name__) - - class OrderBook(Struct): '''EMS-client-side order book ctl and tracking. diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index ffe63292..429c1935 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -41,7 +41,9 @@ import trio from trio_typing import TaskStatus import tractor -from ..log import get_logger +from ._util import ( + log, # sub-sys logger +) from ..data._normalize import iterticks from ..accounting._mktinfo import ( unpack_fqme, @@ -68,9 +70,6 @@ from ._messages import ( ) -log = get_logger(__name__) - - # TODO: numba all of this def mk_check( diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index c4c6108d..0fadfeb6 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -47,7 +47,9 @@ from ..accounting import ( ) from ..data._normalize import iterticks from ..accounting._mktinfo import unpack_fqme -from ..log import get_logger +from ._util import ( + log, # sub-sys logger +) from ._messages import ( BrokerdCancel, BrokerdOrder, @@ -58,8 +60,6 @@ from ._messages import ( BrokerdError, ) -log = get_logger(__name__) - class PaperBoi(Struct): ''' diff --git a/piker/clearing/_util.py b/piker/clearing/_util.py new file mode 100644 index 00000000..ec93512d --- /dev/null +++ b/piker/clearing/_util.py @@ -0,0 +1,33 @@ +# piker: trading gear for hackers +# Copyright (C) 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +""" +Sub-sys module commons. + +""" +from functools import partial + +from ..log import ( + get_logger, + get_console_log, +) +subsys: str = 'piker.clearing' + +log = get_logger(subsys) + +get_console_log = partial( + get_console_log, + name=subsys, +)