From c2da0e56653c39d8ab9718c5066dd3d0e256df43 Mon Sep 17 00:00:00 2001 From: JackTerok Date: Tue, 2 Feb 2021 05:48:50 +0100 Subject: [PATCH 01/20] Auto Update Script for Linux --- PTMagic/PTMUpdate.sh | 112 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 PTMagic/PTMUpdate.sh diff --git a/PTMagic/PTMUpdate.sh b/PTMagic/PTMUpdate.sh new file mode 100644 index 0000000..4fea992 --- /dev/null +++ b/PTMagic/PTMUpdate.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Color Codes + +Red='\033[0;31m' # Red +Green='\033[0;32m' # Green +Color_Off='\033[0m' # Text Reset + +#Init Vars + +BASEDIR=$PWD + +#Main Script + +clear + +if [[ $EUID -ne 0 ]]; +then + echo "This script must be run as root" + exit +fi + +echo "Profit Trailer Magic Auto Updater" +echo "" +echo "This Programm will update you to a Version of PTM you choose" +echo "" +echo -e "Please make sure that PTM is ${Red}NOT RUNNING!!!${Color_Off}" +echo "" +echo "Continue? (yes/no)" + +read start + +if [ "$start" != "yes" ] +then + echo "exiting" + exit +fi + +echo "" +echo "Please input the version NR you want to update to." +echo "It can be found on: https://github.com/PTMagicians/PTMagic/releases" +echo "Example: 2.5.1" + +read VERSION + +echo "" +echo "Checking for Required Programms:" + +if ! command -v unzip &> /dev/null +then + echo -e "Unzip: ${Red}[\u274c]${Color_Off}" + UNZIPINSTALL="unzip" +else + echo -e "Unzip: ${Green}[\u2714]${Color_Off}" + UNZIPINSTALL="" +fi + +if ! command -v wget &> /dev/null +then + echo -e "Wget: ${Red}[\u274c]${Color_Off}" + WGETINSTALL="wget" +else + echo -e "Wget: ${Green}[\u2714]${Color_Off}" + WGETINSTALL="" +fi + + +if [[ $UNZIPINSTALL != "" ]] || [[ $WGETINSTALL != "" ]] +then + echo "" + echo "Installing missing programms..." + apt install -y $UNZIPINSTALL $WGETINSTALL >/dev/null + echo "Missing Programms installed" +fi + +echo "" +echo "Removing old upgrade files..." +rm -r -f -d $PWD/temp >/dev/null + +echo "" +echo "Downloading PTM Version $VERSION..." + +mkdir "$PWD/temp" >/dev/null +cd "$PWD/temp" + +wget "https://github.com/PTMagicians/PTMagic/releases/download/$VERSION/PTM_$VERSION.zip" --output-file=logfile + +if [ ! -f $PWD/PTM_$VERSION.zip ]; +then + echo -e "${Red}Download Failed${Color_Off}" + exit +fi + +echo "" +echo "Unpacking Archive..." + +unzip $PWD/PTM_$VERSION.zip >/dev/null + +echo "" +echo "Moving Files..." + +cp -r $PWD/PTM_$VERSION/PTMagic/. $BASEDIR/ + +echo "" +echo "Cleaning up..." + +cd $BASEDIR + +rm -r -d $PWD/temp >/dev/null + +echo "" +echo "Done" From 88c8f39480436ab30a58e1af79a7fe76f0beff5d Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Thu, 4 Feb 2021 22:57:54 +0000 Subject: [PATCH 02/20] Add active single market settings to SMS tool tip --- Monitor/Pages/_get/TickerWidgets.cshtml | 6 +++++- Monitor/Pages/_get/TickerWidgets.cshtml.cs | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml b/Monitor/Pages/_get/TickerWidgets.cshtml index fa948f6..659d4ed 100644 --- a/Monitor/Pages/_get/TickerWidgets.cshtml +++ b/Monitor/Pages/_get/TickerWidgets.cshtml @@ -3,13 +3,17 @@ @{ Layout = null; + // Single market settings tool tip int activeSingleSettings = Model.MarketsWithSingleSettings.Count; string singleSettingInfoIcon = ""; if (activeSingleSettings > 0) { - singleSettingInfoIcon = "Single Market Settings active for:
-" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "
-", true) + "\" data-template=\"\">
"; + singleSettingInfoIcon = "Single Market Settings active for:
" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "
", true) + "\" data-template=\"\">
"; } + + // Global setting tool tip string globalSettingInfoIcon = "Instance: " + Model.PTMagicConfiguration.GeneralSettings.Application.InstanceName + "\" data-template=\"\">"; + // Health indicator DateTime lastRuntime = Model.Summary.LastRuntime; double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds; double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0; diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml.cs b/Monitor/Pages/_get/TickerWidgets.cshtml.cs index 2788b4d..3f65652 100644 --- a/Monitor/Pages/_get/TickerWidgets.cshtml.cs +++ b/Monitor/Pages/_get/TickerWidgets.cshtml.cs @@ -21,14 +21,23 @@ namespace Monitor.Pages { private void BindData() { // Get markets with active single settings - foreach (string key in Summary.MarketSummary.Keys) { - if (Summary.MarketSummary[key].ActiveSingleSettings != null) { - if (Summary.MarketSummary[key].ActiveSingleSettings.Count > 0) { - MarketsWithSingleSettings.Add(key); - } + var MarketsWithSingleSettingsData = from x in Summary.MarketSummary + where x.Value.ActiveSingleSettings != null + && x.Value.ActiveSingleSettings.Count > 0 + orderby x.Key ascending + select x; + + foreach (var market in MarketsWithSingleSettingsData) { + // Get the name of all active single market settings + string activeSettings = string.Empty; + foreach (var singleSetting in market.Value.ActiveSingleSettings) + { + activeSettings += (", " + singleSetting.SettingName); } + activeSettings = activeSettings.Substring(2); // Chop the unrequired comma + + MarketsWithSingleSettings.Add(String.Format("{0} : {1}", market.Key, activeSettings)); } - MarketsWithSingleSettings.Sort(); } } } From ff7ddb84353c6862184cb48abd13334a90fcbda9 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 6 Feb 2021 00:22:01 +0900 Subject: [PATCH 03/20] rename variable for clarity --- Core/MarketAnalyzer/BaseAnalyzer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index b60d0f0..51b2628 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -391,7 +391,7 @@ namespace Core.MarketAnalyzer if (marketTrendChanges != null && marketTrendChanges.Count > 0) { double totalTrendChange = 0; - int trendChangeCount = marketTrendChanges.Count; + int trendsCount = marketTrendChanges.Count; foreach (MarketTrendChange marketTrendChange in marketTrendChanges) { if (marketTrend.TrendThreshold != 0) @@ -399,7 +399,7 @@ namespace Core.MarketAnalyzer if ((marketTrendChange.TrendChange > marketTrend.TrendThreshold) || (marketTrendChange.TrendChange < (marketTrend.TrendThreshold * -1))) { log.DoLogInfo("Market trend '" + marketTrend.Name + "' is ignoring " + marketTrendChange.Market + " for exceeding TrendThreshold."); - trendChangeCount += -1; + trendsCount += -1; } else { @@ -411,7 +411,7 @@ namespace Core.MarketAnalyzer totalTrendChange += marketTrendChange.TrendChange; } } - double averageTrendChange = totalTrendChange / trendChangeCount; + double averageTrendChange = totalTrendChange / trendsCount; result.Add(marketTrend.Name, averageTrendChange); log.DoLogInfo("Built average market trend change '" + marketTrend.Name + "' (" + averageTrendChange.ToString("#,#0.00") + "% in " + marketTrend.TrendMinutes.ToString() + " minutes) for " + marketTrendChanges.Count.ToString() + " markets."); } From 2ee2a2907d8917f57c8bcd6e4b17c2b31dcc69a0 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 6 Feb 2021 00:23:32 +0900 Subject: [PATCH 04/20] Health icon tootip fix --- Monitor/Pages/_get/TickerWidgets.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml b/Monitor/Pages/_get/TickerWidgets.cshtml index fa948f6..19920ca 100644 --- a/Monitor/Pages/_get/TickerWidgets.cshtml +++ b/Monitor/Pages/_get/TickerWidgets.cshtml @@ -16,10 +16,10 @@ string iconColor = "text-success"; string ptMagicHealthIcon = "fa-heartbeat"; - string ptMagicHealthTooltip = "PT Magic is alive and healthy!
Time elapsed since last run:"+ lastRuntime; + string ptMagicHealthTooltip = "PT Magic is alive and healthy! Time elapsed since last run:" + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; if (elapsedSecondsSinceRuntime > (intervalSeconds * 2)) { ptMagicHealthIcon = "fa-exclamation-triangle"; - ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: "+ Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; + ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; iconColor = "text-danger"; } } From 88beb769da42dfb70894043267a2eea209f122b7 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sat, 6 Feb 2021 19:45:09 +0000 Subject: [PATCH 05/20] Show profit % based on the GAIN strategy if available --- Monitor/Pages/_get/DashboardBottom.cshtml | 2 +- Monitor/Pages/_get/DashboardTop.cshtml | 60 ++++++++++------------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index 6508be7..03cff44 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -196,7 +196,7 @@ Sales Profit @Model.Summary.MainMarket Profit @Model.Summary.MainFiatCurrency - % Gain + Gain diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 2a2fb03..9793351 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -138,50 +138,36 @@ isSellStrategyTrue = (dcaLogEntry.SellStrategies.FindAll(ss => !ss.IsTrue).Count == 0); } - bool buyDisabled = false; string leverage = ""; double leverageValue = 1; string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive); - - if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) - { - buyDisabled = true; - } string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive); // Check for when PT loses the value of a pair bool lostValue = false; lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0); - double exchangeFee = 0; - switch (Model.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower()) + // Profit percentage + var profitPercentage = dcaLogEntry.ProfitPercent; + + if (dcaLogEntry.SellStrategies != null) { - case "binance": - exchangeFee = 0.002; - break; - case "binanceus": - exchangeFee = 0.002; - break; - case "binancefutures": - exchangeFee = 0.002; - break; - case "bittrex": - exchangeFee = 0.0025; - break; - case "poloniex": - exchangeFee = 0.0025; - break; - default: - break; + var gainStrategy = dcaLogEntry.SellStrategies.FirstOrDefault(x => x.Name.Contains(" GAIN", StringComparison.InvariantCultureIgnoreCase)); + if (gainStrategy != null) + { + // Use the gain percentage value as it is accurate to what can be achieved with the order book! + profitPercentage = gainStrategy.CurrentValue; + } } + // Aggregate totals - double tradingFee = (exchangeFee * dcaLogEntry.TotalCost) * 2; - double bagGain = (dcaLogEntry.ProfitPercent / 100) * dcaLogEntry.TotalCost * leverageValue; + double bagGain = (profitPercentage / 100) * dcaLogEntry.TotalCost * leverageValue; Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost; Model.TotalBagGain = Model.TotalBagGain + bagGain; // Render the row + @if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) { @dcaLogEntry.Market @@ -189,8 +175,11 @@ { @dcaLogEntry.Market } + @Html.Raw((dcaLogEntry.PercChange * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))% + @Html.Raw(dcaLogEntry.TotalCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US"))) + @if (dcaEnabled) { @@ -203,9 +192,11 @@ } + @Html.Raw(buyStrategyText) + @Html.Raw(sellStrategyText) - + @if (!sellStrategyText.Contains("WATCHMODE")) { @if (sellStrategyText.Contains("CROSSED")) @@ -223,12 +214,12 @@ } @if (leverageValue == 1) { - @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") + @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") } else { double TargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value; - @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? TargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") + @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? TargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") } } else @@ -236,16 +227,17 @@ } - - + @if (!@lostValue) - { - @dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% + { + @profitPercentage.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% } else { No Value! } + + } From a8e018097df50a888ff69a2527fe9c9a1d4f092e Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:26:43 +0000 Subject: [PATCH 06/20] Take into account TrendThreshold when calculating trend averages --- Core/Main/PTMagic.cs | 67 +++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 2bffb45..418fe68 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1519,11 +1519,15 @@ namespace Core.Main int marketPairProcess = 1; Dictionary> matchedMarketTriggers = new Dictionary>(); + + // Loop through markets foreach (string marketPair in this.MarketList) { this.Log.DoLogDebug("'" + marketPair + "' - Checking triggers (" + marketPairProcess.ToString() + "/" + this.MarketList.Count.ToString() + ")..."); bool stopTriggers = false; + + // Loop through single market settings foreach (SingleMarketSetting marketSetting in this.PTMagicConfiguration.AnalyzerSettings.SingleMarketSettings) { List matchedSingleMarketTriggers = new List(); @@ -1560,7 +1564,7 @@ namespace Core.Main continue; } - #region Checking Off Triggers + // Trigger checking SingleMarketSettingSummary smss = this.SingleMarketSettingSummaries.Find(s => s.Market.Equals(marketPair, StringComparison.InvariantCultureIgnoreCase) && s.SingleMarketSetting.SettingName.Equals(marketSetting.SettingName, StringComparison.InvariantCultureIgnoreCase)); if (smss != null) { @@ -1576,7 +1580,7 @@ namespace Core.Main { if (offTrigger.HoursSinceTriggered > 0) { - #region Check for Activation time period trigger + // Check for Activation time period trigger int smsActiveHours = (int)Math.Floor(DateTime.UtcNow.Subtract(smss.ActivationDateTimeUTC).TotalHours); if (smsActiveHours >= offTrigger.HoursSinceTriggered) { @@ -1588,17 +1592,15 @@ namespace Core.Main } else { - // Trigger not met! this.Log.DoLogDebug("'" + marketPair + "' - SMS only active for " + smsActiveHours.ToString() + " hours. Trigger not matched!"); offTriggerResults.Add(false); } - #endregion } else if (offTrigger.Min24hVolume > 0 || offTrigger.Max24hVolume < Constants.Max24hVolume) { - #region Check for 24h volume trigger + // Check for 24h volume trigger List marketTrendChanges = this.SingleMarketTrendChanges[this.SingleMarketTrendChanges.Keys.Last()]; if (marketTrendChanges.Count > 0) { @@ -1607,7 +1609,6 @@ namespace Core.Main { if (mtc.Volume24h >= offTrigger.Min24hVolume && mtc.Volume24h <= offTrigger.Max24hVolume) { - // Trigger met! this.Log.DoLogDebug("'" + marketPair + "' - 24h volume off trigger matched! 24h volume = " + mtc.Volume24h.ToString(new System.Globalization.CultureInfo("en-US")) + " " + this.LastRuntimeSummary.MainMarket); @@ -1615,7 +1616,6 @@ namespace Core.Main } else { - // Trigger not met! this.Log.DoLogDebug("'" + marketPair + "' - 24h volume off trigger not matched! 24h volume = " + mtc.Volume24h.ToString(new System.Globalization.CultureInfo("en-US")) + " " + this.LastRuntimeSummary.MainMarket); @@ -1623,16 +1623,14 @@ namespace Core.Main } } } - - #endregion } else { - #region Check for market trend triggers + // Check for market trend triggers if (this.SingleMarketTrendChanges.ContainsKey(offTrigger.MarketTrendName)) { - List marketTrendChanges = this.SingleMarketTrendChanges[offTrigger.MarketTrendName]; + List marketTrends = this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends; if (marketTrendChanges.Count > 0) { double averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); @@ -1645,7 +1643,6 @@ namespace Core.Main if (offTrigger.MarketTrendRelation.Equals(Constants.MarketTrendRelationRelative)) { - // Build pair trend change relative to the global market trend trendChange = trendChange - averageMarketTrendChange; } @@ -1684,7 +1681,6 @@ namespace Core.Main offTriggerResults.Add(false); } } - #endregion } } @@ -1720,8 +1716,8 @@ namespace Core.Main } } } - #endregion + // Do we have triggers if (marketSetting.Triggers.Count > 0 && !stopTriggers) { #region Checking Triggers @@ -1730,6 +1726,8 @@ namespace Core.Main List triggerResults = new List(); Dictionary relevantTriggers = new Dictionary(); int triggerIndex = 0; + + // Loop through SMS triggers foreach (Trigger trigger in marketSetting.Triggers) { @@ -1819,7 +1817,37 @@ namespace Core.Main List marketTrendChanges = this.SingleMarketTrendChanges[trigger.MarketTrendName]; if (marketTrendChanges.Count > 0) { - double averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); + double averageMarketTrendChange = 0; + var trendThreshold = (from mt in this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends + where mt.Name == trigger.MarketTrendName + select new { mt.TrendThreshold }).Single(); + + // Calculate average market change, skip any that are outside the threshold if enabled + if (trendThreshold.TrendThreshold != 0) + { + // Exclude trends outside the threshhold. + var excludedMarkets = from m in marketTrendChanges + where m.TrendChange > trendThreshold.TrendThreshold + orderby m.Market + select m; + + foreach (var marketTrend in excludedMarkets) + { + this.Log.DoLogInfo("SMS Trigger for '" + marketSetting.SettingName + "' is ignoring " + marketTrend.Market + " for exceeding TrendThreshold " + trendThreshold.TrendThreshold + " on " + trigger.MarketTrendName); + } + + var includedMarkets = from m in marketTrendChanges + where m.TrendChange <= trendThreshold.TrendThreshold + orderby m.Market + select m; + + averageMarketTrendChange = includedMarkets.Average(m => m.TrendChange); + } + else + { + // Calculate for whole market + averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); + } MarketTrendChange mtc = marketTrendChanges.Find(m => m.Market.Equals(marketPair, StringComparison.InvariantCultureIgnoreCase)); if (mtc != null) @@ -1895,7 +1923,7 @@ namespace Core.Main #endregion } triggerIndex++; - } + } // End loop SMS triggers // Check if all triggers have to get triggered or just one bool settingTriggered = false; @@ -2041,7 +2069,7 @@ namespace Core.Main this.Log.DoLogDebug("'" + marketPair + "' - '" + marketSetting.SettingName + "' not triggered!"); } } - } + } // End loop single market settings if ((marketPairProcess % 10) == 0) { @@ -2049,8 +2077,9 @@ namespace Core.Main } marketPairProcess++; - } + } // End loop through markets + // Did we trigger any SMS? if (this.TriggeredSingleMarketSettings.Count > 0) { this.Log.DoLogInfo("Building single market settings for '" + this.TriggeredSingleMarketSettings.Count.ToString() + "' markets..."); @@ -2626,4 +2655,4 @@ namespace Core.Main } #endregion } -} +} \ No newline at end of file From 1b2908d8a88b4d5a6bff658c066e6f15acbc6d64 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sun, 7 Feb 2021 22:54:47 +0000 Subject: [PATCH 07/20] Fixed compatability with PT 2.5 beta UI --- Core/DataObjects/ProfitTrailerData.cs | 35 +++--- Core/ProfitTrailer/StrategyHelper.cs | 153 ++++++++++++++------------ 2 files changed, 102 insertions(+), 86 deletions(-) diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index 1beedc4..6cc70b1 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -335,7 +335,7 @@ namespace Core.Main.DataObjects // check if bot is a shortbot via PT API. Losses on short bot currently showing as gains. Issue #195 // code removed - + double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice); double soldValueAfterFees = soldValueRaw - (soldValueRaw * ((double)rsld.fee / 100)); sellLogData.SoldValue = soldValueAfterFees; @@ -399,9 +399,11 @@ namespace Core.Main.DataObjects dcaLogData.SellStrategy = pair.sellStrategy == null ? "" : pair.sellStrategy; dcaLogData.IsTrailing = false; - if (pair.buyStrategies != null && processBuyStrategies) + // See if they are using PT 2.5 (buyStrategiesData) or 2.4 (buyStrategies) + var buyStrats = pair.buyStrategies != null ? pair.buyStrategies : pair.buyStrategiesData.data; + if (buyStrats != null && processBuyStrategies) { - foreach (var bs in pair.buyStrategies) + foreach (var bs in buyStrats) { Strategy buyStrategy = new Strategy(); buyStrategy.Type = bs.type; @@ -412,16 +414,18 @@ namespace Core.Main.DataObjects buyStrategy.CurrentValue = bs.currentValue; buyStrategy.CurrentValuePercentage = bs.currentValuePercentage; buyStrategy.Decimals = bs.decimals; - buyStrategy.IsTrailing = ((string)bs.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1; - buyStrategy.IsTrue = ((string)bs.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1; + buyStrategy.IsTrailing = bs.trailing; + buyStrategy.IsTrue = bs.strategyResult; dcaLogData.BuyStrategies.Add(buyStrategy); } } - if (pair.sellStrategies != null) + // See if they are using PT 2.5 (sellStrategiesData) or 2.4 (sellStrategies) + var sellStrats = pair.sellStrategies != null ? pair.sellStrategies : pair.sellStrategiesData.data; + if (sellStrats != null) { - foreach (var ss in pair.sellStrategies) + foreach (var ss in sellStrats) { Strategy sellStrategy = new Strategy(); sellStrategy.Type = ss.type; @@ -432,8 +436,8 @@ namespace Core.Main.DataObjects sellStrategy.CurrentValue = ss.currentValue; sellStrategy.CurrentValuePercentage = ss.currentValuePercentage; sellStrategy.Decimals = ss.decimals; - sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1; - sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1; + sellStrategy.IsTrailing = ss.trailing; + sellStrategy.IsTrue = ss.strategyResult; dcaLogData.SellStrategies.Add(sellStrategy); @@ -495,9 +499,14 @@ namespace Core.Main.DataObjects } else { - if (rbld.buyStrategies != null) + // Parse buy strategies + + // See if they are using PT 2.5 (buyStrategiesData) or 2.4 (buyStrategies) + var buyStrats = rbld.buyStrategies != null ? rbld.buyStrategies : rbld.buyStrategiesData.data; + + if (buyStrats != null) { - foreach (var bs in rbld.buyStrategies) + foreach (var bs in buyStrats) { Strategy buyStrategy = new Strategy(); buyStrategy.Type = bs.type; @@ -508,8 +517,8 @@ namespace Core.Main.DataObjects buyStrategy.CurrentValue = bs.currentValue; buyStrategy.CurrentValuePercentage = bs.currentValuePercentage; buyStrategy.Decimals = bs.decimals; - buyStrategy.IsTrailing = ((string)(bs.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1; - buyStrategy.IsTrue = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1; + buyStrategy.IsTrailing = bs.trailing; + buyStrategy.IsTrue = bs.strategyResult; // Is SOM? buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase); diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index e830c38..db866e7 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -261,85 +261,92 @@ namespace Core.ProfitTrailer public static bool IsValidStrategy(string strategyName, bool checkForAnyInvalid) { bool result = false; - // buy/sell strategies beginning with PT 2.3.3 contain the letter followed by a colon and space. - if (strategyName.Contains(":")) + + if (!string.IsNullOrEmpty(strategyName)) { - result = true; - } - if (!checkForAnyInvalid) - { - switch (strategyName.ToLower()) - { - case "lowbb": - case "highbb": - case "gain": - case "loss": - case "smagain": - case "emagain": - case "hmagain": - case "dmagain": - case "smaspread": - case "emaspread": - case "hmaspread": - case "dmaspread": - case "smacross": - case "emacross": - case "hmacross": - case "dmacross": - case "rsi": - case "stoch": - case "stochrsi": - case "stochrsik": - case "stochrsid": - case "stochrsicross": - case "macd": - case "obv": - case "bbwidth": - case "anderson": - case "dema": - case "hma": - case "pdhigh": - case "pdlow": - case "pdclose": - case "signal": - case "changepercentage": - case "profitpercentage": - case "lastdcabuy": - case "fixedprice": - case "lowatrband": - case "highatrband": - case "atrpercentage": - case "vwappercentage": - case "mvwappercentage": - case "btcdominance": - case "combimagain": - case "combimaspread": - case "combimacross": - case "macdpercentage": - result = true; - break; - default: - break; - } - } - else - { - if (strategyName.IndexOf("max", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("min", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("som", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("price", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("black", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("new", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("insufficient", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("timeout", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("spread", StringComparison.InvariantCultureIgnoreCase) == -1 - && strategyName.IndexOf("pairs", StringComparison.InvariantCultureIgnoreCase) == -1) + // buy/sell strategies beginning with PT 2.3.3 contain the letter followed by a colon and space. + if (strategyName.Contains(":")) { result = true; } + if (!checkForAnyInvalid) + { + switch (strategyName.ToLower()) + { + case "lowbb": + case "highbb": + case "gain": + case "loss": + case "smagain": + case "emagain": + case "hmagain": + case "dmagain": + case "smaspread": + case "emaspread": + case "hmaspread": + case "dmaspread": + case "smacross": + case "emacross": + case "hmacross": + case "dmacross": + case "rsi": + case "stoch": + case "stochrsi": + case "stochrsik": + case "stochrsid": + case "stochrsicross": + case "macd": + case "obv": + case "bbwidth": + case "anderson": + case "dema": + case "hma": + case "pdhigh": + case "pdlow": + case "pdclose": + case "signal": + case "changepercentage": + case "profitpercentage": + case "lastdcabuy": + case "fixedprice": + case "lowatrband": + case "highatrband": + case "atrpercentage": + case "vwappercentage": + case "mvwappercentage": + case "btcdominance": + case "combimagain": + case "combimaspread": + case "combimacross": + case "macdpercentage": + result = true; + break; + default: + break; + } + } + else + { + if (strategyName.IndexOf("max", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("min", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("som", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("price", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("black", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("new", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("insufficient", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("timeout", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("spread", StringComparison.InvariantCultureIgnoreCase) == -1 + && strategyName.IndexOf("pairs", StringComparison.InvariantCultureIgnoreCase) == -1) + { + result = true; + } + } } + return result; } + + public static int GetStrategyValueDecimals(string strategyName) { int result = 0; @@ -397,7 +404,7 @@ namespace Core.ProfitTrailer if (!isValidStrategy) { if (strategy.Name.Contains("TRIGGERED")) - // remove levels already triggered, to show only currently waiting trigger + // remove levels already triggered, to show only currently waiting trigger { strategyText += ""; } From 012ad0e8f2a24c6f909d7eb58dbfecccd2d7ba09 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Mon, 8 Feb 2021 18:54:57 +0000 Subject: [PATCH 08/20] Fixed threshold filters for minus and applied to off triggers as well --- Core/Main/PTMagic.cs | 83 ++++++++++++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 418fe68..c37f917 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -532,7 +532,7 @@ namespace Core.Main public bool StartProcess() { bool result = true; - + this.Log.DoLogInfo(""); this.Log.DoLogInfo(" ██████╗ ████████╗ ███╗ ███╗ █████╗ ██████╗ ██╗ ██████╗"); this.Log.DoLogInfo(" ██╔══██╗╚══██╔══╝ ████╗ ████║██╔══██╗██╔════╝ ██║██╔════╝"); @@ -1626,14 +1626,45 @@ namespace Core.Main } else { - // Check for market trend triggers + // Check for market trend Off triggers if (this.SingleMarketTrendChanges.ContainsKey(offTrigger.MarketTrendName)) { List marketTrendChanges = this.SingleMarketTrendChanges[offTrigger.MarketTrendName]; List marketTrends = this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends; + if (marketTrendChanges.Count > 0) { - double averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); + double averageMarketTrendChange = 0; + var trendThreshold = (from mt in this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends + where mt.Name == offTrigger.MarketTrendName + select new { mt.TrendThreshold }).Single(); + + // Calculate average market change, skip any that are outside the threshold if enabled + if (trendThreshold.TrendThreshold != 0) + { + // Exclude trends outside the threshhold. + var excludedMarkets = from m in marketTrendChanges + where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) + orderby m.Market + select m; + + foreach (var marketTrend in excludedMarkets) + { + this.Log.DoLogInfo(String.Format("SMS Off Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3} on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), offTrigger.MarketTrendName)); + } + + var includedMarkets = from m in marketTrendChanges + where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) + orderby m.Market + select m; + + averageMarketTrendChange = includedMarkets.Average(m => m.TrendChange); + } + else + { + // Calculate for whole market + averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); + } MarketTrendChange mtc = marketTrendChanges.Find(m => m.Market.Equals(marketPair, StringComparison.InvariantCultureIgnoreCase)); if (mtc != null) @@ -1819,35 +1850,35 @@ namespace Core.Main { double averageMarketTrendChange = 0; var trendThreshold = (from mt in this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends - where mt.Name == trigger.MarketTrendName - select new { mt.TrendThreshold }).Single(); - + where mt.Name == trigger.MarketTrendName + select new { mt.TrendThreshold }).Single(); + // Calculate average market change, skip any that are outside the threshold if enabled if (trendThreshold.TrendThreshold != 0) { - // Exclude trends outside the threshhold. - var excludedMarkets = from m in marketTrendChanges - where m.TrendChange > trendThreshold.TrendThreshold - orderby m.Market - select m; - - foreach (var marketTrend in excludedMarkets) - { - this.Log.DoLogInfo("SMS Trigger for '" + marketSetting.SettingName + "' is ignoring " + marketTrend.Market + " for exceeding TrendThreshold " + trendThreshold.TrendThreshold + " on " + trigger.MarketTrendName); - } + // Exclude trends outside the threshhold. + var excludedMarkets = from m in marketTrendChanges + where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) + orderby m.Market + select m; - var includedMarkets = from m in marketTrendChanges - where m.TrendChange <= trendThreshold.TrendThreshold - orderby m.Market - select m; + foreach (var marketTrend in excludedMarkets) + { + this.Log.DoLogInfo(String.Format("SMS Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3} on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), trigger.MarketTrendName)); + } - averageMarketTrendChange = includedMarkets.Average(m => m.TrendChange); + var includedMarkets = from m in marketTrendChanges + where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) + orderby m.Market + select m; + + averageMarketTrendChange = includedMarkets.Average(m => m.TrendChange); } else { - // Calculate for whole market - averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); - } + // Calculate for whole market + averageMarketTrendChange = marketTrendChanges.Average(m => m.TrendChange); + } MarketTrendChange mtc = marketTrendChanges.Find(m => m.Market.Equals(marketPair, StringComparison.InvariantCultureIgnoreCase)); if (mtc != null) @@ -2348,11 +2379,11 @@ namespace Core.Main string ProfitPercentageLabel = ""; for (char c = 'A'; c <= 'Z'; c++) { - + string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_buy_strategy", ""); if (buyStrategyName.Contains("PROFITPERCENTAGE")) { - + ProfitPercentageLabel = "" + c; } } From cd551ef8da7a5cfbc093ee227e2e5c1f40732c7f Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Mon, 8 Feb 2021 18:58:29 +0000 Subject: [PATCH 09/20] Fixed missing % char in logging --- Core/Main/PTMagic.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index c37f917..baa503e 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1650,7 +1650,7 @@ namespace Core.Main foreach (var marketTrend in excludedMarkets) { - this.Log.DoLogInfo(String.Format("SMS Off Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3} on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), offTrigger.MarketTrendName)); + this.Log.DoLogInfo(String.Format("SMS Off Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), offTrigger.MarketTrendName)); } var includedMarkets = from m in marketTrendChanges @@ -1864,7 +1864,7 @@ namespace Core.Main foreach (var marketTrend in excludedMarkets) { - this.Log.DoLogInfo(String.Format("SMS Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3} on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), trigger.MarketTrendName)); + this.Log.DoLogInfo(String.Format("SMS Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), trigger.MarketTrendName)); } var includedMarkets = from m in marketTrendChanges From fb5d05f93c9390c5cf9f55b26073dc6496ad5dd8 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:28:37 +0900 Subject: [PATCH 10/20] leveraged profits fix --- Monitor/Pages/_get/DashboardTop.cshtml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 9793351..48ae690 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -159,11 +159,6 @@ profitPercentage = gainStrategy.CurrentValue; } } - - // Aggregate totals - double bagGain = (profitPercentage / 100) * dcaLogEntry.TotalCost * leverageValue; - Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost; - Model.TotalBagGain = Model.TotalBagGain + bagGain; // Render the row @@ -226,20 +221,25 @@ { } - @if (!@lostValue) - { + { + profitPercentage = profitPercentage * leverageValue; @profitPercentage.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% } else { No Value! } - + { + // Aggregate totals + double bagGain = (profitPercentage / 100) * dcaLogEntry.TotalCost; + Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost; + Model.TotalBagGain = Model.TotalBagGain + bagGain; + } } Totals: From bef871c45592bc6707e3dfadf6aee9d2f7056eff Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:50:53 +0900 Subject: [PATCH 11/20] remove SMS TrendThreshold logging --- Core/Main/PTMagic.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index baa503e..4bfd9b9 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1648,11 +1648,6 @@ namespace Core.Main orderby m.Market select m; - foreach (var marketTrend in excludedMarkets) - { - this.Log.DoLogInfo(String.Format("SMS Off Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), offTrigger.MarketTrendName)); - } - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market From 4a87992681a5d334c3568ed5223e7d8050d26aeb Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:57:54 +0900 Subject: [PATCH 12/20] remove SMS TrendThreshold logging --- Core/Main/PTMagic.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 4bfd9b9..d303014 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1857,11 +1857,6 @@ namespace Core.Main orderby m.Market select m; - foreach (var marketTrend in excludedMarkets) - { - this.Log.DoLogInfo(String.Format("SMS Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), trigger.MarketTrendName)); - } - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market From 7b39b2601a54a9445f5539e4925697adf277c9c5 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 15:11:39 +0900 Subject: [PATCH 13/20] MarketAnalyzer TrendThreshold icon --- Monitor/Pages/MarketAnalyzer.cshtml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Monitor/Pages/MarketAnalyzer.cshtml b/Monitor/Pages/MarketAnalyzer.cshtml index c7e7e4c..691e585 100644 --- a/Monitor/Pages/MarketAnalyzer.cshtml +++ b/Monitor/Pages/MarketAnalyzer.cshtml @@ -278,7 +278,15 @@ else if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name)) { marketTrendsDisplayed++; string trendChangeOutput = mps.MarketTrendChanges[marketTrend.Name].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); - @trendChangeOutput% + if ((mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) || (mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) ) + { +   @trendChangeOutput% + } + else + { + @trendChangeOutput% + } + } } @for (int i = 0; i < marketTrends.Count - marketTrendsDisplayed; i++) { From 0442c1db92603f91dae066123f40436ade3af3f7 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 15:41:08 +0900 Subject: [PATCH 14/20] add TrendThreshold analyzer settings --- Monitor/Pages/_get/SettingsMarketTrends.cshtml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Monitor/Pages/_get/SettingsMarketTrends.cshtml b/Monitor/Pages/_get/SettingsMarketTrends.cshtml index 916e558..a4611bf 100644 --- a/Monitor/Pages/_get/SettingsMarketTrends.cshtml +++ b/Monitor/Pages/_get/SettingsMarketTrends.cshtml @@ -77,6 +77,14 @@ +
+ +
+ + Leave empty to exclude none +
+
+
From 0b7817dff1705a8cea5ef54522e3ffa1189b7bd6 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 21:11:02 +0900 Subject: [PATCH 15/20] removed superfluous code --- Core/Main/PTMagic.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index d303014..19c986d 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1642,12 +1642,6 @@ namespace Core.Main // Calculate average market change, skip any that are outside the threshold if enabled if (trendThreshold.TrendThreshold != 0) { - // Exclude trends outside the threshhold. - var excludedMarkets = from m in marketTrendChanges - where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) - orderby m.Market - select m; - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market @@ -1851,12 +1845,6 @@ namespace Core.Main // Calculate average market change, skip any that are outside the threshold if enabled if (trendThreshold.TrendThreshold != 0) { - // Exclude trends outside the threshhold. - var excludedMarkets = from m in marketTrendChanges - where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) - orderby m.Market - select m; - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market From 10bc56a5b0a31181249b7dcb070d144cb0fcee9c Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 10 Feb 2021 16:17:31 +0900 Subject: [PATCH 16/20] increment version --- PTMagic/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PTMagic/Program.cs b/PTMagic/Program.cs index 6870d95..dd9d492 100644 --- a/PTMagic/Program.cs +++ b/PTMagic/Program.cs @@ -6,7 +6,7 @@ using Core.Helper; using Microsoft.Extensions.DependencyInjection; -[assembly: AssemblyVersion("2.5.2")] +[assembly: AssemblyVersion("2.5.3")] [assembly: AssemblyProduct("PT Magic")] namespace PTMagic From e0b2464d3b8191d741be14e36f39c087bea1ad89 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 10 Feb 2021 16:43:20 +0900 Subject: [PATCH 17/20] relocate PTMUpdate.sh --- PTMagic/{ => _defaults/_linux}/PTMUpdate.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename PTMagic/{ => _defaults/_linux}/PTMUpdate.sh (100%) diff --git a/PTMagic/PTMUpdate.sh b/PTMagic/_defaults/_linux/PTMUpdate.sh similarity index 100% rename from PTMagic/PTMUpdate.sh rename to PTMagic/_defaults/_linux/PTMUpdate.sh From c654546da3ef0073817d09eab5e1e0fdce966082 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 10 Feb 2021 16:47:07 +0900 Subject: [PATCH 18/20] add spacing to health icon tooltip --- Monitor/Pages/_get/TickerWidgets.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml b/Monitor/Pages/_get/TickerWidgets.cshtml index 382265e..7f2fb03 100644 --- a/Monitor/Pages/_get/TickerWidgets.cshtml +++ b/Monitor/Pages/_get/TickerWidgets.cshtml @@ -20,10 +20,10 @@ string iconColor = "text-success"; string ptMagicHealthIcon = "fa-heartbeat"; - string ptMagicHealthTooltip = "PT Magic is alive and healthy! Time elapsed since last run:" + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; + string ptMagicHealthTooltip = "PT Magic is alive and healthy! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; if (elapsedSecondsSinceRuntime > (intervalSeconds * 2)) { ptMagicHealthIcon = "fa-exclamation-triangle"; - ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; + ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins."; iconColor = "text-danger"; } } From a7aa735eb65abc936ab2629cd07f2af49c8af742 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 10 Feb 2021 16:59:01 +0900 Subject: [PATCH 19/20] rename baglist POSITIONS --- Monitor/Pages/_get/DashboardTop.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 48ae690..ffb4781 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -82,7 +82,7 @@
-

Pairs / DCA / Pending (@Model.PTData.DCALog.Count)more

+

Positions (@Model.PTData.DCALog.Count)more

@if (Model.PTData.DCALog.Count == 0) { From eca60133c09908112677c97cb8e3784a8d60399e Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:00:04 +0900 Subject: [PATCH 20/20] Undo baglist rename --- Monitor/Pages/_get/DashboardTop.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index ffb4781..48ae690 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -82,7 +82,7 @@
-

Positions (@Model.PTData.DCALog.Count)more

+

Pairs / DCA / Pending (@Model.PTData.DCALog.Count)more

@if (Model.PTData.DCALog.Count == 0) {