Fixed account output/reporting.
This commit is contained in:
parent
f596d571f6
commit
aa4406d68f
|
@ -271,7 +271,7 @@ model_state = mango.marketmaking.ModelState(market, latest_account_observer,
|
|||
|
||||
add_file_health("marketmaker_pulse", market_maker.pulse_complete, disposer)
|
||||
|
||||
logging.info("Current assets in account:")
|
||||
logging.info(f"Current assets in account {account.address} (owner: {account.owner}):")
|
||||
mango.TokenValue.report([asset for asset in account.net_assets if asset is not None], logging.info)
|
||||
|
||||
pulse_disposable = rx.interval(args.pulse_interval).subscribe(
|
||||
|
|
|
@ -28,6 +28,7 @@ from .group import Group
|
|||
from .layouts import layouts
|
||||
from .metadata import Metadata
|
||||
from .perpaccount import PerpAccount
|
||||
from .token import Token
|
||||
from .tokenvalue import TokenValue
|
||||
from .version import Version
|
||||
|
||||
|
@ -256,10 +257,11 @@ class Account(AddressableAccount):
|
|||
item_to_update.spot_open_orders = spot_open_orders
|
||||
|
||||
def __str__(self) -> str:
|
||||
shared_quote_token: str = f"{self.shared_quote_token}".replace("\n", "\n ")
|
||||
basket_count = len(self.basket)
|
||||
basket = "\n ".join([f"{item}".replace("\n", "\n ") for item in self.basket])
|
||||
|
||||
tokens_in_basket = Account._map_sequence_to_basket_indices(
|
||||
tokens_in_basket: typing.Sequence[typing.Optional[Token]] = Account._map_sequence_to_basket_indices(
|
||||
self.basket, self.basket_indices, lambda item: item.token_info.token)
|
||||
symbols_in_basket = list([tok.symbol for tok in tokens_in_basket if tok is not None])
|
||||
in_margin_basket = ", ".join(symbols_in_basket) or "None"
|
||||
|
@ -270,6 +272,8 @@ class Account(AddressableAccount):
|
|||
MSRM: {self.msrm_amount}
|
||||
Bankrupt? {self.is_bankrupt}
|
||||
Being Liquidated? {self.being_liquidated}
|
||||
Shared Quote Token:
|
||||
{shared_quote_token}
|
||||
In Basket: {in_margin_basket}
|
||||
Basket [{basket_count} in basket]:
|
||||
{basket}
|
||||
|
|
|
@ -50,7 +50,7 @@ class PerpAccount:
|
|||
return PerpAccount(base_position, quote_position, long_settled_funding, short_settled_funding, mngo_accrued, open_orders)
|
||||
|
||||
def __str__(self) -> str:
|
||||
if self.base_position == Decimal(0) and self.quote_position == Decimal(0) and self.long_settled_funding == Decimal(0) and self.short_settled_funding == Decimal(0) and self.mngo_accrued == Decimal(0) and self.open_orders.free_slot_bits == 0xFFFFFFFF:
|
||||
if self.base_position == Decimal(0) and self.quote_position == Decimal(0) and self.long_settled_funding == Decimal(0) and self.short_settled_funding == Decimal(0) and self.mngo_accrued.value == Decimal(0) and self.open_orders.free_slot_bits == 0xFFFFFFFF:
|
||||
return "« 𝙿𝚎𝚛𝚙𝙰𝚌𝚌𝚘𝚞𝚗𝚝 (empty) »"
|
||||
open_orders = f"{self.open_orders}".replace("\n", "\n ")
|
||||
return f"""« 𝙿𝚎𝚛𝚙𝙰𝚌𝚌𝚘𝚞𝚗𝚝
|
||||
|
|
Loading…
Reference in New Issue