Skip to content

Commit

Permalink
rekt inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymorony committed May 18, 2019
1 parent 6b46331 commit d62d842
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions rekt_inspector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

from lib import tuilib

AC_NAME = "BETSTEST"

rpc_connection = tuilib.def_credentials(AC_NAME)

while True:
# scanning list
prices_list = rpc_connection.priceslist("open")
print(tuilib.colorize("Looking for rekts... Current height is: " + str(rpc_connection.getinfo()["blocks"]), "blue"))
for position in prices_list:
position_info = rpc_connection.pricesinfo(position)
if position_info["rekt"] == 1:
try:
rekt_raw = rpc_connection.pricesrekt(position, position_info["LastHeight"])["hex"]
rekt_txid = rpc_connection.sendrawtransaction(rekt_raw)
print(tuilib.colorize("MUAHAHA REEEEKTED! TXID: " + rekt_txid, "green"))
print(tuilib.colorize("Position size: " + str(position_info["TotalPositionSize"]), "magenta"))
except Exception as e:
print(e)
# waiting for next block to perform scan again
prev_scan_height = int(rpc_connection.getinfo()["blocks"])
while True:
current_height = int(rpc_connection.getinfo()["blocks"])
height_difference = current_height - prev_scan_height
if height_difference == 0:
# print(current_height)
# print(prev_scan_height)
# print(colorize("Waiting for next block before scan for rekts", "blue"))
pass
else:
break

0 comments on commit d62d842

Please sign in to comment.