Dump `Position`s as pformatted dicts for now..
parent
ea42f66b54
commit
1c576d72d1
|
@ -26,6 +26,7 @@ from __future__ import annotations
|
||||||
from contextlib import contextmanager as cm
|
from contextlib import contextmanager as cm
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from math import copysign
|
from math import copysign
|
||||||
|
from pprint import pformat
|
||||||
import re
|
import re
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
|
@ -88,6 +89,9 @@ class Position(Struct):
|
||||||
|
|
||||||
expiry: Optional[datetime] = None
|
expiry: Optional[datetime] = None
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return pformat(self.to_dict())
|
||||||
|
|
||||||
def to_dict(self) -> dict:
|
def to_dict(self) -> dict:
|
||||||
return {
|
return {
|
||||||
f: getattr(self, f)
|
f: getattr(self, f)
|
||||||
|
@ -657,7 +661,7 @@ class PpTable(Struct):
|
||||||
if pp_entries:
|
if pp_entries:
|
||||||
log.info(
|
log.info(
|
||||||
f'Updating ``pps.toml``:\n'
|
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
|
self.conf[self.brokername][self.acctid] = pp_entries
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue