Fix profit calculation
This commit is contained in:
parent
6d2050310c
commit
48b3d7c521
|
@ -304,9 +304,8 @@ namespace Core.Main.DataObjects
|
||||||
sellLogData.AverageBuyPrice = rsld.avgPrice;
|
sellLogData.AverageBuyPrice = rsld.avgPrice;
|
||||||
sellLogData.TotalCost = sellLogData.SoldAmount * sellLogData.AverageBuyPrice;
|
sellLogData.TotalCost = sellLogData.SoldAmount * sellLogData.AverageBuyPrice;
|
||||||
|
|
||||||
|
// check if sale was a short position
|
||||||
|
if ((sellLogData.ProfitPercent > 0) && (sellLogData.AverageBuyPrice > sellLogData.SoldPrice))
|
||||||
if (sellLogData.ProfitPercent >0)
|
|
||||||
{
|
{
|
||||||
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
||||||
double soldValueAfterFees = soldValueRaw + (soldValueRaw * ((double)rsld.fee / 100));
|
double soldValueAfterFees = soldValueRaw + (soldValueRaw * ((double)rsld.fee / 100));
|
||||||
|
|
Loading…
Reference in New Issue