Fixed Flood Protection logic + house keeping

This commit is contained in:
djbadders 2019-03-12 21:22:48 +00:00
parent f68ae43f41
commit 67bbfb7580
2 changed files with 12 additions and 8 deletions

View File

@ -738,9 +738,7 @@ namespace Core.Main
{
this.Log.DoLogError("PTM failed to read the Config File. That means something in the File is either missing or incorrect. If this happend after an update please take a look at the release notes at: https://github.com/PTMagicians/PTMagic/releases");
}
}
else
{
this.Log.DoLogWarn("PTMagic disabled, shutting down...");
@ -1388,7 +1386,7 @@ namespace Core.Main
}
// Check if flood protection is active
if (this.EnforceSettingsReapply || !this.LastSetting.Equals(triggeredSetting.SettingName, StringComparison.InvariantCultureIgnoreCase) || this.LastSettingsChange <= DateTime.UtcNow.AddMinutes(-PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes))
if (this.EnforceSettingsReapply || this.LastSettingsChange <= DateTime.UtcNow.AddMinutes(-PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes))
{
// Setting not set => Change setting
if (!EnforceSettingsReapply)
@ -2257,7 +2255,6 @@ namespace Core.Main
}
// Get configured DCA percentages
string dcaDefaultPercentageString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_buy_percentage", "");
double dcaDefaultPercentage = SystemHelper.TextToDouble(dcaDefaultPercentageString, 0, "en-US");

View File

@ -391,16 +391,17 @@ namespace Core.ProfitTrailer
List<string> newDCALines = new List<string>();
List<string> newIndicatorsLines = new List<string>();
// Find the previous single market settings section in the pairs file
foreach (string pairsLine in ptmagicInstance.PairsLines)
{
if (pairsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
{
// Single Market Settings will get overwritten every single run => crop the lines
break;
}
else
{
// Copy the line into the new pairs file and keep searching
string globalPairsLine = pairsLine;
globalPairsLines.Add(globalPairsLine);
@ -412,16 +413,17 @@ namespace Core.ProfitTrailer
newPairsLines.Add("# ########################################################################");
newPairsLines.Add("#");
// Find the previous single market settings section in the DCA file
foreach (string dcaLine in ptmagicInstance.DCALines)
{
if (dcaLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
{
// Single Market Settings will get overwritten every single run => crop the lines
break;
}
else
{
// Copy the line into the new pairs file and keep searching
string globalDCALine = dcaLine;
globalDCALines.Add(globalDCALine);
@ -433,16 +435,17 @@ namespace Core.ProfitTrailer
newDCALines.Add("# ########################################################################");
newDCALines.Add("#");
// Find the previous single market settings section in the Indicators file
foreach (string indicatorsLine in ptmagicInstance.IndicatorsLines)
{
if (indicatorsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
{
// Single Market Settings will get overwritten every single run => crop the lines
break;
}
else
{
// Copy the line into the new pairs file and keep searching
string globalIndicatorsLine = indicatorsLine;
globalIndicatorsLines.Add(globalIndicatorsLine);
@ -536,7 +539,11 @@ namespace Core.ProfitTrailer
string appliedSettingsStringList = "";
foreach (SingleMarketSetting sms in appliedSettings)
{
if (!appliedSettingsStringList.Equals("")) appliedSettingsStringList += ", ";
if (!appliedSettingsStringList.Equals(""))
{
appliedSettingsStringList += ", ";
}
appliedSettingsStringList += sms.SettingName;
}