Fix zero-pp entry to toml case for new file-per-account format

rekt_pps
Tyler Goodlet 2023-04-10 21:53:48 -04:00
parent 2ed9e40d5e
commit 928765074f
1 changed files with 8 additions and 9 deletions

View File

@ -637,8 +637,8 @@ class PpTable(Struct):
active, closed = self.dump_active()
# ONLY dict-serialize all active positions; those that are closed
# we don't store in the ``pps.toml``.
# ONLY dict-serialize all active positions; those that are
# closed we don't store in the ``pps.toml``.
to_toml_dict = {}
for bs_mktid, pos in active.items():
@ -688,13 +688,12 @@ class PpTable(Struct):
self.conf.update(pp_entries)
elif (
self.brokername in self.conf and
self.acctid in self.conf[self.brokername]
):
del self.conf[self.brokername][self.acctid]
if len(self.conf[self.brokername]) == 0:
del self.conf[self.brokername]
# if there are no active position entries according
# to the toml dump output above, then clear the config
# file of all entries.
elif self.conf:
for entry in list(self.conf):
del self.conf[entry]
# TODO: why tf haven't they already done this for inline
# tables smh..