From beb6544bad60ad263873660bf5dc591568d9b17c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 10 Mar 2023 16:42:37 -0500 Subject: [PATCH] Start a new `.accounting` subpkg, move `.pp` contents there --- piker/{pp.py => accounting/__init__.py} | 13 +++++++------ piker/brokers/ib/broker.py | 2 +- piker/brokers/kraken/api.py | 2 +- piker/brokers/kraken/broker.py | 2 +- piker/clearing/_allocate.py | 2 +- piker/clearing/_paper_engine.py | 4 +--- piker/ui/_position.py | 2 +- piker/ui/order_mode.py | 2 +- tests/test_paper.py | 2 +- 9 files changed, 15 insertions(+), 16 deletions(-) rename piker/{pp.py => accounting/__init__.py} (99%) diff --git a/piker/pp.py b/piker/accounting/__init__.py similarity index 99% rename from piker/pp.py rename to piker/accounting/__init__.py index 5b2a8ce6..cc8af877 100644 --- a/piker/pp.py +++ b/piker/accounting/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + ''' Personal/Private position parsing, calculating, summarizing in a way that doesn't try to cuk most humans who prefer to not lose their moneys.. @@ -41,12 +42,12 @@ from pendulum import datetime, now import tomli import toml -from . import config -from .brokers import get_brokermod -from .clearing._messages import BrokerdPosition, Status -from .data._source import Symbol, unpack_fqsn -from .log import get_logger -from .data.types import Struct +from .. import config +from ..brokers import get_brokermod +from ..clearing._messages import BrokerdPosition, Status +from ..data._source import Symbol, unpack_fqsn +from ..data.types import Struct +from ..log import get_logger log = get_logger(__name__) diff --git a/piker/brokers/ib/broker.py b/piker/brokers/ib/broker.py index 56756a76..d5b7571e 100644 --- a/piker/brokers/ib/broker.py +++ b/piker/brokers/ib/broker.py @@ -51,7 +51,7 @@ from ib_insync.objects import Position as IbPosition import pendulum from piker import config -from piker.pp import ( +from piker.accounting import ( Position, Transaction, open_trade_ledger, diff --git a/piker/brokers/kraken/api.py b/piker/brokers/kraken/api.py index e99e6b83..74ad734b 100644 --- a/piker/brokers/kraken/api.py +++ b/piker/brokers/kraken/api.py @@ -49,7 +49,7 @@ from piker.brokers._util import ( BrokerError, DataThrottle, ) -from piker.pp import Transaction +from piker.accounting import Transaction from . import log # // diff --git a/piker/brokers/kraken/broker.py b/piker/brokers/kraken/broker.py index 106ff61a..5d1bbb01 100644 --- a/piker/brokers/kraken/broker.py +++ b/piker/brokers/kraken/broker.py @@ -40,7 +40,7 @@ import pendulum import trio import tractor -from piker.pp import ( +from piker.accounting import ( Position, PpTable, Transaction, diff --git a/piker/clearing/_allocate.py b/piker/clearing/_allocate.py index d201368d..c457de05 100644 --- a/piker/clearing/_allocate.py +++ b/piker/clearing/_allocate.py @@ -25,7 +25,7 @@ from bidict import bidict from ..data._source import Symbol from ..data.types import Struct -from ..pp import Position +from ..accounting import Position _size_units = bidict({ diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index 7a093ad4..39d5a474 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -39,7 +39,7 @@ import tractor from .. import data from ..data.types import Struct from ..data._source import Symbol -from ..pp import ( +from ..accounting import ( Position, Transaction, open_trade_ledger, @@ -58,8 +58,6 @@ from ._messages import ( BrokerdError, ) -from ..config import load - log = get_logger(__name__) diff --git a/piker/ui/_position.py b/piker/ui/_position.py index 41421fb6..3574dd2d 100644 --- a/piker/ui/_position.py +++ b/piker/ui/_position.py @@ -46,7 +46,7 @@ from ..calc import ( puterize, ) from ..clearing._allocate import Allocator -from ..pp import Position +from ..accounting import Position from ..data._normalize import iterticks from ..data.feed import ( Feed, diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index cf5f53b1..bf60c0e6 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -36,7 +36,7 @@ import trio from PyQt5.QtCore import Qt from .. import config -from ..pp import Position +from ..accounting import Position from ..clearing._client import open_ems, OrderBook from ..clearing._allocate import ( mk_allocator, diff --git a/tests/test_paper.py b/tests/test_paper.py index 53e03f47..2f46c559 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -16,7 +16,7 @@ from functools import partial from piker.log import get_logger from piker.clearing._messages import Order -from piker.pp import ( +from piker.accounting import ( open_pps, )