Merge pull request #224 from PTMagicians/develop

Develop
This commit is contained in:
HojouFotytu 2020-11-19 12:17:53 +09:00 committed by GitHub
commit 23b851221d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 253 additions and 192 deletions

View File

@ -15,15 +15,23 @@ namespace Core.Main
private GeneralSettings _generalSettings = null;
private AnalyzerSettings _analyzerSettings = null;
private SecureSettings _secureSettings = null;
private string _basePath;
public PTMagicConfiguration()
{
LoadSettings(Directory.GetCurrentDirectory());
_basePath = Directory.GetCurrentDirectory();
LoadSettings(_basePath);
}
public PTMagicConfiguration(string basePath)
{
LoadSettings(basePath);
_basePath = basePath;
LoadSettings(_basePath);
}
public void RefreshSettings()
{
LoadSettings(_basePath);
}
private void LoadSettings(string basePath)
@ -100,17 +108,17 @@ namespace Core.Main
}
}
public void WriteGeneralSettings(string basePath)
public void WriteGeneralSettings()
{
GeneralSettingsWrapper gsWrapper = new GeneralSettingsWrapper();
gsWrapper.GeneralSettings = this.GeneralSettings;
FileHelper.CreateBackup(basePath + "settings.general.json", basePath, "settings.general.json.backup");
FileHelper.CreateBackup(_basePath + "settings.general.json", _basePath, "settings.general.json.backup");
FileHelper.WriteTextToFile(basePath, "settings.general.json", JsonConvert.SerializeObject(gsWrapper, Formatting.Indented));
FileHelper.WriteTextToFile(_basePath, "settings.general.json", JsonConvert.SerializeObject(gsWrapper, Formatting.Indented));
}
public void WriteAnalyzerSettings(string basePath)
public void WriteAnalyzerSettings()
{
AnalyzerSettingsWrapper asWrapper = new AnalyzerSettingsWrapper();
asWrapper.AnalyzerSettings = this.AnalyzerSettings;
@ -119,12 +127,12 @@ namespace Core.Main
settings.NullValueHandling = NullValueHandling.Ignore;
settings.DefaultValueHandling = DefaultValueHandling.Ignore;
FileHelper.CreateBackup(basePath + "settings.analyzer.json", basePath, "settings.analyzer.json.backup");
FileHelper.CreateBackup(_basePath + "settings.analyzer.json", _basePath, "settings.analyzer.json.backup");
FileHelper.WriteTextToFile(basePath, "settings.analyzer.json", JsonConvert.SerializeObject(asWrapper, Formatting.Indented, settings));
FileHelper.WriteTextToFile(_basePath, "settings.analyzer.json", JsonConvert.SerializeObject(asWrapper, Formatting.Indented, settings));
}
public void WriteSecureSettings(string password, string basePath)
public void WriteSecureSettings(string password)
{
string passwordEncrypted = EncryptionHelper.Encrypt(password);
@ -133,7 +141,7 @@ namespace Core.Main
SecureSettingsWrapper ssWrapper = new SecureSettingsWrapper();
ssWrapper.SecureSettings = this.SecureSettings;
FileHelper.WriteTextToFile(basePath, "settings.secure.json", JsonConvert.SerializeObject(ssWrapper, Formatting.Indented));
FileHelper.WriteTextToFile(_basePath, "settings.secure.json", JsonConvert.SerializeObject(ssWrapper, Formatting.Indented));
}
}
}

View File

