Merge pull request #235 from PTMagicians/develop

2.5.2
This commit is contained in:
HojouFotytu 2021-02-02 02:09:46 +09:00 committed by GitHub
commit dcdb897f9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 82 additions and 74 deletions

View File

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

View File

@ -601,7 +601,7 @@ namespace Core.Helper
result = market + mainMarket; result = market + mainMarket;
break; break;
case "BinanceFutures": case "BinanceFutures":
result = market + "_" + mainMarket; result = market + mainMarket;
break; break;
case "Poloniex": case "Poloniex":
result = mainMarket + "_" + market; result = mainMarket + "_" + market;

View File

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

View File

@ -18,7 +18,6 @@ namespace Core.MarketAnalyzer
public static string GetJsonStringFromURL(string url, LogHelper log, (string header, string value)[] headers = null) public static string GetJsonStringFromURL(string url, LogHelper log, (string header, string value)[] headers = null)
{ {
HttpClient webClient = null; HttpClient webClient = null;
if (webClient == null) if (webClient == null)
{ {
webClient = new HttpClient(); webClient = new HttpClient();
@ -52,9 +51,7 @@ namespace Core.MarketAnalyzer
{ {
// log.DoLogInfo("Calling URL: " + url); // log.DoLogInfo("Calling URL: " + url);
var response = webClient.GetAsync(url).Result; var response = webClient.GetAsync(url).Result;
string repsonseString = response.Content.ReadAsStringAsync().Result; string repsonseString = response.Content.ReadAsStringAsync().Result;
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
return repsonseString; return repsonseString;
@ -63,9 +60,7 @@ namespace Core.MarketAnalyzer
{ {
// Error // Error
var message = string.Format("Error whilst calling {0} - {1}", url, repsonseString); var message = string.Format("Error whilst calling {0} - {1}", url, repsonseString);
log.DoLogError(message); log.DoLogError(message);
throw new Exception(message); throw new Exception(message);
} }
} }
@ -73,13 +68,11 @@ namespace Core.MarketAnalyzer
{ {
// Conneciton timeout // Conneciton timeout
log.DoLogError(string.Format("Timeout whilst calling {0} - {1}", url, tcEx.Message)); log.DoLogError(string.Format("Timeout whilst calling {0} - {1}", url, tcEx.Message));
throw; throw;
} }
catch (Exception ex) catch (Exception ex)
{ {
log.DoLogError(string.Format("Error whilst calling {0} \nError: {1}", url, ex.Message)); log.DoLogError(string.Format("Error whilst calling {0} \nError: {1}", url, ex.Message));
throw; throw;
} }
} }
@ -87,45 +80,34 @@ namespace Core.MarketAnalyzer
public static Dictionary<string, dynamic> GetJsonFromURL(string url, LogHelper log, (string header, string value)[] headers = null) public static Dictionary<string, dynamic> GetJsonFromURL(string url, LogHelper log, (string header, string value)[] headers = null)
{ {
Dictionary<string, dynamic> jsonObject = null; Dictionary<string, dynamic> jsonObject = null;
string jsonString = GetJsonStringFromURL(url, log, headers); string jsonString = GetJsonStringFromURL(url, log, headers);
// Convert the response to JSON // Convert the response to JSON
jsonObject = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(jsonString); jsonObject = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(jsonString);
return jsonObject; return jsonObject;
} }
public static Newtonsoft.Json.Linq.JObject GetSimpleJsonObjectFromURL(string url, LogHelper log, (string header, string value)[] headers = null) public static Newtonsoft.Json.Linq.JObject GetSimpleJsonObjectFromURL(string url, LogHelper log, (string header, string value)[] headers = null)
{ {
Newtonsoft.Json.Linq.JObject jsonObject = null; Newtonsoft.Json.Linq.JObject jsonObject = null;
string jsonString = GetJsonStringFromURL(url, log, headers); string jsonString = GetJsonStringFromURL(url, log, headers);
jsonObject = JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(jsonString); jsonObject = JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(jsonString);
return jsonObject; return jsonObject;
} }
public static List<dynamic> GetSimpleJsonListFromURL(string url, LogHelper log) public static List<dynamic> GetSimpleJsonListFromURL(string url, LogHelper log)
{ {
List<dynamic> jsonObject = null; List<dynamic> jsonObject = null;
string jsonString = GetJsonStringFromURL(url, log, null); string jsonString = GetJsonStringFromURL(url, log, null);
jsonObject = JsonConvert.DeserializeObject<List<dynamic>>(jsonString); jsonObject = JsonConvert.DeserializeObject<List<dynamic>>(jsonString);
return jsonObject; return jsonObject;
} }
public static Newtonsoft.Json.Linq.JArray GetSimpleJsonArrayFromURL(string url, LogHelper log) public static Newtonsoft.Json.Linq.JArray GetSimpleJsonArrayFromURL(string url, LogHelper log)
{ {
Newtonsoft.Json.Linq.JArray jsonObject = null; Newtonsoft.Json.Linq.JArray jsonObject = null;
string jsonString = GetJsonStringFromURL(url, log, null); string jsonString = GetJsonStringFromURL(url, log, null);
jsonObject = JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JArray>(jsonString); jsonObject = JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JArray>(jsonString);
return jsonObject; return jsonObject;
} }
@ -138,7 +120,6 @@ namespace Core.MarketAnalyzer
string baseUrl = "https://api.github.com/repos/PTMagicians/PTMagic/releases/latest"; string baseUrl = "https://api.github.com/repos/PTMagicians/PTMagic/releases/latest";
Newtonsoft.Json.Linq.JObject jsonObject = GetSimpleJsonObjectFromURL(baseUrl, log, new (string header, string value)[] { ("User-Agent", "PTMagic.Import") }); Newtonsoft.Json.Linq.JObject jsonObject = GetSimpleJsonObjectFromURL(baseUrl, log, new (string header, string value)[] { ("User-Agent", "PTMagic.Import") });
if (jsonObject != null) if (jsonObject != null)
{ {
result = jsonObject.GetValue("tag_name").ToString(); result = jsonObject.GetValue("tag_name").ToString();
@ -152,14 +133,12 @@ namespace Core.MarketAnalyzer
{ {
log.DoLogDebug("GitHub version check error: " + ex.Message); log.DoLogDebug("GitHub version check error: " + ex.Message);
} }
return result; return result;
} }
public static double GetMainFiatCurrencyRate(string currency, string FreeCurrencyAPI, LogHelper log) public static double GetMainFiatCurrencyRate(string currency, string FreeCurrencyAPI, LogHelper log)
{ {
double result = 1; double result = 1;
string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y&apiKey=" + FreeCurrencyAPI; string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y&apiKey=" + FreeCurrencyAPI;
log.DoLogDebug("http://free.currencyconverterapi.com - Getting latest exchange rates..."); log.DoLogDebug("http://free.currencyconverterapi.com - Getting latest exchange rates...");
@ -171,7 +150,6 @@ namespace Core.MarketAnalyzer
result = (double)jsonObject["USD_" + currency]["val"]; result = (double)jsonObject["USD_" + currency]["val"];
log.DoLogInfo("http://free.currencyconverterapi.com - Latest exchange rate for USD to " + currency + " is " + result); log.DoLogInfo("http://free.currencyconverterapi.com - Latest exchange rate for USD to " + currency + " is " + result);
} }
return result; return result;
} }
@ -191,12 +169,10 @@ namespace Core.MarketAnalyzer
log.DoLogDebug(ex.Message); log.DoLogDebug(ex.Message);
} }
} }
if (result == null) if (result == null)
{ {
result = new Dictionary<string, MarketInfo>(); result = new Dictionary<string, MarketInfo>();
} }
return result; return result;
} }
@ -208,7 +184,6 @@ namespace Core.MarketAnalyzer
public static Dictionary<string, Market> GetMarketDataFromFile(PTMagicConfiguration systemConfiguration, LogHelper log, string platform, DateTime maxDateTime, string marketCaption) public static Dictionary<string, Market> GetMarketDataFromFile(PTMagicConfiguration systemConfiguration, LogHelper log, string platform, DateTime maxDateTime, string marketCaption)
{ {
Dictionary<string, Market> result = new Dictionary<string, Market>(); Dictionary<string, Market> result = new Dictionary<string, Market>();
DirectoryInfo dataDirectory = new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + platform + Path.DirectorySeparatorChar); DirectoryInfo dataDirectory = new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + platform + Path.DirectorySeparatorChar);
// Get market files older than max datetime in descending order (newest file up top) // Get market files older than max datetime in descending order (newest file up top)
@ -239,7 +214,6 @@ namespace Core.MarketAnalyzer
log.DoLogDebug(platform + " - " + marketCaption + " market data loaded (" + marketFile.LastWriteTimeUtc.ToString() + ")"); log.DoLogDebug(platform + " - " + marketCaption + " market data loaded (" + marketFile.LastWriteTimeUtc.ToString() + ")");
} }
} }
try try
{ {
// Get JSON object // Get JSON object
@ -249,7 +223,6 @@ namespace Core.MarketAnalyzer
{ {
log.DoLogCritical(ex.Message, ex); log.DoLogCritical(ex.Message, ex);
} }
return result; return result;
} }
@ -312,7 +285,6 @@ namespace Core.MarketAnalyzer
{ {
sortedMarkets = new SortedDictionary<string, Market>(recentMarkets).OrderByDescending(m => m.Value.Volume24h); sortedMarkets = new SortedDictionary<string, Market>(recentMarkets).OrderByDescending(m => m.Value.Volume24h);
} }
int marketCount = 1; int marketCount = 1;
foreach (KeyValuePair<string, Market> recentMarketPair in sortedMarkets) foreach (KeyValuePair<string, Market> recentMarketPair in sortedMarkets)
{ {
@ -336,7 +308,6 @@ namespace Core.MarketAnalyzer
} }
Market recentMarket; Market recentMarket;
if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket)) if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket))
{ {
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ","); List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
@ -345,7 +316,6 @@ namespace Core.MarketAnalyzer
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend."); log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend.");
continue; continue;
} }
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ","); List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ",");
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(recentMarketPair.Value.Symbol)) if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(recentMarketPair.Value.Symbol))
{ {
@ -361,12 +331,10 @@ namespace Core.MarketAnalyzer
} }
Market trendMarket; Market trendMarket;
if (trendMarkets.TryGetValue(recentMarketPair.Key, out trendMarket)) if (trendMarkets.TryGetValue(recentMarketPair.Key, out trendMarket))
{ {
double recentMarketPrice = recentMarket.Price; double recentMarketPrice = recentMarket.Price;
double trendMarketPrice = trendMarket.Price; double trendMarketPrice = trendMarket.Price;
if (!platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && marketTrend.TrendCurrency.Equals("Fiat", StringComparison.InvariantCultureIgnoreCase)) if (!platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && marketTrend.TrendCurrency.Equals("Fiat", StringComparison.InvariantCultureIgnoreCase))
{ {
if (recentMarket.MainCurrencyPriceUSD > 0 && trendMarket.MainCurrencyPriceUSD > 0) if (recentMarket.MainCurrencyPriceUSD > 0 && trendMarket.MainCurrencyPriceUSD > 0)
@ -388,9 +356,7 @@ namespace Core.MarketAnalyzer
mtc.TrendDateTime = DateTime.UtcNow; mtc.TrendDateTime = DateTime.UtcNow;
result.Add(mtc); result.Add(mtc);
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' (Vol. " + recentMarket.Volume24h.ToString("#,#0.00") + ") is " + trendMarketChange.ToString("#,#0.00") + "% in " + SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60).ToLower() + "."); log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' (Vol. " + recentMarket.Volume24h.ToString("#,#0.00") + ") is " + trendMarketChange.ToString("#,#0.00") + "% in " + SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60).ToLower() + ".");
marketCount++; marketCount++;
} }
else else
@ -401,14 +367,11 @@ namespace Core.MarketAnalyzer
} }
} }
} }
if (marketTrend.MaxMarkets > 0 && isGlobal) if (marketTrend.MaxMarkets > 0 && isGlobal)
{ {
int maxMarkets = (marketTrend.MaxMarkets <= result.Count) ? marketTrend.MaxMarkets : result.Count; int maxMarkets = (marketTrend.MaxMarkets <= result.Count) ? marketTrend.MaxMarkets : result.Count;
result = result.GetRange(0, maxMarkets); result = result.GetRange(0, maxMarkets);
} }
return result; return result;
} }
@ -422,35 +385,49 @@ namespace Core.MarketAnalyzer
foreach (MarketTrend marketTrend in marketTrends) foreach (MarketTrend marketTrend in marketTrends)
{ {
log.DoLogInfo("Building market trend average for '" + marketTrend.Name + "'"); log.DoLogInfo("Building market trend average for '" + marketTrend.Name + "'");
if (globalMarketTrendChanges.ContainsKey(marketTrend.Name)) if (globalMarketTrendChanges.ContainsKey(marketTrend.Name))
{ {
List<MarketTrendChange> marketTrendChanges = globalMarketTrendChanges[marketTrend.Name]; List<MarketTrendChange> marketTrendChanges = globalMarketTrendChanges[marketTrend.Name];
if (marketTrendChanges != null && marketTrendChanges.Count > 0) if (marketTrendChanges != null && marketTrendChanges.Count > 0)
{ {
double totalTrendChange = 0;
double averageTrendChange = marketTrendChanges.Average(mtc => mtc.TrendChange); int trendChangeCount = marketTrendChanges.Count;
foreach (MarketTrendChange marketTrendChange in marketTrendChanges)
{
if (marketTrend.TrendThreshold != 0)
{
if ((marketTrendChange.TrendChange > marketTrend.TrendThreshold) || (marketTrendChange.TrendChange < (marketTrend.TrendThreshold * -1)))
{
log.DoLogInfo("Market trend '" + marketTrend.Name + "' is ignoring " + marketTrendChange.Market + " for exceeding TrendThreshold.");
trendChangeCount += -1;
}
else
{
totalTrendChange += marketTrendChange.TrendChange;
}
}
else
{
totalTrendChange += marketTrendChange.TrendChange;
}
}
double averageTrendChange = totalTrendChange / trendChangeCount;
result.Add(marketTrend.Name, averageTrendChange); result.Add(marketTrend.Name, averageTrendChange);
log.DoLogInfo("Built average market trend change '" + marketTrend.Name + "' (" + averageTrendChange.ToString("#,#0.00") + "% in " + marketTrend.TrendMinutes.ToString() + " minutes) for " + marketTrendChanges.Count.ToString() + " markets."); log.DoLogInfo("Built average market trend change '" + marketTrend.Name + "' (" + averageTrendChange.ToString("#,#0.00") + "% in " + marketTrend.TrendMinutes.ToString() + " minutes) for " + marketTrendChanges.Count.ToString() + " markets.");
} }
else else
{ {
result.Add(marketTrend.Name, 0); result.Add(marketTrend.Name, 0);
log.DoLogWarn("No market trend changes found for '" + marketTrend.Name + "' - returning 0%"); log.DoLogWarn("No market trend changes found for '" + marketTrend.Name + "' - returning 0%");
} }
} }
else else
{ {
result.Add(marketTrend.Name, 0); result.Add(marketTrend.Name, 0);
log.DoLogWarn("Market trend '" + marketTrend.Name + "' not found in globalMarketTrendChanges[] - returning 0%"); log.DoLogWarn("Market trend '" + marketTrend.Name + "' not found in globalMarketTrendChanges[] - returning 0%");
} }
} }
} }
return result; return result;
} }
} }

