-
Notifications
You must be signed in to change notification settings - Fork 2
/
monitor_arbitrage.py
78 lines (62 loc) · 2.34 KB
/
monitor_arbitrage.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
78
from bittrex_arbitrage_client import BittrexArbitrageClient
from bithumb_arbitrage_client import BithumbArbitrageClient
from arbitrage_finder import ArbitrageFinder
from utils import Trade, TradeStage
import datetime
import time
from math import *
import sys
import json
import os
def load_keys(path):
with open(path) as key_file:
keys = key_file.readlines()
keys = [key.strip() for key in keys]
return keys
def monitor_arbitrage(key_folder_path):
#load API keys
bittrex_keys = load_keys(key_folder_path+'/bittrex_keys.txt')
bithumb_keys = load_keys(key_folder_path+'/bithumb_keys.txt')
#contants
ARBITRAGE_OPPORTUNITY_WAIT_MIN = 60*24 #search for arbitrage oppertunities for a day at most
PROFIT_THRESHOLD = .012
PRINT_TOP_TRADES = True
LOOPS = 20
print("Setting Up Exchanges")
#exchange constants
DEBUG = True
#instanciate exchanges
bittrexName = 'bittrex'
bittrexBaseCurrencies = ['BTC'] #ETH and XMR are also base currencies but we'll experiment with this later
bittrexTradableCurrencies = ['BTC','ETH','ETC','LTC','DASH'] #XRP has a minimum amt which an address can hold (this may cause issues... avoid for now)
bittrexMinFunds = 50 # 50 USD
isStartingExchange = True
bittrexArbitrageClient = BittrexArbitrageClient(bittrex_keys[0],
bittrex_keys[1],
bittrexName,
bittrexBaseCurrencies,
bittrexTradableCurrencies,
bittrexMinFunds,
isStartingExchange,
DEBUG)
bithumbName = 'bithumb'
bithumbBaseCurrencies = ['KRW']
bithumbTradableCurrencies = ['BTC','ETH','ETC','LTC','DASH']
isStartingExchange = False
bithumbMinFunds = 50000 #approximately 50 USD of KRW
bithumbArbitrageClient = BithumbArbitrageClient(bithumb_keys[0],
bithumb_keys[1],
bithumbName,
bithumbBaseCurrencies,
bithumbTradableCurrencies,
bithumbMinFunds,
isStartingExchange,
DEBUG)
#instanciate an arbitrage finder
arbFinder = ArbitrageFinder()
curTrade = Trade([])
for loop in range(LOOPS):
print("Loop: "+str(loop))
arbFinder.find_arbitrage_bittrex_bithum(bittrexArbitrageClient, bithumbArbitrageClient, ARBITRAGE_OPPORTUNITY_WAIT_MIN, PROFIT_THRESHOLD, curTrade, PRINT_TOP_TRADES)
if __name__ == '__main__':
monitor_arbitrage(sys.argv[1])