Skip to content

Commit

Permalink
Merge pull request #443 from NelsonDane/deepsource-transform-55e71f82
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonDane authored Nov 23, 2024
2 parents c8a3321 + f8923b6 commit 3dc1018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions autoRSA.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ def fun_run(orderObj: stockOrder, command, botObj=None, loop=None):
)
# Add to total sum
totalValue += sum(
account["total"] for account in orderObj.get_logged_in(broker).get_account_totals().values()
account["total"]
for account in orderObj.get_logged_in(broker)
.get_account_totals()
.values()
)
except Exception as ex:
print(traceback.format_exc())
Expand All @@ -208,7 +211,9 @@ def fun_run(orderObj: stockOrder, command, botObj=None, loop=None):

# Print final total value and closing message
if "_holdings" in command:
printAndDiscord(f"Total Value of All Accounts: ${format(totalValue, '0.2f')}", loop)
printAndDiscord(
f"Total Value of All Accounts: ${format(totalValue, '0.2f')}", loop
)
printAndDiscord("All commands complete in all brokers", loop)
else:
print(f"Error: {command} is not a valid command")
Expand Down
4 changes: 3 additions & 1 deletion helperAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ def set_account_totals(self, parent_name: str, account_name: str, total: float):
self.__account_totals[parent_name] = {}
self.__account_totals[parent_name][account_name] = round(float(total), 2)
self.__account_totals[parent_name]["total"] = sum(
value for key, value in self.__account_totals[parent_name].items() if key != "total"
value
for key, value in self.__account_totals[parent_name].items()
if key != "total"
)

def set_account_type(self, parent_name: str, account_name: str, account_type: str):
Expand Down

0 comments on commit 3dc1018

Please sign in to comment.