diff --git a/apps/monitor/calc.py b/apps/monitor/calc.py
index c828389..0778f1e 100644
--- a/apps/monitor/calc.py
+++ b/apps/monitor/calc.py
@@ -59,6 +59,7 @@ class Calc:
def GetCurrentValue(self, userid, crypto, total_investment, current_value, total_tax_free):
amount_kept = 0
+ last_updated = None
out = {}
out["crypto"] = crypto
@@ -93,6 +94,7 @@ class Calc:
out["current_value"] = cv
out["amount_kept"] = amount_kept
out["rateEUR"] = rateEUR.rate
+ last_updated = rateEUR.datetime_valid
else:
out["current_value"] = None
out["amount_kept"] = None
@@ -134,4 +136,4 @@ class Calc:
out["value_tax_free"] = amount_available_to_sell * rateEUR.rate
total_tax_free += out["value_tax_free"]
- return (total_investment, current_value, total_tax_free, rateEUR.rate, rateUSD.rate, out)
+ return (total_investment, current_value, total_tax_free, rateEUR.rate, rateUSD.rate, last_updated, out)
diff --git a/apps/monitor/templates/monitor.html b/apps/monitor/templates/monitor.html
index 3e75c73..460123a 100644
--- a/apps/monitor/templates/monitor.html
+++ b/apps/monitor/templates/monitor.html
@@ -4,6 +4,7 @@
Monitor
Refresh
+
last update: {{last_updated|date:'Y-m-d H:i:s'}} ({{django_timezone}})
Hint: these numbers are not very accurate.
Total investment: {{total_investment|floatformat:2}} EUR
diff --git a/apps/monitor/views.py b/apps/monitor/views.py
index 8f3b5f8..d32c39c 100644
--- a/apps/monitor/views.py
+++ b/apps/monitor/views.py
@@ -1,5 +1,7 @@
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
+from django.conf import settings
+import pytz
from apps.transactions.models import Transaction
from apps.rates.models import ExchangeRate
from apps.monitor.calc import Calc
@@ -13,14 +15,23 @@ def monitor(request):
total_investment = 0
current_value = 0
total_tax_free = 0
+ last_updated = None
calc = Calc()
for crypto in crypto_currencies:
- (total_investment, current_value, total_tax_free, rateEUR, rateUSD, out2) = calc.GetCurrentValue(request.user.id, crypto, total_investment, current_value, total_tax_free)
+ (total_investment, current_value, total_tax_free, rateEUR, rateUSD, last_updated, out2) = calc.GetCurrentValue(request.user.id, crypto, total_investment, current_value, total_tax_free)
cryptos.append({"crypto": crypto, "rateEUR": rateEUR, "rateUSD": rateUSD, **out2})
- return render(request,"monitor.html",{'cryptos':cryptos, 'total_tax_free': total_tax_free, 'total_investment': total_investment, 'current_value': current_value})
+ django_timezone = pytz.timezone(settings.TIME_ZONE)
+
+ return render(request,"monitor.html",
+ {'cryptos':cryptos,
+ 'total_tax_free': total_tax_free,
+ 'total_investment': total_investment,
+ 'current_value': current_value,
+ 'last_updated': last_updated,
+ 'django_timezone': django_timezone})
@login_required
def graph(request):
diff --git a/requirements.txt b/requirements.txt
index cb693c9..65d1ddc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,5 @@
django
django-registration
+pytz
matplotlib
btcde
diff --git a/walletmonitor/settings_local.py.example b/walletmonitor/settings_local.py.example
index 06c2bb4..7f1d484 100644
--- a/walletmonitor/settings_local.py.example
+++ b/walletmonitor/settings_local.py.example
@@ -15,3 +15,4 @@ EMAIL_USE_TLS = True
SITE_ID = 1
ABOUT_URL = 'https://about.example.com'
+TIME_ZONE = 'Europe/Amsterdam'