Refactor and add base USD and withdrawal triggers
This commit is contained in:
@@ -3,7 +3,6 @@ from pyotp import TOTP
|
||||
|
||||
from core.clients.base import BaseClient
|
||||
from core.clients.platform import LocalPlatformClient
|
||||
from core.lib.money import Money
|
||||
|
||||
|
||||
class AgoraClient(LocalPlatformClient, BaseClient):
|
||||
@@ -57,7 +56,7 @@ class AgoraClient(LocalPlatformClient, BaseClient):
|
||||
return False
|
||||
# total_usd += total_trades_usd
|
||||
|
||||
profit_usd = total_usd - float(settings.Money.BaseUSD)
|
||||
profit_usd = total_usd - self.instance.base_usd
|
||||
# Get the XMR -> USD exchange rate
|
||||
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
||||
|
||||
@@ -85,7 +84,7 @@ class AgoraClient(LocalPlatformClient, BaseClient):
|
||||
self.ux.notify.notify_need_topup(profit_usd_in_xmr)
|
||||
return
|
||||
|
||||
if not profit_usd >= float(settings.Money.WithdrawLimit):
|
||||
if not profit_usd >= self.instance.withdrawal_trigger:
|
||||
# Not enough profit to withdraw
|
||||
return
|
||||
|
||||
@@ -106,15 +105,16 @@ class AgoraClient(LocalPlatformClient, BaseClient):
|
||||
send_cast = {
|
||||
"address": None,
|
||||
"amount": half_rounded,
|
||||
"password": settings.Agora.Pass,
|
||||
"password": self.instance.password,
|
||||
"otp": otp_code.now(),
|
||||
}
|
||||
|
||||
send_cast["address"] = settings.XMR.Wallet1
|
||||
rtrn1 = await self.api.wallet_send_xmr(**send_cast)
|
||||
return # TODO
|
||||
# send_cast["address"] = settings.XMR.Wallet1
|
||||
# rtrn1 = await self.api.wallet_send_xmr(**send_cast)
|
||||
|
||||
send_cast["address"] = settings.XMR.Wallet2
|
||||
rtrn2 = await self.api.wallet_send_xmr(**send_cast)
|
||||
# send_cast["address"] = settings.XMR.Wallet2
|
||||
# rtrn2 = await self.api.wallet_send_xmr(**send_cast)
|
||||
|
||||
self.irc.sendmsg(f"Withdrawal: {rtrn1['success']} | {rtrn2['success']}")
|
||||
self.ux.notify.notify_withdrawal(half_rounded)
|
||||
# self.irc.sendmsg(f"Withdrawal: {rtrn1['success']} | {rtrn2['success']}")
|
||||
# self.ux.notify.notify_withdrawal(half_rounded)
|
||||
|
||||
Reference in New Issue
Block a user