Skip to content

Commit

Permalink
Use MST to display date
Browse files Browse the repository at this point in the history
  • Loading branch information
rubik committed Apr 14, 2016
1 parent ae8b12f commit 97daf16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion history/views.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 97daf16

Please sign in to comment.