Remove whitespace, uneeded comments

explicit_write_pps_on_exit
jaredgoldman 2023-02-25 16:21:30 -05:00
parent 3a6fbabaf8
commit 3e83764b5b
4 changed files with 9 additions and 5 deletions

View File

@ -1452,6 +1452,7 @@ async def _emsd_main(
brokerd_stream = relay.brokerd_stream
dark_book = _router.get_dark_book(broker)
# signal to client that we're started and deliver
# all known pps and accounts for this ``brokerd``.
await ems_ctx.started((

View File

@ -30,6 +30,7 @@ from typing import (
Callable,
)
import uuid
from bidict import bidict
import pendulum
import trio
@ -249,7 +250,6 @@ class PaperBoi(Struct):
)
await self.ems_trades_stream.send(msg)
# lookup any existing position
key = fqsn.rstrip(f'.{self.broker}')
t = Transaction(
fqsn=fqsn,

View File

@ -33,6 +33,7 @@ from .log import get_logger
log = get_logger('broker-config')
# taken from ``click`` since apparently they have some
# super weirdness with sigint and sudo..no clue
def get_app_dir(app_name, roaming=True, force_posix=False):
@ -92,7 +93,7 @@ def get_app_dir(app_name, roaming=True, force_posix=False):
os.path.expanduser("~/.{}".format(_posixify(app_name))))
if sys.platform == "darwin":
return os.path.join(
os.path.expanduser("~/Los.mkdir(_config_dir)ibrary/Application Support"), app_name
os.path.expanduser("~/Library/Application Support"), app_name
)
return os.path.join(
os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")),

View File

@ -35,7 +35,6 @@ from typing import (
Union,
Generator
)
from typing import Generator
import pendulum
from pendulum import datetime, now
@ -56,6 +55,7 @@ log = get_logger(__name__)
def open_trade_ledger(
broker: str,
account: str,
) -> Generator[dict, None, None]:
'''
Indempotently create and read in a trade log file from the
@ -84,6 +84,7 @@ def open_trade_ledger(
ledger = tomli.load(cf)
print(f'Ledger load took {time.time() - start}s')
cpy = ledger.copy()
try:
yield cpy
finally:
@ -544,6 +545,7 @@ class PpTable(Struct):
pps = self.pps
updated: dict[str, Position] = {}
# lifo update all pps from records
for tid, t in trans.items():
@ -680,6 +682,7 @@ class PpTable(Struct):
# TODO: show diff output?
# https://stackoverflow.com/questions/12956957/print-diff-of-python-dictionaries
print(f'Updating ``pps.toml`` for {path}:\n')
# active, closed_pp_objs = table.dump_active()
pp_entries = self.to_toml()
self.conf[self.brokername][self.acctid] = pp_entries
@ -975,7 +978,6 @@ def open_pps(
pp.ensure_state()
try:
# breakpoint()
yield table
finally:
if write_on_exit: