Ignore Ouliers

This commit is contained in:
HojouFotytu 2021-01-31 01:32:36 +09:00
parent 8e7bd96970
commit c2bbc274b5
4 changed files with 28 additions and 2 deletions

View File

@ -146,6 +146,9 @@ namespace Core.Main.DataObjects.PTMagicData
[DefaultValue("")]
public string AllowedMarkets { get; set; } = "";
[DefaultValue(0)]
public int IgnoreOutlier { get; set; } = 0;
[DefaultValue(true)]
public bool ExcludeMainCurrency { get; set; } = true;
}

View File

@ -1310,7 +1310,7 @@ namespace Core.Main
// CoinMarketCap
this.GlobalMarketTrendChanges = BaseAnalyzer.BuildMarketTrends("CoinMarketCap", this.LastRuntimeSummary.MainMarket, new List<string>(), "", true, this.GlobalMarketTrendChanges, this.PTMagicConfiguration, this.Log);
// Bittrex
// Exchange
foreach (MarketTrend marketTrend in this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends.FindAll(mt => mt.Platform.Equals("Exchange", StringComparison.InvariantCultureIgnoreCase)))
{
if (this.SingleMarketTrendChanges.ContainsKey(marketTrend.Name))

View File

@ -429,7 +429,29 @@ namespace Core.MarketAnalyzer
if (marketTrendChanges != null && marketTrendChanges.Count > 0)
{
double averageTrendChange = marketTrendChanges.Average(mtc => mtc.TrendChange);
double totalTrendChange = 0;
foreach (MarketTrendChange marketTrendChange in marketTrendChanges)
{
if (marketTrend.IgnoreOutlier != 0)
{
if ((marketTrendChange.TrendChange > marketTrend.IgnoreOutlier) || (marketTrendChange.TrendChange < (marketTrend.IgnoreOutlier * -1)))
{
log.DoLogWarn("Market trend '" + marketTrend.Name + "' is ignoring the outlier '" + marketTrendChange.Market + ".");
}
else
{
totalTrendChange += marketTrendChange.TrendChange;
}
}
else
{
totalTrendChange += marketTrendChange.TrendChange;
}
}
double averageTrendChange = totalTrendChange / marketTrendChanges.Count;
result.Add(marketTrend.Name, averageTrendChange);

View File

@ -77,6 +77,7 @@ namespace Monitor.Pages
mt.TrendCurrency = HttpContext.Request.Form[mtFormKey + "TrendCurrency"];
mt.IgnoredMarkets = HttpContext.Request.Form[mtFormKey + "IgnoredMarkets"];
mt.AllowedMarkets = HttpContext.Request.Form[mtFormKey + "AllowedMarkets"];
mt.IgnoreOutlier = SystemHelper.TextToInteger(HttpContext.Request.Form[mtFormKey + "IgnoreOutlier"], mt.IgnoreOutlier);
mt.DisplayGraph = HttpContext.Request.Form[mtFormKey + "DisplayGraph"].Equals("on");
mt.ExcludeMainCurrency = HttpContext.Request.Form[mtFormKey + "ExcludeMainCurrency"].Equals("on");