mrtg/tmpl/cryptoReport.tmpl
2022-01-14 11:56:41 +01:00

72 lines
2.0 KiB
Cheetah

[% USE f2 = format('%.6f') %]
<html>
<head>
<style>
body {
font-family: Helvetica,Arial;
}
table {
width: 100vw;
}
th {
text-align: left;
font-weight: bold;
border-bottom: 1px solid #808080;
}
td {
text-align: right;
padding: 0em 1em;
border-bottom: 1px solid #808080;
}
.green {
font-weight: bold;
color: #303030;
background-color: #adebad;
}
.red {
font-weight: bold;
color: #f0f0f0;
background-color: #cc0000;
}
</style>
</head>
<body>
<h1>Report vom [% GENERATED %]</h1>
<table>
[% totalProfit = 0 %]
[% totalValue = 0 %]
[% FOREACH c IN DATA %]
[% gain = f2(c.CURRENT_PRICE / c.LAST_WEEK_PRICE * 100 - 100) %]
[% cur_value = f2(c.CURRENT_PRICE * c.COIN) %]
[% totalValue = totalValue + cur_value %]
[% cur_profit_value = f2((c.CURRENT_PRICE * c.COIN) - c.PRICE) %]
[% cur_profit_perc = f2(cur_profit_value / c.PRICE * 100) %]
<tr>
<th><img alt="[% c.NAME %]" src="data:image/png;base64,[% c.IMAGE %]"></th>
<td>
<table style="width: 100%">
<tr><th>W&auml;hrung</th><td>[% c.NAME %] ([% c.CURRENCY %])</td></tr>
<tr><th>Kaufdatum</th><td>[% c.DATE %]</td></tr>
<tr><th>Kaufwert</th><td>[% f2(c.PRICE) %] Euro | [% c.COIN %] [% c.CURRENCY %]</td></tr>
<tr><th>Kaufkurs</th><td>[% f2(c.BUYRATE) %] Euro/[% c.CURRENCY %]</td></tr>
<tr><th>aktueller Kurs</th><td>[% f2(c.CURRENT_PRICE) %] Euro/[% c.CURRENCY %]</td></tr>
<tr><th>aktueller Wert</th><td>[% cur_value %] Euro</td></tr>
<tr><th>aktueller Profit</th><td><b>[% cur_profit_value %] Euro ([% cur_profit_perc %]%)</b></td></tr>
<!--
[% IF gain > 0 %]
<tr class="green"><td>7 Tage Gewinn</td><td>+[% gain %]%</td></tr>
[% ELSE %]
<tr class="red"><td>7 Tage Verlust</td><td>[% gain %]%</td></tr>
[% END %]
-->
</table>
</td>
</tr>
[% totalProfit = totalProfit + cur_profit_value %]
[% END %]
</table>
<h2>Wert (gesamt) ca. [% totalValue %] Euro</h2>
<h2>Gewinn (gesamt) ca. [% totalProfit %] Euro</h2>
</body>
</html>