Fixes and reliability tweaks
- Fixed issues with detecting the console and whether keypresses can be captured. - Changed the start-up to keep trying to acquire configuration and/or Profit Trailer connectivity using a exponential backoff to stop thrashing. - Changed the code to use UTC times to avoid issues when daylight svaing kicks in.
This commit is contained in:
parent
d161c11a3a
commit
bfae59193f
|
@ -136,7 +136,7 @@ namespace Core.Main.DataObjects
|
||||||
|
|
||||||
public double GetCurrentBalance()
|
public double GetCurrentBalance()
|
||||||
{
|
{
|
||||||
return this.GetSnapshotBalance(DateTime.Now.ToUniversalTime());
|
return this.GetSnapshotBalance(DateTime.UtcNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double GetSnapshotBalance(DateTime snapshotDateTime)
|
public double GetSnapshotBalance(DateTime snapshotDateTime)
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Core.Helper
|
||||||
|
|
||||||
FileInfo file = new FileInfo(filePath);
|
FileInfo file = new FileInfo(filePath);
|
||||||
|
|
||||||
string backupFilePath = backupFolder + DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss") + "_" + file.Name;
|
string backupFilePath = backupFolder + DateTime.UtcNow.ToString("yyyy-MM-dd_HH.mm.ss") + "_" + file.Name;
|
||||||
if (!backupFileName.Equals(""))
|
if (!backupFileName.Equals(""))
|
||||||
{
|
{
|
||||||
backupFilePath = backupFolder + backupFileName;
|
backupFilePath = backupFolder + backupFileName;
|
||||||
|
@ -64,7 +64,7 @@ namespace Core.Helper
|
||||||
DirectoryInfo folder = new DirectoryInfo(folderPath);
|
DirectoryInfo folder = new DirectoryInfo(folderPath);
|
||||||
foreach (FileInfo file in folder.GetFiles())
|
foreach (FileInfo file in folder.GetFiles())
|
||||||
{
|
{
|
||||||
DateTime maxAge = DateTime.Now.AddMinutes(-maxMinutes);
|
DateTime maxAge = DateTime.UtcNow.AddMinutes(-maxMinutes);
|
||||||
|
|
||||||
if (file.LastWriteTime < maxAge)
|
if (file.LastWriteTime < maxAge)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ namespace Core.Helper
|
||||||
DirectoryInfo folder = new DirectoryInfo(folderPath);
|
DirectoryInfo folder = new DirectoryInfo(folderPath);
|
||||||
foreach (FileInfo file in folder.GetFiles())
|
foreach (FileInfo file in folder.GetFiles())
|
||||||
{
|
{
|
||||||
DateTime maxAge = DateTime.Now.AddHours(-(maxHours + 1));
|
DateTime maxAge = DateTime.UtcNow.AddHours(-(maxHours + 1));
|
||||||
|
|
||||||
if (file.LastWriteTime < maxAge)
|
if (file.LastWriteTime < maxAge)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,6 @@ namespace Core.Main
|
||||||
private int _state = 0;
|
private int _state = 0;
|
||||||
private int _runCount = 0;
|
private int _runCount = 0;
|
||||||
private int _totalElapsedSeconds = 0;
|
private int _totalElapsedSeconds = 0;
|
||||||
private int _configCheckRetryCount = 0;
|
|
||||||
private bool _configCheckResult = true;
|
|
||||||
private bool _globalSettingWritten = false;
|
private bool _globalSettingWritten = false;
|
||||||
private bool _singleMarketSettingWritten = false;
|
private bool _singleMarketSettingWritten = false;
|
||||||
private bool _enforceSettingsReapply = false;
|
private bool _enforceSettingsReapply = false;
|
||||||
|
@ -510,6 +508,30 @@ namespace Core.Main
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PTMagic Startup Methods
|
#region PTMagic Startup Methods
|
||||||
|
|
||||||
|
private static int ExponentialDelay(int failedAttempts,
|
||||||
|
int maxDelayInSeconds = 900)
|
||||||
|
{
|
||||||
|
//Attempt 1 0s 0s
|
||||||
|
//Attempt 2 2s 2s
|
||||||
|
//Attempt 3 4s 4s
|
||||||
|
//Attempt 4 8s 8s
|
||||||
|
//Attempt 5 16s 16s
|
||||||
|
//Attempt 6 32s 32s
|
||||||
|
|
||||||
|
//Attempt 7 64s 1m 4s
|
||||||
|
//Attempt 8 128s 2m 8s
|
||||||
|
//Attempt 9 256s 4m 16s
|
||||||
|
//Attempt 10 512 8m 32s
|
||||||
|
//Attempt 11 1024 17m 4s
|
||||||
|
|
||||||
|
var delayInSeconds = ((1d / 2d) * (Math.Pow(2d, failedAttempts) - 1d));
|
||||||
|
|
||||||
|
return maxDelayInSeconds < delayInSeconds
|
||||||
|
? maxDelayInSeconds
|
||||||
|
: (int)delayInSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
public bool StartProcess()
|
public bool StartProcess()
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -535,27 +557,28 @@ namespace Core.Main
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_configCheckResult = this.RunConfigurationChecks();
|
bool configCheckResult = this.RunConfigurationChecks();
|
||||||
if (!_configCheckResult)
|
|
||||||
{
|
|
||||||
this.Log.DoLogInfo("Starting configuration check retry in 10 seconds...");
|
|
||||||
System.Timers.Timer configCheckTimer = new System.Timers.Timer(10000);
|
|
||||||
configCheckTimer.Enabled = true;
|
|
||||||
configCheckTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.ConfigCheckTimer_Elapsed);
|
|
||||||
|
|
||||||
while (!_configCheckResult && _configCheckRetryCount < 20)
|
if (!configCheckResult)
|
||||||
|
{
|
||||||
|
// Config check failed so retry using an exponential back off until it passes; max retry time 15 mins.
|
||||||
|
int configRetryCount = 1;
|
||||||
|
int delaySeconds;
|
||||||
|
|
||||||
|
while (!configCheckResult)
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
delaySeconds = ExponentialDelay(configRetryCount);
|
||||||
|
this.Log.DoLogError("Configuration check retry " + configRetryCount + " failed, starting next retry in " + delaySeconds + " seconds...");
|
||||||
|
Thread.Sleep(delaySeconds * 1000);
|
||||||
|
|
||||||
|
// Reinit config in case the user changed something
|
||||||
|
this.InitializeConfiguration();
|
||||||
|
configCheckResult = this.RunConfigurationChecks();
|
||||||
|
configRetryCount++;
|
||||||
}
|
}
|
||||||
configCheckTimer.Stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_configCheckResult)
|
this.LastSettingFileCheck = DateTime.UtcNow;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.LastSettingFileCheck = DateTime.Now;
|
|
||||||
|
|
||||||
SettingsFiles.CheckPresets(this.PTMagicConfiguration, this.Log, true);
|
SettingsFiles.CheckPresets(this.PTMagicConfiguration, this.Log, true);
|
||||||
|
|
||||||
|
@ -662,7 +685,7 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for CoinMarketCap API Key
|
// Check for CoinMarketCap API Key
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey))
|
||||||
{
|
{
|
||||||
this.Log.DoLogInfo("CoinMarketCap API KEY found");
|
this.Log.DoLogInfo("CoinMarketCap API KEY found");
|
||||||
}
|
}
|
||||||
|
@ -688,7 +711,7 @@ namespace Core.Main
|
||||||
this.Log.DoLogInfo("========== STARTING CHECKS FOR Profit Trailer ==========");
|
this.Log.DoLogInfo("========== STARTING CHECKS FOR Profit Trailer ==========");
|
||||||
|
|
||||||
// Check for PT license key
|
// Check for PT license key
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerLicense.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerLicense))
|
||||||
{
|
{
|
||||||
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer license found");
|
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer license found");
|
||||||
}
|
}
|
||||||
|
@ -699,18 +722,18 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check for ptServerAPIToken
|
//Check for ptServerAPIToken
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken))
|
||||||
{
|
{
|
||||||
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer Server API Token Specified");
|
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer Server API Token Specified");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Log.DoLogError("Profit Trailer check: No Server API Token specified. It has to be the same Token as in the Profit Trailer Config File");
|
this.Log.DoLogError("Profit Trailer check: No Server API Token specified. Please configure ProfitTrailerServerAPIToken in settings.general.json , ensuring it has to be the same Token as in the Profit Trailer Config File!");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for PT default setting key
|
// Check for PT default setting key
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerDefaultSettingName.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerDefaultSettingName))
|
||||||
{
|
{
|
||||||
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer default setting name specified");
|
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer default setting name specified");
|
||||||
}
|
}
|
||||||
|
@ -721,7 +744,7 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for PT monitor
|
// Check for PT monitor
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerMonitorURL.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerMonitorURL))
|
||||||
{
|
{
|
||||||
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer monitor URL found");
|
this.Log.DoLogInfo("Profit Trailer check: Profit Trailer monitor URL found");
|
||||||
}
|
}
|
||||||
|
@ -768,17 +791,6 @@ namespace Core.Main
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PTMagic Interval Methods
|
#region PTMagic Interval Methods
|
||||||
public void ConfigCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
// Reinit config in case the user changed something
|
|
||||||
this.InitializeConfiguration();
|
|
||||||
_configCheckResult = this.RunConfigurationChecks();
|
|
||||||
_configCheckRetryCount++;
|
|
||||||
if (!_configCheckResult)
|
|
||||||
{
|
|
||||||
this.Log.DoLogError("Configuration check retry " + _configCheckRetryCount + "/10 failed, starting next retry in 5 seconds...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PTMagicIntervalTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public void PTMagicIntervalTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -805,7 +817,7 @@ namespace Core.Main
|
||||||
// Change state to "Running"
|
// Change state to "Running"
|
||||||
this.State = Constants.PTMagicBotState_Running;
|
this.State = Constants.PTMagicBotState_Running;
|
||||||
|
|
||||||
this.LastRuntime = DateTime.Now;
|
this.LastRuntime = DateTime.UtcNow;
|
||||||
|
|
||||||
this.LastRuntimeSummary = new Summary();
|
this.LastRuntimeSummary = new Summary();
|
||||||
this.LastRuntimeSummary.LastRuntime = this.LastRuntime;
|
this.LastRuntimeSummary.LastRuntime = this.LastRuntime;
|
||||||
|
@ -881,7 +893,7 @@ namespace Core.Main
|
||||||
if (File.Exists(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json"))
|
if (File.Exists(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json"))
|
||||||
{
|
{
|
||||||
FileInfo fiLastSummary = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json");
|
FileInfo fiLastSummary = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json");
|
||||||
if (fiLastSummary.LastWriteTime < DateTime.Now.AddMinutes(-(this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 2)))
|
if (fiLastSummary.LastWriteTime < DateTime.UtcNow.AddMinutes(-(this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 2)))
|
||||||
{
|
{
|
||||||
Log.DoLogWarn("PTMagic seems to have frozen after raid " + this.RunCount.ToString() + ", but don't worry I will sacrifice some Magicbots to get this running again...");
|
Log.DoLogWarn("PTMagic seems to have frozen after raid " + this.RunCount.ToString() + ", but don't worry I will sacrifice some Magicbots to get this running again...");
|
||||||
this.State = Constants.PTMagicBotState_Idle;
|
this.State = Constants.PTMagicBotState_Idle;
|
||||||
|
@ -935,7 +947,7 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.DoLogInfo("New configuration reloaded.");
|
Log.DoLogInfo("New configuration reloaded.");
|
||||||
this.LastSettingFileCheck = DateTime.Now;
|
this.LastSettingFileCheck = DateTime.UtcNow;
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
if (this.Timer.Interval != this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60 * 1000)
|
if (this.Timer.Interval != this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60 * 1000)
|
||||||
|
@ -977,7 +989,7 @@ namespace Core.Main
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals(""))
|
if (String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.Exchange))
|
||||||
{
|
{
|
||||||
Log.DoLogError("Your setting for Application.Exchange in settings.general.json is invalid (empty)! Terminating process.");
|
Log.DoLogError("Your setting for Application.Exchange in settings.general.json is invalid (empty)! Terminating process.");
|
||||||
this.Timer.Stop();
|
this.Timer.Stop();
|
||||||
|
@ -1000,10 +1012,10 @@ namespace Core.Main
|
||||||
private void CheckLatestGitHubVersion(string currentVersion)
|
private void CheckLatestGitHubVersion(string currentVersion)
|
||||||
{
|
{
|
||||||
// Get latest version number
|
// Get latest version number
|
||||||
if (this.LastVersionCheck < DateTime.Now.AddMinutes(-30))
|
if (this.LastVersionCheck < DateTime.UtcNow.AddMinutes(-30))
|
||||||
{
|
{
|
||||||
this.LatestVersion = BaseAnalyzer.GetLatestGitHubRelease(this.Log, currentVersion);
|
this.LatestVersion = BaseAnalyzer.GetLatestGitHubRelease(this.Log, currentVersion);
|
||||||
this.LastVersionCheck = DateTime.Now;
|
this.LastVersionCheck = DateTime.UtcNow;
|
||||||
if (!SystemHelper.IsRecentVersion(currentVersion, this.LatestVersion))
|
if (!SystemHelper.IsRecentVersion(currentVersion, this.LatestVersion))
|
||||||
{
|
{
|
||||||
this.Log.DoLogWarn("Your bot is out of date! The most recent version of PTMagic is " + this.LatestVersion);
|
this.Log.DoLogWarn("Your bot is out of date! The most recent version of PTMagic is " + this.LatestVersion);
|
||||||
|
@ -1016,7 +1028,7 @@ namespace Core.Main
|
||||||
this.LastRuntimeSummary.MainFiatCurrency = this.LastMainFiatCurrency;
|
this.LastRuntimeSummary.MainFiatCurrency = this.LastMainFiatCurrency;
|
||||||
this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = this.LastMainFiatCurrencyExchangeRate;
|
this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = this.LastMainFiatCurrencyExchangeRate;
|
||||||
|
|
||||||
if (this.LastFiatCurrencyCheck < DateTime.Now.AddHours(-12) && !this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency.Equals("USD", StringComparison.InvariantCultureIgnoreCase))
|
if (this.LastFiatCurrencyCheck < DateTime.UtcNow.AddHours(-12) && !this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency.Equals("USD", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1025,7 +1037,7 @@ namespace Core.Main
|
||||||
this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency;
|
this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency;
|
||||||
this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate;
|
this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate;
|
||||||
|
|
||||||
this.LastFiatCurrencyCheck = DateTime.Now;
|
this.LastFiatCurrencyCheck = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1112,7 +1124,7 @@ namespace Core.Main
|
||||||
private void BuildMarketData()
|
private void BuildMarketData()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey.Equals(""))
|
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey))
|
||||||
{
|
{
|
||||||
// Get most recent market data from CMC
|
// Get most recent market data from CMC
|
||||||
string cmcMarketDataResult = CoinMarketCap.GetMarketData(this.PTMagicConfiguration, this.Log);
|
string cmcMarketDataResult = CoinMarketCap.GetMarketData(this.PTMagicConfiguration, this.Log);
|
||||||
|
@ -1154,7 +1166,7 @@ namespace Core.Main
|
||||||
private void BuildMarketList()
|
private void BuildMarketList()
|
||||||
{
|
{
|
||||||
string marketPairs = SettingsHandler.GetMarketPairs(this.PTMagicConfiguration, this.PairsLines, this.Log);
|
string marketPairs = SettingsHandler.GetMarketPairs(this.PTMagicConfiguration, this.PairsLines, this.Log);
|
||||||
if (marketPairs.ToLower().Equals("all") || marketPairs.ToLower().Equals("false") || marketPairs.ToLower().Equals("true") || marketPairs.Equals(""))
|
if (marketPairs.ToLower().Equals("all") || marketPairs.ToLower().Equals("false") || marketPairs.ToLower().Equals("true") || String.IsNullOrEmpty(marketPairs))
|
||||||
{
|
{
|
||||||
this.MarketList = this.ExchangeMarketList;
|
this.MarketList = this.ExchangeMarketList;
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1311,7 @@ namespace Core.Main
|
||||||
private void ActivateSetting(ref bool headerLinesAdded, ref GlobalSetting triggeredSetting, ref List<string> matchedTriggers)
|
private void ActivateSetting(ref bool headerLinesAdded, ref GlobalSetting triggeredSetting, ref List<string> matchedTriggers)
|
||||||
{
|
{
|
||||||
string activeSettingName = SettingsHandler.GetActiveSetting(this, ref headerLinesAdded);
|
string activeSettingName = SettingsHandler.GetActiveSetting(this, ref headerLinesAdded);
|
||||||
if (activeSettingName.Equals("") && this.PTMagicConfiguration.GeneralSettings.Application.TestMode)
|
if (String.IsNullOrEmpty(activeSettingName) && this.PTMagicConfiguration.GeneralSettings.Application.TestMode)
|
||||||
{
|
{
|
||||||
activeSettingName = this.ActiveSetting;
|
activeSettingName = this.ActiveSetting;
|
||||||
}
|
}
|
||||||
|
@ -1657,7 +1669,7 @@ namespace Core.Main
|
||||||
|
|
||||||
if (marketInfo != null)
|
if (marketInfo != null)
|
||||||
{
|
{
|
||||||
int marketAge = (int)Math.Floor(DateTime.Now.ToUniversalTime().Subtract(marketInfo.FirstSeen).TotalDays);
|
int marketAge = (int)Math.Floor(DateTime.UtcNow.Subtract(marketInfo.FirstSeen).TotalDays);
|
||||||
if (marketAge < trigger.AgeDaysLowerThan)
|
if (marketAge < trigger.AgeDaysLowerThan)
|
||||||
{
|
{
|
||||||
matchedSingleMarketTriggers.Add(marketSetting.SettingName + ": '" + marketPair + "' is only " + marketAge.ToString() + " days old on this exchange. Trigger matched!");
|
matchedSingleMarketTriggers.Add(marketSetting.SettingName + ": '" + marketPair + "' is only " + marketAge.ToString() + " days old on this exchange. Trigger matched!");
|
||||||
|
@ -1979,7 +1991,7 @@ namespace Core.Main
|
||||||
|
|
||||||
private void SaveRuntimeSummary(bool headerLinesAdded)
|
private void SaveRuntimeSummary(bool headerLinesAdded)
|
||||||
{
|
{
|
||||||
DateTime endTime = DateTime.Now;
|
DateTime endTime = DateTime.UtcNow;
|
||||||
int elapsedSeconds = (int)Math.Round(endTime.Subtract(this.LastRuntime).TotalSeconds, 0);
|
int elapsedSeconds = (int)Math.Round(endTime.Subtract(this.LastRuntime).TotalSeconds, 0);
|
||||||
|
|
||||||
this.LastRuntimeSummary.LastRuntimeSeconds = elapsedSeconds;
|
this.LastRuntimeSummary.LastRuntimeSeconds = elapsedSeconds;
|
||||||
|
@ -2004,11 +2016,11 @@ namespace Core.Main
|
||||||
// Market trend changes history for graph data
|
// Market trend changes history for graph data
|
||||||
foreach (string key in summary.MarketTrendChanges.Keys)
|
foreach (string key in summary.MarketTrendChanges.Keys)
|
||||||
{
|
{
|
||||||
this.LastRuntimeSummary.MarketTrendChanges.Add(key, summary.MarketTrendChanges[key].FindAll(mtc => mtc.TrendDateTime >= DateTime.Now.AddHours(-PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours)));
|
this.LastRuntimeSummary.MarketTrendChanges.Add(key, summary.MarketTrendChanges[key].FindAll(mtc => mtc.TrendDateTime >= DateTime.UtcNow.AddHours(-PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global setting summary to be kept
|
// Global setting summary to be kept
|
||||||
this.LastRuntimeSummary.GlobalSettingSummary.AddRange(summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= DateTime.Now.AddHours(-96)));
|
this.LastRuntimeSummary.GlobalSettingSummary.AddRange(summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= DateTime.UtcNow.AddHours(-96)));
|
||||||
|
|
||||||
this.Log.DoLogInfo("Summary: Loaded old LastRuntimeSummary.json to keep data.");
|
this.Log.DoLogInfo("Summary: Loaded old LastRuntimeSummary.json to keep data.");
|
||||||
}
|
}
|
||||||
|
@ -2034,7 +2046,7 @@ namespace Core.Main
|
||||||
if (this.LastRuntimeSummary.GlobalSettingSummary.Count > 0)
|
if (this.LastRuntimeSummary.GlobalSettingSummary.Count > 0)
|
||||||
{
|
{
|
||||||
lastSettingSummary = this.LastRuntimeSummary.GlobalSettingSummary.OrderByDescending(lss => lss.SwitchDateTime).First();
|
lastSettingSummary = this.LastRuntimeSummary.GlobalSettingSummary.OrderByDescending(lss => lss.SwitchDateTime).First();
|
||||||
lastSettingSummary.ActiveSeconds = (int)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(lastSettingSummary.SwitchDateTime).TotalSeconds);
|
lastSettingSummary.ActiveSeconds = (int)Math.Ceiling(DateTime.UtcNow.Subtract(lastSettingSummary.SwitchDateTime).TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.LastRuntimeSummary.GlobalSettingSummary.Add(gss);
|
this.LastRuntimeSummary.GlobalSettingSummary.Add(gss);
|
||||||
|
@ -2048,7 +2060,7 @@ namespace Core.Main
|
||||||
if (this.LastRuntimeSummary.GlobalSettingSummary.Count > 0)
|
if (this.LastRuntimeSummary.GlobalSettingSummary.Count > 0)
|
||||||
{
|
{
|
||||||
lastSettingSummary = this.LastRuntimeSummary.GlobalSettingSummary.OrderByDescending(lss => lss.SwitchDateTime).First();
|
lastSettingSummary = this.LastRuntimeSummary.GlobalSettingSummary.OrderByDescending(lss => lss.SwitchDateTime).First();
|
||||||
lastSettingSummary.ActiveSeconds = (int)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(lastSettingSummary.SwitchDateTime).TotalSeconds);
|
lastSettingSummary.ActiveSeconds = (int)Math.Ceiling(DateTime.UtcNow.Subtract(lastSettingSummary.SwitchDateTime).TotalSeconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2160,7 +2172,7 @@ namespace Core.Main
|
||||||
for (int dca = 1; dca <= maxDCALevel; dca++)
|
for (int dca = 1; dca <= maxDCALevel; dca++)
|
||||||
{
|
{
|
||||||
string dcaTriggerString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "buy_trigger_" + dca.ToString(), "DEFAULT_DCA_buy_trigger_" + dca.ToString());
|
string dcaTriggerString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "buy_trigger_" + dca.ToString(), "DEFAULT_DCA_buy_trigger_" + dca.ToString());
|
||||||
if (!dcaTriggerString.Equals(""))
|
if (!String.IsNullOrEmpty(dcaTriggerString))
|
||||||
{
|
{
|
||||||
double dcaTrigger = SystemHelper.TextToDouble(dcaTriggerString, 0, "en-US");
|
double dcaTrigger = SystemHelper.TextToDouble(dcaTriggerString, 0, "en-US");
|
||||||
|
|
||||||
|
@ -2183,7 +2195,7 @@ namespace Core.Main
|
||||||
for (int dca = 1; dca <= maxDCALevel; dca++)
|
for (int dca = 1; dca <= maxDCALevel; dca++)
|
||||||
{
|
{
|
||||||
string dcaPercentageString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_buy_percentage_" + dca.ToString(), "");
|
string dcaPercentageString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_buy_percentage_" + dca.ToString(), "");
|
||||||
if (!dcaPercentageString.Equals(""))
|
if (!String.IsNullOrEmpty(dcaPercentageString))
|
||||||
{
|
{
|
||||||
double dcaPercentage = SystemHelper.TextToDouble(dcaPercentageString, 0, "en-US");
|
double dcaPercentage = SystemHelper.TextToDouble(dcaPercentageString, 0, "en-US");
|
||||||
|
|
||||||
|
@ -2200,7 +2212,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, "DEFAULT_" + c + "_buy_strategy", "");
|
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, "DEFAULT_" + c + "_buy_strategy", "");
|
||||||
if (!buyStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(buyStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary buyStrategy = new StrategySummary();
|
StrategySummary buyStrategy = new StrategySummary();
|
||||||
buyStrategy.Name = buyStrategyName;
|
buyStrategy.Name = buyStrategyName;
|
||||||
|
@ -2218,7 +2230,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, "DEFAULT_" + c + "_sell_strategy", "");
|
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, "DEFAULT_" + c + "_sell_strategy", "");
|
||||||
if (!sellStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(sellStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary sellStrategy = new StrategySummary();
|
StrategySummary sellStrategy = new StrategySummary();
|
||||||
sellStrategy.Name = sellStrategyName;
|
sellStrategy.Name = sellStrategyName;
|
||||||
|
@ -2236,7 +2248,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_buy_strategy", "");
|
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_buy_strategy", "");
|
||||||
if (!buyStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(buyStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary buyStrategy = new StrategySummary();
|
StrategySummary buyStrategy = new StrategySummary();
|
||||||
buyStrategy.Name = buyStrategyName;
|
buyStrategy.Name = buyStrategyName;
|
||||||
|
@ -2254,7 +2266,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_sell_strategy", "");
|
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_sell_strategy", "");
|
||||||
if (!sellStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(sellStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary sellStrategy = new StrategySummary();
|
StrategySummary sellStrategy = new StrategySummary();
|
||||||
sellStrategy.Name = sellStrategyName;
|
sellStrategy.Name = sellStrategyName;
|
||||||
|
@ -2315,7 +2327,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, marketPairSimple + "_" + c + "_buy_strategy", "");
|
string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, marketPairSimple + "_" + c + "_buy_strategy", "");
|
||||||
if (!buyStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(buyStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary buyStrategy = new StrategySummary();
|
StrategySummary buyStrategy = new StrategySummary();
|
||||||
buyStrategy.Name = buyStrategyName;
|
buyStrategy.Name = buyStrategyName;
|
||||||
|
@ -2334,7 +2346,7 @@ namespace Core.Main
|
||||||
for (char c = 'A'; c <= 'Z'; c++)
|
for (char c = 'A'; c <= 'Z'; c++)
|
||||||
{
|
{
|
||||||
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, marketPairSimple + "_" + c + "_sell_strategy", "");
|
string sellStrategyName = SettingsHandler.GetCurrentPropertyValue(pairsProperties, marketPairSimple + "_" + c + "_sell_strategy", "");
|
||||||
if (!sellStrategyName.Equals(""))
|
if (!String.IsNullOrEmpty(sellStrategyName))
|
||||||
{
|
{
|
||||||
StrategySummary sellStrategy = new StrategySummary();
|
StrategySummary sellStrategy = new StrategySummary();
|
||||||
sellStrategy.Name = sellStrategyName;
|
sellStrategy.Name = sellStrategyName;
|
||||||
|
|
|
@ -300,7 +300,7 @@ namespace Core.MarketAnalyzer
|
||||||
List<MarketTrend> marketTrends = systemConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends.FindAll(mt => mt.Platform.Equals(platform, StringComparison.InvariantCultureIgnoreCase));
|
List<MarketTrend> marketTrends = systemConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends.FindAll(mt => mt.Platform.Equals(platform, StringComparison.InvariantCultureIgnoreCase));
|
||||||
if (marketTrends.Count > 0)
|
if (marketTrends.Count > 0)
|
||||||
{
|
{
|
||||||
Dictionary<string, Market> recentMarkets = BaseAnalyzer.GetMarketDataFromFile(systemConfiguration, log, platform, DateTime.Now.ToUniversalTime(), "Recent");
|
Dictionary<string, Market> recentMarkets = BaseAnalyzer.GetMarketDataFromFile(systemConfiguration, log, platform, DateTime.UtcNow, "Recent");
|
||||||
|
|
||||||
foreach (MarketTrend marketTrend in marketTrends)
|
foreach (MarketTrend marketTrend in marketTrends)
|
||||||
{
|
{
|
||||||
|
@ -313,7 +313,7 @@ namespace Core.MarketAnalyzer
|
||||||
log.DoLogInfo(platform + " - Building market trend changes for '" + marketTrend.Name + "'...");
|
log.DoLogInfo(platform + " - Building market trend changes for '" + marketTrend.Name + "'...");
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, Market> trendMarkets = BaseAnalyzer.GetMarketDataFromFile(systemConfiguration, log, platform, DateTime.Now.ToUniversalTime().AddMinutes(-marketTrend.TrendMinutes), marketTrend.Name);
|
Dictionary<string, Market> trendMarkets = BaseAnalyzer.GetMarketDataFromFile(systemConfiguration, log, platform, DateTime.UtcNow.AddMinutes(-marketTrend.TrendMinutes), marketTrend.Name);
|
||||||
|
|
||||||
List<MarketTrendChange> marketTrendChanges = BaseAnalyzer.GetMarketTrendChanges(platform, mainMarket, marketTrend, marketList, recentMarkets, trendMarkets, sortBy, isGlobal, systemConfiguration, log);
|
List<MarketTrendChange> marketTrendChanges = BaseAnalyzer.GetMarketTrendChanges(platform, mainMarket, marketTrend, marketList, recentMarkets, trendMarkets, sortBy, isGlobal, systemConfiguration, log);
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ namespace Core.MarketAnalyzer
|
||||||
mtc.Market = recentMarket.Name;
|
mtc.Market = recentMarket.Name;
|
||||||
mtc.LastPrice = recentMarket.Price;
|
mtc.LastPrice = recentMarket.Price;
|
||||||
mtc.Volume24h = recentMarket.Volume24h;
|
mtc.Volume24h = recentMarket.Volume24h;
|
||||||
mtc.TrendDateTime = DateTime.Now;
|
mtc.TrendDateTime = DateTime.UtcNow;
|
||||||
|
|
||||||
result.Add(mtc);
|
result.Add(mtc);
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
Binance.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
Binance.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
||||||
|
|
||||||
DateTime fileDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0).ToUniversalTime();
|
DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime();
|
||||||
|
|
||||||
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ namespace Core.MarketAnalyzer
|
||||||
marketInfo.FirstSeen = Binance.GetFirstSeenDate(key, systemConfiguration, log);
|
marketInfo.FirstSeen = Binance.GetFirstSeenDate(key, systemConfiguration, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
marketInfo.LastSeen = DateTime.Now.ToUniversalTime();
|
marketInfo.LastSeen = DateTime.UtcNow;
|
||||||
|
|
||||||
marketsChecked++;
|
marketsChecked++;
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Int64 endTime = (Int64)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(Constants.Epoch).TotalMilliseconds);
|
Int64 endTime = (Int64)Math.Ceiling(DateTime.UtcNow.Subtract(Constants.Epoch).TotalMilliseconds);
|
||||||
int ticksLimit = 500;
|
int ticksLimit = 500;
|
||||||
string baseUrl = "";
|
string baseUrl = "";
|
||||||
int ticksFetched = 0;
|
int ticksFetched = 0;
|
||||||
|
@ -327,13 +327,13 @@ namespace Core.MarketAnalyzer
|
||||||
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latestMarketDataFileDateTime < DateTime.Now.ToUniversalTime().AddMinutes(-20))
|
if (latestMarketDataFileDateTime < DateTime.UtcNow.AddMinutes(-20))
|
||||||
{
|
{
|
||||||
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.UtcNow.Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
||||||
|
|
||||||
// Go back in time and create market data
|
// Go back in time and create market data
|
||||||
DateTime startDateTime = DateTime.Now.ToUniversalTime();
|
DateTime startDateTime = DateTime.UtcNow;
|
||||||
DateTime endDateTime = DateTime.Now.ToUniversalTime().AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
DateTime endDateTime = DateTime.UtcNow.AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
||||||
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
||||||
{
|
{
|
||||||
// Existing market files too old => Recreate market data for configured timeframe
|
// Existing market files too old => Recreate market data for configured timeframe
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace Core.MarketAnalyzer
|
||||||
marketInfos.Add(marketName, marketInfo);
|
marketInfos.Add(marketName, marketInfo);
|
||||||
}
|
}
|
||||||
if (currencyTicker["Summary"]["Created"].Type == Newtonsoft.Json.Linq.JTokenType.Date) marketInfo.FirstSeen = (DateTime)currencyTicker["Summary"]["Created"];
|
if (currencyTicker["Summary"]["Created"].Type == Newtonsoft.Json.Linq.JTokenType.Date) marketInfo.FirstSeen = (DateTime)currencyTicker["Summary"]["Created"];
|
||||||
marketInfo.LastSeen = DateTime.Now.ToUniversalTime();
|
marketInfo.LastSeen = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
Bittrex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
Bittrex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
||||||
|
|
||||||
DateTime fileDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0).ToUniversalTime();
|
DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime();
|
||||||
|
|
||||||
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
||||||
|
|
||||||
|
@ -203,13 +203,13 @@ namespace Core.MarketAnalyzer
|
||||||
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latestMarketDataFileDateTime < DateTime.Now.ToUniversalTime().AddMinutes(-20))
|
if (latestMarketDataFileDateTime < DateTime.UtcNow.AddMinutes(-20))
|
||||||
{
|
{
|
||||||
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.UtcNow.Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
||||||
|
|
||||||
// Go back in time and create market data
|
// Go back in time and create market data
|
||||||
DateTime startDateTime = DateTime.Now.ToUniversalTime();
|
DateTime startDateTime = DateTime.UtcNow;
|
||||||
DateTime endDateTime = DateTime.Now.ToUniversalTime().AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
DateTime endDateTime = DateTime.UtcNow.AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
||||||
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
||||||
{
|
{
|
||||||
// Existing market files too old => Recreate market data for configured timeframe
|
// Existing market files too old => Recreate market data for configured timeframe
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
CoinMarketCap.CheckForMarketDataRecreation(markets, systemConfiguration, log);
|
CoinMarketCap.CheckForMarketDataRecreation(markets, systemConfiguration, log);
|
||||||
|
|
||||||
DateTime fileDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0).ToUniversalTime();
|
DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime();
|
||||||
|
|
||||||
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
List<FileInfo> marketFiles = dataDirectory.EnumerateFiles("MarketData*")
|
List<FileInfo> marketFiles = dataDirectory.EnumerateFiles("MarketData*")
|
||||||
.Select(x => { x.Refresh(); return x; })
|
.Select(x => { x.Refresh(); return x; })
|
||||||
.Where(x => x.LastWriteTimeUtc <= DateTime.Now.AddHours(-24))
|
.Where(x => x.LastWriteTimeUtc <= DateTime.UtcNow.AddHours(-24))
|
||||||
.ToArray().OrderByDescending(f => f.LastWriteTimeUtc).ToList();
|
.ToArray().OrderByDescending(f => f.LastWriteTimeUtc).ToList();
|
||||||
|
|
||||||
bool build24hMarketDataFile = false;
|
bool build24hMarketDataFile = false;
|
||||||
|
@ -95,7 +95,7 @@ namespace Core.MarketAnalyzer
|
||||||
if (marketFiles.Count > 0)
|
if (marketFiles.Count > 0)
|
||||||
{
|
{
|
||||||
marketFile = marketFiles.First();
|
marketFile = marketFiles.First();
|
||||||
if (marketFile.LastWriteTimeUtc <= DateTime.Now.AddHours(-24).AddMinutes(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(-10))
|
if (marketFile.LastWriteTimeUtc <= DateTime.UtcNow.AddHours(-24).AddMinutes(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(-10))
|
||||||
{
|
{
|
||||||
log.DoLogDebug("CoinMarketCap - 24h market data file too old (" + marketFile.LastWriteTimeUtc.ToString() + "). Rebuilding data...");
|
log.DoLogDebug("CoinMarketCap - 24h market data file too old (" + marketFile.LastWriteTimeUtc.ToString() + "). Rebuilding data...");
|
||||||
build24hMarketDataFile = true;
|
build24hMarketDataFile = true;
|
||||||
|
@ -105,13 +105,13 @@ namespace Core.MarketAnalyzer
|
||||||
{
|
{
|
||||||
marketFiles = dataDirectory.EnumerateFiles("MarketData*")
|
marketFiles = dataDirectory.EnumerateFiles("MarketData*")
|
||||||
.Select(x => { x.Refresh(); return x; })
|
.Select(x => { x.Refresh(); return x; })
|
||||||
.Where(x => x.LastWriteTimeUtc >= DateTime.Now.AddHours(-24))
|
.Where(x => x.LastWriteTimeUtc >= DateTime.UtcNow.AddHours(-24))
|
||||||
.ToArray().OrderBy(f => f.LastWriteTimeUtc).ToList();
|
.ToArray().OrderBy(f => f.LastWriteTimeUtc).ToList();
|
||||||
|
|
||||||
if (marketFiles.Count > 0)
|
if (marketFiles.Count > 0)
|
||||||
{
|
{
|
||||||
marketFile = marketFiles.First();
|
marketFile = marketFiles.First();
|
||||||
if (marketFile.LastWriteTimeUtc >= DateTime.Now.AddHours(-24).AddMinutes(systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(10))
|
if (marketFile.LastWriteTimeUtc >= DateTime.UtcNow.AddHours(-24).AddMinutes(systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(10))
|
||||||
{
|
{
|
||||||
log.DoLogDebug("CoinMarketCap - 24h market data file too young (" + marketFile.LastWriteTimeUtc.ToString() + "). Rebuilding data...");
|
log.DoLogDebug("CoinMarketCap - 24h market data file too young (" + marketFile.LastWriteTimeUtc.ToString() + "). Rebuilding data...");
|
||||||
build24hMarketDataFile = true;
|
build24hMarketDataFile = true;
|
||||||
|
@ -139,7 +139,7 @@ namespace Core.MarketAnalyzer
|
||||||
markets24h.Add(markets[key].Name, market24h);
|
markets24h.Add(markets[key].Name, market24h);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime fileDateTime = new DateTime(DateTime.Now.ToLocalTime().AddHours(-24).Year, DateTime.Now.ToLocalTime().AddHours(-24).Month, DateTime.Now.ToLocalTime().AddHours(-24).Day, DateTime.Now.ToLocalTime().AddHours(-24).Hour, DateTime.Now.ToLocalTime().AddHours(-24).Minute, 0).ToUniversalTime();
|
DateTime fileDateTime = new DateTime(DateTime.UtcNow.ToLocalTime().AddHours(-24).Year, DateTime.UtcNow.ToLocalTime().AddHours(-24).Month, DateTime.UtcNow.ToLocalTime().AddHours(-24).Day, DateTime.UtcNow.ToLocalTime().AddHours(-24).Hour, DateTime.UtcNow.ToLocalTime().AddHours(-24).Minute, 0).ToUniversalTime();
|
||||||
|
|
||||||
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets24h), fileDateTime, fileDateTime);
|
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets24h), fileDateTime, fileDateTime);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
Poloniex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
Poloniex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log);
|
||||||
|
|
||||||
DateTime fileDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0).ToUniversalTime();
|
DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime();
|
||||||
|
|
||||||
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
FileHelper.WriteTextToFile(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathExchange + Path.DirectorySeparatorChar, "MarketData_" + fileDateTime.ToString("yyyy-MM-dd_HH.mm") + ".json", JsonConvert.SerializeObject(markets), fileDateTime, fileDateTime);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ namespace Core.MarketAnalyzer
|
||||||
marketInfo.FirstSeen = Poloniex.GetFirstSeenDate(key, systemConfiguration, log);
|
marketInfo.FirstSeen = Poloniex.GetFirstSeenDate(key, systemConfiguration, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
marketInfo.LastSeen = DateTime.Now.ToUniversalTime();
|
marketInfo.LastSeen = DateTime.UtcNow;
|
||||||
|
|
||||||
marketsChecked++;
|
marketsChecked++;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ namespace Core.MarketAnalyzer
|
||||||
{
|
{
|
||||||
DateTime result = Constants.confMinDate;
|
DateTime result = Constants.confMinDate;
|
||||||
|
|
||||||
Int64 startTime = (Int64)Math.Ceiling(DateTime.Now.ToUniversalTime().AddDays(-100).Subtract(Constants.Epoch).TotalSeconds);
|
Int64 startTime = (Int64)Math.Ceiling(DateTime.UtcNow.AddDays(-100).Subtract(Constants.Epoch).TotalSeconds);
|
||||||
string baseUrl = "https://poloniex.com/public?command=returnChartData&period=14400&start=" + startTime.ToString() + "&end=9999999999¤cyPair=" + marketName;
|
string baseUrl = "https://poloniex.com/public?command=returnChartData&period=14400&start=" + startTime.ToString() + "&end=9999999999¤cyPair=" + marketName;
|
||||||
|
|
||||||
log.DoLogDebug("Poloniex - Getting first seen date for '" + marketName + "'...");
|
log.DoLogDebug("Poloniex - Getting first seen date for '" + marketName + "'...");
|
||||||
|
@ -188,7 +188,7 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Int64 startTime = (Int64)Math.Ceiling(DateTime.Now.ToUniversalTime().AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours).Subtract(Constants.Epoch).TotalSeconds);
|
Int64 startTime = (Int64)Math.Ceiling(DateTime.UtcNow.AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours).Subtract(Constants.Epoch).TotalSeconds);
|
||||||
string baseUrl = "https://poloniex.com/public?command=returnChartData&period=300&start=" + startTime.ToString() + "&end=9999999999¤cyPair=" + marketName;
|
string baseUrl = "https://poloniex.com/public?command=returnChartData&period=300&start=" + startTime.ToString() + "&end=9999999999¤cyPair=" + marketName;
|
||||||
|
|
||||||
log.DoLogDebug("Poloniex - Getting ticks for '" + marketName + "'...");
|
log.DoLogDebug("Poloniex - Getting ticks for '" + marketName + "'...");
|
||||||
|
@ -237,13 +237,13 @@ namespace Core.MarketAnalyzer
|
||||||
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
latestMarketDataFileDateTime = latestMarketDataFile.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latestMarketDataFileDateTime < DateTime.Now.ToUniversalTime().AddMinutes(-(systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 3)))
|
if (latestMarketDataFileDateTime < DateTime.UtcNow.AddMinutes(-(systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 3)))
|
||||||
{
|
{
|
||||||
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
int lastMarketDataAgeInSeconds = (int)Math.Ceiling(DateTime.UtcNow.Subtract(latestMarketDataFileDateTime).TotalSeconds);
|
||||||
|
|
||||||
// Go back in time and create market data
|
// Go back in time and create market data
|
||||||
DateTime startDateTime = DateTime.Now.ToUniversalTime();
|
DateTime startDateTime = DateTime.UtcNow;
|
||||||
DateTime endDateTime = DateTime.Now.ToUniversalTime().AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
DateTime endDateTime = DateTime.UtcNow.AddHours(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours);
|
||||||
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
if (latestMarketDataFileDateTime != Constants.confMinDate && latestMarketDataFileDateTime > endDateTime)
|
||||||
{
|
{
|
||||||
// Existing market files too old => Recreate market data for configured timeframe
|
// Existing market files too old => Recreate market data for configured timeframe
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Core.ProfitTrailer
|
||||||
List<string> lines = File.ReadAllLines(filePath).ToList();
|
List<string> lines = File.ReadAllLines(filePath).ToList();
|
||||||
lines.Insert(0, "");
|
lines.Insert(0, "");
|
||||||
lines.Insert(0, "# ####################################");
|
lines.Insert(0, "# ####################################");
|
||||||
lines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
lines.Insert(0, "# PTMagic_LastChanged = " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString());
|
||||||
lines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(settingName, Constants.WhiteListProperties));
|
lines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(settingName, Constants.WhiteListProperties));
|
||||||
lines.Insert(0, "# ####### PTMagic Current Setting ########");
|
lines.Insert(0, "# ####### PTMagic Current Setting ########");
|
||||||
lines.Insert(0, "# ####################################");
|
lines.Insert(0, "# ####################################");
|
||||||
|
@ -117,7 +117,7 @@ namespace Core.ProfitTrailer
|
||||||
if (presetFilePath.IndexOf(".properties", StringComparison.InvariantCultureIgnoreCase) > -1)
|
if (presetFilePath.IndexOf(".properties", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
FileInfo presetFile = new FileInfo(presetFilePath);
|
FileInfo presetFile = new FileInfo(presetFilePath);
|
||||||
if (presetFile.LastWriteTime > DateTime.Now.AddMinutes(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(2))
|
if (presetFile.LastWriteTime > DateTime.UtcNow.AddMinutes(-systemConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes).AddSeconds(2))
|
||||||
{
|
{
|
||||||
|
|
||||||
// File has changed recently, force preparation check
|
// File has changed recently, force preparation check
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace Core.ProfitTrailer
|
||||||
// Writing Header lines
|
// Writing Header lines
|
||||||
fileLines.Insert(0, "");
|
fileLines.Insert(0, "");
|
||||||
fileLines.Insert(0, "# ####################################");
|
fileLines.Insert(0, "# ####################################");
|
||||||
fileLines.Insert(0, "# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
fileLines.Insert(0, "# PTMagic_LastChanged = " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString());
|
||||||
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
fileLines.Insert(0, "# PTMagic_ActiveSetting = " + SystemHelper.StripBadCode(ptmagicInstance.DefaultSettingName, Constants.WhiteListProperties));
|
||||||
fileLines.Insert(0, "# ####################################");
|
fileLines.Insert(0, "# ####################################");
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ namespace Core.ProfitTrailer
|
||||||
{
|
{
|
||||||
|
|
||||||
// Setting last change datetime
|
// Setting last change datetime
|
||||||
result.Add("# PTMagic_LastChanged = " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
|
result.Add("# PTMagic_LastChanged = " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString());
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (line.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
else if (line.IndexOf("PTMagic_SingleMarketSettings", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
|
@ -293,14 +293,14 @@ namespace Core.ProfitTrailer
|
||||||
string previousLine = result.Last();
|
string previousLine = result.Last();
|
||||||
if (previousLine.IndexOf("PTMagic Changed Line", StringComparison.InvariantCultureIgnoreCase) > -1)
|
if (previousLine.IndexOf("PTMagic Changed Line", StringComparison.InvariantCultureIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
previousLine = "# PTMagic changed line for setting '" + settingName + "' on " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
|
previousLine = "# PTMagic changed line for setting '" + settingName + "' on " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString();
|
||||||
|
|
||||||
result.RemoveAt(result.Count - 1);
|
result.RemoveAt(result.Count - 1);
|
||||||
result.Add(previousLine);
|
result.Add(previousLine);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string editLine = "# PTMagic changed line for setting '" + settingName + "' on " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
|
string editLine = "# PTMagic changed line for setting '" + settingName + "' on " + DateTime.UtcNow.ToShortDateString() + " " + DateTime.UtcNow.ToShortTimeString();
|
||||||
result.Add(editLine);
|
result.Add(editLine);
|
||||||
}
|
}
|
||||||
result.Add(line);
|
result.Add(line);
|
||||||
|
@ -337,7 +337,7 @@ namespace Core.ProfitTrailer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newPairsLines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.Now.ToString());
|
newPairsLines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.UtcNow.ToString());
|
||||||
newPairsLines.Add("# ########################################################################");
|
newPairsLines.Add("# ########################################################################");
|
||||||
newPairsLines.Add("");
|
newPairsLines.Add("");
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ namespace Core.ProfitTrailer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newDCALines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.Now.ToString());
|
newDCALines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.UtcNow.ToString());
|
||||||
newDCALines.Add("# ########################################################################");
|
newDCALines.Add("# ########################################################################");
|
||||||
newDCALines.Add("");
|
newDCALines.Add("");
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ namespace Core.ProfitTrailer
|
||||||
Dictionary<string, string> globalDCAProperties = SettingsHandler.GetPropertiesAsDictionary(globalDCALines);
|
Dictionary<string, string> globalDCAProperties = SettingsHandler.GetPropertiesAsDictionary(globalDCALines);
|
||||||
Dictionary<string, string> globalIndicatorsProperties = SettingsHandler.GetPropertiesAsDictionary(globalIndicatorsLines);
|
Dictionary<string, string> globalIndicatorsProperties = SettingsHandler.GetPropertiesAsDictionary(globalIndicatorsLines);
|
||||||
|
|
||||||
newIndicatorsLines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.Now.ToString());
|
newIndicatorsLines.Add("# PTMagic_SingleMarketSettings - Written on " + DateTime.UtcNow.ToString());
|
||||||
newIndicatorsLines.Add("# ########################################################################");
|
newIndicatorsLines.Add("# ########################################################################");
|
||||||
newIndicatorsLines.Add("");
|
newIndicatorsLines.Add("");
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,14 @@ namespace Monitor.Pages
|
||||||
|
|
||||||
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
||||||
{
|
{
|
||||||
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.Now.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
||||||
|
|
||||||
if (cbRememberMe != null)
|
if (cbRememberMe != null)
|
||||||
{
|
{
|
||||||
if (cbRememberMe.Equals("on", StringComparison.InvariantCultureIgnoreCase))
|
if (cbRememberMe.Equals("on", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
CookieOptions cookieOption = new CookieOptions();
|
CookieOptions cookieOption = new CookieOptions();
|
||||||
cookieOption.Expires = DateTime.Now.AddYears(1);
|
cookieOption.Expires = DateTime.UtcNow.AddYears(1);
|
||||||
|
|
||||||
string cookieValue = EncryptionHelper.Encrypt(encryptedPassword);
|
string cookieValue = EncryptionHelper.Encrypt(encryptedPassword);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Monitor.Pages
|
||||||
TrendChartDataJSON += "values: [";
|
TrendChartDataJSON += "values: [";
|
||||||
|
|
||||||
// Get trend ticks for chart
|
// Get trend ticks for chart
|
||||||
DateTime currentDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 0, 0);
|
DateTime currentDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0);
|
||||||
DateTime startDateTime = currentDateTime.AddHours(-PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours);
|
DateTime startDateTime = currentDateTime.AddHours(-PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours);
|
||||||
DateTime endDateTime = currentDateTime;
|
DateTime endDateTime = currentDateTime;
|
||||||
int trendChartTicks = 0;
|
int trendChartTicks = 0;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<h4 class="m-t-0 header-title">PTMagic Status <small id="last-refresh" class="pull-right"></small></h4>
|
<h4 class="m-t-0 header-title">PTMagic Status <small id="last-refresh" class="pull-right"></small></h4>
|
||||||
@{
|
@{
|
||||||
DateTime lastRuntime = Model.Summary.LastRuntime;
|
DateTime lastRuntime = Model.Summary.LastRuntime;
|
||||||
double elapsedSecondsSinceRuntime = DateTime.Now.Subtract(lastRuntime).TotalSeconds;
|
double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds;
|
||||||
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
||||||
|
|
||||||
string ptMagicHealthIcon = "<i class=\"fa fa-heartbeat text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic is alive and healthy!\"></i>";
|
string ptMagicHealthIcon = "<i class=\"fa fa-heartbeat text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic is alive and healthy!\"></i>";
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
floodProtectionIcon = "<i class=\"fa fa-info-circle text-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Flood protection active! Not switching setting to " + Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.FloodProtectedSetting.SettingName) + " .\"></i>";
|
floodProtectionIcon = "<i class=\"fa fa-info-circle text-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Flood protection active! Not switching setting to " + Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.FloodProtectedSetting.SettingName) + " .\"></i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
string lastGlobalSettingSwitch = Core.Helper.SystemHelper.GetProperDurationTime((int)Math.Ceiling(DateTime.Now.Subtract(Model.Summary.LastGlobalSettingSwitch).TotalSeconds)) + " ago";
|
string lastGlobalSettingSwitch = Core.Helper.SystemHelper.GetProperDurationTime((int)Math.Ceiling(DateTime.UtcNow.Subtract(Model.Summary.LastGlobalSettingSwitch).TotalSeconds)) + " ago";
|
||||||
if (Model.Summary.LastGlobalSettingSwitch == Core.Main.Constants.confMinDate) {
|
if (Model.Summary.LastGlobalSettingSwitch == Core.Main.Constants.confMinDate) {
|
||||||
lastGlobalSettingSwitch = "-";
|
lastGlobalSettingSwitch = "-";
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Monitor.Pages
|
||||||
{
|
{
|
||||||
if (Summary.GlobalSettingSummary.Count > 0)
|
if (Summary.GlobalSettingSummary.Count > 0)
|
||||||
{
|
{
|
||||||
DateTime dateTime24hAgo = DateTime.Now.AddHours(-24);
|
DateTime dateTime24hAgo = DateTime.UtcNow.AddHours(-24);
|
||||||
List<GlobalSettingSummary> gsSummaries24h = Summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= dateTime24hAgo);
|
List<GlobalSettingSummary> gsSummaries24h = Summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= dateTime24hAgo);
|
||||||
IEnumerable<GlobalSettingSummary> gsNames24h = gsSummaries24h.GroupBy(gss => gss.SettingName).Select(group => group.First());
|
IEnumerable<GlobalSettingSummary> gsNames24h = gsSummaries24h.GroupBy(gss => gss.SettingName).Select(group => group.First());
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ namespace Monitor.Pages
|
||||||
{
|
{
|
||||||
if (Summary.GlobalSettingSummary.Count > 0)
|
if (Summary.GlobalSettingSummary.Count > 0)
|
||||||
{
|
{
|
||||||
DateTime dateTime3dAgo = DateTime.Now.AddHours(-72);
|
DateTime dateTime3dAgo = DateTime.UtcNow.AddHours(-72);
|
||||||
List<GlobalSettingSummary> gsSummaries3d = Summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= dateTime3dAgo);
|
List<GlobalSettingSummary> gsSummaries3d = Summary.GlobalSettingSummary.FindAll(gss => gss.SwitchDateTime >= dateTime3dAgo);
|
||||||
IEnumerable<GlobalSettingSummary> gsNames3d = gsSummaries3d.GroupBy(gss => gss.SettingName).Select(group => group.First());
|
IEnumerable<GlobalSettingSummary> gsNames3d = gsSummaries3d.GroupBy(gss => gss.SettingName).Select(group => group.First());
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace Monitor.Pages {
|
||||||
TrendChartDataJSON += "values: [";
|
TrendChartDataJSON += "values: [";
|
||||||
|
|
||||||
// Get trend ticks for chart
|
// Get trend ticks for chart
|
||||||
DateTime currentDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 0, 0);
|
DateTime currentDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0);
|
||||||
DateTime startDateTime = currentDateTime.AddHours(-PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours);
|
DateTime startDateTime = currentDateTime.AddHours(-PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours);
|
||||||
DateTime endDateTime = currentDateTime;
|
DateTime endDateTime = currentDateTime;
|
||||||
int trendChartTicks = 0;
|
int trendChartTicks = 0;
|
||||||
|
@ -115,9 +115,9 @@ namespace Monitor.Pages {
|
||||||
string profitPerDayJSON = "";
|
string profitPerDayJSON = "";
|
||||||
if (PTData.SellLog.Count > 0) {
|
if (PTData.SellLog.Count > 0) {
|
||||||
DateTime minSellLogDate = PTData.SellLog.OrderBy(sl => sl.SoldDate).First().SoldDate.Date;
|
DateTime minSellLogDate = PTData.SellLog.OrderBy(sl => sl.SoldDate).First().SoldDate.Date;
|
||||||
DateTime graphStartDate = DateTime.Now.Date.AddDays(-30);
|
DateTime graphStartDate = DateTime.UtcNow.Date.AddDays(-30);
|
||||||
if (minSellLogDate > graphStartDate) graphStartDate = minSellLogDate;
|
if (minSellLogDate > graphStartDate) graphStartDate = minSellLogDate;
|
||||||
for (DateTime salesDate = graphStartDate; salesDate <= DateTime.Now.Date; salesDate = salesDate.AddDays(1)) {
|
for (DateTime salesDate = graphStartDate; salesDate <= DateTime.UtcNow.Date; salesDate = salesDate.AddDays(1)) {
|
||||||
if (tradeDayIndex > 0) {
|
if (tradeDayIndex > 0) {
|
||||||
profitPerDayJSON += ",\n";
|
profitPerDayJSON += ",\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime lastRuntime = Model.Summary.LastRuntime;
|
DateTime lastRuntime = Model.Summary.LastRuntime;
|
||||||
double elapsedSecondsSinceRuntime = DateTime.Now.Subtract(lastRuntime).TotalSeconds;
|
double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds;
|
||||||
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
||||||
|
|
||||||
string iconColor = "text-success";
|
string iconColor = "text-success";
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Monitor {
|
||||||
string appsettingsJson = monitorBasePath + Path.DirectorySeparatorChar + "appsettings.json";
|
string appsettingsJson = monitorBasePath + Path.DirectorySeparatorChar + "appsettings.json";
|
||||||
if (!File.Exists(appsettingsJson)) {
|
if (!File.Exists(appsettingsJson)) {
|
||||||
Console.WriteLine("ERROR: appsettings.json not found: '" + appsettingsJson + "'. Please check if the file exists. If not, review the PT Magic setup steps listed on the wiki!");
|
Console.WriteLine("ERROR: appsettings.json not found: '" + appsettingsJson + "'. Please check if the file exists. If not, review the PT Magic setup steps listed on the wiki!");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: appsettings.json found in " + monitorBasePath);
|
Console.WriteLine("INFO: appsettings.json found in " + monitorBasePath);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace Monitor {
|
||||||
// Check if PT Magic directoy is correctly configured
|
// Check if PT Magic directoy is correctly configured
|
||||||
if (!Directory.Exists(ptMagicBasePath)) {
|
if (!Directory.Exists(ptMagicBasePath)) {
|
||||||
Console.WriteLine("ERROR: PT Magic directory not found: '" + ptMagicBasePath + "'. Please check your setting for 'PTMagicBasePath' in 'Monitor/appsettings.json'");
|
Console.WriteLine("ERROR: PT Magic directory not found: '" + ptMagicBasePath + "'. Please check your setting for 'PTMagicBasePath' in 'Monitor/appsettings.json'");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: PT Magic directory found at " + ptMagicBasePath);
|
Console.WriteLine("INFO: PT Magic directory found at " + ptMagicBasePath);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace Monitor {
|
||||||
string settingsGeneralJson = ptMagicBasePath + "settings.general.json";
|
string settingsGeneralJson = ptMagicBasePath + "settings.general.json";
|
||||||
if (!File.Exists(settingsGeneralJson)) {
|
if (!File.Exists(settingsGeneralJson)) {
|
||||||
Console.WriteLine("ERROR: PT Magic settings not found: '" + settingsGeneralJson + "'. Please check if you setup PT Magic correctly!");
|
Console.WriteLine("ERROR: PT Magic settings not found: '" + settingsGeneralJson + "'. Please check if you setup PT Magic correctly!");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: settings.general.json found at " + settingsGeneralJson);
|
Console.WriteLine("INFO: settings.general.json found at " + settingsGeneralJson);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace Monitor {
|
||||||
string lastRuntimeSummaryJson = ptMagicBasePath + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json";
|
string lastRuntimeSummaryJson = ptMagicBasePath + Constants.PTMagicPathData + Path.DirectorySeparatorChar + "LastRuntimeSummary.json";
|
||||||
if (!File.Exists(lastRuntimeSummaryJson)) {
|
if (!File.Exists(lastRuntimeSummaryJson)) {
|
||||||
Console.WriteLine("ERROR: PT Magic runtime summary not found: '" + lastRuntimeSummaryJson + "'. Please wait for PT Magic to complete its first run!");
|
Console.WriteLine("ERROR: PT Magic runtime summary not found: '" + lastRuntimeSummaryJson + "'. Please wait for PT Magic to complete its first run!");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: LastRuntimeSummary.json found at " + lastRuntimeSummaryJson);
|
Console.WriteLine("INFO: LastRuntimeSummary.json found at " + lastRuntimeSummaryJson);
|
||||||
|
|
||||||
|
@ -76,14 +76,14 @@ namespace Monitor {
|
||||||
string wwwrootPath = monitorBasePath + Path.DirectorySeparatorChar + "wwwroot";
|
string wwwrootPath = monitorBasePath + Path.DirectorySeparatorChar + "wwwroot";
|
||||||
if (!Directory.Exists(wwwrootPath)) {
|
if (!Directory.Exists(wwwrootPath)) {
|
||||||
Console.WriteLine("ERROR: wwwroot directory not found: '" + wwwrootPath + "'. Did you copy all files as instructed on the wiki?");
|
Console.WriteLine("ERROR: wwwroot directory not found: '" + wwwrootPath + "'. Did you copy all files as instructed on the wiki?");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: wwwroot directory found at " + wwwrootPath);
|
Console.WriteLine("INFO: wwwroot directory found at " + wwwrootPath);
|
||||||
|
|
||||||
string assetsPath = wwwrootPath + Path.DirectorySeparatorChar + "assets";
|
string assetsPath = wwwrootPath + Path.DirectorySeparatorChar + "assets";
|
||||||
if (!Directory.Exists(assetsPath)) {
|
if (!Directory.Exists(assetsPath)) {
|
||||||
Console.WriteLine("ERROR: assets directory not found: '" + assetsPath + "'. Did you copy all files as instructed on the wiki?");
|
Console.WriteLine("ERROR: assets directory not found: '" + assetsPath + "'. Did you copy all files as instructed on the wiki?");
|
||||||
if (Console.KeyAvailable) Console.ReadKey();
|
if (!Console.IsInputRedirected) Console.ReadKey();
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("INFO: assets directory found at " + assetsPath);
|
Console.WriteLine("INFO: assets directory found at " + assetsPath);
|
||||||
Console.WriteLine("INFO: ALL CHECKS COMPLETED - ATTEMPTING TO START WEBSERVER...");
|
Console.WriteLine("INFO: ALL CHECKS COMPLETED - ATTEMPTING TO START WEBSERVER...");
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Monitor._Internal
|
||||||
string encryptedPassword = EncryptionHelper.Decrypt(Request.Cookies["PTMRememberMeKey"]);
|
string encryptedPassword = EncryptionHelper.Decrypt(Request.Cookies["PTMRememberMeKey"]);
|
||||||
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
||||||
{
|
{
|
||||||
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.Now.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
||||||
redirectToLogin = false;
|
redirectToLogin = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Monitor._Internal
|
||||||
string encryptedPassword = EncryptionHelper.Decrypt(Request.Cookies["PTMRememberMeKey"]);
|
string encryptedPassword = EncryptionHelper.Decrypt(Request.Cookies["PTMRememberMeKey"]);
|
||||||
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
||||||
{
|
{
|
||||||
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.Now.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
||||||
redirectToLogin = false;
|
redirectToLogin = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ using Core.Helper;
|
||||||
using Core.Main.DataObjects.PTMagicData;
|
using Core.Main.DataObjects.PTMagicData;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.1.1")]
|
[assembly: AssemblyVersion("2.1.2")]
|
||||||
[assembly: AssemblyProduct("PT Magic")]
|
[assembly: AssemblyProduct("PT Magic")]
|
||||||
|
|
||||||
namespace PTMagic
|
namespace PTMagic
|
||||||
|
@ -26,7 +26,7 @@ namespace PTMagic
|
||||||
// Keep the app running
|
// Keep the app running
|
||||||
for (; ; )
|
for (; ; )
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +1,81 @@
|
||||||
# ####################################
|
# ####################################
|
||||||
# ####### PTMagic Current Setting ########
|
# ####### PTMagic Current Setting ########
|
||||||
# PTMagic_ActiveSetting = Default
|
# PTMagic_ActiveSetting = Default
|
||||||
# PTMagic_LastChanged = 3/26/2018 11:52 AM
|
# PTMagic_LastChanged = 7/30/18 10:58 PM
|
||||||
# ####################################
|
# ####################################
|
||||||
#
|
|
||||||
|
############################
|
||||||
|
##### General Settings #####
|
||||||
|
DEFAULT_DCA_ignore_sell_only_mode = true
|
||||||
|
SOM_DCA_buy_trigger = 0
|
||||||
|
DEFAULT_DCA_enabled = true
|
||||||
DCA_keep_balance = 0
|
DCA_keep_balance = 0
|
||||||
DCA_keep_balance_percentage = 0
|
DCA_keep_balance_percentage = 0
|
||||||
#
|
|
||||||
DEFAULT_DCA_max_cost = 0
|
############################
|
||||||
DEFAULT_DCA_max_buy_times = 20
|
##### Selling Strategy #####
|
||||||
#
|
|
||||||
DEFAULT_DCA_A_buy_strategy = LOWBB
|
# Find the best price with enough volume
|
||||||
DEFAULT_DCA_A_buy_value = 5
|
DCA_orderbook_profit_calculation = true
|
||||||
DEFAULT_DCA_A_buy_value_limit = -2.5
|
# Sell at this percentage always
|
||||||
#
|
|
||||||
DEFAULT_DCA_B_buy_strategy = RSI
|
|
||||||
DEFAULT_DCA_B_buy_value = 33
|
|
||||||
DEFAULT_DCA_B_buy_value_limit = 5
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_trailing_buy = 0
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_buy_trigger = 0
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_buy_percentage_1 = 100
|
|
||||||
DEFAULT_DCA_buy_percentage_2 = 50
|
|
||||||
DEFAULT_DCA_buy_percentage_3 = 50
|
|
||||||
DEFAULT_DCA_buy_percentage_4 = 25
|
|
||||||
DEFAULT_DCA_buy_percentage_5 = 30
|
|
||||||
DEFAULT_DCA_buy_percentage_6 = 25
|
|
||||||
DEFAULT_DCA_buy_percentage_7 = 20
|
|
||||||
DEFAULT_DCA_buy_percentage_8 = 15.5
|
|
||||||
DEFAULT_DCA_buy_percentage_9 = 12.11
|
|
||||||
DEFAULT_DCA_buy_percentage_10 = 10
|
|
||||||
DEFAULT_DCA_buy_percentage_11 = 8
|
|
||||||
DEFAULT_DCA_buy_percentage_12 = 7
|
|
||||||
DEFAULT_DCA_buy_percentage_13 = 6
|
|
||||||
DEFAULT_DCA_buy_percentage_14 = 6
|
|
||||||
DEFAULT_DCA_buy_percentage_15 = 5
|
|
||||||
DEFAULT_DCA_buy_percentage_16 = 5
|
|
||||||
DEFAULT_DCA_buy_percentage_17 = 5
|
|
||||||
DEFAULT_DCA_buy_percentage_18 = 5
|
|
||||||
DEFAULT_DCA_buy_percentage_19 = 5
|
|
||||||
DEFAULT_DCA_buy_percentage_20 = 5
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_A_sell_strategy = GAIN
|
|
||||||
DEFAULT_DCA_A_sell_value = 1
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_B_sell_strategy = RSI
|
|
||||||
DEFAULT_DCA_B_sell_value = 40
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_trailing_profit = 0.147
|
|
||||||
DEFAULT_DCA_max_profit = 0
|
DEFAULT_DCA_max_profit = 0
|
||||||
#
|
|
||||||
DEFAULT_DCA_min_order_book_volume_percentage = 100
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_ignore_sell_only_mode = true
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_max_buy_spread = 2
|
|
||||||
DEFAULT_DCA_rebuy_timeout = 10
|
|
||||||
#
|
|
||||||
DEFAULT_DCA_stop_loss_trigger = 0
|
DEFAULT_DCA_stop_loss_trigger = 0
|
||||||
DEFAULT_DCA_stop_loss_timeout = 0
|
|
||||||
DEFAULT_DCA_pending_order_wait_time = 0
|
DEFAULT_DCA_pending_order_wait_time = 0
|
||||||
#
|
|
||||||
DEFAULT_DCA_buy_min_price_increase = 0
|
# Sell if stalled
|
||||||
DEFAULT_DCA_buy_max_price_increase = 0
|
DEFAULT_DCA_take_profit_percentage = 1.0
|
||||||
#
|
DEFAULT_DCA_take_profit_reset_percentage_move = 0.1
|
||||||
|
DEFAULT_DCA_take_profit_wait_time = 15
|
||||||
|
|
||||||
|
# Sell strat A
|
||||||
|
DEFAULT_DCA_A_sell_strategy = GAIN
|
||||||
|
DEFAULT_DCA_A_sell_value = 0.25
|
||||||
|
DEFAULT_DCA_trailing_profit = 0.1
|
||||||
|
|
||||||
|
#DEFAULT_DCA_B_sell_strategy = STOCHRSI
|
||||||
|
#DEFAULT_DCA_B_sell_value = 0.9
|
||||||
|
|
||||||
|
########################
|
||||||
|
##### Buy Strategy #####
|
||||||
|
DEFAULT_DCA_buy_trigger = -2
|
||||||
|
DEFAULT_DCA_buy_trigger_1 = -1
|
||||||
|
DEFAULT_DCA_buy_trigger_2 = -1
|
||||||
|
DEFAULT_DCA_buy_trigger_3 = -1
|
||||||
|
DEFAULT_DCA_buy_trigger_4 = -1
|
||||||
|
DEFAULT_DCA_buy_trigger_5 = -5
|
||||||
|
DEFAULT_DCA_buy_trigger_6 = -5
|
||||||
|
|
||||||
|
DEFAULT_DCA_buy_percentage = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_1 = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_2 = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_3 = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_4 = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_5 = 100
|
||||||
|
DEFAULT_DCA_buy_percentage_6 = 100
|
||||||
|
|
||||||
|
DEFAULT_DCA_min_buy_balance_percentage = 0
|
||||||
|
DEFAULT_DCA_max_cost = 0
|
||||||
|
DEFAULT_DCA_max_buy_times = 6
|
||||||
|
DEFAULT_DCA_rebuy_timeout = 0
|
||||||
|
DEFAULT_DCA_trailing_buy = 0
|
||||||
|
DEFAULT_DCA_min_buy_volume = 0
|
||||||
|
DEFAULT_DCA_max_buy_spread = 0
|
||||||
|
DEFAULT_DCA_buy_min_change_percentage = 0
|
||||||
|
DEFAULT_DCA_buy_max_change_percentage = 0
|
||||||
|
|
||||||
|
# Buy strat A
|
||||||
|
DEFAULT_DCA_A_buy_strategy = EMAGAIN
|
||||||
|
DEFAULT_DCA_A_buy_value = -0.2
|
||||||
|
DEFAULT_DCA_A_buy_value_limit = 0
|
||||||
|
|
||||||
|
# Buy strat B
|
||||||
|
DEFAULT_DCA_B_buy_strategy = STOCHRSI
|
||||||
|
DEFAULT_DCA_B_buy_value = 0.2
|
||||||
|
DEFAULT_DCA_B_buy_value_limit = 0
|
||||||
|
|
||||||
|
################
|
||||||
|
##### Dust #####
|
||||||
|
BTC_dust = 0.000999
|
||||||
|
ETH_dust = 0.00999
|
||||||
|
BNB_dust = 0.0105
|
||||||
|
USDT_dust = 9.99
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
# ####################################
|
# ####################################
|
||||||
# ####### PTMagic Current Setting ########
|
# ####### PTMagic Current Setting ########
|
||||||
# PTMagic_ActiveSetting = Default
|
# PTMagic_ActiveSetting = Default
|
||||||
# PTMagic_LastChanged = 3/26/2018 11:52 AM
|
# PTMagic_LastChanged = 7/30/18 10:58 PM
|
||||||
# ####################################
|
# ####################################
|
||||||
#
|
|
||||||
BB_std = 2
|
OBV_candle_period = 300
|
||||||
BB_candle_period = 300
|
OBV_length = 5
|
||||||
BB_length = 20
|
OBV_signal = 1
|
||||||
#
|
|
||||||
SMA_cross_candles = 2
|
|
||||||
SMA_candle_period = 300
|
|
||||||
SMA_fast_length = 12
|
|
||||||
SMA_slow_length = 24
|
|
||||||
#
|
|
||||||
EMA_cross_candles = 3
|
|
||||||
EMA_candle_period = 300
|
|
||||||
EMA_fast_length = 3
|
|
||||||
EMA_slow_length = 24
|
|
||||||
#
|
|
||||||
RSI_candle_period = 300
|
RSI_candle_period = 300
|
||||||
RSI_length = 14
|
RSI_length = 14
|
||||||
#
|
|
||||||
STOCH_length = 14
|
STOCH_length = 14
|
||||||
#
|
|
||||||
MACD_candle_period = 300
|
MACD_candle_period = 300
|
||||||
MACD_fast_length = 12
|
MACD_fast_Length = 12
|
||||||
MACD_slow_length = 26
|
MACD_slow_Length = 26
|
||||||
MACD_signal = 9
|
MACD_signal = 9
|
||||||
#
|
|
||||||
|
BB_std = 2
|
||||||
|
BB_length = 20
|
||||||
|
BB_candle_period = 300
|
||||||
|
|
||||||
|
SMA_cross_candles = 1
|
||||||
|
SMA_candle_period = 300
|
||||||
|
SMA_fast_length = 3
|
||||||
|
SMA_slow_length = 13
|
||||||
|
|
||||||
|
EMA_cross_candles = 1
|
||||||
|
EMA_candle_period = 300
|
||||||
|
EMA_slow_length = 20
|
||||||
|
EMA_fast_length = 5
|
||||||
|
|
||||||
|
SOM_trigger_length = 288
|
||||||
|
|
|
@ -1,67 +1,106 @@
|
||||||
# ####################################
|
# ####################################
|
||||||
# ####### PTMagic Current Setting ########
|
# ####### PTMagic Current Setting ########
|
||||||
# PTMagic_ActiveSetting = Default
|
# PTMagic_ActiveSetting = Default
|
||||||
# PTMagic_LastChanged = 23.05.2018 07:29
|
# PTMagic_LastChanged = 7/30/18 10:58 PM
|
||||||
# ####################################
|
# ####################################
|
||||||
|
|
||||||
|
############################
|
||||||
|
##### General Settings #####
|
||||||
|
market = BTC
|
||||||
|
price_trigger_market = BTC
|
||||||
|
DEFAULT_sell_only_mode_enabled = false
|
||||||
|
DEFAULT_panic_sell_enabled = false
|
||||||
|
|
||||||
#
|
enabled_pairs = ALL
|
||||||
market = USDT
|
start_balance = 1.5
|
||||||
#
|
|
||||||
start_balance = 1105.17429444
|
|
||||||
USDT_dust = 3.50
|
|
||||||
#
|
|
||||||
enabled_pairs = ADA, BCC, BTC, BTG, ETH, LTC, NEO, OMG, XMR, XRP, ZEC
|
|
||||||
hidden_pairs = ALL
|
|
||||||
#
|
|
||||||
max_trading_pairs = 5
|
|
||||||
#
|
|
||||||
keep_balance = 0
|
keep_balance = 0
|
||||||
keep_balance_percentage = 0
|
keep_balance_percentage = 0
|
||||||
#
|
|
||||||
|
max_trading_pairs = 12
|
||||||
|
pair_min_listed_days = 0
|
||||||
|
DEFAULT_DCA_enabled = -2.0
|
||||||
|
|
||||||
|
#DEFAULT_pending_order_wait_time = 2880
|
||||||
|
DEFAULT_combined_cancel_pending_trigger = 0.1
|
||||||
|
|
||||||
|
#----- Protection -----
|
||||||
|
#price_drop_trigger = 10
|
||||||
|
#price_drop_recover_trigger = 8
|
||||||
|
|
||||||
|
#price_rise_trigger = 10
|
||||||
|
#price_rise_recover_trigger = 8
|
||||||
|
|
||||||
consecutive_buy_trigger = 0
|
consecutive_buy_trigger = 0
|
||||||
consecutive_sell_trigger = 0
|
consecutive_sell_trigger = 0
|
||||||
#
|
|
||||||
DEFAULT_trading_enabled = true
|
########################
|
||||||
DEFAULT_sell_only_mode_enabled = true
|
##### Buy Strategy #####
|
||||||
#
|
DEFAULT_A_buy_strategy = EMAGAIN
|
||||||
pair_min_listed_days = 14
|
DEFAULT_A_buy_value = -0.2
|
||||||
DEFAULT_DCA_enabled = true
|
DEFAULT_A_buy_value_limit = 0
|
||||||
#
|
|
||||||
DEFAULT_initial_cost = 10
|
DEFAULT_B_buy_strategy = STOCHRSI
|
||||||
DEFAULT_initial_cost_percentage = 0
|
DEFAULT_B_buy_value = 0.2
|
||||||
DEFAULT_min_buy_volume = 300000
|
|
||||||
DEFAULT_min_buy_price = 0
|
|
||||||
DEFAULT_max_buy_spread = 1
|
|
||||||
DEFAULT_min_order_book_volume_percentage = 100
|
|
||||||
#
|
|
||||||
DEFAULT_A_buy_strategy = LOWBB
|
|
||||||
DEFAULT_A_buy_value = 5
|
|
||||||
DEFAULT_A_buy_value_limit = -2.5
|
|
||||||
#
|
|
||||||
DEFAULT_B_buy_strategy = RSI
|
|
||||||
DEFAULT_B_buy_value = 33
|
|
||||||
DEFAULT_B_buy_value_limit = 0
|
DEFAULT_B_buy_value_limit = 0
|
||||||
#
|
|
||||||
|
DEFAULT_initial_cost = 0
|
||||||
|
DEFAULT_initial_cost_percentage = 0.25
|
||||||
DEFAULT_trailing_buy = 0
|
DEFAULT_trailing_buy = 0
|
||||||
#
|
DEFAULT_rebuy_timeout = 0
|
||||||
DEFAULT_A_sell_strategy = GAIN
|
DEFAULT_buy_min_change_percentage = 0
|
||||||
DEFAULT_A_sell_value = 1
|
DEFAULT_buy_max_change_percentage = 0
|
||||||
#
|
|
||||||
DEFAULT_B_sell_strategy = RSI
|
orderbook_profit_calculation = true
|
||||||
DEFAULT_B_sell_value = 40
|
DEFAULT_min_orderbook_volume_percentage = 105
|
||||||
#
|
|
||||||
DEFAULT_trailing_profit = 0.16
|
DEFAULT_trading_enabled = false
|
||||||
|
BNB_trading_enabled = true
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Black list
|
||||||
|
DEFAULT_trading_enabled = true
|
||||||
|
BNB_trading_enabled = false
|
||||||
|
|
||||||
|
BCN_sell_only_mode_enabled = true
|
||||||
|
CHAT_sell_only_mode_enabled = true
|
||||||
|
ICN_sell_only_mode_enabled = true
|
||||||
|
ICX_sell_only_mode_enabled = true
|
||||||
|
NCASH_sell_only_mode_enabled = true
|
||||||
|
TRIG_sell_only_mode_enabled = true
|
||||||
|
XVG_sell_only_mode_enabled = true
|
||||||
|
|
||||||
|
hidden_pairs = CTR
|
||||||
|
pair_min_listed_days = 7
|
||||||
|
|
||||||
|
############################
|
||||||
|
##### Selling Strategy #####
|
||||||
|
DEFAULT_trailing_profit = 0.1
|
||||||
DEFAULT_max_profit = 0
|
DEFAULT_max_profit = 0
|
||||||
#
|
|
||||||
DEFAULT_stop_loss_trigger = 0
|
DEFAULT_stop_loss_trigger = 0
|
||||||
DEFAULT_stop_loss_timeout = 0
|
DEFAULT_stop_loss_timeout = 0
|
||||||
DEFAULT_panic_sell_enabled = false
|
|
||||||
DEFAULT_rebuy_timeout = 5
|
#------- Stalled coins -------
|
||||||
#
|
DEFAULT_take_profit_percentage = 1.0
|
||||||
DEFAULT_buy_min_price_increase = 0
|
DEFAULT_take_profit_reset_percentage_move = 0.01
|
||||||
DEFAULT_buy_max_price_increase = 0
|
DEFAULT_take_profit_wait_time = 15
|
||||||
#
|
|
||||||
DEFAULT_pending_order_wait_time = 0
|
#------- Pair minimums ------
|
||||||
DEFAULT_combined_cancel_pending_trigger = 0
|
DEFAULT_min_buy_volume = 250
|
||||||
#
|
DEFAULT_min_buy_price = 0.0
|
||||||
|
|
||||||
|
#------- Optional ------
|
||||||
|
DEFAULT_max_buy_spread = 0
|
||||||
|
|
||||||
|
#------- Sell Strat A -------
|
||||||
|
DEFAULT_A_sell_strategy = GAIN
|
||||||
|
DEFAULT_A_sell_value = 0.25
|
||||||
|
|
||||||
|
#DEFAULT_B_sell_strategy = STOCHRSI
|
||||||
|
#DEFAULT_B_sell_value = 0.9
|
||||||
|
|
||||||
|
################
|
||||||
|
##### Dust #####
|
||||||
|
BTC_dust = 0.000999
|
||||||
|
ETH_dust = 0.00999
|
||||||
|
BNB_dust = 0.0105
|
||||||
|
USDT_dust = 9.99
|
||||||
|
|
Loading…
Reference in New Issue