Ignore Ouliers
This commit is contained in:
parent
8e7bd96970
commit
c2bbc274b5
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue