-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.html
243 lines (239 loc) · 13.5 KB
/
index.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
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
<html >
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body ng-app="trailingStop">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="/js/trailing.js"></script>
<script src="/js/sockets.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.js"></script>
<div class="logo-title">
<div class="container">
<div class="centered">
<a target="_blank" href="https://t.me/blockchainwhispers"><img class="col-centered" src="https://blockchainwhispers.com/assets/img/png/logo-about.png"><img></a>
</div>
</div>
</div>
<div class="spacing-top spacing-bot">
<h2 class="text-center">Trailing <span class="badge badge-danger">Stop Loss</span></h1>
</div>
<div ng-controller="trades">
<div class="container">
<div class="trade-table box spacing-top">
<div class="row">
<div class="spacing-bot">
A Trailing Stop Loss is a Stop-Limit that shifts its sell price according to price growth determined by laziness(ratio). A Stop-Limit order is an order to buy or sell a coin once the price reaches a specified price.
<a class="spacing-bot" href="https://support.binance.com/hc/en-us/articles/115003372072" target="_blank" ng-if="cur_lang!='cn'">view more</a>
</div>
</div>
<form ng-submit="submit()" ng-if="!dataLoaded">
<div class="alert alert-warning" ng-cloak ng-if="warning" role="alert">
{{data.error}}
</div>
<div class="alert alert-danger" ng-cloak ng-if="danger" role="alert">
Trailing Stop Loss server is Down!
</div>
<div class="form-group">
<label for="API Key">API Key</label>
<input type="text" ng-model="data.userkeys.apikey" class="form-control" id="apiKey" placeholder="Enter API Key">
</div>
<div class="form-group">
<label for="Secret Key">Secret Key</label>
<input type="password" ng-model="data.userkeys.secretkey" class="form-control" id="secretKey" aria-describedby="apiKeyHelp" placeholder="Enter Secret Key">
<small id="apiKeyHelp" class="form-text text-muted">We'll never share your Secret Key with anyone.</small>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<div class="row ng-cloak spacing-top" ng-if="dataLoaded">
<div class="col-2">
</div>
<div class="col-8">
<div class="container">
<div class="row input-group input-group-sm mb-3 balance">
<div class="input-group-prepend">
<span class="input-group-text">Available Balances: </span>
</div>
<select ng-if="data.coins != null" ng-model="data.selectedCoin" ng-change="addTradingPair()" class="custom-select form-control-sm">
<option ng-repeat="option in data.coins | filterAvailableBalance" value="{{option.symbol}}">{{option.symbol + " - " + option.available}}</option>
</select>
<div class="input-group-append" ng-if="data.selectedCoin != null" ng-init="data.selectedCoinLogo = data.coins[data.selectedCoin].logoUrl">
<span class="input-group-text" ng-if="data.selectedCoinLogo != null">
<img ng-src="{{data.coins[data.selectedCoin].logoUrl}}" class="portrait input-sm"></img>
</span>
<span class="input-group-text">{{data.coins[data.selectedCoin].coinName}}</span>
<button class="btn btn-info" ng-click="submit()"><strong>Update Balance</strong></button>
</div>
</div>
<div class="row input-group input-group-sm mb-3 balance" ng-if="data.selectedCoin != null">
<div class="input-group-prepend">
<span class="input-group-text">Trading Pairs: </span>
</div>
<select ng-model="data.selectedCoinPair" ng-change="getLatestPrice()" class="custom-select form-control-sm">
<option ng-repeat="option in data.tradingPairs" value="{{option.pair}}">{{option.pair}}</option>
</select>
</div>
</div>
</div>
<div class="col-2">
</div>
</div>
<div class="row">
<div>
<p style="margin-bottom: 20px">In case you find issues contact <a target="_blank" href="https://t.me/cosmicascension">@cosmicascension</a> on telegram for fixes, improvements and suggestions.
</p>
</div>
</div>
</div>
</div>
<div ng-class="{'main-app': data.selectedCoinPair != null || data.tradeHistory.length > 0}">
<div class="centered">
<div class="col-sm-4 ng-cloak" ng-if="data.selectedCoinPair != null">
<div class="trade trade-table spacing-top title">
<div class="spacing-bot spacing-top">
<h5>Trade</h5>
</div>
<hr>
<form name="stopSellForm" class="spacing-bot form-group-sm" id="tradeForm" class="needs-validation" novalidate ng-submit="stopLimit_sell_submit()">
<div class="trade-fields">
<div class="row" ng-if="data.lastPrice.last">
<label class="col-3 col-form-label trade-label">Current Price </label>
<div class="col-sm-9">
<div class="input-group input-group-sm mb-3">
<input class="form-control form-control-sm field-right" id="lastprice" type="text" readonly ng-model="data.lastPrice.last"/>
<div class="input-group-append">
<span class="input-group-append input-sm input-group-text">{{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}</span>
</div>
</div>
</div>
</div>
<div class="row">
<label for="stopPercentage" class="col-sm-3 col-form-label trade-label">Stop Distance (%) </label>
<div class="col-sm-9">
<div class="input-group input-group-sm">
<input type="number" class="form-control form-control-sm field-right" ng-keypress="removeNegatives()" id="stopPercentage" ng-change="calculatePrice(data.trade.stop)" ng-model="data.trade.stop.percentage" aria-label="Stop">
<div class="invalid-feedback form-control-sm mb-3">
Please choose a Stop Distance greater than 0 and less than 99.
</div>
<input class="form-control field-right" id="stopPrice" type="text" readonly ng-model="data.trade.stop.price"/>
<div class="input-group-append">
<span class="input-group-text">{{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}</span>
</div>
</div>
<small id="stopHelp" class="form-text text-muted mb-3">
When the coin reaches this price the sell order limit is set. Distance is defined by a percentage. (max 99)
</small>
</div>
</div>
<div class="row">
<label for="limitPercentage" class="col-sm-3 col-form-label trade-label">Limit Distance (%) </label>
<div class="col-sm-9">
<div class="input-group input-group-sm">
<input type="number" class="form-control form-control-sm field-right" ng-keypress="removeNegatives()" id="limitPercentage" ng-change="calculatePrice(data.trade.limit)" ng-model="data.trade.limit.percentage" aria-label="Limit">
<div class="invalid-feedback">
Please choose a Limit Distance greater than 0 and less than 99.
</div>
<input class="form-control field-right" id="limitPrice" type="text" readonly ng-model="data.trade.limit.price"/>
<div class="input-group-append">
<span class="input-group-text">{{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}</span>
</div>
</div>
<small id="limitHelp" class="form-text text-muted mb-3">
The sell order will be executed at this price. Distance is defined by a percentage (max 99, suggestion: less or equal to stop distance so order comes through quicker)
</small>
</div>
</div>
<div class="row">
<label for="coinAmount" class="col-sm-3 col-form-label trade-label">Trade Amount </label>
<div class="col-sm-9">
<div class="input-group input-group-sm">
<input type="number" class="form-control form-control-sm field-right" ng-keypress="removeNegatives()" id="coinAmount" ng-change="calculateCoinsValue(true)" ng-model="data.trade.amount.coinAmount" aria-label="Amount">
<div ng-if="data.minError" class="invalid-feedback">
Please choose a valid coin amount above min value: {{data.minValue * 1.1}} {{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}
</div>
<div ng-if="data.maxError" class="invalid-feedback">
The coin amount is above your balance of: {{data.coins[data.selectedCoin].available}} {{data.selectedCoin}}. Update balance if the amount displayed is not correct.
</div>
<input class="form-control field-right " id="amountPrice" type="text" readonly ng-model="data.trade.amount.price"/>
<div class="input-group-append">
<span class="input-group-text">{{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}</span>
</div>
</div>
<small id="amountHelp" class="form-text text-muted mb">
Amount of selected coin to trade.
</small>
<input type="range" value="0" ng-model="data.trade.amount.amountPercentage" ng-change="calculateAmount()" class="custom-range mb-3" id="amountRange">
<span ng-if="data.trade.amount.amountPercentage" class="text-muted">{{data.trade.amount.amountPercentage + "%"}}</span>
</div>
</div>
<div class="row">
<label for="laziness" class="col-sm-3 col-form-label trade-label">Laziness (%)</label>
<div class="col-sm-9">
<div class="input-group input-group-sm">
<input type="number" class="form-control form-control-sm field-right" id="lazinessPercentage" ng-change="calculateSellPrice()" ng-model="data.trade.lazy.percentage" aria-label="Laziness">
<div class="invalid-feedback">
Please choose a laziness percentage above 0 (otherwise you will get blocked by Binance API, we recommend at least 0.05%)
</div>
<input class="form-control field-right" id="lazinessPrice" ng-keypress="removeNegatives()" type="text" readonly ng-model="data.trade.lazy.price"/>
<div class="input-group-append">
<span class="input-group-text">{{data.selectedCoinPair.replace(data.selectedCoin + '/', '')}}</span>
</div>
</div>
<small id="lazyHelp" class="form-text text-muted">
The sell order will be updated again when this price is reached. (max 99)
</small>
</div>
</div>
<hr class="trade-hr">
<div class="form-group-row">
<button type="submit" class="btn btn-danger btn-sm right spacing-bot" id="trail"><strong>Trailing Stop</strong></button>
</div>
</div>
</form>
</div>
</div>
<div class="col-sm-8 ng-cloak">
<div class="col-centered">
<iframe class="ng-cloak" src="/html/chart.html" frameBorder="0" id="content">
</iframe>
<div class="orders trade-table spacing-top title ng-cloak" ng-if="data.tradeHistory.length > 0">
<div class="spacing-bot">
<h5 style="color: black">Running orders</h5>
</div>
<table class="table table-striped trade-label">
<thead class="thead-dark">
<tr>
<th scope="col">Trading Pair</th>
<th scope="col">Amount</th>
<th scope="col">Current Price</th>
<th scope="col">Stop Price</th>
<th scope="col">Limit Price</th>
<th scope="col">Order Value</th>
<th scope="col">Lazy price</th>
<th scope="col">Remove Order</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tradeHistory in data.tradeHistory track by $index">
<td><strong>{{tradeHistory.pair}}</strong></td>
<td>{{tradeHistory.amount.coinAmount}}</td>
<td>{{tradeHistory.last}}</td>
<td>{{tradeHistory.stop.price}}</td>
<td>{{tradeHistory.limit.price}}</td>
<td>{{tradeHistory.amount.price}}</td>
<td>{{tradeHistory.lazy.price}}</td>
<td class="cancel"><button class="btn btn-danger btn-sm cancel-btn" ng-click="cancelOrder(tradeHistory)">Cancel <i class="fa fa-ban"></i></button></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>