Merge pull request #291 from PTMagicians/develop

Develop
This commit is contained in:
HojouFotytu 2021-03-29 15:27:51 +09:00 committed by GitHub
commit 4e58bb7e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 21 deletions

View File

@ -448,7 +448,7 @@ namespace Core.Helper
return result;
}
public static string GetProperDurationTime(int durationSeconds, bool includeDays = true)
public static string GetProperDurationTime(int durationSeconds, bool includeDays = true, bool shortOutput = false)
{
string result = "";
@ -472,15 +472,19 @@ namespace Core.Helper
if (minutes > 0)
{
if (hours > 0 || days > 0) result += " ";
result += minutes.ToString() + "m";
if (days == 0 || (days > 0 && hours == 0))
{
result += " ";
result += minutes.ToString() + "m";
}
}
if (seconds > 0)
if ((days == 0 && hours == 0) || (days > 0 && hours == 0 && minutes == 0) || (days == 0 && hours > 0 && minutes == 0))
{
if (minutes > 0 || hours > 0 || days > 0) result += " ";
result += " ";
result += seconds.ToString() + "s";
}
return result;
}

View File

@ -903,6 +903,28 @@ namespace Core.Main
// Check for single market trend triggers
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
this.SaveProfitTrailerProperties();
@ -1518,7 +1540,7 @@ namespace Core.Main
// Check ignore markets
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredMarkets, ",");
if (ignoredMarkets.Contains(marketPair))
if (ignoredMarkets.Any(im => marketPair.StartsWith(im, StringComparison.InvariantCultureIgnoreCase)))
{
this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'.");
continue;
@ -1526,7 +1548,7 @@ namespace Core.Main
// Check allowed markets
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 + "'.");
continue;

View File

@ -74,9 +74,7 @@ namespace Core.MarketAnalyzer
//New variables for filtering out bad markets
float marketLastPrice = currencyTicker["lastPrice"].ToObject<float>();
float marketVolume = currencyTicker["volume"].ToObject<float>();
if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase))
{
if (marketLastPrice > 0 && marketVolume > 0)
if (marketLastPrice > 0 && marketVolume > 0)
{
// Set last values in case any error occurs
@ -100,7 +98,6 @@ namespace Core.MarketAnalyzer
//Let the user know that the problem market was ignored.
log.DoLogInfo("BinanceFutures - Ignoring bad market data for " + marketName);
}
}
}
BinanceFutures.CheckFirstSeenDates(markets, ref marketInfos, systemConfiguration, log);

View File

@ -185,6 +185,8 @@ namespace Monitor.Pages
sms.OffTriggerConnection = HttpContext.Request.Form[smsFormKey + "OffTriggerConnection"];
sms.IgnoredMarkets = HttpContext.Request.Form[smsFormKey + "IgnoredMarkets"];
sms.AllowedMarkets = HttpContext.Request.Form[smsFormKey + "AllowedMarkets"];
sms.IgnoredGlobalSettings = HttpContext.Request.Form[smsFormKey + "IgnoredGlobalSettings"];
sms.AllowedGlobalSettings = HttpContext.Request.Form[smsFormKey + "AllowedGlobalSettings"];
sms.StopProcessWhenTriggered = HttpContext.Request.Form[smsFormKey + "StopProcessWhenTriggered"].Equals("on");
#region Triggers

View File

@ -57,7 +57,7 @@
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, buyLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@buyLogEntry.Market</a></th>
} else {
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, buyLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@buyLogEntry.Market</a> <i class="fa fa-exclamation-triangle text-highlight" data-toggle="tooltip" data-placement="top" data-html="true" title="@await Component.InvokeAsync("PairIcon", mps)" data-template="<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner pair-tooltip'></div></div>"></i></th>
<th class="align-top; text-nowrap"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, buyLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@buyLogEntry.Market &nbsp;</a> <i class="fa fa-exclamation-triangle text-highlight" data-toggle="tooltip" data-placement="top" data-html="true" title="@await Component.InvokeAsync("PairIcon", mps)" data-template="<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner pair-tooltip'></div></div>"></i></th>
}
<td class="text-autocolor">@string.Format("{0}%", (buyLogEntry.PercChange * 100).ToString("#,#0.00"))</td>
<td class="text">@string.Format("{0}", (buyLogEntry.Volume24h).ToString())</td>
@ -94,7 +94,7 @@
<table class="table table-sm m-b-0">
<thead>
<tr>
<th>Market</th>
<th>Market</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="24 Hour Trend">24H</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Cost">Cost</th>
<th></th>
@ -113,6 +113,8 @@
mps = Model.Summary.MarketSummary[dcaLogEntry.Market];
}
string bagAgeText = Core.Helper.SystemHelper.GetProperDurationTime((int)Math.Ceiling(Model.DateTimeNow.Subtract(dcaLogEntry.FirstBoughtDate).TotalSeconds), true, true);
bool dcaEnabled = true;
if (mps != null) {
dcaEnabled = mps.IsDCAEnabled;
@ -162,14 +164,23 @@
// Render the row
<tr @(lostValue ? "class=errorRow" : "") >
<!-- Market -->
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0)
{
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.Market</a></th>
} else
{
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.Market</a> <i class="fa fa-exclamation-triangle text-highlight" data-toggle="tooltip" data-placement="top" data-html="true" title="@await Component.InvokeAsync("PairIcon", mps)" data-template="<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner pair-tooltip'></div></div>"></i></th>
}
<td class="align-top; text-nowrap">
<b>
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0)
{
<a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.Market</a>
} else
{
<a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.Market &nbsp;</a><i class="fa fa-exclamation-triangle text-highlight" data-toggle="tooltip" data-placement="top" data-html="true" title="@await Component.InvokeAsync("PairIcon", mps)" data-template="<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner pair-tooltip'></div></div>"></i>
}
</b>
<br>
@bagAgeText
</td>
<!-- 24hr change -->
<td class="text-autocolor">@Html.Raw((dcaLogEntry.PercChange * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))%</td>
<!-- Cost -->

View File

@ -61,6 +61,21 @@
</div>
</div>
<div class="form-group row">
<label class="col-md-4 col-form-label">Ignored Global Settings <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Comma separated list of global settings you want to be ignored in this single market setting."></i></label>
<div class="col-md-8">
<input type="text" class="form-control" name="MarketAnalyzer_SingleMarketSetting_@(Model.SettingName)|IgnoredGlobalSettings" value="@Model.SingleMarketSetting.IgnoredGlobalSettings">
</div>
</div>
<div class="form-group row">
<label class="col-md-4 col-form-label">Allowed Global Settings <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Comma separated list of markets that are allowed for this single market setting to get applied to."></i></label>
<div class="col-md-8">
<input type="text" class="form-control" name="MarketAnalyzer_SingleMarketSetting_@(Model.SettingName)|AllowedGlobalSettings" value="@Model.SingleMarketSetting.AllowedGlobalSettings">
<span class="help-block"><small>Leave empty to allow all</small></span>
</div>
</div>
<div class="form-group row">
<label class="col-md-4 col-form-label">Stop Process When Triggered <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Stops looking for other single market settings when this setting gets triggered for a market."></i></label>
<div class="col-md-8">

View File

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