Dump `Position`s as pformatted dicts for now..

rekt_pps
Tyler Goodlet 2023-03-22 13:22:24 -04:00
parent ea42f66b54
commit 1c576d72d1
1 changed files with 5 additions and 1 deletions

View File

@ -26,6 +26,7 @@ from __future__ import annotations
from contextlib import contextmanager as cm
from decimal import Decimal
from math import copysign
from pprint import pformat
import re
from typing import (
Any,
@ -88,6 +89,9 @@ class Position(Struct):
expiry: Optional[datetime] = None
def __repr__(self) -> str:
return pformat(self.to_dict())
def to_dict(self) -> dict:
return {
f: getattr(self, f)
@ -657,7 +661,7 @@ class PpTable(Struct):
if pp_entries:
log.info(
f'Updating ``pps.toml``:\n'
f'Current positions:\n{pp_entries}'
f'Current positions:\n{pformat(pp_entries)}'
)
self.conf[self.brokername][self.acctid] = pp_entries