-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
400 lines (373 loc) · 16.6 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
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
390
391
392
393
394
395
396
397
398
399
400
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tradano - Simple Cryptocurrency Trade Portfolio Tracker</title>
<link rel="stylesheet" href="https://unpkg.com/buefy/dist/buefy.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="./style.css">
<link rel="shortcut icon" href="./tradano-logo.svg" type="image/x-icon">
</head>
<body>
<div id="app" class="is-invisible">
<section class="section">
<div class="columns">
<aside class="column nav is-2">
<div class="logo">
<img width="32" src="./tradano-logo.svg" alt="Tradano">
<h1 class="is-size-4">Tradano</h1>
</div>
<nav class="menu">
<ul class="menu-list new-trade">
<li>
<a class="button shadow new-asset is-rounded is-white" @click="addCoin()">
<span class="icon">
<b-icon icon="plus" pack="fas"></b-icon>
</span>
<span>New trade</span>
</a>
</li>
</ul>
<hr>
<ul class="menu-list pages">
<li>
<a class="button is-transparent" href="#">
<span class="icon">
<b-icon icon="columns" pack="fas"></b-icon>
</span>
<span>Dashboard</span>
</a>
</li>
<li>
<a class="button is-transparent active" href="#">
<span class="icon">
<b-icon icon="list-alt" pack="fas"></b-icon>
</span>
<span>Trades</span>
</a>
</li>
<li>
<a class="button is-transparent" href="#">
<span class="icon">
<b-icon icon="coins" pack="fas"></b-icon>
</span>
<span>Portofolio</span>
</a>
</li>
<li class="settings">
<a class="button is-transparent" href="#">
<span class="icon">
<b-icon icon="cog" pack="fas"></b-icon>
</span>
<span>Settings</span>
</a>
</li>
<li>
<div class="settings-buttons" style="display: inline-flex">
<button @click="reset" class="button">
<b-icon icon="undo" pack="fas"></b-icon>
</button>
<button @click="exportFile" class="button">
<b-icon icon="save" pack="fas"></b-icon>
</button>
<label class="button fake-file">
<input @change="importFile" class="file-input" type="file" name="resume">
<b-icon icon="file-code" pack="fas"></b-icon>
</label>
</div>
</li>
<li>
<div class="settings-buttons-unit" style="display: inline-flex">
<b-field>
<b-radio-button v-model="unit" native-value="dv" size="is-small">
<span class="icon">
-
</span>
</b-radio-button>
<b-radio-button v-model="unit" native-value="btc" size="is-small">
<span class="icon">
<i class="fab fa-bitcoin"></i>
</span>
</b-radio-button>
<b-radio-button v-model="unit" native-value="usd" size="is-small">
<b-icon icon="dollar-sign" pack="fas"></b-icon>
</b-radio-button>
<b-radio-button v-model="unit" native-value="eur" size="is-small">
<b-icon icon="euro-sign" pack="fas"></b-icon>
</b-radio-button>
</b-field>
</div>
</li>
</ul>
</nav>
</aside>
<main class="column">
<div class="level" v-if="false">
<div class="level-left">
<div class="level-item">
<div class="title">
<small>{{unitSymbol}}</small> {{ sum | numberFormat(2) }}
({{unitSymbol}} {{ sumAll | numberFormat(2) }})
</div>
</div>
</div>
</div>
<div class="columns main box shadow is-multiline">
<div class="column">
<table class="table is-fullwidth">
<thead>
<tr>
<th></th>
<th>Pair</th>
<th></th>
<th></th>
<th>Hodling</th>
<th class="has-text-right">Buy Price</th>
<th class="has-text-right">Sell Price</th>
<th class="has-text-right">Current Price</th>
<th class="has-text-right">Amount</th>
<th class="has-text-right">Buy Value</th>
<th class="has-text-right">Sell Value</th>
<th class="has-text-right">Value</th>
<th class="has-text-right">Profit/Lose</th>
<!-- <th>1H, 24H, 7D</th> -->
</tr>
</thead>
<tbody>
<tr v-for="item in sortedCoins" v-if="item" :class="{ half: item.deactive, gray: item.done }">
<!-- Controls -->
<td class="controls">
<span class="is-hidden">{{item.loading}}</span>
<b-dropdown aria-role="list">
<button :class="['button is-small more', {'is-loading': item.loading}]" slot="trigger">
<b-icon icon="ellipsis-h" pack="fas" size="is-small"></b-icon>
</button>
<b-dropdown-item @click="toggleCoin(item, 'done')" aria-role="listitem">
<b-icon icon="check" pack="fas" size="is-small"></b-icon>
{{ item.done ? 'Undone' : 'Done' }}
</b-dropdown-item>
<b-dropdown-item @click="addCoin(item)" aria-role="listitem">
<b-icon icon="pencil-alt" pack="fas" size="is-small"></b-icon>
Edit
</b-dropdown-item>
<b-dropdown-item @click="getCoin(item)" aria-role="listitem">
<b-icon icon="sync-alt" pack="fas" size="is-small"></b-icon>
Sync
</b-dropdown-item>
<b-dropdown-item @click="toggleCoin(item, 'deactive')" aria-role="listitem">
<b-icon pack="fas" :icon="item.deactive ? 'eye' : 'eye-slash'" size="is-small"></b-icon>
{{ item.deactive ? 'Active' : 'Deactive' }}
</b-dropdown-item>
<b-dropdown-item @click="copyToClipboard(item)" aria-role="listitem">
<b-icon icon="clipboard" pack="fas" size="is-small"></b-icon>
Copy
</b-dropdown-item>
</b-dropdown>
</td>
<!-- Pair -->
<td>
<img class="pair" :src="`http://s2.coinmarketcap.com/static/img/coins/32x32/${item.realId}.png`"
:alt="item.name">
{{item.symbol}}
</td>
<td class="trade-icon-cell">
<span class="trade-icon"></span>
</td>
<td>
<span v-if="item.from">
<img class="pair"
:src="`http://s2.coinmarketcap.com/static/img/coins/32x32/${item.from.realId}.png`"
:alt="item.from.name">
{{item.from.symbol}}
</span>
</td>
<!-- Hodling -->
<td>
{{item.dateBuy || '' | moment}}
</td>
<!-- Buy Price -->
<td class="has-text-right">
{{item.priceBuy | numberFormat(10)}}
</td>
<!-- Sell Price -->
<td class="has-text-right">
{{item.priceSell | numberFormat}}
</td>
<!-- Current Price -->
<td class="has-text-right">
{{item.price_btc/item.from.price_btc | numberFormat}}
</td>
<!-- Amount -->
<td class="has-text-right">
{{ item.amount | numberFormat }}
</td>
<!-- Buy Value -->
<td class="has-text-right">
{{item.valueBuy | numberFormat}}
</td>
<!-- Sell Value -->
<td class="has-text-right">
{{item.valueSell | numberFormat}}
</td>
<!-- Current Vlaue -->
<td class="has-text-right">
<!-- {{item.valueCurrent_btc | numberFormat}} -->
{{item.valueCurrent[unit] | numberFormat}}
<small>{{unit}}</small>
</td>
<!-- Profit -->
<td class="has-text-right">
<span
:class="['bold has-text-right', {'has-text-success': item.profit > 0, 'has-text-danger': item.profit < 0}]">
{{Math.abs(item.profit) | numberFormat}}
(%{{Math.abs(item.profit_per) | numberFormat(1)}})
</span>
</td>
<!-- Changes (1H, 24H, 7D) -->
<td v-if=0>
<span class="tag is-rounded" v-if="item.percent_change_1h">
<span
:class="[{'color-green': item.percent_change_1h > 0, 'color-red': item.percent_change_1h < 0}]">
%{{Math.abs(item.percent_change_1h)}}
</span>
</span>
<span class="tag is-rounded" v-if="item.percent_change_24h">
<span
:class="[{'color-green': item.percent_change_24h > 0, 'color-red': item.percent_change_24h < 0}]">
%{{Math.abs(item.percent_change_24h)}}
</span>
</span>
<span class="tag is-rounded" v-if="item.percent_change_7d">
<span
:class="[{'color-green': item.percent_change_7d > 0, 'color-red': item.percent_change_7d < 0}]">
%{{Math.abs(item.percent_change_7d)}}
</span>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
</section>
<!-- start modal -->
<div :class="['modal', {'is-active': addCoinToggle}]">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">{{editMode ? 'Edit' : 'Add'}} trade</p>
<button class="delete" aria-label="close" @click="addCoinToggle=false"></button>
</header>
<section class="modal-card-body">
<section class="modal-body">
<b-field>
<b-input placeholder="UUID" type="text" icon="circle" icon-pack="fas" v-model="coin.uuid" disabled />
</b-field>
<b-field>
<b-autocomplete v-model="coin.name" icon="coins" icon-pack="fas" :data="filteredSearchList"
placeholder="Trade to" field="name" @typing="findInSearchList"
@select="option => selectedSearchListItem = option">
<template slot-scope="props">
<div class="media">
<div class="media-left search-list-img">
<img width="32"
:src="`http://s2.coinmarketcap.com/static/img/coins/64x64/${props.option.id}.png`">
</div>
<div class="media-content">
{{ props.option.name }}
<br>
<small>
{{ props.option.symbol }}
</small>
</div>
</div>
</template>
</b-autocomplete>
</b-field>
<b-field>
<b-autocomplete v-model="coin.from.name" icon="coins" icon-pack="fas" :data="filteredSearchList"
placeholder="Trade from" field="name" @typing="findInSearchList"
@select="option => selectedSearchListFromItem = option">
<template slot-scope="props">
<div class="media">
<div class="media-left search-list-img">
<img width="32"
:src="`http://s2.coinmarketcap.com/static/img/coins/64x64/${props.option.id}.png`">
</div>
<div class="media-content">
{{ props.option.name }}
<br>
<small>
{{ props.option.symbol }}
</small>
</div>
</div>
</template>
</b-autocomplete>
</b-field>
<b-field>
<b-input placeholder="Amount" type="number" step="any" icon="money-bill-alt" icon-pack="fas"
v-model="coin.amount" />
</b-field>
<b-field>
<b-input placeholder="Buy Price" type="number" step="any" icon="dollar-sign" icon-pack="fas"
v-model="coin.priceBuy" />
</b-field>
<b-field>
<b-input placeholder="Sell Price" type="number" step="any" icon="dollar-sign" icon-pack="fas"
v-model="coin.priceSell" />
</b-field>
<b-field>
<b-input placeholder="Wallet" type="text" icon="briefcase" icon-pack="fas" v-model="coin.wallet" />
</b-field>
<b-field>
<b-datepicker :readonly="false" position="is-top-right" v-model="coin.dateBuy" placeholder="Buy Date"
icon="calendar" icon-pack="fas" />
</b-field>
<b-field>
<b-datepicker :readonly="false" position="is-top-right" v-model="coin.dateSell" placeholder="Sell Date"
icon="calendar-check" icon-pack="fas" />
</b-field>
<div class="field">
<b-switch v-model="coin.deactive">
Deactive
</b-switch>
</div>
<div class="field">
<b-switch v-model="coin.done">
Done
</b-switch>
</div>
</section>
</section>
<footer class="modal-card-foot">
<button :class="['button is-success', {'is-loading': loading.save}]" @click="editCoin">
<b-icon icon="save" pack="fas"></b-icon>
<span>Save</span>
</button>
<button class="button" @click="cancelEditCoin">Cancel</button>
<div class="remove-btn">
<button @click="removeCoin" class="button is-danger is-outlined" v-if="editMode">
<b-icon icon="times" pack="fas"></b-icon>
<app-icon icon="save"></app-icon>
<span>Remove</span>
</button>
</div>
</footer>
</div>
</div>
<!-- end modal -->
</div>
<script src="https://cdn.jsdelivr.net/npm/moment"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.4"></script>
<script src="https://unpkg.com/buefy"></script>
<script src="https://cdn.jsdelivr.net/npm/lodash"></script>
<script src="./script.js"></script>
</body>
</html>