Fix price extraction bug and remove debugging statements

This commit is contained in:
2023-08-26 11:05:28 +00:00
parent cd32dff779
commit e10c6f5c46
6 changed files with 10 additions and 25 deletions

View File

@@ -12,8 +12,6 @@ def get_balance_hook(user_id, user_name, account_id, account_name, balance):
Called every time the balance is fetched on an account.
Store this into Elasticsearch.
"""
print("get_balance_hook start")
print("PARAMS", user_id, user_name, account_id, account_name, balance)
store_msg(
"balances",
{
@@ -24,7 +22,6 @@ def get_balance_hook(user_id, user_name, account_id, account_name, balance):
"balance": balance,
},
)
print("get_balance_hook end")
def get_pair(account, base, quote, invert=False):

View File

@@ -41,15 +41,10 @@ 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,
@@ -58,11 +53,8 @@ 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):