Add some comments to Transactions
This commit is contained in:
parent
4ff6875638
commit
6418c5ecca
|
@ -78,10 +78,12 @@ class Transactions(object):
|
||||||
self.irc.client.msg(
|
self.irc.client.msg(
|
||||||
self.irc.client.channel, f"AUTO Incoming transaction: {amount}{currency} ({reference}) - {state} - {description}"
|
self.irc.client.channel, f"AUTO Incoming transaction: {amount}{currency} ({reference}) - {state} - {description}"
|
||||||
)
|
)
|
||||||
|
# Try getting the trade by the reference ID given
|
||||||
stored_trade = self.get_ref(reference)
|
stored_trade = self.get_ref(reference)
|
||||||
if not stored_trade:
|
if not stored_trade:
|
||||||
self.log.info(f"No reference in DB for {reference}")
|
self.log.info(f"No reference in DB for {reference}")
|
||||||
self.irc.client.msg(self.irc.client.channel, f"No reference in DB for {reference}")
|
self.irc.client.msg(self.irc.client.channel, f"No reference in DB for {reference}")
|
||||||
|
# Try getting the trade by the reference, using it as a TXID
|
||||||
ref2 = self.tx_to_ref(reference)
|
ref2 = self.tx_to_ref(reference)
|
||||||
if not ref2:
|
if not ref2:
|
||||||
self.log.info("No TXID in DB for {reference}")
|
self.log.info("No TXID in DB for {reference}")
|
||||||
|
@ -92,9 +94,13 @@ class Transactions(object):
|
||||||
|
|
||||||
amount = float(amount)
|
amount = float(amount)
|
||||||
stored_trade["amount"] = float(stored_trade["amount"])
|
stored_trade["amount"] = float(stored_trade["amount"])
|
||||||
|
|
||||||
|
# Make sure it was sent in the expected currency
|
||||||
if not stored_trade["currency"] == currency:
|
if not stored_trade["currency"] == currency:
|
||||||
self.irc.client.msg(self.irc.client.channel, f"Currency mismatch, Agora: {stored_trade['currency']} / Revolut: {currency}")
|
self.irc.client.msg(self.irc.client.channel, f"Currency mismatch, Agora: {stored_trade['currency']} / Revolut: {currency}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Make sure the expected amount was sent
|
||||||
if not stored_trade["amount"] == amount:
|
if not stored_trade["amount"] == amount:
|
||||||
# If the amount does not match exactly, get the min and max values for our given acceptable margins for trades
|
# If the amount does not match exactly, get the min and max values for our given acceptable margins for trades
|
||||||
min_amount, max_amount = self.agora.get_acceptable_margins(currency, amount)
|
min_amount, max_amount = self.agora.get_acceptable_margins(currency, amount)
|
||||||
|
@ -107,6 +113,7 @@ class Transactions(object):
|
||||||
f"Amount mismatch - not in margins: {stored_trade['amount']} (min: {min_amount} / max: {max_amount}",
|
f"Amount mismatch - not in margins: {stored_trade['amount']} (min: {min_amount} / max: {max_amount}",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
# Make sure the account type was Revolut, as these are completed instantly
|
||||||
if not account_type == "revolut":
|
if not account_type == "revolut":
|
||||||
self.irc.client.msg(self.irc.client.channel, f"Account type is not Revolut: {account_type}")
|
self.irc.client.msg(self.irc.client.channel, f"Account type is not Revolut: {account_type}")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue