Even more...

This commit is contained in:
Mark Veidemanis 2023-08-24 17:55:53 +00:00
parent 3d91fb394a
commit a2f3170ab5
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 8 additions and 0 deletions

View File

@ -41,10 +41,15 @@ class OANDAExchange(BaseExchange):
def get_balance(self, return_usd=False):
r = accounts.AccountSummary(self.account_id)
print("r", r)
response = self.call(r)
print("response", response)
balance = float(response["balance"])
print("balance", balance)
currency = response["currency"]
print("currency", currency)
balance_usd = common.to_currency("sell", self.account, balance, currency, "USD")
print("balance_usd", balance_usd)
common.get_balance_hook(
self.account.user.id,
@ -53,8 +58,11 @@ class OANDAExchange(BaseExchange):
self.account.name,
balance_usd,
)
print("common.get_balance_hook", common.get_balance_hook)
if return_usd:
print("YES return_usd")
return balance_usd
print("NO return_usd")
return balance
def get_market_value(self, symbol):