60 lines
1.5 KiB
HTML
60 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Crypto Portfolio</title>
|
|
<style>
|
|
table {
|
|
border-style: solid;
|
|
border-width: 3px;
|
|
}
|
|
|
|
td, th {
|
|
border-style: solid;
|
|
border-width: 2px;
|
|
}
|
|
td {
|
|
text-align: right;
|
|
}
|
|
td.left {
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<table>
|
|
<tr>
|
|
<th>Token</th><th>Balance</th><th>Price</th><th>Investment</th><th>Value</th><th>Margin</th><th>Movement</th>
|
|
</tr>
|
|
%row%
|
|
<tr>
|
|
<td class="left"><b>Total</b></td><td></td><td></td><td><b>%inv%</b></td><td><b>%val%</b></td><td><b>%mar%</b></td><td><b>%mov%</b></td>
|
|
</tr>
|
|
</table>
|
|
<p><i>%dts%</i></p>
|
|
<button onclick="download_csv_file()"> Download CSV </button>
|
|
</body>
|
|
<script>
|
|
var csvFileData = [
|
|
%csv_data%
|
|
];
|
|
|
|
function download_csv_file() {
|
|
|
|
var csv = 'Date,Time,Zone,Token,Balance,Price,Investment,Value,Margin,Movement\n';
|
|
|
|
csvFileData.forEach(function(row) {
|
|
csv += row.join(',');
|
|
csv += "\n";
|
|
});
|
|
|
|
document.write(csv);
|
|
|
|
var hiddenElement = document.createElement('a');
|
|
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
|
|
hiddenElement.target = '_blank';
|
|
|
|
hiddenElement.download = 'CSV_Portfolio_%dts_fln%.csv';
|
|
hiddenElement.click();
|
|
}
|
|
</script>
|
|
</html>
|