@ -335,9 +335,9 @@ namespace Core.MarketAnalyzer
}
}
Market recentMarket = recentMarkets[recentMarketPair.Key];
Market recentMarket;
if (trendMarkets.ContainsKey(recentMarketPair.Key))
if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket))
{
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
if (ignoredMarkets.Contains(recentMarketPair.Value.Symbol))
@ -352,40 +352,52 @@ namespace Core.MarketAnalyzer
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend.");
continue;
}
}
else
{
// No recent market data
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' has no recent market trend data.");
continue;
}
Market trendMarket = trendMarkets[recentMarketPair.Key];
Market trendMarket;
if (trendMarket != null)
if (trendMarkets.TryGetValue(recentMarketPair.Key, out trendMarket))
{
double recentMarketPrice = recentMarket.Price;
double trendMarketPrice = trendMarket.Price;
if (!platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && marketTrend.TrendCurrency.Equals("Fiat", StringComparison.InvariantCultureIgnoreCase))
{
double recentMarketPrice = recentMarket.Price;
double trendMarketPrice = trendMarket.Price;
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)
{
recentMarketPrice = recentMarketPrice * recentMarket.MainCurrencyPriceUSD;
trendMarketPrice = trendMarketPrice * trendMarket.MainCurrencyPriceUSD;
}
recentMarketPrice = recentMarketPrice * recentMarket.MainCurrencyPriceUSD;
trendMarketPrice = trendMarketPrice * trendMarket.MainCurrencyPriceUSD;
}
double trendMarketChange = (recentMarketPrice - trendMarketPrice) / trendMarketPrice * 100;
MarketTrendChange mtc = new MarketTrendChange();
mtc.MarketTrendName = marketTrend.Name;
mtc.TrendMinutes = marketTrend.TrendMinutes;
mtc.TrendChange = trendMarketChange;
mtc.Market = recentMarket.Name;
mtc.LastPrice = recentMarket.Price;
mtc.Volume24h = recentMarket.Volume24h;
mtc.TrendDateTime = DateTime.UtcNow;
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() + ".");
marketCount++;
}
double trendMarketChange = (recentMarketPrice - trendMarketPrice) / trendMarketPrice * 100;
MarketTrendChange mtc = new MarketTrendChange();
mtc.MarketTrendName = marketTrend.Name;
mtc.TrendMinutes = marketTrend.TrendMinutes;
mtc.TrendChange = trendMarketChange;
mtc.Market = recentMarket.Name;
mtc.LastPrice = recentMarket.Price;
mtc.Volume24h = recentMarket.Volume24h;
mtc.TrendDateTime = DateTime.UtcNow;
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() + ".");
marketCount++;
}
else
{
// No data market trend data
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' has no market trend data.");
continue;
}
}
}

View File

