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
# should not be explicitly required in our generic API.
info: dict = {} # make it frozen?
info: dict | None = None
# TODO?
# _to_dict_skip = {'info'}

View File

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