View File

@ -19,8 +19,8 @@ namespace Core.ProfitTrailer
string strategyLetter = ""; string strategyLetter = "";
string strategyNameOnly = strategyName; string strategyNameOnly = strategyName;
// PT allows for "advanced_stats" to show details of the trailing logic. // PT allows for "advanced_stats" to show details of the trailing logic and dynamic formulas.
if (result.Contains("STATS")) if (result.Contains("STATS") || result.Contains("DYN"))
{ {
result = ""; result = "";
} }

View File

@ -162,6 +162,7 @@ else
<th>Name</th> <th>Name</th>
<th class="text-right">Markets</th> <th class="text-right">Markets</th>
<th class="text-right">Timeframe</th> <th class="text-right">Timeframe</th>
<th class="text-right">Threshold %</th>
<th class="text-right">Change</th> <th class="text-right">Change</th>
</tr> </tr>
</thead> </thead>
@ -182,7 +183,14 @@ else
<tr> <tr>
<td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td> <td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td>
<td class="text-right">@marketCountString</td> <td class="text-right">@marketCountString</td>
<td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td> <td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td> @if (marketTrend.TrendThreshold == 0)
{
<td class="text-right">--</td>
}
else
{
<td class="text-right">@marketTrend.TrendThreshold</td>
}
<td class="text-right text-autocolor">@trendChangeOutput%</td> <td class="text-right text-autocolor">@trendChangeOutput%</td>
</tr> </tr>
} }

