-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
389 lines (320 loc) · 20.1 KB
/
index.php
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<?php
require('actions.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
<?php echo TRADE_WEBSITE_NAME; ?>
</title>
<!-- Jquery -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!-- Bootstrap 4 -->
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>-->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<!-- Google Graph API -->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<link rel="stylesheet" href="css/simpletrader.css">
<script type="text/javascript" src="js/simpletrader.js"></script>
</head>
<body>
<div class="container-fluid">
<div id="loginbox" style="margin-top:5px;" class="mainbox col-md-12 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">
<a href="index.php">
<?php echo TRADE_WEBSITE_NAME; ?>
</a>
</div>
<div style="float:right; font-size: 80%; position: relative; top:-18px">
<?php
if($refresh) {
?>
<a href="javascript:void(0)" id="auto-refresh" class="btn btn-xs btn-warning pause">
<span class="glyphicon glyphicon-pause"></span> Auto refresh</a>
<script type="text/javascript">
startAutoRefresh();
</script>
<?php
}
else {
?>
<a href="javascript:void(0)" id="auto-refresh" class="btn btn-xs btn-success play">
<span class="glyphicon glyphicon-play"></span> Auto refresh</a>
<?php
}
?>
<a href="index.php?purge=1" class="btn btn-default btn-xs" role="button">
<span class="glyphicon glyphicon-flash"></span> Clear cache</a>
</div>
</div>
<div style="padding-top:10px" class="panel-body">
<?php
if(count($message) > 0) {
foreach($message as $key => $resp) { ?>
<div class="alert alert-<?php echo $resp->css; ?> col-sm-12">
<b>
<?php echo $resp->message; ?>
</b>
</div>
<?php
}
}
if(isset($_POST['addOrder']) && $_POST['addOrder']) {
} // END DISPLAY FOR POST ORDER
else {
?>
<div class="col-sm-6 col-lg-6">
<div class="row">
<div class="col-sm-6 col-lg-6">
<h3>Balance</h3>
<div class="col-xs-3 col-sm-6 col-lg-6">
<input id="UpdateBalanceZEUR" class="btn btn-<?php echo $cssEUR; ?>" type="button" value="<?php echo money_format('%i', $Balance['ZEUR']); ?>">
<input id="BalanceZEUR" type="hidden" value="<?php echo $Balance['ZEUR']; ?>">
</div>
<div class="col-xs-3 col-sm-6 col-lg-6">
<input id="UpdateBalanceXETH" class="btn btn-<?php echo $cssETH; ?>" type="button" value="<?php echo number_format($Balance['XETH'], 4, '.', ' '); ?> ETH">
<input id="BalanceXETH" type="hidden" value="<?php echo $Balance['XETH']; ?>">
</div>
</div>
<div class="col-xs-3 col-sm-6 col-lg-6">
<h3>Value</h3>
<div class="col-xs-12 col-sm-12 col-lg-12">
<?php echo money_format('%i', $Balance['XETHZEUR']); ?>
</div>
</div>
<div class="col-xs-3 col-sm-6 col-lg-6">
<h3>Last</h3>
<div class="col-xs-12 col-sm-12 col-lg-12">
<?php echo money_format('%i', $last); ?>
</div>
</div>
</div>
<div class="row">
<div id="table_closed_div"></div>
<div id="chart_short_div"></div>
<div id="chart_medium_div"></div>
<div id="chart_long_div"></div>
</div>
</div>
<div class="col-sm-6 col-lg-6">
<!-- <hr class="colorgraph"><br> -->
<div class="row">
<h3>Create Order</h3>
<form id="createOrder" name="createOrder" action="index.php" method="post" class="form-horizontal require-validation" role="form">
<!-- <div class='form-group required'>
<div class='error form-group hide'>
<div class='alert-danger alert'>
Please correct the errors and try again.
</div>
</div>
</div> -->
<div class="col-sm-12 col-lg-12">
<div class="row">
<div id="table_open_div"></div>
</div>
<div class="form-group">
<div class="col-md-6">
<div class="radio">
<label>
<input type="radio" name="orderAction" id="orderAction1" value="buy" <?php if($orderDefault=='buy' ) { echo ' checked'; }
?>> Buy
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="orderAction" id="orderAction2" value="sell" <?php if($orderDefault=='sell' ) { echo ' checked';
} ?>> Sell
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<div class="radio">
<label>
<input type="radio" name="type" id="type1" value="limit" checked> Limit
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" id="type2" value="market"> Market
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" id="type2" value="position"> Position
</label>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<div class="form-group required">
<label for="volume" class="control-label col-md-4">Volume</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" id="volume" name="volume" <?php if($orderDefault=='buy' ) { echo 'value="'.round($Balance[
'ZEUR']/$last,5). '"'; } else { echo 'value="'.round($Balance[ 'XETH'],6).
'"'; } ?>>
<div class="input-group-addon">ETH</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<div class="form-group required">
<label for="price" class="control-label col-md-4">Price</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" id="price" name="price" value="<?php echo $last; ?>">
<div class="input-group-addon">EUR</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<div class="form-group">
<label for="volume" class="control-label col-md-4">Total</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" id="total" name="total" <?php if($orderDefault=='buy' ) { echo 'value="'.round($Balance[
'ZEUR'],4). '"'; } else { echo 'value="'.round($Balance[ 'XETH']*$last,2).
'"'; } ?>>
<div class="input-group-addon">EUR</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-12">
<div class="col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label for="volume" class="control-label col-md-4">Take-Profit</label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" aria-label="Activate Sell at Take Profit" id="takeProfit_active" name="takeProfit_active" value="1">
</span>
<input type="text" class="form-control" aria-label="" id="takeProfit_rate" name="takeProfit_rate" value="5">
<div class="input-group-addon">%</div>
<div id="takeProfit_price" class="input-group-addon"></div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label for="volume" class="control-label col-md-4">Stop-Loss</label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" aria-label="Activate Sell at Stop Loss Profit" id="stopLoss_active" name="stopLoss_active" value="1">
</span>
<input type="text" class="form-control" aria-label="" id="stopLoss_rate" name="stopLoss_rate" value="1">
<div class="input-group-addon">%</div>
<div id="stopLoss_price" class="input-group-addon"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-12">
<div class="form-group">
<input type="hidden" name="addOrder" value="1" />
<button type="submit" name="submitOrder" class="btn btn-success btn-lg btn-block">
<span class="glyphicon glyphicon-plus-sign"></span> Post Order</button>
</div>
</div>
</form>
<h3>Android notifications</h3>
<form id="createAlert" name="createAlert" action="index.php" method="post" class="form-horizontal require-validation" role="form">
<div class="col-sm-12 col-lg-12">
<div class="col-sm-12 col-md-8 col-lg-2">
<?php
if(is_array($Alert->List) && count($Alert->List) > 0) {
echo "<ul>\n";
foreach($Alert->List as $alertDetail) {
switch($alertDetail->operator) {
case 'less':
$operator = '<';
break;
case 'more':
$operator = '>';
break;
case 'even':
$operator = '=';
break;
}
echo "<li>$operator $alertDetail->price</li>\n";
}
echo "</ul>\n";
} else echo "empty";
?>
</div>
<div class="form-group">
<div class="col-md-6">
<div class="radio">
<label>
<input type="radio" name="operator" id="operator1" value="less" checked>
< </label>
</div>
<div class="radio">
<label>
<input type="radio" name="operator" id="operator2" value="even">
=
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="operator" id="operator3" value="more">
>
</label>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<input type="text" class="form-control" id="priceAlert" name="priceAlert" value="<?php echo $last; ?>">
<div class="input-group-addon">EUR</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-12">
<div class="form-group">
<input type="hidden" name="addAlert" value="1" />
<button type="submit" name="submitAlert" class="btn btn-info btn-lg btn-block"><span class="glyphicon glyphicon-plus-sign"></span> Add notification</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php
} // END DISPLAY
// Display Loading time
$loading_time = microtime();
$loading_time = explode(' ', $loading_time);
$loading_time = $loading_time[1] + $loading_time[0];
$loading_finish = $loading_time;
$loading_total_time = round(($loading_finish - $loading_start), 4);
?>
<small>Simple Trading v0.1 - Load:<?php echo $loading_total_time; ?>s <em><?php echo $cache; ?></em></small>
</div>
</body>
</html>