diff --git a/history/views.py b/history/views.py index 371a9ec..9441374 100644 --- a/history/views.py +++ b/history/views.py @@ -1,3 +1,4 @@ +import pytz from django.contrib.admin.views.decorators import staff_member_required from history.models import ( PredictionTest, Price, Trade, Balance, TradeRecommendation, PerformanceComp, @@ -566,7 +567,8 @@ def profit_view(request): # get data data = {} for t in Trade.objects.filter(symbol=symbol, status='fill').order_by('-created_on').all(): - date = datetime.datetime.strftime(t.created_on, '%Y-%m-%d') + mst_dt = timezone.localtime(t.created_on, pytz.timezone('MST')) + date = datetime.datetime.strftime(mst_dt, '%Y-%m-%d') if date not in data.keys(): data[date] = {'buyvol': [], 'sellvol': [], 'buy': [], 'sell': [], 'bal': 0.00} data[date][t.type].append(t.price)