Merge pull request #289 from HojouFotytu/develop

Ignored/Allowed in SMS && BinanceFutures Quarterly Contracts
This commit is contained in:
HojouFotytu 2021-03-29 14:58:55 +09:00 committed by GitHub
commit 4d16970b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View File

@ -903,6 +903,28 @@ namespace Core.Main
// Check for single market trend triggers // Check for single market trend triggers
this.ApplySingleMarketSettings(); this.ApplySingleMarketSettings();
// Ignore quarterly futures
if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("BinanceFutures", StringComparison.InvariantCultureIgnoreCase))
{
// Find all quarterly futures pairs
var results = this.MarketList.FindAll(m => m.Contains("_", StringComparison.InvariantCultureIgnoreCase));
// Create the settings lines to disable trading
if (results.Count > 0)
{
this.PairsLines.AddRange(new string[] {
"",
"# BinanceFutures Quarterly Contracts - Ignore list:",
"###################################################"
});
foreach (var marketPair in results)
{
this.PairsLines.Add(String.Format("{0}_trading_enabled = false", marketPair));
}
}
}
// Save new properties to Profit Trailer // Save new properties to Profit Trailer
this.SaveProfitTrailerProperties(); this.SaveProfitTrailerProperties();
@ -1518,7 +1540,7 @@ namespace Core.Main
// Check ignore markets // Check ignore markets
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredMarkets, ","); List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredMarkets, ",");
if (ignoredMarkets.Contains(marketPair)) if (ignoredMarkets.Any(marketPair.Contains))
{ {
this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'."); this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'.");
continue; continue;
@ -1526,7 +1548,7 @@ namespace Core.Main
// Check allowed markets // Check allowed markets
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.AllowedMarkets, ","); List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.AllowedMarkets, ",");
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(marketPair)) if (allowedMarkets.Count > 0 && !allowedMarkets.Any(am => marketPair.StartsWith(am, StringComparison.InvariantCultureIgnoreCase)))
{ {
this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'."); this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'.");
continue; continue;
@ -1534,7 +1556,7 @@ namespace Core.Main
// Check ignore global settings // Check ignore global settings
List<string> ignoredGlobalSettings = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredGlobalSettings, ","); List<string> ignoredGlobalSettings = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredGlobalSettings, ",");
if (ignoredGlobalSettings.Contains(this.ActiveSettingName)) if (ignoredMarkets.Any(im => marketPair.StartsWith(im, StringComparison.InvariantCultureIgnoreCase)))
{ {
this.Log.DoLogDebug("'" + marketPair + "' - '" + this.ActiveSettingName + "' - Is ignored in '" + marketSetting.SettingName + "'."); this.Log.DoLogDebug("'" + marketPair + "' - '" + this.ActiveSettingName + "' - Is ignored in '" + marketSetting.SettingName + "'.");
continue; continue;

View File

@ -74,8 +74,6 @@ namespace Core.MarketAnalyzer
//New variables for filtering out bad markets //New variables for filtering out bad markets
float marketLastPrice = currencyTicker["lastPrice"].ToObject<float>(); float marketLastPrice = currencyTicker["lastPrice"].ToObject<float>();
float marketVolume = currencyTicker["volume"].ToObject<float>(); float marketVolume = currencyTicker["volume"].ToObject<float>();
if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase))
{
if (marketLastPrice > 0 && marketVolume > 0) if (marketLastPrice > 0 && marketVolume > 0)
{ {
@ -101,7 +99,6 @@ namespace Core.MarketAnalyzer
log.DoLogInfo("BinanceFutures - Ignoring bad market data for " + marketName); log.DoLogInfo("BinanceFutures - Ignoring bad market data for " + marketName);
} }
} }
}
BinanceFutures.CheckFirstSeenDates(markets, ref marketInfos, systemConfiguration, log); BinanceFutures.CheckFirstSeenDates(markets, ref marketInfos, systemConfiguration, log);