|
|
|
@ -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):
|
|
|
|
|