-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwatcher.py
77 lines (72 loc) · 2.18 KB
/
watcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import click
import sys
from config import Config
from services.ethereum.ethereum import Ethereum
from services.strategy.watcher import StrategyWatcher
from services.ttypes.strategy import StrategyEnum
@click.command()
@click.option("--kovan", is_flag=True, help="point to kovan test network")
@click.option("--debug", is_flag=True, help="Display logs")
@click.option("--send-tx", is_flag=True, help="Flag to activate sending tx on-chain")
@click.option(
"--max-amount",
default=5.0,
help="Set max amount to trade with in WETH (Default: 5.0)",
)
@click.option(
"--min-amount",
default=1.0,
help="set min amount to trade with in weth (default: 1.0)",
)
@click.option(
"--consecutive",
default=2,
help="Set triggering tx after how many consecutive block of arbitrage (Default: 2)",
)
@click.option(
"--gas-multiplier",
default=1.1,
help="Set gas price multipler (Default: 1.1)",
)
@click.option(
"--max-block",
default=3,
help="Set max number of block we allow the transaction to go through (Default: 3)",
)
def watcher(
kovan: bool,
debug: bool,
send_tx: bool,
max_amount: float,
min_amount: float,
consecutive: int,
gas_multiplier: float,
max_block: int,
) -> None:
print(
f"-----------------------------------------------------------\n"
f"--------------- ARBITRAGING FRESH POOLS -------------------\n"
f"-----------------------------------------------------------\n"
f"Consecutive Arbitrage: {consecutive}\n"
f"Gas Multiplier: {gas_multiplier}\n"
f"Max Block Allowed: {max_block}\n"
f"Sending Transactions on-chain: {send_tx}\n"
f"-----------------------------------------------------------"
)
sys.stdout.flush()
config = Config(
strategy=StrategyEnum.WATCHER,
kovan=kovan,
debug=debug,
send_tx=send_tx,
max_amount=max_amount,
min_amount=min_amount,
min_liquidity=None,
max_liquidity=None,
gas_multiplier=gas_multiplier,
max_block=max_block,
)
ethereum = Ethereum(config)
strategy = StrategyWatcher(consecutive, ethereum, config)
strategy.watch()
watcher()