View File

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

View File

@ -10,7 +10,7 @@
} }
<div class="row"> <div class="row">
<div class="col-md-4 px-1"> <div class="col-md-5 px-1">
<div class="card-box px-2" style="height:305px;"> <div class="card-box px-2" style="height:305px;">
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div> <div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
@if (!Model.TrendChartDataJSON.Equals("")) { @if (!Model.TrendChartDataJSON.Equals("")) {
@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<div class="col-md-5 px-1"> <div class="col-md-4 px-1">
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div> <div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
<div class="card-box px-2" style="height:305px;"> <div class="card-box px-2" style="height:305px;">
@if (!Model.ProfitChartDataJSON.Equals("")) { @if (!Model.ProfitChartDataJSON.Equals("")) {
@ -74,6 +74,7 @@
<th>Name</th> <th>Name</th>
<th class="text-right">Markets</th> <th class="text-right">Markets</th>
<th class="text-right">Timeframe</th> <th class="text-right">Timeframe</th>
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Pairs exceeding this threshold are excluded from the trend average.">Threshold %</th>
<th class="text-right">Change</th> <th class="text-right">Change</th>
</tr> </tr>
</thead> </thead>
@ -95,6 +96,14 @@
<td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td> <td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td>
<td class="text-right">@marketCountString</td> <td class="text-right">@marketCountString</td>
<td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td> <td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td>
@if (marketTrend.TrendThreshold == 0)
{
<td class="text-right">--</td>
}
else
{
<td class="text-right">@marketTrend.TrendThreshold</td>
}
<td class="text-right text-autocolor">@trendChangeOutput%</td> <td class="text-right text-autocolor">@trendChangeOutput%</td>
</tr> </tr>
} }

View File

@ -206,28 +206,38 @@
<td>@Html.Raw(buyStrategyText)</td> <td>@Html.Raw(buyStrategyText)</td>
<td>@Html.Raw(sellStrategyText)</td> <td>@Html.Raw(sellStrategyText)</td>
@if (sellStrategyText.Contains("CROSSED")) @if (!sellStrategyText.Contains("WATCHMODE"))
// if leverage, recalculate profit target
{ {
string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("CROSSED")+9); @if (sellStrategyText.Contains("CROSSED"))
leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)")); // if leverage, recalculate profit target
leverageValue = double.Parse(leverage); {
} string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("CROSSED")+9);
@if (sellStrategyText.Contains("ISOLATED")) leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
{ leverageValue = double.Parse(leverage);
string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("ISOLATED")+10); }
leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)")); @if (sellStrategyText.Contains("ISOLATED"))
leverageValue = double.Parse(leverage); {
} string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("ISOLATED")+10);
@if (leverageValue == 1) leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
{ leverageValue = double.Parse(leverage);
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : "&nbsp")</td> }
@if (leverageValue == 1)
{
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : "&nbsp")</td>
}
else
{
double TargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? TargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : "&nbsp")</td>
}
} }
else else
{ {
double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value; <td class="text-left"></td>
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : "&nbsp")</td>
} }
@if (!@lostValue) @if (!@lostValue)
{ {
<td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td> <td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>

View File

@ -16,17 +16,17 @@
string iconColor = "text-success"; string iconColor = "text-success";
string ptMagicHealthIcon = "fa-heartbeat"; string ptMagicHealthIcon = "fa-heartbeat";
string ptMagicHealthTooltip = "PT Magic is alive and healthy!"; string ptMagicHealthTooltip = "PT Magic is alive and healthy! <br> Time elapsed since last run:"+ lastRuntime;
if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds)) { if (elapsedSecondsSinceRuntime > (intervalSeconds * 2)) {
ptMagicHealthIcon = "fa-exclamation-triangle"; ptMagicHealthIcon = "fa-exclamation-triangle";
ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs!"; ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: "+ Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins.";
iconColor = "text-danger"; iconColor = "text-danger";
} }
} }
<div class="card-box card-box-mini card-box-ptmagic-outlined"> <div class="card-box card-box-mini card-box-ptmagic-outlined">
<span data-toggle="tooltip" data-placement="bottom" title="Active global setting"> <span data-toggle="tooltip" data-placement="bottom" title="Active global setting">
@Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)</span><span class = "header-title"><a href="ManaSettingsAnalyzergeSMS">@Html.Raw(" " + globalSettingInfoIcon)</a></span> @Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)</span><span class = "header-title"><a href="StatusSummary">@Html.Raw(" " + globalSettingInfoIcon)</a></span>
</div> </div>
<div class="card-box card-box-mini card-box-ptmagic-outlined"> <div class="card-box card-box-mini card-box-ptmagic-outlined">

View File

@ -6,7 +6,7 @@ using Core.Helper;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
[assembly: AssemblyVersion("2.5.1")] [assembly: AssemblyVersion("2.5.2")]
[assembly: AssemblyProduct("PT Magic")] [assembly: AssemblyProduct("PT Magic")]
namespace PTMagic namespace PTMagic