2021-12-28 12:50:19 +00:00
|
|
|
# Other library imports
|
2022-01-23 17:07:53 +00:00
|
|
|
from json import dumps, loads
|
2021-12-28 12:50:19 +00:00
|
|
|
|
2022-01-23 17:07:53 +00:00
|
|
|
# Project imports
|
|
|
|
from settings import settings
|
2021-12-28 12:50:19 +00:00
|
|
|
|
2022-01-25 11:48:12 +00:00
|
|
|
|
2021-12-28 12:50:19 +00:00
|
|
|
class IRCCommands(object):
|
|
|
|
class trades(object):
|
|
|
|
name = "trades"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Get all open trades."
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
"""
|
|
|
|
Get details of open trades and post on IRC.
|
|
|
|
"""
|
2021-12-31 18:21:27 +00:00
|
|
|
# Send IRC - we don't want to automatically send messages on IRC, even though
|
|
|
|
# this variable seems counter-intuitive here, we are doing something with the result
|
|
|
|
# then calling msg() ourselves, and we don't want extra spam in the channel.
|
2022-01-09 22:11:39 +00:00
|
|
|
trades = agora.get_dashboard()
|
2021-12-28 12:50:19 +00:00
|
|
|
if not trades:
|
|
|
|
msg("No open trades.")
|
2021-12-28 14:10:05 +00:00
|
|
|
return
|
2021-12-28 12:50:19 +00:00
|
|
|
for trade_id in trades:
|
|
|
|
msg(trade_id)
|
|
|
|
|
|
|
|
class create(object):
|
|
|
|
name = "create"
|
|
|
|
authed = True
|
2022-02-13 09:56:22 +00:00
|
|
|
helptext = "Create an ad. Usage: create <XMR/BTC> <country> <currency> [<provider>]"
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
"""
|
|
|
|
Post an ad on AgoraDesk with the given country and currency code.
|
|
|
|
"""
|
2022-01-21 13:54:47 +00:00
|
|
|
if length == 4:
|
|
|
|
if spl[1] not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
2022-01-29 08:25:50 +00:00
|
|
|
posted = agora.create_ad(spl[1], spl[2], spl[3], "REVOLUT")
|
2022-01-21 13:54:47 +00:00
|
|
|
if posted["success"]:
|
|
|
|
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
|
|
|
else:
|
|
|
|
msg(dumps(posted["response"]))
|
2022-02-13 09:56:22 +00:00
|
|
|
elif length == 5:
|
|
|
|
if spl[1] not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
|
|
|
if spl[4] not in loads(settings.Agora.ProviderList):
|
|
|
|
msg(f"Not a valid provider: {spl[4]}")
|
|
|
|
return
|
|
|
|
posted = agora.create_ad(spl[1], spl[2], spl[3], spl[4])
|
|
|
|
if posted["success"]:
|
|
|
|
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
|
|
|
else:
|
|
|
|
msg(dumps(posted["response"]))
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
class messages(object):
|
|
|
|
name = "messages"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Get messages. Usage: messages [<reference>]"
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
"""
|
|
|
|
Get all messages for all open trades or a given trade.
|
|
|
|
"""
|
|
|
|
if length == 1:
|
2021-12-30 22:41:28 +00:00
|
|
|
messages = agora.get_recent_messages()
|
2021-12-28 14:10:05 +00:00
|
|
|
if messages is False:
|
|
|
|
msg("Error getting messages.")
|
|
|
|
return
|
2021-12-28 12:50:19 +00:00
|
|
|
if not messages:
|
|
|
|
msg("No messages.")
|
2021-12-28 14:10:05 +00:00
|
|
|
return
|
2021-12-30 22:41:28 +00:00
|
|
|
for reference in messages:
|
|
|
|
for message in messages[reference]:
|
|
|
|
msg(f"{reference}: {message[0]} {message[1]}")
|
2021-12-28 12:50:19 +00:00
|
|
|
msg("---")
|
|
|
|
|
|
|
|
elif length == 2:
|
2021-12-30 14:15:34 +00:00
|
|
|
tx = tx.ref_to_tx(spl[1])
|
|
|
|
if not tx:
|
|
|
|
msg(f"No such reference: {spl[1]}")
|
|
|
|
return
|
2021-12-28 12:50:19 +00:00
|
|
|
messages = agora.get_messages(spl[1], send_irc=False)
|
|
|
|
if not messages:
|
|
|
|
msg("No messages.")
|
|
|
|
for message in messages:
|
|
|
|
msg(f"{spl[1]}: {message}")
|
|
|
|
|
|
|
|
class dist(object):
|
|
|
|
name = "dist"
|
|
|
|
authed = True
|
2022-02-15 21:30:16 +00:00
|
|
|
helptext = "Distribute all our chosen currency and country ad pairs. Usage: dist [<XMR/BTC>]"
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
# Distribute out our ad to all countries in the config
|
2022-02-15 21:30:16 +00:00
|
|
|
if length == 2:
|
|
|
|
asset = spl[1]
|
|
|
|
if asset not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
|
|
|
for x in agora.dist_countries(filter_asset=asset):
|
|
|
|
if x["success"]:
|
|
|
|
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
|
|
|
else:
|
|
|
|
msg(dumps(x["response"]))
|
|
|
|
elif length == 1:
|
|
|
|
for x in agora.dist_countries():
|
|
|
|
if x["success"]:
|
|
|
|
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
|
|
|
else:
|
|
|
|
msg(dumps(x["response"]))
|
2021-12-28 12:50:19 +00:00
|
|
|
|
2022-02-01 20:50:08 +00:00
|
|
|
class redist(object):
|
|
|
|
name = "redist"
|
|
|
|
authed = True
|
|
|
|
helptext = "Update all ads with details."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
for x in agora.redist_countries():
|
2022-02-02 12:53:05 +00:00
|
|
|
if x[0]["success"]:
|
2022-02-01 20:50:08 +00:00
|
|
|
msg(f"{x[0]['response']['data']['message']}: {x[1]}")
|
|
|
|
else:
|
2022-02-02 12:53:05 +00:00
|
|
|
msg(dumps(x[0]["response"]))
|
2021-12-31 00:39:52 +00:00
|
|
|
|
|
|
|
class stripdupes(object):
|
|
|
|
name = "stripdupes"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Remove all duplicate adverts."
|
2021-12-31 00:39:52 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-31 00:39:52 +00:00
|
|
|
rtrn = agora.strip_duplicate_ads()
|
|
|
|
msg(dumps(rtrn))
|
2021-12-30 22:41:28 +00:00
|
|
|
|
2021-12-28 12:50:19 +00:00
|
|
|
class accounts(object):
|
|
|
|
name = "accounts"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Get all account information from Revolut."
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
accounts = revolut.accounts()
|
2021-12-28 14:10:05 +00:00
|
|
|
accounts_posted = 0
|
|
|
|
if accounts is None:
|
|
|
|
msg("Error getting accounts.")
|
2021-12-28 12:50:19 +00:00
|
|
|
for account in accounts:
|
|
|
|
if account["balance"] > 0:
|
2021-12-29 14:25:07 +00:00
|
|
|
if "name" in account:
|
|
|
|
name = account["name"]
|
|
|
|
else:
|
|
|
|
name = "not_set"
|
|
|
|
msg(f"{name} {account['currency']}: {account['balance']}")
|
2021-12-28 14:10:05 +00:00
|
|
|
accounts_posted += 1
|
|
|
|
if accounts_posted == 0:
|
|
|
|
msg("No accounts with balances.")
|
2021-12-28 12:50:19 +00:00
|
|
|
|
2022-01-12 19:56:08 +00:00
|
|
|
class balance(object):
|
|
|
|
name = "balance"
|
2021-12-28 12:50:19 +00:00
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Get total account balance from Revolut in USD."
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 12:50:19 +00:00
|
|
|
total_usd = revolut.get_total_usd()
|
2021-12-28 15:28:56 +00:00
|
|
|
if total_usd is False:
|
2021-12-28 12:50:19 +00:00
|
|
|
msg("Error getting total balance.")
|
|
|
|
msg(f"Total: {round(total_usd, 2)}USD")
|
|
|
|
|
2022-01-12 19:56:08 +00:00
|
|
|
class total(object):
|
|
|
|
name = "total"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get total account balance from Revolut and Agora."
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-25 17:54:42 +00:00
|
|
|
totals_all = tx.get_total()
|
|
|
|
totals = totals_all[0]
|
|
|
|
wallets = totals_all[1]
|
|
|
|
msg(f"Totals: SEK: {totals[0]} | USD: {totals[1]} | GBP: {totals[2]}")
|
|
|
|
msg(f"Wallets: XMR USD: {wallets[0]} | BTC USD: {wallets[1]}")
|
2022-01-12 19:56:08 +00:00
|
|
|
|
2021-12-28 12:50:19 +00:00
|
|
|
class ping(object):
|
|
|
|
name = "ping"
|
|
|
|
authed = False
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Pong!"
|
2021-12-28 12:50:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg):
|
|
|
|
msg("Pong!")
|
2021-12-28 13:41:48 +00:00
|
|
|
|
2022-01-27 19:12:15 +00:00
|
|
|
class summon(object):
|
|
|
|
name = "summon"
|
|
|
|
authed = True
|
|
|
|
helptext = "Summon all operators."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
notify.sendmsg("You have been summoned!")
|
|
|
|
|
2021-12-28 15:28:56 +00:00
|
|
|
class message(object):
|
|
|
|
name = "msg"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Send a message on a trade. Usage: msg <reference> <message...>"
|
2021-12-28 15:28:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 15:28:56 +00:00
|
|
|
if length > 2:
|
|
|
|
full_msg = " ".join(spl[2:])
|
2021-12-29 14:49:29 +00:00
|
|
|
reference = tx.ref_to_tx(spl[1])
|
|
|
|
if not reference:
|
|
|
|
msg(f"No such reference: {spl[1]}")
|
|
|
|
return
|
|
|
|
rtrn = agora.agora.contact_message_post(reference, full_msg)
|
|
|
|
msg(f"Sent {full_msg} to {reference}: {rtrn}")
|
2021-12-28 23:57:25 +00:00
|
|
|
|
|
|
|
class refs(object):
|
|
|
|
name = "refs"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "List all references"
|
2021-12-28 23:57:25 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 23:57:25 +00:00
|
|
|
msg(f"References: {', '.join(tx.get_refs())}")
|
|
|
|
|
|
|
|
class ref(object):
|
|
|
|
name = "ref"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Get more information about a reference. Usage: ref <reference>"
|
2021-12-28 23:57:25 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 23:57:25 +00:00
|
|
|
if length == 2:
|
|
|
|
ref_data = tx.get_ref(spl[1])
|
|
|
|
if not ref_data:
|
2021-12-29 14:49:29 +00:00
|
|
|
msg(f"No such reference: {spl[1]}")
|
|
|
|
return
|
2021-12-28 23:57:25 +00:00
|
|
|
msg(f"{spl[1]}: {dumps(ref_data)}")
|
|
|
|
|
|
|
|
class delete(object):
|
|
|
|
name = "del"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Delete a reference. Usage: del <reference>"
|
2021-12-28 23:57:25 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-28 23:57:25 +00:00
|
|
|
if length == 2:
|
|
|
|
ref_data = tx.get_ref(spl[1])
|
|
|
|
if not ref_data:
|
|
|
|
msg(f"No such reference: {spl[1]}")
|
|
|
|
return
|
|
|
|
tx.del_ref(spl[1])
|
|
|
|
msg(f"Deleted reference: {spl[1]}")
|
2021-12-29 19:21:27 +00:00
|
|
|
|
|
|
|
class release(object):
|
|
|
|
name = "release"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Release funds for a trade. Usage: release <reference>"
|
2021-12-29 19:21:27 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-29 19:21:27 +00:00
|
|
|
if length == 2:
|
|
|
|
tx = tx.ref_to_tx(spl[1])
|
|
|
|
if not tx:
|
|
|
|
msg(f"No such reference: {spl[1]}")
|
|
|
|
return
|
|
|
|
rtrn = agora.release_funds(tx)
|
2022-01-20 14:48:14 +00:00
|
|
|
message = rtrn["message"]
|
|
|
|
message_long = rtrn["response"]["data"]["message"]
|
|
|
|
msg(f"{message} - {message_long}")
|
2021-12-30 14:15:34 +00:00
|
|
|
|
|
|
|
class nuke(object):
|
|
|
|
name = "nuke"
|
|
|
|
authed = True
|
2021-12-31 00:51:43 +00:00
|
|
|
helptext = "Delete all our adverts."
|
2021-12-30 14:15:34 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2021-12-30 14:15:34 +00:00
|
|
|
rtrn = agora.nuke_ads()
|
|
|
|
msg(dumps(rtrn))
|
2021-12-30 22:41:28 +00:00
|
|
|
|
|
|
|
class wallet(object):
|
|
|
|
name = "wallet"
|
|
|
|
authed = True
|
2022-01-21 13:54:47 +00:00
|
|
|
helptext = "Get Agora wallet balances."
|
2021-12-30 22:41:28 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-21 13:54:47 +00:00
|
|
|
rtrn_xmr = agora.agora.wallet_balance_xmr()
|
|
|
|
if not rtrn_xmr["success"]:
|
|
|
|
msg("Error getting XMR wallet details.")
|
|
|
|
return
|
|
|
|
rtrn_btc = agora.agora.wallet_balance()
|
|
|
|
if not rtrn_btc["success"]:
|
|
|
|
msg("Error getting BTC wallet details.")
|
2021-12-30 22:41:28 +00:00
|
|
|
return
|
2022-01-21 13:54:47 +00:00
|
|
|
balance_xmr = rtrn_xmr["response"]["data"]["total"]["balance"]
|
|
|
|
balance_btc = rtrn_btc["response"]["data"]["total"]["balance"]
|
|
|
|
msg(f"XMR wallet balance: {balance_xmr}")
|
|
|
|
msg(f"BTC wallet balance: {balance_btc}")
|
2022-01-09 14:34:37 +00:00
|
|
|
|
|
|
|
class pubads(object):
|
|
|
|
name = "pubads"
|
|
|
|
authed = True
|
2022-02-09 14:57:11 +00:00
|
|
|
helptext = "View public adverts. Usage: pubads <XMR/BTC> <currency> [<provider,...>]"
|
2022-01-09 14:34:37 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-25 11:48:12 +00:00
|
|
|
if length == 3:
|
|
|
|
asset = spl[1]
|
|
|
|
if asset not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
|
|
|
currency = spl[2]
|
2022-02-13 09:56:22 +00:00
|
|
|
rtrn = agora.get_all_public_ads(assets=[asset], currencies=[currency])
|
|
|
|
if not rtrn:
|
|
|
|
msg("No results.")
|
|
|
|
return
|
2022-02-12 15:12:52 +00:00
|
|
|
for ad in rtrn[currency]:
|
|
|
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
2022-01-29 09:02:27 +00:00
|
|
|
elif length == 4:
|
|
|
|
asset = spl[1]
|
|
|
|
if asset not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
|
|
|
providers = spl[3].split(",")
|
|
|
|
currency = spl[2]
|
2022-02-13 09:56:22 +00:00
|
|
|
rtrn = agora.get_all_public_ads(assets=[asset], currencies=[currency], providers=providers)
|
|
|
|
if not rtrn:
|
|
|
|
msg("No results.")
|
|
|
|
return
|
2022-02-12 15:12:52 +00:00
|
|
|
for ad in rtrn[currency]:
|
|
|
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
2022-01-09 14:34:37 +00:00
|
|
|
|
|
|
|
class cheat(object):
|
|
|
|
name = "cheat"
|
|
|
|
authed = True
|
2022-01-25 11:48:12 +00:00
|
|
|
helptext = "Cheat the markets by manipulating our prices to exploit people. Usage: cheat [<XMR/BTC>]"
|
2022-01-09 14:34:37 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-25 11:48:12 +00:00
|
|
|
if length == 1:
|
2022-02-09 09:01:18 +00:00
|
|
|
agora.run_cheat_in_thread()
|
2022-01-25 11:48:12 +00:00
|
|
|
msg("Running cheat in thread.")
|
|
|
|
elif length == 2:
|
|
|
|
asset = spl[1]
|
|
|
|
if asset not in loads(settings.Agora.AssetList):
|
|
|
|
msg(f"Not a valid asset: {spl[1]}")
|
|
|
|
return
|
2022-02-09 09:01:18 +00:00
|
|
|
agora.run_cheat_in_thread([asset])
|
2022-01-25 11:48:12 +00:00
|
|
|
msg(f"Running cheat in thread for {asset}.")
|
2022-01-09 14:34:37 +00:00
|
|
|
|
2022-01-27 16:52:32 +00:00
|
|
|
class cheatnext(object):
|
|
|
|
name = "cheatnext"
|
|
|
|
authed = True
|
|
|
|
helptext = "Run the next currency for cheat."
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-27 16:52:32 +00:00
|
|
|
if length == 1:
|
2022-02-09 14:57:11 +00:00
|
|
|
asset = agora.run_cheat_in_thread()
|
2022-01-27 16:52:32 +00:00
|
|
|
msg(f"Running next asset for cheat in thread: {asset}")
|
|
|
|
|
2022-01-09 14:34:37 +00:00
|
|
|
class ads(object):
|
|
|
|
name = "ads"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get all our ad regions"
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-09 14:34:37 +00:00
|
|
|
ads = agora.enum_ads()
|
|
|
|
for ad in ads:
|
2022-01-29 09:02:27 +00:00
|
|
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]}")
|
2022-01-12 19:56:08 +00:00
|
|
|
|
|
|
|
class xmr(object):
|
|
|
|
name = "xmr"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get current XMR price."
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-12 19:56:08 +00:00
|
|
|
xmr_prices = agora.cg.get_price(ids="monero", vs_currencies=["sek", "usd", "gbp"])
|
|
|
|
price_sek = xmr_prices["monero"]["sek"]
|
|
|
|
price_usd = xmr_prices["monero"]["usd"]
|
|
|
|
price_gbp = xmr_prices["monero"]["gbp"]
|
|
|
|
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
|
|
|
|
|
|
|
class btc(object):
|
|
|
|
name = "btc"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get current BTC price."
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-12 19:56:08 +00:00
|
|
|
xmr_prices = agora.cg.get_price(ids="bitcoin", vs_currencies=["sek", "usd", "gbp"])
|
|
|
|
price_sek = xmr_prices["bitcoin"]["sek"]
|
|
|
|
price_usd = xmr_prices["bitcoin"]["usd"]
|
|
|
|
price_gbp = xmr_prices["bitcoin"]["gbp"]
|
|
|
|
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
2022-01-25 17:54:42 +00:00
|
|
|
|
|
|
|
class withdraw(object):
|
|
|
|
name = "withdraw"
|
|
|
|
authed = True
|
|
|
|
helptext = "Take profit."
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-25 18:57:35 +00:00
|
|
|
agora.withdraw_funds()
|
2022-01-25 20:01:22 +00:00
|
|
|
|
|
|
|
class shuffle(object):
|
|
|
|
name = "shuffle"
|
|
|
|
authed = True
|
|
|
|
helptext = "Convert all currencies in Revolut to supplied one. Usage: shuffle <currency>"
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-27 19:12:15 +00:00
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
2022-01-25 20:01:22 +00:00
|
|
|
if length == 2:
|
|
|
|
currency = spl[1]
|
|
|
|
rtrn = revolut.shuffle(currency)
|
|
|
|
msg(dumps(rtrn))
|
2022-01-31 11:32:47 +00:00
|
|
|
|
|
|
|
class remaining(object):
|
|
|
|
name = "r"
|
|
|
|
authed = True
|
|
|
|
helptext = "Show how much is left before we are able to withdraw funds."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
remaining = tx.get_remaining()
|
|
|
|
msg(f"Remaining: {remaining}USD")
|
2022-02-09 18:45:43 +00:00
|
|
|
|
|
|
|
class total_remaining(object):
|
|
|
|
name = "tr"
|
|
|
|
authed = True
|
|
|
|
helptext = "Show how much is left before we are able to withdraw funds (including open trades)."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
remaining = tx.get_total_remaining()
|
|
|
|
msg(f"Total remaining: {remaining}USD")
|
2022-02-15 22:27:42 +00:00
|
|
|
|
|
|
|
class tradetotal(object):
|
|
|
|
name = "tradetotal"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get total value of all open trades in USD."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
total = tx.get_open_trades_usd()
|
|
|
|
msg(f"Total trades: {total}USD")
|
|
|
|
|
|
|
|
class dollar(object):
|
|
|
|
name = "$"
|
|
|
|
authed = True
|
|
|
|
helptext = "Get total value of everything, including open trades."
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
|
|
|
total = tx.get_total_with_trades()
|
|
|
|
msg(f"${total}")
|