diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index 631d812..7ecae4b 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -304,21 +304,12 @@ namespace Core.Main.DataObjects sellLogData.AverageBuyPrice = rsld.avgPrice; sellLogData.TotalCost = sellLogData.SoldAmount * sellLogData.AverageBuyPrice; - // check if sale was a short position - if ((sellLogData.ProfitPercent > 0) && (sellLogData.AverageBuyPrice > sellLogData.SoldPrice)) - { - double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice); - double soldValueAfterFees = soldValueRaw + (soldValueRaw * ((double)rsld.fee / 100)); - sellLogData.SoldValue = soldValueAfterFees; - sellLogData.Profit = Math.Abs(Math.Round(sellLogData.SoldValue - sellLogData.TotalCost, 8)); - } - else - { + // check if bot is a shortbot via PT API. Losses on short bot showing as gains. Issue #195 + double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice); double soldValueAfterFees = soldValueRaw - (soldValueRaw * ((double)rsld.fee / 100)); sellLogData.SoldValue = soldValueAfterFees; sellLogData.Profit = Math.Round(sellLogData.SoldValue - sellLogData.TotalCost, 8); - } //Convert Unix Timestamp to Datetime System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index 2a902be..2f29e99 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -228,7 +228,7 @@ namespace Core.ProfitTrailer result = ""; } - // strategy labels that are variable, so can't be caught by the switch statement + // strategy labels that are variable value if (result.Contains("REBUY")) { time = strategyName.Remove(0, 14); @@ -423,6 +423,18 @@ namespace Core.ProfitTrailer case "no dca buy logic": result = String.Concat(strategyLetter, "NODCA"); break; + case "combimagain": + result = String.Concat(strategyLetter, "COMBIG"); + break; + case "combimaspread": + result = String.Concat(strategyLetter, "COMBIS"); + break; + case "combimacross": + result = String.Concat(strategyLetter, "COMBIC"); + break; + case "macdpercentage": + result = String.Concat(strategyLetter, "MACDPERC"); + break; default: break; } @@ -588,7 +600,7 @@ namespace Core.ProfitTrailer if (!isValidStrategy) { // Parse Formulas - if (strategy.Name.Contains("FORMULA") && !strategy.Name.Contains("STATS")) + if (strategy.Name.Contains("FORMULA") && !strategy.Name.Contains("STATS") && !strategy.Name.Contains("LEVEL")) { string expression = strategy.Name.Remove(0, 10); expression = expression.Replace("", "true").Replace("", "false").Replace("", "").Replace("&&", "and").Replace("||", "or"); @@ -605,10 +617,43 @@ namespace Core.ProfitTrailer } } - else + //else + //{ + // strategyText += "" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + " "; + //} + + + if (strategy.Name.Contains("LEVEL") && !strategy.Name.Contains("TRIGGERED")) { - strategyText += "" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + " "; + string level = strategy.Name.Substring(5, 2); + string expression = strategy.Name.Remove(0, 17); + expression = expression.Replace("", "true").Replace("", "false").Replace("", "").Replace("&&", "and").Replace("||", "or"); + expression = regx.Replace(expression, String.Empty); + var tokens = new Tokenizer(expression).Tokenize(); + var parser = new Parser(tokens); + if (parser.Parse()) + { + strategyText += "LEVEL" + level + " "; + } + else + { + strategyText += "LEVEL" + level + " "; + } + } + //else + //{ + // strategyText += "" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + " "; + //} + + if (strategy.Name.Contains("LEVEL") && strategy.Name.Contains("TRIGGERED")) + { + string level = strategy.Name.Substring(5, 2); + strategyText += "LEVEL " + level + "TRIG "; + } + + + } else { diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index 2e0bd56..7cf7553 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -13,7 +13,6 @@
- @if (!Model.TrendChartDataJSON.Equals("")) {
@@ -25,7 +24,7 @@
-
+ @{ double currentBalance = Model.PTData.GetCurrentBalance(); string currentBalanceString = currentBalance.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")); @@ -34,21 +33,14 @@ } }
- - Start balence:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket -
- Current value:   @currentBalanceString @Model.Summary.MainMarket -
- Gain:   @Math.Round(((currentBalance - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2) % -
-
+ TCV:   @currentBalanceString   @Model.Summary.MainMarket  
- +
-
+
@if (!Model.ProfitChartDataJSON.Equals("")) { @@ -65,11 +57,9 @@
-
-
-
-

Market Trends at @Model.PTMagicConfiguration.GeneralSettings.Application.Exchangemore

+

Market Trends at @Model.PTMagicConfiguration.GeneralSettings.Application.Exchange + more

@@ -108,12 +98,10 @@
-
-

Sales Overviewmore

- @{ + @{ double totalProfit = Model.PTData.SellLog.Sum(s => s.Profit); double totalProfitFiat = Math.Round(totalProfit * Model.Summary.MainMarketPrice, 2); double percentGain = Math.Round(totalProfit / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance * 100, 2); @@ -190,6 +178,7 @@
+ Starting Balance:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket
diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index b417b9a..90c7de1 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -224,8 +224,9 @@ - @Html.Raw((((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))% + @Html.Raw( (((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#0.00", new System.Globalization.CultureInfo("en-US")))% +