Libraries refactor and add some sinks #4
|
@ -684,11 +684,3 @@ class Agora(object):
|
|||
|
||||
self.irc.sendmsg(f"Withdrawal: {rtrn1['success']} | {rtrn2['success']}")
|
||||
self.notify.notify_withdrawal(half_rounded)
|
||||
|
||||
# TODO: move to money
|
||||
def to_usd(self, amount, currency):
|
||||
if currency == "USD":
|
||||
return float(amount)
|
||||
else:
|
||||
rates = self.money.get_rates_all()
|
||||
return float(amount) / rates[currency]
|
||||
|
|
|
@ -70,3 +70,10 @@ class Money(object):
|
|||
min_local = min_usd * rates[currency]
|
||||
max_local = max_usd * rates[currency]
|
||||
return (min_local, max_local)
|
||||
|
||||
def to_usd(self, amount, currency):
|
||||
if currency == "USD":
|
||||
return float(amount)
|
||||
else:
|
||||
rates = self.get_rates_all()
|
||||
return float(amount) / rates[currency]
|
||||
|
|
|
@ -31,11 +31,11 @@ class Notify(object):
|
|||
)
|
||||
|
||||
def notify_new_trade(self, amount, currency):
|
||||
amount_usd = self.agora.to_usd(amount, currency)
|
||||
amount_usd = self.money.to_usd(amount, currency)
|
||||
self.sendmsg(f"Total: {amount_usd}", title="New trade", tags="trades", priority="2")
|
||||
|
||||
def notify_complete_trade(self, amount, currency):
|
||||
amount_usd = self.agora.to_usd(amount, currency)
|
||||
amount_usd = self.money.to_usd(amount, currency)
|
||||
self.sendmsg(f"Total: {amount_usd}", title="Trade complete", tags="trades,profit", priority="3")
|
||||
|
||||
def notify_withdrawal(self, amount_usd):
|
||||
|
|
Loading…
Reference in New Issue