-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
296 lines (275 loc) · 12.2 KB
/
index.html
File metadata and controls
296 lines (275 loc) · 12.2 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/png" href="/briefcase.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cryptofolio</title>
<!-- Meta Description -->
<meta name="description"
content="Track your cryptocurrency portfolio locally with Cryptofolio. Simple, minimal, and easy to use. Import/export your data as JSON and visualize it with pie charts and graphs." />
<link rel="canonical" href="https://cryptofolio.wolfez.dev/" />
<!-- Open Graph Tags -->
<meta property="og:title" content="Cryptofolio - Minimal Crypto Portfolio Tracker" />
<meta property="og:description"
content="Track your cryptocurrency portfolio locally with Cryptofolio. Simple, minimal, and easy to use. Import/export your data as JSON and visualize it with pie charts and graphs." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://cryptofolio.wolfez.dev/" />
<meta property="og:logo" content="briefcase.png" />
<meta property="og:image" content="briefcase.png" />
<meta property="og:site_name" content="Cryptofolio" />
<!-- Twitter Card Tags -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Cryptofolio - Minimal Crypto Portfolio Tracker" />
<meta name="twitter:description"
content="Track your cryptocurrency portfolio locally with Cryptofolio. Simple, minimal, and easy to use. Import/export your data as JSON and visualize it with pie charts and graphs." />
<meta name="twitter:image" content="/briefcase.png" />
<link rel="stylesheet" href="/src/style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" />
</head>
<body>
<div id="app">
<!-- Table of holdings -->
<div class="row">
<div class="assetsTable">
<h2 id="assetsTableTitle">Cryptofolio</h2>
<button id="addCrypto">Add crypto</button>
<table class="table" id="assetsTable">
<thead>
<tr>
<th>Asset</th>
<th title="The average price of all the buys combined">
Average buy price
</th>
<th title="Current amount held">Amount</th>
<th title="Total of the buys minus the sells">Net invested</th>
<th title="The value at current market rates">Current Value</th>
<th title="Current value and average sells compared to average buys (in percentage)">
Gain
</th>
</tr>
</thead>
<tbody id="assetsTableBody"></tbody>
</table>
</div>
</div>
<div class="row" style="flex-direction: column;">
<div class="summary">
<h3>Total value</h3>
<span id="summaryTotalValue">
<span id="summaryTotalValueCurrency">$</span><span id="summaryTotalValueContent"></span>
</span>
<h3>Total gain</h3>
<span id="summaryTotalPercentage">%</span>
<!-- Export Dropdown -->
<div class="dropdown">
<button class="dropbtn" id="exportDropdownBtn">Export</button>
<div class="dropdown-content" id="exportDropdown">
<a class="exportDataBtn" id="exportDataJsonBtn">Export data (JSON)</a>
<a class="exportDataBtn" id="exportDataCsvBtn">Export data (CSV)</a>
</div>
</div>
<!-- Import Dropdown -->
<div class="dropdown">
<button class="dropbtn" id="importDropdownBtn">Import</button>
<div class="dropdown-content" id="importDropdown">
<input type="file" accept=".json" id="importDataJsonBtn" />
<label for="importDataJsonBtn"><a class="importDataBtn">Import data (JSON)</a></label>
<input type="file" accept=".csv" id="importDataCsvBtn" />
<label for="importDataCsvBtn"><a class="importDataBtn">Import data (CSV)</a></label>
</div>
</div>
<!-- CSV Instructions Modal -->
<dialog id="csvInstructionsModal" class="modal">
<div class="modal-content">
<span id="csv-warning-close" class="close">×</span>
<h3>CSV File Structure</h3>
<p>The CSV file structure is compatible with the Delta CSV export. If you want to import a custom CSV file,
it must have the following columns:</p>
<ul>
<li><strong>Date</strong>: The date of the transaction (YYYY-MM-DD)</li>
<li><strong>Way</strong>: The type of transaction, BUY or SELL</li>
<li><strong>Base amount</strong>: The amount of cryptocurrency transacted</li>
<li><strong>Quote amount</strong>: The cost of the transaction (in USD)</li>
<li><strong>Coingecko id</strong>: The unique identifier of the cryptocurrency (as used by <a
href="https://docs.coingecko.com/reference/coins-id">coingecko</a>)</li>
<li><strong>symbol</strong>: The symbol of the cryptocurrency (e.g., BTC)</li>
</ul>
<div>
<a id="downloadSampleCsv" href="#" download="sample.csv">Download Sample CSV</a>
</div>
</div>
</dialog>
</div>
<div class="chart mainChart lineChart">
<span>
<h2 class="totalValueTitle">Total value over time</h2>
<div id="toggleDate" class="toggleDate">
<button id="toggleWeekMode" class="toggleDateModes" value="week" type="button">
7D
</button>
<button id="toggleMonthMode" class="toggleDateModes active" value="month" type="button">
1M
</button>
<button id="toggleYearMode" class="toggleDateModes" value="year" type="button">
1Y
</button>
</div>
</span>
<div id="loader">
Calculating with some delay to prevent being rate limited.
<div class="loader"></div>
</div>
<div id="rateLimiting">Too many data calls. Wait a few minutes and continue.</div>
<div id="lineChart1Parent">
<canvas id="lineChart1"></canvas>
</div>
</div>
<div class="row">
<div class="chart pieChart">
<h2>Total invested</h2>
<canvas id="pieChart1"></canvas>
</div>
<div class="chart pieChart">
<h2>Current value</h2>
<canvas id="pieChart2"></canvas>
</div>
</div>
<!-- Search Popup modal -->
<dialog id="search-modal" class="modal">
<div class="modal-content">
<span class="close" id="search-modal-close">×</span>
<div class="inner-modal-content" id="inner-search-modal-content">
<form id="searchForm">
<input id="crypto-search-input" type="text" placeholder="Search.." />
<button><i class="fa fa-search"></i></button>
</form>
<div id="cryptoList"></div>
</div>
</div>
</dialog>
<!-- Asset modal to edit existing assets-->
<dialog id="cryptocurrency-modal" class="modal">
<div class="modal-content">
<span class="close" id="cryptocurrency-modal-close">×</span>
<div class="inner-modal-content">
<form id="cryptocurrencyForm">
<h2 id="cryptocurrencyModalTitle">Edit cryptocurrency</h2>
<div>
<!-- text -->
<label for="cryptocurrencyId" style="display: flex; flex-direction: column;">
Coingecko id
<a href="https://www.coingecko.com/" target="_blank" style="opacity: 0.8;">find on
coingecko.com</a>
</label>
<input id="cryptocurrencyId" type="text" placeholder="coingecko id" autocomplete="off" />
</div>
<div>
<label for="cryptocurrencySymbol">Symbol</label>
<input id="cryptocurrencySymbol" type="text" placeholder="symbol (e.g. BTC)" autocomplete="off" />
</div>
<div>
<label for="cryptocurrencyName">Displayname</label>
<input id="cryptocurrencyName" type="text" placeholder="displayname" autocomplete="off" />
</div>
<div id="cryptocurrencyModalError" style="color: red; display: none;"></div>
<button id="saveCryptocurrencyBtn" type="submit">Save</button>
</form>
</div>
</div>
</dialog>
<!-- New Transaction modal -->
<dialog id="transaction-modal" class="modal">
<div class="modal-content">
<span class="close" id="transaction-modal-close">×</span>
<div class="inner-modal-content">
<h2>
New transaction for <span id="transactionModalTitle"></span>
</h2>
<form id="transactionForm">
<div class="button" id="toggleTransactionType">
<p class="active" id="buyTransactionBtn">Buy</p>
<p class="" id="sellTransactionBtn">Sell</p>
</div>
<div>
<input id="transactionDate" type="date" />
</div>
<div class="availableAmountDiv">
<span id="availableAmount"></span>
<input id="transactionAmount" type="number" step="any" placeholder="Amount of coins" min="0" required />
</div>
<div>
<input id="transactionCost" type="number" step="any" placeholder="Total cost ($)" min="0" required />
</div>
<button id="addTransactionBtn">Add transaction</button>
</form>
</div>
</div>
</dialog>
<!-- Manage Transactions modal -->
<dialog id="manage-transactions-modal" class="modal">
<div class="modal-content manage-transactions-modal-content">
<span class="close" id="manage-transactions-modal-close">×</span>
<h2>
Manage <span id="manageTransactionsModalTitle"></span> transactions
</h2>
<div class="inner-modal-content" id="inner-manage-transactions-modal-content">
<table class="table" id="manageTransactionsTable">
<thead>
<tr>
<th>Date</th>
<th>type</th>
<th>Amount</th>
<th>Cost</th>
</tr>
</thead>
<tbody id="manageTransactionsTableBody"></tbody>
</table>
</div>
</div>
</dialog>
<!-- Edit Transaction modal -->
<dialog id="edit-transaction-modal" class="modal">
<div class="modal-content">
<span class="close" id="edit-transaction-modal-close">×</span>
<div class="inner-modal-content">
<h2>
Edit <span id="editTransactionModalTitle"></span> transaction
</h2>
<form id="editTransactionForm">
<div class="button" id="editToggleTransactionType">
<p class="" id="editBuyTransactionBtn">Buy</p>
<p class="" id="editSellTransactionBtn">Sell</p>
</div>
<div>
<input id="editTransactionDate" type="date" />
</div>
<div>
<input id="editTransactionAmount" type="number" step="any" placeholder="Amount of coins" min="0"
required />
</div>
<div>
<input id="editTransactionCost" type="number" step="any" placeholder="Total cost ($)" min="0"
required />
</div>
<button id="editTransactionBtn">Edit transaction</button>
</form>
</div>
</div>
</dialog>
<footer>
<p>
A project by
<a href="https://wolfez.dev" rel="noopener">wolfez.dev</a>
</p>
</footer>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
<script defer src="https://umami.wolfez.dev/script.js"
data-website-id="c08875fb-7cbc-48eb-b3f1-a6eeb3e57773"></script>
</body>
</html>