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