Fixed Flood Protection logic + house keeping
This commit is contained in:
parent
f68ae43f41
commit
67bbfb7580
|
@ -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");
|
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
|
else
|
||||||
{
|
{
|
||||||
this.Log.DoLogWarn("PTMagic disabled, shutting down...");
|
this.Log.DoLogWarn("PTMagic disabled, shutting down...");
|
||||||
|
@ -1388,7 +1386,7 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if flood protection is active
|
// 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
|
// Setting not set => Change setting
|
||||||
if (!EnforceSettingsReapply)
|
if (!EnforceSettingsReapply)
|
||||||
|
@ -2257,7 +2255,6 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get configured DCA percentages
|
// Get configured DCA percentages
|
||||||
|
|
||||||
string dcaDefaultPercentageString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_buy_percentage", "");
|
string dcaDefaultPercentageString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_buy_percentage", "");
|
||||||
double dcaDefaultPercentage = SystemHelper.TextToDouble(dcaDefaultPercentageString, 0, "en-US");
|
double dcaDefaultPercentage = SystemHelper.TextToDouble(dcaDefaultPercentageString, 0, "en-US");
|
||||||
|
|
||||||
|
|
|
@ -391,16 +391,17 @@ namespace Core.ProfitTrailer
|
||||||
List<string> newDCALines = new List<string>();
|
List<string> newDCALines = new List<string>();
|
||||||
List<string> newIndicatorsLines = 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)
|
foreach (string pairsLine in ptmagicInstance.PairsLines)
|
||||||
{
|
{
|
||||||
if (pairsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
if (pairsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Single Market Settings will get overwritten every single run => crop the lines
|
// Single Market Settings will get overwritten every single run => crop the lines
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Copy the line into the new pairs file and keep searching
|
||||||
string globalPairsLine = pairsLine;
|
string globalPairsLine = pairsLine;
|
||||||
|
|
||||||
globalPairsLines.Add(globalPairsLine);
|
globalPairsLines.Add(globalPairsLine);
|
||||||
|
@ -412,16 +413,17 @@ namespace Core.ProfitTrailer
|
||||||
newPairsLines.Add("# ########################################################################");
|
newPairsLines.Add("# ########################################################################");
|
||||||
newPairsLines.Add("#");
|
newPairsLines.Add("#");
|
||||||
|
|
||||||
|
// Find the previous single market settings section in the DCA file
|
||||||
foreach (string dcaLine in ptmagicInstance.DCALines)
|
foreach (string dcaLine in ptmagicInstance.DCALines)
|
||||||
{
|
{
|
||||||
if (dcaLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
if (dcaLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Single Market Settings will get overwritten every single run => crop the lines
|
// Single Market Settings will get overwritten every single run => crop the lines
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Copy the line into the new pairs file and keep searching
|
||||||
string globalDCALine = dcaLine;
|
string globalDCALine = dcaLine;
|
||||||
|
|
||||||
globalDCALines.Add(globalDCALine);
|
globalDCALines.Add(globalDCALine);
|
||||||
|
@ -433,16 +435,17 @@ namespace Core.ProfitTrailer
|
||||||
newDCALines.Add("# ########################################################################");
|
newDCALines.Add("# ########################################################################");
|
||||||
newDCALines.Add("#");
|
newDCALines.Add("#");
|
||||||
|
|
||||||
|
// Find the previous single market settings section in the Indicators file
|
||||||
foreach (string indicatorsLine in ptmagicInstance.IndicatorsLines)
|
foreach (string indicatorsLine in ptmagicInstance.IndicatorsLines)
|
||||||
{
|
{
|
||||||
if (indicatorsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
if (indicatorsLine.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Single Market Settings will get overwritten every single run => crop the lines
|
// Single Market Settings will get overwritten every single run => crop the lines
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Copy the line into the new pairs file and keep searching
|
||||||
string globalIndicatorsLine = indicatorsLine;
|
string globalIndicatorsLine = indicatorsLine;
|
||||||
|
|
||||||
globalIndicatorsLines.Add(globalIndicatorsLine);
|
globalIndicatorsLines.Add(globalIndicatorsLine);
|
||||||
|
@ -536,7 +539,11 @@ namespace Core.ProfitTrailer
|
||||||
string appliedSettingsStringList = "";
|
string appliedSettingsStringList = "";
|
||||||
foreach (SingleMarketSetting sms in appliedSettings)
|
foreach (SingleMarketSetting sms in appliedSettings)
|
||||||
{
|
{
|
||||||
if (!appliedSettingsStringList.Equals("")) appliedSettingsStringList += ", ";
|
if (!appliedSettingsStringList.Equals(""))
|
||||||
|
{
|
||||||
|
appliedSettingsStringList += ", ";
|
||||||
|
}
|
||||||
|
|
||||||
appliedSettingsStringList += sms.SettingName;
|
appliedSettingsStringList += sms.SettingName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue