Fix getting all profit variables

This commit is contained in:
2023-03-11 11:45:24 +00:00
parent 1c0cbba855
commit be9f9e7363
3 changed files with 167 additions and 160 deletions

View File

@@ -24,13 +24,29 @@ log = logs.get_logger(__name__)
class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
context_object_name_singular = "profit"
context_object_name = "profit"
page_title = "Profit info (USD)"
# detail_template = "partials/profit-info.html"
def get_object(self, **kwargs):
res = synchronize_async_helper(money.check_all(user=self.request.user, nordigen=NordigenClient, agora=AgoraClient))
print("RES", res)
results = {
"Bank balance total (USD)": res["total"]["total_sinks_usd"],
"Platform balance total (USD)": res["total"]["total_usd_agora"],
"Sum of above": res["total"]["total_sinks_usd"] + res["total"]["total_usd_agora"],
"Bank balance total": res["total_sinks_usd"],
"Platform balance total": res["total_usd_agora"],
"Open trade value": res["open_trade_value"],
"Total": res["total_with_trades"],
"Profit": res["total_profit"],
"Remaining before withdrawal": res["total_remaining"],
"Total (without open trades)": res["total_usd"],
"Profit (without open trades)": res["profit"],
"Remaining before withdrawal (without open trades)": res["remaining"],
"Base balance required": res["total_base_usd"],
"Amount above base balance to trigger withdrawal":
res["total_withdrawal_limit"],
"Withdrawal trigger": res["withdraw_threshold"],
}
return results