-
Notifications
You must be signed in to change notification settings - Fork 8
/
arbitrageTrader.html
200 lines (174 loc) · 7.17 KB
/
arbitrageTrader.html
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Arbitrage Trader Machine</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<link rel="stylesheet" href="arbitrageTrader.css">
<link rel="stylesheet" href="css/modalBox.css">
<script src="js/modalBox.js"></script>
<script src="arbitrageTrader.js"></script>
</head>
<body>
<select name="exchangeA" id="exchangeA" class="browser-default" value>
<option value="Binance" selected="selected">Binance</option>
<option value="BitMax">BitMax</option>
<option value="FTX">FTX</option>
</select>
<select name="exchangeB" id="exchangeB" class="browser-default">
<option value="Binance">Binance</option>
<option value="BitMax">BitMax</option>
<option value="FTX" selected="selected">FTX</option>
</select>
<!-- <div class="input">
<input type="number" name="exchangeAFee" id="exchangeAFee">
<input type="number" name="exchangeBFee" id="exchangeBFee">
</div> -->
<button class="waves-effect waves-light btn" onclick="setExchangeAndRestart()">Set Exchange</button>
<div class="board">
<table id="tableAc">
<caption>Account Balance</caption>
<tr>
<th></th>
<th id="ac_exchangeA">Binance</th>
<th id="ac_exchangeB">BitMax</th>
<th>sum</th>
</tr>
<tr>
<td>BNB</td>
<td id="ac_exchangeA_BNB">N/A</td>
<td id="ac_exchangeB_BNB">N/A</td>
<td id="ac_sum_BNB">N/A</td>
</tr>
<tr>
<td>USDT</td>
<td id="ac_exchangeA_USDT">N/A</td>
<td id="ac_exchangeB_USDT">N/A</td>
<td id="ac_sum_USDT">N/A</td>
</tr>
<tr>
<td></td>
<td class="tdLastUpdate" id="exchangeA_WalletLastUpdatePassed">N/A</td>
<td class="tdLastUpdate" id="exchangeB_WalletLastUpdatePassed">N/A</td>
<td></td>
</tr>
</table>
</div>
<div class="board">
<table id="tableDiff">
<caption>BNB/USDT Market</caption>
<tr>
<th id="market_exchangeA">Binance</th>
<th class="thDiff">diff/max profit</th>
<th id="market_exchangeB">BitMax</th>
</tr>
<tr>
<td class="tdClose" id="exchangeA_BNB_USDT_close">N/A</td>
<td id="diff_BNB_USDT_close">N/A</td>
<td class="tdClose" id="exchangeB_BNB_USDT_close">N/A</td>
</tr>
<tr>
<td class="tdBid" id="exchangeA_BNB_USDT_bid">N/A</td>
<td id="diff_BNB_USDT_maxProfit" rowspan="2">N/A<br/>(N/A)</td>
<td class="tdBid" id="exchangeB_BNB_USDT_bid">N/A</td>
</tr>
<tr>
<td class="tdAsk" id="exchangeA_BNB_USDT_ask">N/A</td>
<td class="tdAsk" id="exchangeB_BNB_USDT_ask">N/A</td>
</tr>
<tr>
<td class="tdLastUpdate" id="exchangeA_OrderBookLastUpdatePassed">N/A</td>
<td></td>
<td class="tdLastUpdate" id="exchangeB_OrderBookLastUpdatePassed">N/A</td>
</tr>
</table>
<p class="tableDescription">
<span style="color:white">WHITE</span>: Close, last trading price<br/>
<span style="color:#0ecb81">GREEN</span>: Bid, people would buy at this price<br/>
<span style="color:#f6465d">RED</span>: Ask, people would sell at this price<br/>
We want to buy from RED and sell to GREEN with profits.
</p>
</div>
<div class="card">
<div class="input">
<label for="traderCriticalMaxProfitWithFee">Critical max profit with fee:</label>
<input type="number" step="0.001" id="traderCriticalMaxProfitWithFee" name="traderCriticalMaxProfitWithFee" value="0">
</div>
<div class="input">
<label for="traderMaxLastUpdate">Max last update(ms):</label>
<input type="number" id="traderMaxLastUpdate" name="traderMaxLastUpdate" value="1000">
</div>
<div class="input">
<label for="traderSafeTradeBuffer">Safe trade buffer uses max profit with fee(%):</label>
<input type="number" min="0" max="120" id="traderSafeTradeBuffer" name="traderSafeTradeBuffer" value="80">
</div>
<button class="waves-effect waves-light btn" id="toggleTraderBtn" onclick="toggleTrader()">Start trading</button>
<label>
<input type="checkbox" class="filled-in" id="performOneTrade" name="performOneTrade" />
<span>stop after 1 trade</span>
</label>
<div class="board">
<table id="tableHistory">
<caption>Trade History</caption>
<tr>
<th>Time</th>
<th>Exchange</th>
<th>Side</th>
<th>Order</th>
<th>Fill</th>
<th>Status</th>
</tr>
<!-- <tr>
<td class="tdTime">2021-02-26 18:10:07</td>
<td>Binance</td>
<td style="color: #f6465d">Sell</td>
<td>224.8 / 2.0</td>
<td>224 / 1.0</td>
<td>active</td>
</tr> -->
</table>
</div>
</div>
<div class="card">
<div class="input">
<label for="priceRecorderCriticalMaxProfitWithFee">Critical max profit with fee:</label>
<input type="number" step="0.001" id="priceRecorderCriticalMaxProfitWithFee" name="priceRecorderCriticalMaxProfitWithFee" value="0">
</div>
<div class="input">
<label for="priceRecorderMaxLastUpdate">Max last update(ms):</label>
<input type="number" id="priceRecorderMaxLastUpdate" name="priceRecorderMaxLastUpdate" value="1000">
</div>
<button class="waves-effect waves-light btn" onclick="priceRecorderClearUI()">Hide Old Records</button>
<div class="board" style="overflow-y:auto; height: 500px;">
<table id="tableRecord">
<caption>Profitable Price Records</caption>
<tr>
<th>Time</th>
<th id="priceRecord_exchangeA">Binance</th>
<th id="priceRecord_exchangeB">BitMax</th>
<th>Profit</th>
</tr>
<!-- <tr>
<td class="tdTime">2021-02-26 18:10:07</td>
<td>225.311 / 6.5</td>
<td>224.821 / 2.0</td>
<td>1.510 / 2.0</td>
</tr> -->
</table>
</div>
</div>
<div id="modalBox" class="modal">
<!-- Modal content -->
<div class="modalContent">
<span class="close">×</span>
<p id="modalText"></p>
</div>
</div>
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>