@ -11,157 +11,176 @@
<div class="row">
<div class="col-sm-12">
<div class="card-box">
<h4 class="m-t-0 header-title"><b>Applied Single Market Setting Details</b></h4>
<h4 class="m-t-0 header-title"><b>Applied Single Market Settings</b></h4>
<tbody>
<p style="text-align: center;"><br>
<tr>
@{
Model.CreateSmsList();
foreach (string sms in Model.smsList)
{
int smsCount = 0;
foreach (Core.Main.DataObjects.PTMagicData.SingleMarketSettingSummary smsSummary in Model.SingleMarketSettingSummaries)
{
if (smsSummary.SingleMarketSetting.SettingName == sms)
{
smsCount = smsCount + 1;
}
}
<td><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)SettingsAnalyzer#SingleMarketSetting_@sms">@sms</a>:&nbsp;@smsCount &emsp; &emsp;</td>
}
}
</tr>
</p>
</tbody>
<br>
<table class="table table-striped table-sm m-b-0" h>
<thead>
<tr>
<th>Market Name</th>
<th class="text-right">Last Price</th>
<th class="text-right">Volume</th>
<th>Active Setting</th>
<th>Triggered time</th>
<th>Off Triggers</th>
<th class="text-right">Current Values</th>
<th>Volume</th>
<th>Last Price</th>
<th class="text-right">Active Setting </th>
<th> Triggered time</th>
<th class="text-center">Off Triggers</th>
<th class="text-center">Current Value</th>
<th></th>
</tr>
</thead>
<tbody>
@{
string lastMarket = "";
}
@foreach (Core.Main.DataObjects.PTMagicData.SingleMarketSettingSummary smsSummary in Model.SingleMarketSettingSummaries.OrderBy(s => s.Market)) {
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
if (Model.Summary.MarketSummary.ContainsKey(smsSummary.Market)) {
mps = Model.Summary.MarketSummary[smsSummary.Market];
} else {
mps = new Core.Main.DataObjects.PTMagicData.MarketPairSummary();
}
</tbody>
@{
string lastMarket = "";
}
@foreach (Core.Main.DataObjects.PTMagicData.SingleMarketSettingSummary smsSummary in Model.SingleMarketSettingSummaries.OrderBy(s => s.Market)) {
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
if (Model.Summary.MarketSummary.ContainsKey(smsSummary.Market)) {
mps = Model.Summary.MarketSummary[smsSummary.Market];
} else {
mps = new Core.Main.DataObjects.PTMagicData.MarketPairSummary();
}
bool settingHasOffTriggers = false;
if (smsSummary.SingleMarketSetting.OffTriggers.Count > 0) {
settingHasOffTriggers = true;
}
bool settingHasOffTriggers = false;
if (smsSummary.SingleMarketSetting.OffTriggers.Count > 0) {
settingHasOffTriggers = true;
}
int activeSeconds = (int)Math.Floor(DateTime.UtcNow.Subtract(smsSummary.ActivationDateTimeUTC).TotalSeconds);
int activeHours = (int)Math.Floor(DateTime.UtcNow.Subtract(smsSummary.ActivationDateTimeUTC).TotalHours);
<tr>
<th>
@if (!lastMarket.Equals(smsSummary.Market)) {
<a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform, Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, smsSummary.Market, Model.Summary.MainMarket)" target="_blank">@smsSummary.Market</a>
int activeSeconds = (int)Math.Floor(DateTime.UtcNow.Subtract(smsSummary.ActivationDateTimeUTC).TotalSeconds);
int activeHours = (int)Math.Floor(DateTime.UtcNow.Subtract(smsSummary.ActivationDateTimeUTC).TotalHours);
<tr>
<th>
@if (!lastMarket.Equals(smsSummary.Market)) {
<a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform, Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, smsSummary.Market, Model.Summary.MainMarket)" target="_blank">@smsSummary.Market</a>
}
</th>
<td>
@if (!lastMarket.Equals(smsSummary.Market)) {
<span>@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span>
}
</td>
<td>
@if (!lastMarket.Equals(smsSummary.Market)) {
<span>@mps.LatestPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span>
}
</td>
<td class="text-right">
@Core.Helper.SystemHelper.SplitCamelCase(smsSummary.SingleMarketSetting.SettingName)
</td>
<td>
@Core.Helper.SystemHelper.GetProperDurationTime(activeSeconds)
</td>
<td>
@if (settingHasOffTriggers) {
foreach (Core.Main.DataObjects.PTMagicData.OffTrigger ot in smsSummary.SingleMarketSetting.OffTriggers) {
string triggerTextClass = "text-danger";
if (ot.HoursSinceTriggered > 0) {
triggerTextClass = (activeHours >= ot.HoursSinceTriggered) ? "text-success" : "text-danger";
<p class="@triggerTextClass"><span>Hours Since Triggered</span><span class="pull-right">@ot.HoursSinceTriggered</span></p>
}
</th>
<td class="text-right">
@if (!lastMarket.Equals(smsSummary.Market)) {
<span>@mps.LatestPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span>
}
</td>
<td class="text-right">
@if (!lastMarket.Equals(smsSummary.Market)) {
<span>@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span>
}
</td>
<td>
@Core.Helper.SystemHelper.SplitCamelCase(smsSummary.SingleMarketSetting.SettingName)
</td>
<td>
@Core.Helper.SystemHelper.GetProperDurationTime(activeSeconds)
</td>
<td>
@if (settingHasOffTriggers) {
foreach (Core.Main.DataObjects.PTMagicData.OffTrigger ot in smsSummary.SingleMarketSetting.OffTriggers) {
string triggerTextClass = "text-danger";
if (ot.HoursSinceTriggered > 0) {
triggerTextClass = (activeHours >= ot.HoursSinceTriggered) ? "text-success" : "text-danger";
<p class="@triggerTextClass"><span>Hours Since Triggered</span><span class="pull-right">@ot.HoursSinceTriggered</span></p>
}
if (ot.Min24hVolume > 0 || ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume >= ot.Min24hVolume && mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">
<span>Volume</span>
<span class="pull-right">
@if (ot.Min24hVolume > 0) {
@("min: " + ot.Min24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + " " + Model.Summary.MainMarket)
}
@if (ot.Min24hVolume > 0 && ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
@(", ")
}
@if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
@("max: " + ot.Max24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + " " + Model.Summary.MainMarket)
}
</span>
</p>
}
if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass"><span>Max 24h Volume</span><span class="pull-right">@ot.Max24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span></p>
}
if (!ot.MarketTrendName.Equals("")) {
double trendChange = Model.GetTrendChange(ot.MarketTrendName, mps, smsSummary.TriggerSnapshot, ot.MarketTrendRelation);
triggerTextClass = (trendChange >= ot.MinChange && trendChange <= ot.MaxChange) ? "text-success" : "text-danger";
<p class="@triggerTextClass">
<span>@Core.Helper.SystemHelper.SplitCamelCase(ot.MarketTrendName) (@Core.Helper.SystemHelper.SplitCamelCase(ot.MarketTrendRelation))</span>
<span class="pull-right">
@if (ot.MinChange > Core.Main.Constants.MinTrendChange) {
@("min: " + ot.MinChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%")
}
@if (ot.MinChange > Core.Main.Constants.MinTrendChange && ot.MaxChange < Core.Main.Constants.MaxTrendChange) {
@(", ")
}
@if (ot.MaxChange < Core.Main.Constants.MaxTrendChange) {
@("max: " + ot.MaxChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%")
}
</span>
</p>
}
}
} else {
<i class="text-warning">Not specified</i> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This setting has no Off Triggers so it will stay active until its triggers are no longer matched."></i>
}
</td>
<td class="text-right">
@if (settingHasOffTriggers) {
foreach (Core.Main.DataObjects.PTMagicData.OffTrigger ot in smsSummary.SingleMarketSetting.OffTriggers) {
string triggerTextClass = "text-danger";
if (ot.HoursSinceTriggered > 0) {
triggerTextClass = (activeHours >= ot.HoursSinceTriggered) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@activeHours.ToString(new System.Globalization.CultureInfo("en-US"))</p>
}
if (ot.Min24hVolume > 0) {
triggerTextClass = (mps.Latest24hVolume >= ot.Min24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</p>
}
if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</p>
}
if (!ot.MarketTrendName.Equals("")) {
if (mps.MarketTrendChanges.ContainsKey(ot.MarketTrendName)) {
double trendChange = Model.GetTrendChange(ot.MarketTrendName, mps, smsSummary.TriggerSnapshot, ot.MarketTrendRelation);
triggerTextClass = (trendChange >= ot.MinChange && trendChange <= ot.MaxChange) ? "text-success" : "text-danger";
string trendChangeOutput = trendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
<p class="@triggerTextClass">@trendChangeOutput%</p>
if (ot.Min24hVolume > 0 || ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume >= ot.Min24hVolume && mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">
<span>Volume</span>
<span class="pull-right">
@if (ot.Min24hVolume > 0) {
@("min: " + ot.Min24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + " " + Model.Summary.MainMarket)
}
}
@if (ot.Min24hVolume > 0 && ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
@(", ")
}
@if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
@("max: " + ot.Max24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + " " + Model.Summary.MainMarket)
}
</span>
</p>
}
if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass"><span>Max 24h Volume</span><span class="pull-right">@ot.Max24hVolume.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</span></p>
}
if (!ot.MarketTrendName.Equals("")) {
double trendChange = Model.GetTrendChange(ot.MarketTrendName, mps, smsSummary.TriggerSnapshot, ot.MarketTrendRelation);
triggerTextClass = (trendChange >= ot.MinChange && trendChange <= ot.MaxChange) ? "text-success" : "text-danger";
<p class="@triggerTextClass">
<span>@Core.Helper.SystemHelper.SplitCamelCase(ot.MarketTrendName) (@Core.Helper.SystemHelper.SplitCamelCase(ot.MarketTrendRelation))</span>
<span class="pull-right">
@if (ot.MinChange > Core.Main.Constants.MinTrendChange) {
@("min: " + ot.MinChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%")
}
@if (ot.MinChange > Core.Main.Constants.MinTrendChange && ot.MaxChange < Core.Main.Constants.MaxTrendChange) {
@(", ")
}
@if (ot.MaxChange < Core.Main.Constants.MaxTrendChange) {
@("max: " + ot.MaxChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%")
}
</span>
</p>
}
}
} else {
<i class="text-warning">Not specified</i> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This setting has no Off Triggers so it will stay active until its triggers are no longer matched."></i>
}
</td>
<td class="text-center">
@if (settingHasOffTriggers) {
foreach (Core.Main.DataObjects.PTMagicData.OffTrigger ot in smsSummary.SingleMarketSetting.OffTriggers) {
string triggerTextClass = "text-danger";
if (ot.HoursSinceTriggered > 0) {
triggerTextClass = (activeHours >= ot.HoursSinceTriggered) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@activeHours.ToString(new System.Globalization.CultureInfo("en-US"))</p>
}
if (ot.Min24hVolume > 0) {
triggerTextClass = (mps.Latest24hVolume >= ot.Min24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</p>
}
if (ot.Max24hVolume < Core.Main.Constants.Max24hVolume) {
triggerTextClass = (mps.Latest24hVolume <= ot.Max24hVolume) ? "text-success" : "text-danger";
<p class="@triggerTextClass">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</p>
}
if (!ot.MarketTrendName.Equals("")) {
if (mps.MarketTrendChanges.ContainsKey(ot.MarketTrendName)) {
double trendChange = Model.GetTrendChange(ot.MarketTrendName, mps, smsSummary.TriggerSnapshot, ot.MarketTrendRelation);
triggerTextClass = (trendChange >= ot.MinChange && trendChange <= ot.MaxChange) ? "text-success" : "text-danger";
string trendChangeOutput = trendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
<p class="@triggerTextClass">@trendChangeOutput%</p>
}
}
</td>
<td>
@if (settingHasOffTriggers) {
@if (Model.PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected) {
<a class="btn btn-danger btn-sm btn-custom btn-block text-uppercase btn-resetsettingsecure" data-datatarget="@Html.Raw(smsSummary.Market)" data-setting="@Html.Raw(smsSummary.SingleMarketSetting.SettingName)" href="#">Reset</a>
} else {
<a class="btn btn-danger btn-custom btn-block text-uppercase" data-toggle="tooltip" data-placement="top" title="This is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> Reset</a>
}
}
</td>
</tr>
lastMarket = smsSummary.Market;
}
</tbody>
</table>
}
}
</td>
<td>
@if (settingHasOffTriggers) {
@if (Model.PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected) {
<a class="btn btn-danger btn-sm btn-custom btn-block text-uppercase btn-resetsettingsecure" data-datatarget="@Html.Raw(smsSummary.Market)" data-setting="@Html.Raw(smsSummary.SingleMarketSetting.SettingName)" href="#">Reset</a>
} else {
<a class="btn btn-danger btn-custom btn-block text-uppercase" data-toggle="tooltip" data-placement="top" title="This is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> Reset</a>
}
}
</td>
</tr>
lastMarket = smsSummary.Market;
}
</tbody>
</table>
</div>
</div>
</div>

View File

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -20,6 +21,20 @@ namespace Monitor.Pages
BindData();
}
public List<string> smsList = new List<string>();
public void CreateSmsList ()
{
foreach (Core.Main.DataObjects.PTMagicData.SingleMarketSettingSummary smsSummary in SingleMarketSettingSummaries)
{
if (!smsList.Contains(smsSummary.SingleMarketSetting.SettingName))
{
smsList.Add(smsSummary.SingleMarketSetting.SettingName);
}
}
}
private void BindData()
{
if (System.IO.File.Exists(PTMagicBasePath + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "SingleMarketSettingSummary.json"))

View File

@ -42,7 +42,8 @@ namespace Monitor.Pages
SaveGlobalSettings(formKeys);
SaveSingleMarketSettings(formKeys);
PTMagicConfiguration.WriteAnalyzerSettings(PTMagicBasePath);
PTMagicConfiguration.WriteAnalyzerSettings();
PTMagicConfiguration.RefreshSettings();
NotifyHeadline = "Settings saved!";
NotifyMessage = "Settings saved successfully to settings.analyzer.json.";

View File

@ -65,6 +65,7 @@ namespace Monitor.Pages
{
base.Init();
// Read the new settings
PTMagicConfiguration.GeneralSettings.Application.IsEnabled = HttpContext.Request.Form["Application_IsEnabled"].Equals("on");
PTMagicConfiguration.GeneralSettings.Application.TestMode = HttpContext.Request.Form["Application_TestMode"].Equals("on");
PTMagicConfiguration.GeneralSettings.Application.StartBalance = SystemHelper.TextToDouble(HttpContext.Request.Form["Application_StartBalance"], PTMagicConfiguration.GeneralSettings.Application.StartBalance, "en-US");
@ -79,7 +80,7 @@ namespace Monitor.Pages
PTMagicConfiguration.GeneralSettings.Application.InstanceName = HttpContext.Request.Form["Application_InstanceName"];
PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey = HttpContext.Request.Form["Application_CoinMarketCapAPIKey"];
PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey = HttpContext.Request.Form["Application_FreeCurrencyConverterAPIKey"];
//
PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = HttpContext.Request.Form["Monitor_IsPasswordProtected"].Equals("on");
PTMagicConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart = HttpContext.Request.Form["Monitor_OpenBrowserOnStart"].Equals("on");
PTMagicConfiguration.GeneralSettings.Monitor.DefaultDCAMode = HttpContext.Request.Form["Monitor_AnalyzerChart"];
@ -105,8 +106,11 @@ namespace Monitor.Pages
PTMagicConfiguration.GeneralSettings.Telegram.ChatId = SystemHelper.TextToInteger64(HttpContext.Request.Form["Telegram_ChatId"], PTMagicConfiguration.GeneralSettings.Telegram.ChatId);
PTMagicConfiguration.GeneralSettings.Telegram.SilentMode = HttpContext.Request.Form["Telegram_SilentMode"].Equals("on");
PTMagicConfiguration.WriteGeneralSettings(PTMagicBasePath);
// Save and reload the settings
PTMagicConfiguration.WriteGeneralSettings();
PTMagicConfiguration.RefreshSettings();
// Notify
NotifyHeadline = "Settings saved!";
NotifyMessage = "Settings saved successfully to settings.general.json.";
NotifyType = "success";

View File

@ -26,7 +26,7 @@ namespace Monitor.Pages
if (ModelState.IsValid)
{
base.PreInit();
PTMagicConfiguration.WriteSecureSettings(password, PTMagicBasePath);
PTMagicConfiguration.WriteSecureSettings(password);
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
}

View File

@ -139,11 +139,11 @@
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-12 text-center">
<span class="header-title">@Model.PTMagicConfiguration.GeneralSettings.Application.InstanceName</span>
&emsp; &emsp;
<a href="https://github.com/PTMagicians/PTMagic" target="_blank">GitHub</a>
|
&nbsp; | &nbsp;
<a href="https://github.com/PTMagicians/PTMagic/wiki" target="_blank">Wiki</a>
</div>
</div>
</div>
</footer>

View File

@ -8,6 +8,7 @@
if (activeSingleSettings > 0) {
singleSettingInfoIcon = "<i class=\"fa fa-info-circle text-muted\" data-toggle=\"tooltip\" data-placement=\"top\" data-html=\"true\" title=\"<b>Single Market Settings active for:</b><br />-" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "<br />-", true) + "\" data-template=\"<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner tooltip-200 text-left'></div></div>\"></i>";
}
string globalSettingInfoIcon = "<i class=\"fa fa-info-circle text-muted\" data-toggle=\"tooltip\" data-placement=\"top\" data-html=\"true\" title=\"<b>Instance: </b>" + Model.PTMagicConfiguration.GeneralSettings.Application.InstanceName + "\" data-template=\"<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner tooltip-100 text-left'></div></div>\"></i>";
DateTime lastRuntime = Model.Summary.LastRuntime;
double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds;
@ -23,12 +24,13 @@
}
}
<div class="card-box card-box-mini card-box-ptmagic-outlined" data-toggle="tooltip" data-placement="bottom" title="Active global setting">
@Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)
<div class="card-box card-box-mini card-box-ptmagic-outlined">
<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>
</div>
<div class="card-box card-box-mini card-box-ptmagic-outlined" data-toggle="tooltip" data-placement="bottom" title="Active single market settings">
<b>SMS:</b> <a href="ManageSMS">@Html.Raw(singleSettingInfoIcon)</a> @activeSingleSettings
<div class="card-box card-box-mini card-box-ptmagic-outlined">
<span data-toggle="tooltip" data-placement="bottom" title="Active single market settings"><b>SMS: </b></span><span class = "header-title"><a href="ManageSMS">@Html.Raw(activeSingleSettings + " " + singleSettingInfoIcon)</a></span>
</div>
<div class="card-box card-box-mini card-box-ptmagic-status-outlined @iconColor" data-toggle="tooltip" data-placement="bottom" title="@ptMagicHealthTooltip">

View File

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