for history
This commit is contained in:
parent
de24264331
commit
2704848368
|
@ -179,25 +179,30 @@ def profile(request):
|
||||||
order_positions_count = order_positions.count()
|
order_positions_count = order_positions.count()
|
||||||
order_position_list = list(order_positions)
|
order_position_list = list(order_positions)
|
||||||
for idx2, order_position in enumerate(order_position_list):
|
for idx2, order_position in enumerate(order_position_list):
|
||||||
|
position_price = None
|
||||||
|
price = None
|
||||||
# get currencyname to display:
|
# get currencyname to display:
|
||||||
if order.exchange_rate is not None:
|
if order.exchange_rate is not None:
|
||||||
# get price of position in order and append to a list:
|
# get price of position in order and append to a list:
|
||||||
rate = ExchangeRate.objects.get(
|
rate = ExchangeRate.objects.get(
|
||||||
id=order.exchange_rate.id)
|
id=order.exchange_rate.id)
|
||||||
order_position.price_in_chf = round(
|
price = round(
|
||||||
rate.exchange_rate_to_chf *
|
rate.exchange_rate_to_chf *
|
||||||
order_position.price_in_chf,
|
order_position.price_in_chf,
|
||||||
2)
|
2)
|
||||||
currency_name = order.exchange_rate
|
currency_name = order.exchange_rate
|
||||||
else:
|
else:
|
||||||
currency_name = 'CHF'
|
currency_name = 'CHF'
|
||||||
totalprice_list.append(order_position.price_in_chf)
|
price = order_position.price_in_chf
|
||||||
|
position_price = price * Decimal.from_float(
|
||||||
|
order_position.amount)
|
||||||
|
totalprice_list.append(position_price)
|
||||||
order_position_list[idx2] = order_position
|
order_position_list[idx2] = order_position
|
||||||
total = sum(totalprice_list)
|
total = sum(totalprice_list)
|
||||||
currency_list.append(currency_name)
|
currency_list.append(currency_name)
|
||||||
total_list.append(total)
|
total_list.append(total)
|
||||||
order_positions_count_list.append(order_positions_count)
|
order_positions_count_list.append(order_positions_count)
|
||||||
orders_list[idx1] = order
|
orders_list[idx1] = order
|
||||||
order_list_zip = zip(orders_list,
|
order_list_zip = zip(orders_list,
|
||||||
order_positions_count_list,
|
order_positions_count_list,
|
||||||
total_list,
|
total_list,
|
||||||
|
|
Loading…
Reference in New Issue