Better empty account console msg styling

basic_buy_bot
Tyler Goodlet 2023-06-16 21:06:28 -04:00
parent 81d5ca9bc2
commit f2c1988536
2 changed files with 13 additions and 8 deletions

View File

@ -121,7 +121,7 @@ class Asset(Struct, frozen=True):
# NOTE: additional info optionally packed in by the backend, but # NOTE: additional info optionally packed in by the backend, but
# should not be explicitly required in our generic API. # should not be explicitly required in our generic API.
info: dict = {} # make it frozen? info: dict | None = None
# TODO? # TODO?
# _to_dict_skip = {'info'} # _to_dict_skip = {'info'}

View File

@ -34,6 +34,7 @@ from ..service import (
open_piker_runtime, open_piker_runtime,
) )
from ..clearing._messages import BrokerdPosition from ..clearing._messages import BrokerdPosition
from ..config import load_ledger
from ..calc import humanize from ..calc import humanize
@ -169,14 +170,18 @@ def sync(
): ):
try: try:
assert len(accounts) == 1 assert len(accounts) == 1
if ( if not pp_msg_table:
not pp_msg_table ld, fpath = load_ledger(brokername, account)
and account == 'paper' assert not ld, f'WTF did we fail to parse ledger:\n{ld}'
):
console.print( console.print(
'[yellow underline]' '[yellow]'
f'No pps found for `{brokername}.paper` account!\n' 'No pps found for '
'Do you even have any paper ledger files?' f'`{brokername}.{account}` '
'account!\n\n'
'[/][underline]'
'None of the following ledger files exist:\n\n[/]'
f'{fpath.as_uri()}\n'
) )
return return