Fix % format comma separator and empty positions.json parse error
This commit is contained in:
@@ -49,7 +49,10 @@ class Portfolio:
|
||||
if not self._path.exists():
|
||||
return
|
||||
try:
|
||||
data = json.loads(self._path.read_text())
|
||||
content = self._path.read_text().strip()
|
||||
if not content:
|
||||
return
|
||||
data = json.loads(content)
|
||||
self.positions = {pair: Position(**fields) for pair, fields in data.items()}
|
||||
log.info("Loaded %d position(s) from %s", len(self.positions), self._path)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user