From 5e69348c23d9be8f6ba7f09072d907d9e8fa8599 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sat, 9 Mar 2019 09:21:49 +0100 Subject: [PATCH 1/3] Fixes to marketdata in non UTC timezones + small tweaks --- Core/Main/PTMagic.cs | 60 ++--- Core/MarketAnalyzer/BaseAnalyzer.cs | 14 +- Core/MarketAnalyzer/Binance.cs | 43 +-- Core/MarketAnalyzer/Bittrex.cs | 10 +- Core/MarketAnalyzer/CoinMarketCap.cs | 10 +- Core/MarketAnalyzer/Poloniex.cs | 10 +- PTMagic/_presets/Default/DCA.PROPERTIES | 253 +++++++++++++++--- .../_presets/Default/INDICATORS.PROPERTIES | 90 +++++-- PTMagic/_presets/Default/PAIRS.PROPERTIES | 176 +++++++++--- .../ElDorado-V4-INDICATORS.properties | 78 ++++++ .../ElDorado-V4-INDICATORS.properties | 78 ++++++ 11 files changed, 650 insertions(+), 172 deletions(-) create mode 100644 PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties create mode 100644 PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 26753a8..43a6be9 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -604,6 +604,7 @@ namespace Core.Main this.Log.DoLogInfo("Detected a '" + e.ChangeType.ToString() + "' change in the following preset file: " + e.FullPath); // Reprocess now + this.EnforceSettingsReapply = true; PTMagicIntervalTimer_Elapsed(new object(), null); // Enable the file watcher again @@ -961,7 +962,7 @@ namespace Core.Main FileInfo generalSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.general.json"); FileInfo analyzerSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.analyzer.json"); - if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || EnforceSettingsReapply) + if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck) { Log.DoLogInfo("Detected configuration changes. Reloading settings..."); @@ -1199,7 +1200,6 @@ namespace Core.Main } else if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Binance", StringComparison.InvariantCultureIgnoreCase)) { - // Get most recent market data from Binance this.ExchangeMarketList = Binance.GetMarketData(this.LastRuntimeSummary.MainMarket, this.MarketInfos, this.PTMagicConfiguration, this.Log); } @@ -1379,14 +1379,7 @@ namespace Core.Main if (this.EnforceSettingsReapply || !activeSettingName.Equals(triggeredSetting.SettingName, StringComparison.InvariantCultureIgnoreCase)) { // Check if we need to force a refresh of the settings - if (this.EnforceSettingsReapply) - { - this.Log.DoLogInfo("Reapplying '" + activeSettingName + "' as the settings.analyzer.json or a preset file got changed."); - } - else - { - this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); - } + this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); // If the setting we are about to activate is the default one, do not list matched triggers if (triggeredSetting.SettingName.Equals(this.DefaultSettingName, StringComparison.InvariantCultureIgnoreCase)) @@ -1402,6 +1395,10 @@ namespace Core.Main { this.Log.DoLogInfo("Switching global settings to '" + triggeredSetting.SettingName + "'..."); } + else + { + this.Log.DoLogInfo("Applying '" + triggeredSetting.SettingName + "' as the settings.analyzer.json or a preset file got changed."); + } SettingsHandler.CompileProperties(this, triggeredSetting); this.GlobalSettingWritten = true; @@ -1412,35 +1409,31 @@ namespace Core.Main // Build Telegram message string telegramMessage; - if (!EnforceSettingsReapply) + telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; + + if (matchedTriggers.Count > 0) { - telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; - - if (matchedTriggers.Count > 0) + telegramMessage += "\n\n*Matching Triggers:*"; + foreach (string triggerResult in matchedTriggers) { - telegramMessage += "\n\n*Matching Triggers:*"; - foreach (string triggerResult in matchedTriggers) - { - telegramMessage += "\n" + triggerResult; - } - } - - if (this.AverageMarketTrendChanges.Keys.Count > 0) - { - telegramMessage += "\n\n*Market Trends:*"; - foreach (string key in this.AverageMarketTrendChanges.Keys) - { - telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; - } + telegramMessage += "\n" + triggerResult; } } - else + + if (this.AverageMarketTrendChanges.Keys.Count > 0) { - telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Reapplying settings '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; + telegramMessage += "\n\n*Market Trends:*"; + foreach (string key in this.AverageMarketTrendChanges.Keys) + { + telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; + } } // Send Telegram message - if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); + if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) + { + TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); + } // Record last settings run this.LastSetting = activeSettingName; @@ -2483,10 +2476,7 @@ namespace Core.Main } } - if (!this.LastRuntimeSummary.MarketSummary.ContainsKey(marketPair)) - { - this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); - } + this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); } this.Log.DoLogInfo("Summary: Current single market properties saved."); diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index ca38f1b..70648d8 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -345,7 +345,17 @@ namespace Core.MarketAnalyzer return output; } - public static List GetMarketTrendChanges(string platform, string mainMarket, MarketTrend marketTrend, List marketList, Dictionary recentMarkets, Dictionary trendMarkets, string sortBy, bool isGlobal, PTMagicConfiguration systemConfiguration, LogHelper log) + public static List GetMarketTrendChanges( + string platform, + string mainMarket, + MarketTrend marketTrend, + List marketList, + Dictionary recentMarkets, + Dictionary trendMarkets, + string sortBy, + bool isGlobal, + PTMagicConfiguration systemConfiguration, + LogHelper log) { List result = new List(); @@ -368,7 +378,6 @@ namespace Core.MarketAnalyzer if (platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && excludeMainCurrency) { - // Check if this is the main currency (only for CoinMarketCap) if (recentMarketPair.Value.Symbol.Equals(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { @@ -377,6 +386,7 @@ namespace Core.MarketAnalyzer continue; } } + Market recentMarket = recentMarkets[recentMarketPair.Key]; if (trendMarkets.ContainsKey(recentMarketPair.Key)) diff --git a/Core/MarketAnalyzer/Binance.cs b/Core/MarketAnalyzer/Binance.cs index bb7337a..d8a212b 100644 --- a/Core/MarketAnalyzer/Binance.cs +++ b/Core/MarketAnalyzer/Binance.cs @@ -11,6 +11,7 @@ using Core.ProfitTrailer; using System.Net; using System.Threading; using System.Threading.Tasks; +using System.Collections.Concurrent; namespace Core.MarketAnalyzer { @@ -75,24 +76,24 @@ namespace Core.MarketAnalyzer float marketVolume = currencyTicker["volume"].ToObject(); if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { - if(marketLastPrice > 0 && marketVolume > 0 ) + if (marketLastPrice > 0 && marketVolume > 0) { - // Set last values in case any error occurs - lastMarket = marketName; - lastTicker = currencyTicker; + // Set last values in case any error occurs + lastMarket = marketName; + lastTicker = currencyTicker; - Market market = new Market(); - market.Position = markets.Count + 1; - market.Name = marketName; - market.Symbol = currencyTicker["symbol"].ToString(); - market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); - market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); - market.MainCurrencyPriceUSD = mainCurrencyPrice; + Market market = new Market(); + market.Position = markets.Count + 1; + market.Name = marketName; + market.Symbol = currencyTicker["symbol"].ToString(); + market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); + market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); + market.MainCurrencyPriceUSD = mainCurrencyPrice; - markets.Add(market.Name, market); + markets.Add(market.Name, market); - result.Add(market.Name); + result.Add(market.Name); } else { @@ -108,7 +109,7 @@ namespace Core.MarketAnalyzer Binance.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -167,7 +168,7 @@ namespace Core.MarketAnalyzer log.DoLogInfo("Binance - Checking first seen dates for " + markets.Count + " markets. This may take a while..."); int marketsChecked = 0; - + foreach (string key in markets.Keys) { // Save market info @@ -360,13 +361,17 @@ namespace Core.MarketAnalyzer // Get Ticks for all markets log.DoLogDebug("Binance - Getting ticks for '" + markets.Count + "' markets"); - Dictionary> marketTicks = new Dictionary>(); + ConcurrentDictionary> marketTicks = new ConcurrentDictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Binance.GetMarketTicks(key, totalTicks, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, GetMarketTicks(key, totalTicks, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) { @@ -436,4 +441,4 @@ namespace Core.MarketAnalyzer } } -} +} \ No newline at end of file diff --git a/Core/MarketAnalyzer/Bittrex.cs b/Core/MarketAnalyzer/Bittrex.cs index 5343ac8..28771b8 100644 --- a/Core/MarketAnalyzer/Bittrex.cs +++ b/Core/MarketAnalyzer/Bittrex.cs @@ -115,7 +115,7 @@ namespace Core.MarketAnalyzer Bittrex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -235,11 +235,15 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Bittrex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Bittrex.GetMarketTicks(key, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) { diff --git a/Core/MarketAnalyzer/CoinMarketCap.cs b/Core/MarketAnalyzer/CoinMarketCap.cs index 3bd9d61..5ed2902 100644 --- a/Core/MarketAnalyzer/CoinMarketCap.cs +++ b/Core/MarketAnalyzer/CoinMarketCap.cs @@ -53,11 +53,10 @@ namespace Core.MarketAnalyzer CoinMarketCap.CheckForMarketDataRecreation(markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); - + // Save the data + DateTime fileDateTime = DateTime.UtcNow; 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); - log.DoLogInfo("CoinMarketCap - Market data saved."); FileHelper.CleanupFiles(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours); @@ -139,11 +138,10 @@ namespace Core.MarketAnalyzer markets24h.Add(markets[key].Name, market24h); } - 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(); - + // Save the 24hr market data + DateTime fileDateTime = DateTime.UtcNow.AddHours(-24); 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); - log.DoLogInfo("CoinMarketCap - 24h market data rebuilt."); } } diff --git a/Core/MarketAnalyzer/Poloniex.cs b/Core/MarketAnalyzer/Poloniex.cs index b3ebedb..08a25ec 100644 --- a/Core/MarketAnalyzer/Poloniex.cs +++ b/Core/MarketAnalyzer/Poloniex.cs @@ -99,7 +99,7 @@ namespace Core.MarketAnalyzer Poloniex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -269,11 +269,15 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Poloniex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Poloniex.GetMarketTicks(key, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) { diff --git a/PTMagic/_presets/Default/DCA.PROPERTIES b/PTMagic/_presets/Default/DCA.PROPERTIES index 7fac35f..37b9297 100644 --- a/PTMagic/_presets/Default/DCA.PROPERTIES +++ b/PTMagic/_presets/Default/DCA.PROPERTIES @@ -1,68 +1,233 @@ # #################################### # ####### PTMagic Current Setting ######## # PTMagic_ActiveSetting = Default -# PTMagic_LastChanged = 3/26/2018 11:52 AM +# PTMagic_LastChanged = 5/14/2018 13:54 # #################################### +## +## +## BTC PT2.2/PTM2.1 (DCA) +## +## # +#GENERAL SETTINGS# +DEFAULT_DCA_ignore_sell_only_mode = true DCA_keep_balance = 0 -DCA_keep_balance_percentage = 0 -# DEFAULT_DCA_max_cost = 0 -DEFAULT_DCA_max_buy_times = 20 +DEFAULT_DCA_pending_order_wait_time = 0 # -DEFAULT_DCA_A_buy_strategy = LOWBB -DEFAULT_DCA_A_buy_value = 5 -DEFAULT_DCA_A_buy_value_limit = -2.5 +DCA_keep_balance_percentage = 20 +DEFAULT_DCA_buy_percentage = 75 # -DEFAULT_DCA_B_buy_strategy = RSI -DEFAULT_DCA_B_buy_value = 33 -DEFAULT_DCA_B_buy_value_limit = 5 +#--------------------------------------------------------------- +#BUY FILTER SETTINGS# +DEFAULT_DCA_max_buy_spread = 1 +DEFAULT_DCA_min_buy_volume = 300 +DEFAULT_DCA_min_orderbook_volume_percentage = 75 # -DEFAULT_DCA_trailing_buy = 0 +DEFAULT_DCA_buy_min_change_percentage = -6 +DEFAULT_DCA_buy_max_change_percentage = 0 # -DEFAULT_DCA_buy_trigger = 0 +#--------------------------------------------------------------- +#BUY SETTINGS# # -DEFAULT_DCA_buy_percentage_1 = 100 -DEFAULT_DCA_buy_percentage_2 = 50 +DEFAULT_DCA_rebuy_timeout = 60 +DEFAULT_DCA_buy_trigger = -2 +# +DEFAULT_DCA_A_buy_strategy = EMAGAIN +DEFAULT_DCA_A_buy_value = -0.2 +DEFAULT_DCA_A_buy_value_limit = 0 +# +DEFAULT_DCA_trailing_buy = 0.27 +# +DEFAULT_DCA_B_buy_strategy = LOWBB +DEFAULT_DCA_B_buy_value = 20 +DEFAULT_DCA_B_buy_value_limit = 0 +# +DEFAULT_DCA_C_buy_strategy = STOCHRSIK +DEFAULT_DCA_C_buy_value = 30 +DEFAULT_DCA_C_buy_value_limit = 0 +# +DEFAULT_DCA_D_buy_strategy = DISABLED +DEFAULT_DCA_D_buy_value = 0 +DEFAULT_DCA_D_buy_value_limit = 0 +DEFAULT_DCA_E_buy_strategy = DISABLED +DEFAULT_DCA_E_buy_value = 0 +DEFAULT_DCA_E_buy_value_limit = 0 +# +#--------------------------------------------------------------- +# DCA SETTINGS +#DEFAULT_DCA_max_buy_times = 6 +#DEFAULT_DCA_buy_trigger_1 = -1.5 +#DEFAULT_DCA_buy_trigger_2 = -2 +#DEFAULT_DCA_buy_trigger_3 = -5 +#DEFAULT_DCA_buy_trigger_4 = -6 +#DEFAULT_DCA_buy_trigger_5 = -6 +#DEFAULT_DCA_buy_trigger_6 = -7 +# +#DEFAULT_DCA_buy_percentage_1 = 75 +#DEFAULT_DCA_buy_percentage_2 = 125 +#DEFAULT_DCA_buy_percentage_3 = 100 +#DEFAULT_DCA_buy_percentage_4 = 100 +#DEFAULT_DCA_buy_percentage_5 = 75 +#DEFAULT_DCA_buy_percentage_6 = 75 +# +DEFAULT_DCA_buy_percentage_1 = 60 +DEFAULT_DCA_buy_percentage_2 = 75 DEFAULT_DCA_buy_percentage_3 = 50 -DEFAULT_DCA_buy_percentage_4 = 25 +DEFAULT_DCA_buy_percentage_4 = 37.5 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_buy_percentage_7 = 21.42857143 +DEFAULT_DCA_buy_percentage_8 = 18.75 +DEFAULT_DCA_buy_percentage_9 = 16.66666667 +DEFAULT_DCA_buy_percentage_10 = 15 +DEFAULT_DCA_buy_percentage_11 = 13.63636364 +DEFAULT_DCA_buy_percentage_12 = 12.5 +DEFAULT_DCA_buy_percentage_13 = 11.53846154 +DEFAULT_DCA_buy_percentage_14 = 10.71428571 +DEFAULT_DCA_buy_percentage_15 = 10 +DEFAULT_DCA_buy_percentage_16 = 9.375 +DEFAULT_DCA_buy_percentage_17 = 8.823529412 +DEFAULT_DCA_buy_percentage_18 = 8.333333333 +DEFAULT_DCA_buy_percentage_19 = 7.894736842 +DEFAULT_DCA_buy_percentage_20 = 7.5 +DEFAULT_DCA_buy_percentage_21 = 7.142857143 +DEFAULT_DCA_buy_percentage_22 = 6.818181818 +DEFAULT_DCA_buy_percentage_23 = 6.52173913 +DEFAULT_DCA_buy_percentage_24 = 6.25 +DEFAULT_DCA_buy_percentage_25 = 6 +DEFAULT_DCA_buy_percentage_26 = 5.769230769 +DEFAULT_DCA_buy_percentage_27 = 5.555555556 +DEFAULT_DCA_buy_percentage_28 = 5.357142857 +DEFAULT_DCA_buy_percentage_29 = 5.172413793 +DEFAULT_DCA_buy_percentage_30 = 5 +DEFAULT_DCA_buy_percentage_31 = 4.838709677 +DEFAULT_DCA_buy_percentage_32 = 4.6875 +DEFAULT_DCA_buy_percentage_33 = 4.545454545 +DEFAULT_DCA_buy_percentage_34 = 4.411764706 +DEFAULT_DCA_buy_percentage_35 = 4.285714286 +DEFAULT_DCA_buy_percentage_36 = 4.166666667 +DEFAULT_DCA_buy_percentage_37 = 4.054054054 +DEFAULT_DCA_buy_percentage_38 = 3.947368421 +DEFAULT_DCA_buy_percentage_39 = 3.846153846 +DEFAULT_DCA_buy_percentage_40 = 3.75 +DEFAULT_DCA_buy_percentage_41 = 3.658536585 +DEFAULT_DCA_buy_percentage_42 = 3.571428571 +DEFAULT_DCA_buy_percentage_43 = 3.488372093 +DEFAULT_DCA_buy_percentage_44 = 3.409090909 +DEFAULT_DCA_buy_percentage_45 = 3.333333333 +DEFAULT_DCA_buy_percentage_46 = 3.260869565 +DEFAULT_DCA_buy_percentage_47 = 3.191489362 +DEFAULT_DCA_buy_percentage_48 = 3.125 +DEFAULT_DCA_buy_percentage_49 = 3.06122449 +DEFAULT_DCA_buy_percentage_50 = 3 +DEFAULT_DCA_buy_percentage_51 = 2.941176471 +DEFAULT_DCA_buy_percentage_52 = 2.884615385 +DEFAULT_DCA_buy_percentage_53 = 2.830188679 +DEFAULT_DCA_buy_percentage_54 = 2.777777778 +DEFAULT_DCA_buy_percentage_55 = 2.727272727 +DEFAULT_DCA_buy_percentage_56 = 2.678571429 +DEFAULT_DCA_buy_percentage_57 = 2.631578947 +DEFAULT_DCA_buy_percentage_58 = 2.586206897 +DEFAULT_DCA_buy_percentage_59 = 2.542372881 +DEFAULT_DCA_buy_percentage_60 = 2.5 +DEFAULT_DCA_buy_percentage_61 = 2.459016393 +DEFAULT_DCA_buy_percentage_62 = 2.419354839 +DEFAULT_DCA_buy_percentage_63 = 2.380952381 +DEFAULT_DCA_buy_percentage_64 = 2.34375 +DEFAULT_DCA_buy_percentage_65 = 2.307692308 +DEFAULT_DCA_buy_percentage_66 = 2.272727273 +DEFAULT_DCA_buy_percentage_67 = 2.23880597 +DEFAULT_DCA_buy_percentage_68 = 2.205882353 +DEFAULT_DCA_buy_percentage_69 = 2.173913043 +DEFAULT_DCA_buy_percentage_70 = 2.142857143 +DEFAULT_DCA_buy_percentage_71 = 2.112676056 +DEFAULT_DCA_buy_percentage_72 = 2.083333333 +DEFAULT_DCA_buy_percentage_73 = 2.054794521 +DEFAULT_DCA_buy_percentage_74 = 2.027027027 +DEFAULT_DCA_buy_percentage_75 = 2 +DEFAULT_DCA_buy_percentage_76 = 1.973684211 +DEFAULT_DCA_buy_percentage_77 = 1.948051948 +DEFAULT_DCA_buy_percentage_78 = 1.923076923 +DEFAULT_DCA_buy_percentage_79 = 1.898734177 +DEFAULT_DCA_buy_percentage_80 = 1.875 +DEFAULT_DCA_buy_percentage_81 = 1.851851852 +DEFAULT_DCA_buy_percentage_82 = 1.829268293 +DEFAULT_DCA_buy_percentage_83 = 1.807228916 +DEFAULT_DCA_buy_percentage_84 = 1.785714286 +DEFAULT_DCA_buy_percentage_85 = 1.764705882 +DEFAULT_DCA_buy_percentage_86 = 1.744186047 +DEFAULT_DCA_buy_percentage_87 = 1.724137931 +DEFAULT_DCA_buy_percentage_88 = 1.704545455 +DEFAULT_DCA_buy_percentage_89 = 1.685393258 +DEFAULT_DCA_buy_percentage_90 = 1.666666667 +DEFAULT_DCA_buy_percentage_91 = 1.648351648 +DEFAULT_DCA_buy_percentage_92 = 1.630434783 +DEFAULT_DCA_buy_percentage_93 = 1.612903226 +DEFAULT_DCA_buy_percentage_94 = 1.595744681 +DEFAULT_DCA_buy_percentage_95 = 1.578947368 +DEFAULT_DCA_buy_percentage_96 = 1.5625 +DEFAULT_DCA_buy_percentage_97 = 1.546391753 +DEFAULT_DCA_buy_percentage_98 = 1.530612245 +DEFAULT_DCA_buy_percentage_99 = 1.515151515 +DEFAULT_DCA_buy_percentage_100 = 1.5 +# +#--------------------------------------------------------------- +#SELL SETTINGS +# +DCA_orderbook_profit_calculation = true +#DEFAULT_DCA_trailing_profit_rebound_count = 2 +# +DCA_orderbook_profit_calculation = true +#DEFAULT_DCA_trailing_profit_rebound_count = 2 # DEFAULT_DCA_A_sell_strategy = GAIN -DEFAULT_DCA_A_sell_value = 1 +DEFAULT_DCA_A_sell_value = 1.573 +DEFAULT_DCA_trailing_profit = 0.27 +DEFAULT_DCA_trailing_profit_type = GROW # -DEFAULT_DCA_B_sell_strategy = RSI -DEFAULT_DCA_B_sell_value = 40 +DEFAULT_DCA_B_sell_strategy = HIGHBB +DEFAULT_DCA_B_sell_value = 50 +# +DEFAULT_DCA_C_sell_strategy = STOCHRSIK +DEFAULT_DCA_C_sell_value = 60 # -DEFAULT_DCA_trailing_profit = 0.147 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_take_profit_wait_time = 60 +DEFAULT_DCA_take_profit_reset_percentage_move = .25 +DEFAULT_DCA_take_profit_percentage = 0.5 # DEFAULT_DCA_stop_loss_trigger = 0 DEFAULT_DCA_stop_loss_timeout = 0 -DEFAULT_DCA_pending_order_wait_time = 0 # -DEFAULT_DCA_buy_min_price_increase = 0 -DEFAULT_DCA_buy_max_price_increase = 0 -# \ No newline at end of file +#======================================== +# +#--------------------------------TUSD +# +#TUSD_DCA_A_sell_value = 1.5 +#TUSD_DCA_trailing_profit = 0.45 +#TUSD_DCA_trailing_profit_type = GROW +#TUSD_DCA_B_sell_value = 75 +#TUSD_DCA_C_sell_value = 0 +# +#TUSD_DCA_buy_min_change_percentage = -10 +#TUSD_DCA_max_buy_spread = 2 +TUSD_DCA_buy_trigger = -1.5 +# +#DEFAULT_DCA_take_profit_wait_time = 60 +#DEFAULT_DCA_take_profit_reset_percentage_move = .3 +#DEFAULT_DCA_take_profit_percentage = 2 +# +#======================================== +# +#------------------------ STOP LOSS TRIGGERS +# +#DCA_stop_before_complete = true +#TRX_DCA_stop_loss_trigger = -2 +#TUSD_DCA_stop_loss_trigger = -7 +# +#======================================== +#---------------------------------------- +# Coin Specific STRATEGY +#---------------------------------------- + diff --git a/PTMagic/_presets/Default/INDICATORS.PROPERTIES b/PTMagic/_presets/Default/INDICATORS.PROPERTIES index a6ecba4..20940dd 100644 --- a/PTMagic/_presets/Default/INDICATORS.PROPERTIES +++ b/PTMagic/_presets/Default/INDICATORS.PROPERTIES @@ -1,30 +1,78 @@ # #################################### # ####### PTMagic Current Setting ######## -# PTMagic_ActiveSetting = Default -# PTMagic_LastChanged = 3/26/2018 11:52 AM +# PTMagic_ActiveSetting = ElDorado-V4 +# PTMagic_LastChanged = 11/30/2018 16:41 # #################################### -# + +# Standard Deviation BB_std = 2 -BB_candle_period = 300 +# Define how many candles back to look back BB_length = 20 -# -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_length = 14 -# +# Define the period (in seconds) used by all BB calculation of ProfitTrailer. +BB_candle_period = 900 +# Define how many candles back to look and see if the SMA lines just crossed. +SMA_cross_candles = 4 +# Define the period (in seconds) used to calculate the SMA lines +SMA_candle_period = 3600 +# Define the SMA time frame (in candles) used to calculate the fast SMA line. +SMA_fast_length = 21 +# Define the SMA time frame (in candles) used to calculate the slow SMA line. +SMA_slow_length = 55 +# Define how many candles back to look and see if the EMA lines just crossed. +EMA_cross_candles = 12 +# Define the period (in seconds) used to calculate the EMA lines. +EMA_candle_period = 900 +# Define the EMA time frame (in candles) used to calculate the fast EMA line. +EMA_fast_length = 8 +# Define the EMA time frame (in candles) used to calculate the slow EMA line. +EMA_slow_length = 13 +# Define the period (in seconds) used to calculate the RSI lines. +RSI_candle_period = 900 +# Define the RSI time frame (in candles) used by all RSI calculations +RSI_length = 2 +# Define the period (in seconds) used to calculate the STOCH. +STOCH_candle_period = 900 +# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations STOCH_length = 14 -# -MACD_candle_period = 300 +# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. +# Both K and D represent lines on a price action chart. +# The first line (known as K) displays the current close (ie. the percentage of the +# price at closing) in relation to the price range (high/low) along the number of +# candles used to look back along the price action chart. +STOCH_K = 1 +# The second line (known as D) is a simple moving average of the first line, typically +# based on the last three candle periods for smoothing. +STOCH_D = 1 +# Define the period (in seconds) used to calculate the MACD lines. +MACD_candle_period = 900 +# Define the MA time frame (in candles) used to calculate the fast MACD line. MACD_fast_length = 12 +# Define the MA time frame (in candles) used to calculate the slow MACD line. MACD_slow_length = 26 +# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD MACD_signal = 9 -# \ No newline at end of file +# Define the period (in seconds) used to calculate the RSI lines. +OBV_candle_period = 900 +# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values +OBV_length = 50 +# The number (integer) of the first OBV value used for the calculation of the percentage change. +OBV_signal = 1 +# Always uses 5 minute candles +SOM_trigger_length = 288 +# +# +STOCHRSI_candle_period = 900 +STOCHRSIK_candle_period = 900 +STOCHRSID_candle_period = 900 +# +STOCHRSI_stoch_length = 14 +STOCHRSIK_stoch_length = 14 +STOCHRSID_stoch_length = 14 +# +STOCHRSI_rsi_length = 14 +STOCHRSIK_rsi_length = 14 +STOCHRSID_rsi_length = 14 +# +STOCHRSIK_K = 3 +STOCHRSID_K = 3 +STOCHRSID_D = 3 \ No newline at end of file diff --git a/PTMagic/_presets/Default/PAIRS.PROPERTIES b/PTMagic/_presets/Default/PAIRS.PROPERTIES index 35670dc..9ca9f00 100644 --- a/PTMagic/_presets/Default/PAIRS.PROPERTIES +++ b/PTMagic/_presets/Default/PAIRS.PROPERTIES @@ -1,67 +1,165 @@ # #################################### # ####### PTMagic Current Setting ######## # PTMagic_ActiveSetting = Default -# PTMagic_LastChanged = 23.05.2018 07:29 +# PTMagic_LastChanged = 2/16/2019 4:05 PM # #################################### - # -market = USDT # -start_balance = 1105.17429444 -USDT_dust = 3.50 +# BTC PT2.2/PTM2.1 # -enabled_pairs = ADA, BCC, BTC, BTG, ETH, LTC, NEO, OMG, XMR, XRP, ZEC -hidden_pairs = ALL # -max_trading_pairs = 5 +#======================================== +# >>> Hotconfig <<< +#======================================== +#http://localhost:8082/settings/sellOnlyMode?type=&enabled=false # -keep_balance = 0 -keep_balance_percentage = 0 +#--------------------------------- +#xxx_reset_stored_average = true +#xxx_bought_price = xxxxxxx # -consecutive_buy_trigger = 0 -consecutive_sell_trigger = 0 +#XXX_DCA_set_buy_times = 0 # +# ================================== DCA +# +DEFAULT_DCA_enabled = -0.1 +#BNB_DCA_enabled = false +#BAT_DCA_enabled = +#NPXS_DCA_enabled = false +# +# +#======================================== +# Saftey Triggers +#======================================== +# +#NANO_panic_sell_enabled = true +# +DEFAULT_sell_only_mode_enabled = false DEFAULT_trading_enabled = true -DEFAULT_sell_only_mode_enabled = true +#consecutive_buy_trigger = 4 +#consecutive_sell_trigger = 1 # -pair_min_listed_days = 14 -DEFAULT_DCA_enabled = true +#price_trigger_market = BTC +#price_rise_trigger = 5 +#price_rise_recover_trigger = 4 +#price_drop_trigger = 8 +#price_drop_recover_trigger = 6.4 # -DEFAULT_initial_cost = 10 -DEFAULT_initial_cost_percentage = 0 -DEFAULT_min_buy_volume = 300000 -DEFAULT_min_buy_price = 0 +#======================================== +# Money Management $ $ $ +#======================================== +market = BTC +start_balance = 2.3 +max_trading_pairs = 14 +DEFAULT_initial_cost = 0 +DEFAULT_initial_cost_percentage = 4 +keep_balance_percentage = 75 +# +#======================================== +# WHAT TO TRADE +#======================================== +enabled_pairs = ALL +DEFAULT_buy_min_change_percentage = -3 +DEFAULT_buy_max_change_percentage = 20 +pair_min_listed_days = 15 +# +DEFAULT_min_buy_volume = 350 +# +DEFAULT_min_buy_price = 0.00000250 +DEFAULT_min_orderbook_volume_percentage = 120 DEFAULT_max_buy_spread = 1 -DEFAULT_min_order_book_volume_percentage = 100 +#DEFAULT_sell_wall_orderbook_depth = 40 +#DEFAULT_sell_wall_diff_percentage = 600 +DEFAULT_rebuy_timeout = 10 # -DEFAULT_A_buy_strategy = LOWBB -DEFAULT_A_buy_value = 5 -DEFAULT_A_buy_value_limit = -2.5 +# ------------------------------ DO NOT TRADE +hidden_pairs = ALL +#ZIL_trading_enabled = false # -DEFAULT_B_buy_strategy = RSI -DEFAULT_B_buy_value = 33 +#KMD_sell_only_mode_enabled = true +# +# ------------------------------ DELISTING +CLOAK_trading_enabled = false +MOD_trading_enabled = false +SALT_trading_enabled = false +SUB_trading_enabled = false +WINGS_trading_enabled = false +# +#======================================== +# BUY +#======================================== +# +DEFAULT_A_buy_strategy = EMAGAIN +DEFAULT_A_buy_value = -0.23 +DEFAULT_A_buy_value_limit = 0 +# +DEFAULT_trailing_buy = 0.27 +# +DEFAULT_B_buy_strategy = LOWBB +DEFAULT_B_buy_value = 25 DEFAULT_B_buy_value_limit = 0 # -DEFAULT_trailing_buy = 0 +DEFAULT_C_buy_strategy = STOCHRSIK +DEFAULT_C_buy_value = 25 +DEFAULT_C_buy_value_limit = 0 +# +DEFAULT_D_buy_strategy = DISABLED +DEFAULT_D_buy_value = 0 +DEFAULT_D_buy_value_limit = 0 +DEFAULT_E_buy_strategy = DISABLED +DEFAULT_E_buy_value = 0 +DEFAULT_E_buy_value_limit = 0 +# +#======================================== +# SELL +#======================================== +orderbook_profit_calculation = true # DEFAULT_A_sell_strategy = GAIN -DEFAULT_A_sell_value = 1 +DEFAULT_A_sell_value = 1.73 +DEFAULT_trailing_profit_type = GROW +DEFAULT_trailing_profit = 0.33 # -DEFAULT_B_sell_strategy = RSI -DEFAULT_B_sell_value = 40 +DEFAULT_B_sell_strategy = HIGHBB +DEFAULT_B_sell_value = 50 +# +#DEFAULT_C_sell_strategy = STOCHRSIK +DEFAULT_C_sell_strategy = RSI +DEFAULT_C_sell_value = 50 +# +DEFAULT_take_profit_wait_time = 90 +DEFAULT_take_profit_percentage = 0.75 +DEFAULT_take_profit_reset_percentage_move = 0.25 +orderbook_profit_calculation = true # -DEFAULT_trailing_profit = 0.16 DEFAULT_max_profit = 0 -# -DEFAULT_stop_loss_trigger = 0 -DEFAULT_stop_loss_timeout = 0 -DEFAULT_panic_sell_enabled = false -DEFAULT_rebuy_timeout = 5 -# -DEFAULT_buy_min_price_increase = 0 -DEFAULT_buy_max_price_increase = 0 -# DEFAULT_pending_order_wait_time = 0 DEFAULT_combined_cancel_pending_trigger = 0 +DEFAULT_stop_loss_trigger = 0 +DEFAULT_stop_loss_timeout = 0 # +#======================================== +# +#------------------------- TUSD +# +#TUSD_A_sell_value = 3 +#TUSD_trailing_profit = 0.75 +#TUSD_trailing_profit_type = GROWTH +#TUSD_B_sell_value = 75 +# +#TUSD_take_profit_wait_time = 90 +#TUSD_take_profit_reset_percentage_move = .25 +# +#TUSD_DCA_enabled = false +# +#======================================== +# +#------------------------ STOP LOSS TRIGGERS +# +#TRX_stop_loss_trigger = -2 +#TUSD_stop_loss_trigger = -3.5 +# +#======================================== +#---------------------------------------- +# Coin Specific STRATEGY +#---------------------------------------- diff --git a/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties b/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties new file mode 100644 index 0000000..6c56eb3 --- /dev/null +++ b/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties @@ -0,0 +1,78 @@ +# #################################### +# ####### PTMagic Current Setting ######## +# PTMagic_ActiveSetting = ElDorado-V4 +# PTMagic_LastChanged = 11/30/2018 16:41 +# #################################### +# +# Standard Deviation +BB_std = 2 +# Define how many candles back to look back +BB_length = 20 +# Define the period (in seconds) used by all BB calculation of ProfitTrailer. +BB_candle_period = 900 +# Define how many candles back to look and see if the SMA lines just crossed. +SMA_cross_candles = 4 +# Define the period (in seconds) used to calculate the SMA lines +SMA_candle_period = 3600 +# Define the SMA time frame (in candles) used to calculate the fast SMA line. +SMA_fast_length = 21 +# Define the SMA time frame (in candles) used to calculate the slow SMA line. +SMA_slow_length = 55 +# Define how many candles back to look and see if the EMA lines just crossed. +EMA_cross_candles = 12 +# Define the period (in seconds) used to calculate the EMA lines. +EMA_candle_period = 900 +# Define the EMA time frame (in candles) used to calculate the fast EMA line. +EMA_fast_length = 8 +# Define the EMA time frame (in candles) used to calculate the slow EMA line. +EMA_slow_length = 13 +# Define the period (in seconds) used to calculate the RSI lines. +RSI_candle_period = 900 +# Define the RSI time frame (in candles) used by all RSI calculations +RSI_length = 2 +# Define the period (in seconds) used to calculate the STOCH. +STOCH_candle_period = 900 +# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations +STOCH_length = 14 +# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. +# Both K and D represent lines on a price action chart. +# The first line (known as K) displays the current close (ie. the percentage of the +# price at closing) in relation to the price range (high/low) along the number of +# candles used to look back along the price action chart. +STOCH_K = 1 +# The second line (known as D) is a simple moving average of the first line, typically +# based on the last three candle periods for smoothing. +STOCH_D = 1 +# Define the period (in seconds) used to calculate the MACD lines. +MACD_candle_period = 900 +# Define the MA time frame (in candles) used to calculate the fast MACD line. +MACD_fast_length = 12 +# Define the MA time frame (in candles) used to calculate the slow MACD line. +MACD_slow_length = 26 +# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD +MACD_signal = 9 +# Define the period (in seconds) used to calculate the RSI lines. +OBV_candle_period = 900 +# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values +OBV_length = 50 +# The number (integer) of the first OBV value used for the calculation of the percentage change. +OBV_signal = 1 +# Always uses 5 minute candles +SOM_trigger_length = 288 +# +# +STOCHRSI_candle_period = 900 +STOCHRSIK_candle_period = 900 +STOCHRSID_candle_period = 900 +# +STOCHRSI_stoch_length = 14 +STOCHRSIK_stoch_length = 14 +STOCHRSID_stoch_length = 14 +# +STOCHRSI_rsi_length = 14 +STOCHRSIK_rsi_length = 14 +STOCHRSID_rsi_length = 14 +# +STOCHRSIK_K = 3 +STOCHRSID_K = 3 +STOCHRSID_D = 3 \ No newline at end of file diff --git a/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties b/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties new file mode 100644 index 0000000..d47a85b --- /dev/null +++ b/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties @@ -0,0 +1,78 @@ +# #################################### +# ####### PTMagic Current Setting #### +# PTMagic_ActiveSetting = ElDorado-V4 +# PTMagic_LastChanged = 11/30/2018 16:41 +# #################################### + +# Standard Deviation +BB_std = 2 +# Define how many candles back to look back +BB_length = 20 +# Define the period (in seconds) used by all BB calculation of ProfitTrailer. +BB_candle_period = 900 +# Define how many candles back to look and see if the SMA lines just crossed. +SMA_cross_candles = 4 +# Define the period (in seconds) used to calculate the SMA lines +SMA_candle_period = 3600 +# Define the SMA time frame (in candles) used to calculate the fast SMA line. +SMA_fast_length = 21 +# Define the SMA time frame (in candles) used to calculate the slow SMA line. +SMA_slow_length = 55 +# Define how many candles back to look and see if the EMA lines just crossed. +EMA_cross_candles = 12 +# Define the period (in seconds) used to calculate the EMA lines. +EMA_candle_period = 900 +# Define the EMA time frame (in candles) used to calculate the fast EMA line. +EMA_fast_length = 8 +# Define the EMA time frame (in candles) used to calculate the slow EMA line. +EMA_slow_length = 13 +# Define the period (in seconds) used to calculate the RSI lines. +RSI_candle_period = 900 +# Define the RSI time frame (in candles) used by all RSI calculations +RSI_length = 2 +# Define the period (in seconds) used to calculate the STOCH. +STOCH_candle_period = 900 +# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations +STOCH_length = 14 +# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. +# Both K and D represent lines on a price action chart. +# The first line (known as K) displays the current close (ie. the percentage of the +# price at closing) in relation to the price range (high/low) along the number of +# candles used to look back along the price action chart. +STOCH_K = 1 +# The second line (known as D) is a simple moving average of the first line, typically +# based on the last three candle periods for smoothing. +STOCH_D = 1 +# Define the period (in seconds) used to calculate the MACD lines. +MACD_candle_period = 900 +# Define the MA time frame (in candles) used to calculate the fast MACD line. +MACD_fast_length = 12 +# Define the MA time frame (in candles) used to calculate the slow MACD line. +MACD_slow_length = 26 +# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD +MACD_signal = 9 +# Define the period (in seconds) used to calculate the RSI lines. +OBV_candle_period = 900 +# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values +OBV_length = 50 +# The number (integer) of the first OBV value used for the calculation of the percentage change. +OBV_signal = 1 +# Always uses 5 minute candles +SOM_trigger_length = 288 +# +# +STOCHRSI_candle_period = 900 +STOCHRSIK_candle_period = 900 +STOCHRSID_candle_period = 900 +# +STOCHRSI_stoch_length = 14 +STOCHRSIK_stoch_length = 14 +STOCHRSID_stoch_length = 14 +# +STOCHRSI_rsi_length = 14 +STOCHRSIK_rsi_length = 14 +STOCHRSID_rsi_length = 14 +# +STOCHRSIK_K = 3 +STOCHRSID_K = 3 +STOCHRSID_D = 3 From 3dbb8aedf59f61fa17925a925ffadb944d54ba91 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sat, 9 Mar 2019 09:29:52 +0100 Subject: [PATCH 2/3] Revert "Fixes to marketdata in non UTC timezones + small tweaks" This reverts commit 5e69348c23d9be8f6ba7f09072d907d9e8fa8599. --- Core/Main/PTMagic.cs | 60 +++-- Core/MarketAnalyzer/BaseAnalyzer.cs | 14 +- Core/MarketAnalyzer/Binance.cs | 43 ++- Core/MarketAnalyzer/Bittrex.cs | 10 +- Core/MarketAnalyzer/CoinMarketCap.cs | 10 +- Core/MarketAnalyzer/Poloniex.cs | 10 +- PTMagic/_presets/Default/DCA.PROPERTIES | 253 +++--------------- .../_presets/Default/INDICATORS.PROPERTIES | 90 ++----- PTMagic/_presets/Default/PAIRS.PROPERTIES | 178 +++--------- .../ElDorado-V4-INDICATORS.properties | 78 ------ .../ElDorado-V4-INDICATORS.properties | 78 ------ 11 files changed, 173 insertions(+), 651 deletions(-) delete mode 100644 PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties delete mode 100644 PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 43a6be9..26753a8 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -604,7 +604,6 @@ namespace Core.Main this.Log.DoLogInfo("Detected a '" + e.ChangeType.ToString() + "' change in the following preset file: " + e.FullPath); // Reprocess now - this.EnforceSettingsReapply = true; PTMagicIntervalTimer_Elapsed(new object(), null); // Enable the file watcher again @@ -962,7 +961,7 @@ namespace Core.Main FileInfo generalSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.general.json"); FileInfo analyzerSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.analyzer.json"); - if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck) + if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || EnforceSettingsReapply) { Log.DoLogInfo("Detected configuration changes. Reloading settings..."); @@ -1200,6 +1199,7 @@ namespace Core.Main } else if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Binance", StringComparison.InvariantCultureIgnoreCase)) { + // Get most recent market data from Binance this.ExchangeMarketList = Binance.GetMarketData(this.LastRuntimeSummary.MainMarket, this.MarketInfos, this.PTMagicConfiguration, this.Log); } @@ -1379,7 +1379,14 @@ namespace Core.Main if (this.EnforceSettingsReapply || !activeSettingName.Equals(triggeredSetting.SettingName, StringComparison.InvariantCultureIgnoreCase)) { // Check if we need to force a refresh of the settings - this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); + if (this.EnforceSettingsReapply) + { + this.Log.DoLogInfo("Reapplying '" + activeSettingName + "' as the settings.analyzer.json or a preset file got changed."); + } + else + { + this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); + } // If the setting we are about to activate is the default one, do not list matched triggers if (triggeredSetting.SettingName.Equals(this.DefaultSettingName, StringComparison.InvariantCultureIgnoreCase)) @@ -1395,10 +1402,6 @@ namespace Core.Main { this.Log.DoLogInfo("Switching global settings to '" + triggeredSetting.SettingName + "'..."); } - else - { - this.Log.DoLogInfo("Applying '" + triggeredSetting.SettingName + "' as the settings.analyzer.json or a preset file got changed."); - } SettingsHandler.CompileProperties(this, triggeredSetting); this.GlobalSettingWritten = true; @@ -1409,31 +1412,35 @@ namespace Core.Main // Build Telegram message string telegramMessage; - telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; - - if (matchedTriggers.Count > 0) + if (!EnforceSettingsReapply) { - telegramMessage += "\n\n*Matching Triggers:*"; - foreach (string triggerResult in matchedTriggers) + telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; + + if (matchedTriggers.Count > 0) { - telegramMessage += "\n" + triggerResult; + telegramMessage += "\n\n*Matching Triggers:*"; + foreach (string triggerResult in matchedTriggers) + { + telegramMessage += "\n" + triggerResult; + } + } + + if (this.AverageMarketTrendChanges.Keys.Count > 0) + { + telegramMessage += "\n\n*Market Trends:*"; + foreach (string key in this.AverageMarketTrendChanges.Keys) + { + telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; + } } } - - if (this.AverageMarketTrendChanges.Keys.Count > 0) + else { - telegramMessage += "\n\n*Market Trends:*"; - foreach (string key in this.AverageMarketTrendChanges.Keys) - { - telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; - } + telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Reapplying settings '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; } // Send Telegram message - if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) - { - TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); - } + if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); // Record last settings run this.LastSetting = activeSettingName; @@ -2476,7 +2483,10 @@ namespace Core.Main } } - this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); + if (!this.LastRuntimeSummary.MarketSummary.ContainsKey(marketPair)) + { + this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); + } } this.Log.DoLogInfo("Summary: Current single market properties saved."); diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index 70648d8..ca38f1b 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -345,17 +345,7 @@ namespace Core.MarketAnalyzer return output; } - public static List GetMarketTrendChanges( - string platform, - string mainMarket, - MarketTrend marketTrend, - List marketList, - Dictionary recentMarkets, - Dictionary trendMarkets, - string sortBy, - bool isGlobal, - PTMagicConfiguration systemConfiguration, - LogHelper log) + public static List GetMarketTrendChanges(string platform, string mainMarket, MarketTrend marketTrend, List marketList, Dictionary recentMarkets, Dictionary trendMarkets, string sortBy, bool isGlobal, PTMagicConfiguration systemConfiguration, LogHelper log) { List result = new List(); @@ -378,6 +368,7 @@ namespace Core.MarketAnalyzer if (platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && excludeMainCurrency) { + // Check if this is the main currency (only for CoinMarketCap) if (recentMarketPair.Value.Symbol.Equals(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { @@ -386,7 +377,6 @@ namespace Core.MarketAnalyzer continue; } } - Market recentMarket = recentMarkets[recentMarketPair.Key]; if (trendMarkets.ContainsKey(recentMarketPair.Key)) diff --git a/Core/MarketAnalyzer/Binance.cs b/Core/MarketAnalyzer/Binance.cs index d8a212b..bb7337a 100644 --- a/Core/MarketAnalyzer/Binance.cs +++ b/Core/MarketAnalyzer/Binance.cs @@ -11,7 +11,6 @@ using Core.ProfitTrailer; using System.Net; using System.Threading; using System.Threading.Tasks; -using System.Collections.Concurrent; namespace Core.MarketAnalyzer { @@ -76,24 +75,24 @@ namespace Core.MarketAnalyzer float marketVolume = currencyTicker["volume"].ToObject(); if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { - if (marketLastPrice > 0 && marketVolume > 0) + if(marketLastPrice > 0 && marketVolume > 0 ) { - // Set last values in case any error occurs - lastMarket = marketName; - lastTicker = currencyTicker; + // Set last values in case any error occurs + lastMarket = marketName; + lastTicker = currencyTicker; - Market market = new Market(); - market.Position = markets.Count + 1; - market.Name = marketName; - market.Symbol = currencyTicker["symbol"].ToString(); - market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); - market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); - market.MainCurrencyPriceUSD = mainCurrencyPrice; + Market market = new Market(); + market.Position = markets.Count + 1; + market.Name = marketName; + market.Symbol = currencyTicker["symbol"].ToString(); + market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); + market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); + market.MainCurrencyPriceUSD = mainCurrencyPrice; - markets.Add(market.Name, market); + markets.Add(market.Name, market); - result.Add(market.Name); + result.Add(market.Name); } else { @@ -109,7 +108,7 @@ namespace Core.MarketAnalyzer Binance.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = DateTime.UtcNow; + 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); @@ -168,7 +167,7 @@ namespace Core.MarketAnalyzer log.DoLogInfo("Binance - Checking first seen dates for " + markets.Count + " markets. This may take a while..."); int marketsChecked = 0; - + foreach (string key in markets.Keys) { // Save market info @@ -361,17 +360,13 @@ namespace Core.MarketAnalyzer // Get Ticks for all markets log.DoLogDebug("Binance - Getting ticks for '" + markets.Count + "' markets"); - ConcurrentDictionary> marketTicks = new ConcurrentDictionary>(); + Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach(markets.Keys, + Parallel.ForEach( markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - if (!marketTicks.TryAdd(key, GetMarketTicks(key, totalTicks, systemConfiguration, log))) - { - // Failed to add ticks to dictionary - throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); - } + marketTicks.Add(key, Binance.GetMarketTicks(key, totalTicks, systemConfiguration, log)); if ((marketTicks.Count % 10) == 0) { @@ -441,4 +436,4 @@ namespace Core.MarketAnalyzer } } -} \ No newline at end of file +} diff --git a/Core/MarketAnalyzer/Bittrex.cs b/Core/MarketAnalyzer/Bittrex.cs index 28771b8..5343ac8 100644 --- a/Core/MarketAnalyzer/Bittrex.cs +++ b/Core/MarketAnalyzer/Bittrex.cs @@ -115,7 +115,7 @@ namespace Core.MarketAnalyzer Bittrex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = DateTime.UtcNow; + 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); @@ -235,15 +235,11 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Bittrex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach(markets.Keys, + Parallel.ForEach( markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) - { - // Failed to add ticks to dictionary - throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); - } + marketTicks.Add(key, Bittrex.GetMarketTicks(key, systemConfiguration, log)); if ((marketTicks.Count % 10) == 0) { diff --git a/Core/MarketAnalyzer/CoinMarketCap.cs b/Core/MarketAnalyzer/CoinMarketCap.cs index 5ed2902..3bd9d61 100644 --- a/Core/MarketAnalyzer/CoinMarketCap.cs +++ b/Core/MarketAnalyzer/CoinMarketCap.cs @@ -53,10 +53,11 @@ namespace Core.MarketAnalyzer CoinMarketCap.CheckForMarketDataRecreation(markets, systemConfiguration, log); - // Save the data - DateTime fileDateTime = DateTime.UtcNow; + 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); + log.DoLogInfo("CoinMarketCap - Market data saved."); FileHelper.CleanupFiles(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours); @@ -138,10 +139,11 @@ namespace Core.MarketAnalyzer markets24h.Add(markets[key].Name, market24h); } - // Save the 24hr market data - DateTime fileDateTime = DateTime.UtcNow.AddHours(-24); + 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); + log.DoLogInfo("CoinMarketCap - 24h market data rebuilt."); } } diff --git a/Core/MarketAnalyzer/Poloniex.cs b/Core/MarketAnalyzer/Poloniex.cs index 08a25ec..b3ebedb 100644 --- a/Core/MarketAnalyzer/Poloniex.cs +++ b/Core/MarketAnalyzer/Poloniex.cs @@ -99,7 +99,7 @@ namespace Core.MarketAnalyzer Poloniex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = DateTime.UtcNow; + 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); @@ -269,15 +269,11 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Poloniex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach(markets.Keys, + Parallel.ForEach( markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) - { - // Failed to add ticks to dictionary - throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); - } + marketTicks.Add(key, Poloniex.GetMarketTicks(key, systemConfiguration, log)); if ((marketTicks.Count % 10) == 0) { diff --git a/PTMagic/_presets/Default/DCA.PROPERTIES b/PTMagic/_presets/Default/DCA.PROPERTIES index 37b9297..7fac35f 100644 --- a/PTMagic/_presets/Default/DCA.PROPERTIES +++ b/PTMagic/_presets/Default/DCA.PROPERTIES @@ -1,233 +1,68 @@ # #################################### # ####### PTMagic Current Setting ######## # PTMagic_ActiveSetting = Default -# PTMagic_LastChanged = 5/14/2018 13:54 +# PTMagic_LastChanged = 3/26/2018 11:52 AM # #################################### -## -## -## BTC PT2.2/PTM2.1 (DCA) -## -## # -#GENERAL SETTINGS# -DEFAULT_DCA_ignore_sell_only_mode = true DCA_keep_balance = 0 +DCA_keep_balance_percentage = 0 +# DEFAULT_DCA_max_cost = 0 -DEFAULT_DCA_pending_order_wait_time = 0 +DEFAULT_DCA_max_buy_times = 20 # -DCA_keep_balance_percentage = 20 -DEFAULT_DCA_buy_percentage = 75 +DEFAULT_DCA_A_buy_strategy = LOWBB +DEFAULT_DCA_A_buy_value = 5 +DEFAULT_DCA_A_buy_value_limit = -2.5 # -#--------------------------------------------------------------- -#BUY FILTER SETTINGS# -DEFAULT_DCA_max_buy_spread = 1 -DEFAULT_DCA_min_buy_volume = 300 -DEFAULT_DCA_min_orderbook_volume_percentage = 75 +DEFAULT_DCA_B_buy_strategy = RSI +DEFAULT_DCA_B_buy_value = 33 +DEFAULT_DCA_B_buy_value_limit = 5 # -DEFAULT_DCA_buy_min_change_percentage = -6 -DEFAULT_DCA_buy_max_change_percentage = 0 +DEFAULT_DCA_trailing_buy = 0 # -#--------------------------------------------------------------- -#BUY SETTINGS# +DEFAULT_DCA_buy_trigger = 0 # -DEFAULT_DCA_rebuy_timeout = 60 -DEFAULT_DCA_buy_trigger = -2 -# -DEFAULT_DCA_A_buy_strategy = EMAGAIN -DEFAULT_DCA_A_buy_value = -0.2 -DEFAULT_DCA_A_buy_value_limit = 0 -# -DEFAULT_DCA_trailing_buy = 0.27 -# -DEFAULT_DCA_B_buy_strategy = LOWBB -DEFAULT_DCA_B_buy_value = 20 -DEFAULT_DCA_B_buy_value_limit = 0 -# -DEFAULT_DCA_C_buy_strategy = STOCHRSIK -DEFAULT_DCA_C_buy_value = 30 -DEFAULT_DCA_C_buy_value_limit = 0 -# -DEFAULT_DCA_D_buy_strategy = DISABLED -DEFAULT_DCA_D_buy_value = 0 -DEFAULT_DCA_D_buy_value_limit = 0 -DEFAULT_DCA_E_buy_strategy = DISABLED -DEFAULT_DCA_E_buy_value = 0 -DEFAULT_DCA_E_buy_value_limit = 0 -# -#--------------------------------------------------------------- -# DCA SETTINGS -#DEFAULT_DCA_max_buy_times = 6 -#DEFAULT_DCA_buy_trigger_1 = -1.5 -#DEFAULT_DCA_buy_trigger_2 = -2 -#DEFAULT_DCA_buy_trigger_3 = -5 -#DEFAULT_DCA_buy_trigger_4 = -6 -#DEFAULT_DCA_buy_trigger_5 = -6 -#DEFAULT_DCA_buy_trigger_6 = -7 -# -#DEFAULT_DCA_buy_percentage_1 = 75 -#DEFAULT_DCA_buy_percentage_2 = 125 -#DEFAULT_DCA_buy_percentage_3 = 100 -#DEFAULT_DCA_buy_percentage_4 = 100 -#DEFAULT_DCA_buy_percentage_5 = 75 -#DEFAULT_DCA_buy_percentage_6 = 75 -# -DEFAULT_DCA_buy_percentage_1 = 60 -DEFAULT_DCA_buy_percentage_2 = 75 +DEFAULT_DCA_buy_percentage_1 = 100 +DEFAULT_DCA_buy_percentage_2 = 50 DEFAULT_DCA_buy_percentage_3 = 50 -DEFAULT_DCA_buy_percentage_4 = 37.5 +DEFAULT_DCA_buy_percentage_4 = 25 DEFAULT_DCA_buy_percentage_5 = 30 DEFAULT_DCA_buy_percentage_6 = 25 -DEFAULT_DCA_buy_percentage_7 = 21.42857143 -DEFAULT_DCA_buy_percentage_8 = 18.75 -DEFAULT_DCA_buy_percentage_9 = 16.66666667 -DEFAULT_DCA_buy_percentage_10 = 15 -DEFAULT_DCA_buy_percentage_11 = 13.63636364 -DEFAULT_DCA_buy_percentage_12 = 12.5 -DEFAULT_DCA_buy_percentage_13 = 11.53846154 -DEFAULT_DCA_buy_percentage_14 = 10.71428571 -DEFAULT_DCA_buy_percentage_15 = 10 -DEFAULT_DCA_buy_percentage_16 = 9.375 -DEFAULT_DCA_buy_percentage_17 = 8.823529412 -DEFAULT_DCA_buy_percentage_18 = 8.333333333 -DEFAULT_DCA_buy_percentage_19 = 7.894736842 -DEFAULT_DCA_buy_percentage_20 = 7.5 -DEFAULT_DCA_buy_percentage_21 = 7.142857143 -DEFAULT_DCA_buy_percentage_22 = 6.818181818 -DEFAULT_DCA_buy_percentage_23 = 6.52173913 -DEFAULT_DCA_buy_percentage_24 = 6.25 -DEFAULT_DCA_buy_percentage_25 = 6 -DEFAULT_DCA_buy_percentage_26 = 5.769230769 -DEFAULT_DCA_buy_percentage_27 = 5.555555556 -DEFAULT_DCA_buy_percentage_28 = 5.357142857 -DEFAULT_DCA_buy_percentage_29 = 5.172413793 -DEFAULT_DCA_buy_percentage_30 = 5 -DEFAULT_DCA_buy_percentage_31 = 4.838709677 -DEFAULT_DCA_buy_percentage_32 = 4.6875 -DEFAULT_DCA_buy_percentage_33 = 4.545454545 -DEFAULT_DCA_buy_percentage_34 = 4.411764706 -DEFAULT_DCA_buy_percentage_35 = 4.285714286 -DEFAULT_DCA_buy_percentage_36 = 4.166666667 -DEFAULT_DCA_buy_percentage_37 = 4.054054054 -DEFAULT_DCA_buy_percentage_38 = 3.947368421 -DEFAULT_DCA_buy_percentage_39 = 3.846153846 -DEFAULT_DCA_buy_percentage_40 = 3.75 -DEFAULT_DCA_buy_percentage_41 = 3.658536585 -DEFAULT_DCA_buy_percentage_42 = 3.571428571 -DEFAULT_DCA_buy_percentage_43 = 3.488372093 -DEFAULT_DCA_buy_percentage_44 = 3.409090909 -DEFAULT_DCA_buy_percentage_45 = 3.333333333 -DEFAULT_DCA_buy_percentage_46 = 3.260869565 -DEFAULT_DCA_buy_percentage_47 = 3.191489362 -DEFAULT_DCA_buy_percentage_48 = 3.125 -DEFAULT_DCA_buy_percentage_49 = 3.06122449 -DEFAULT_DCA_buy_percentage_50 = 3 -DEFAULT_DCA_buy_percentage_51 = 2.941176471 -DEFAULT_DCA_buy_percentage_52 = 2.884615385 -DEFAULT_DCA_buy_percentage_53 = 2.830188679 -DEFAULT_DCA_buy_percentage_54 = 2.777777778 -DEFAULT_DCA_buy_percentage_55 = 2.727272727 -DEFAULT_DCA_buy_percentage_56 = 2.678571429 -DEFAULT_DCA_buy_percentage_57 = 2.631578947 -DEFAULT_DCA_buy_percentage_58 = 2.586206897 -DEFAULT_DCA_buy_percentage_59 = 2.542372881 -DEFAULT_DCA_buy_percentage_60 = 2.5 -DEFAULT_DCA_buy_percentage_61 = 2.459016393 -DEFAULT_DCA_buy_percentage_62 = 2.419354839 -DEFAULT_DCA_buy_percentage_63 = 2.380952381 -DEFAULT_DCA_buy_percentage_64 = 2.34375 -DEFAULT_DCA_buy_percentage_65 = 2.307692308 -DEFAULT_DCA_buy_percentage_66 = 2.272727273 -DEFAULT_DCA_buy_percentage_67 = 2.23880597 -DEFAULT_DCA_buy_percentage_68 = 2.205882353 -DEFAULT_DCA_buy_percentage_69 = 2.173913043 -DEFAULT_DCA_buy_percentage_70 = 2.142857143 -DEFAULT_DCA_buy_percentage_71 = 2.112676056 -DEFAULT_DCA_buy_percentage_72 = 2.083333333 -DEFAULT_DCA_buy_percentage_73 = 2.054794521 -DEFAULT_DCA_buy_percentage_74 = 2.027027027 -DEFAULT_DCA_buy_percentage_75 = 2 -DEFAULT_DCA_buy_percentage_76 = 1.973684211 -DEFAULT_DCA_buy_percentage_77 = 1.948051948 -DEFAULT_DCA_buy_percentage_78 = 1.923076923 -DEFAULT_DCA_buy_percentage_79 = 1.898734177 -DEFAULT_DCA_buy_percentage_80 = 1.875 -DEFAULT_DCA_buy_percentage_81 = 1.851851852 -DEFAULT_DCA_buy_percentage_82 = 1.829268293 -DEFAULT_DCA_buy_percentage_83 = 1.807228916 -DEFAULT_DCA_buy_percentage_84 = 1.785714286 -DEFAULT_DCA_buy_percentage_85 = 1.764705882 -DEFAULT_DCA_buy_percentage_86 = 1.744186047 -DEFAULT_DCA_buy_percentage_87 = 1.724137931 -DEFAULT_DCA_buy_percentage_88 = 1.704545455 -DEFAULT_DCA_buy_percentage_89 = 1.685393258 -DEFAULT_DCA_buy_percentage_90 = 1.666666667 -DEFAULT_DCA_buy_percentage_91 = 1.648351648 -DEFAULT_DCA_buy_percentage_92 = 1.630434783 -DEFAULT_DCA_buy_percentage_93 = 1.612903226 -DEFAULT_DCA_buy_percentage_94 = 1.595744681 -DEFAULT_DCA_buy_percentage_95 = 1.578947368 -DEFAULT_DCA_buy_percentage_96 = 1.5625 -DEFAULT_DCA_buy_percentage_97 = 1.546391753 -DEFAULT_DCA_buy_percentage_98 = 1.530612245 -DEFAULT_DCA_buy_percentage_99 = 1.515151515 -DEFAULT_DCA_buy_percentage_100 = 1.5 -# -#--------------------------------------------------------------- -#SELL SETTINGS -# -DCA_orderbook_profit_calculation = true -#DEFAULT_DCA_trailing_profit_rebound_count = 2 -# -DCA_orderbook_profit_calculation = true -#DEFAULT_DCA_trailing_profit_rebound_count = 2 +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.573 -DEFAULT_DCA_trailing_profit = 0.27 -DEFAULT_DCA_trailing_profit_type = GROW +DEFAULT_DCA_A_sell_value = 1 # -DEFAULT_DCA_B_sell_strategy = HIGHBB -DEFAULT_DCA_B_sell_value = 50 -# -DEFAULT_DCA_C_sell_strategy = STOCHRSIK -DEFAULT_DCA_C_sell_value = 60 +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_take_profit_wait_time = 60 -DEFAULT_DCA_take_profit_reset_percentage_move = .25 -DEFAULT_DCA_take_profit_percentage = 0.5 +# +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_timeout = 0 +DEFAULT_DCA_pending_order_wait_time = 0 # -#======================================== -# -#--------------------------------TUSD -# -#TUSD_DCA_A_sell_value = 1.5 -#TUSD_DCA_trailing_profit = 0.45 -#TUSD_DCA_trailing_profit_type = GROW -#TUSD_DCA_B_sell_value = 75 -#TUSD_DCA_C_sell_value = 0 -# -#TUSD_DCA_buy_min_change_percentage = -10 -#TUSD_DCA_max_buy_spread = 2 -TUSD_DCA_buy_trigger = -1.5 -# -#DEFAULT_DCA_take_profit_wait_time = 60 -#DEFAULT_DCA_take_profit_reset_percentage_move = .3 -#DEFAULT_DCA_take_profit_percentage = 2 -# -#======================================== -# -#------------------------ STOP LOSS TRIGGERS -# -#DCA_stop_before_complete = true -#TRX_DCA_stop_loss_trigger = -2 -#TUSD_DCA_stop_loss_trigger = -7 -# -#======================================== -#---------------------------------------- -# Coin Specific STRATEGY -#---------------------------------------- - +DEFAULT_DCA_buy_min_price_increase = 0 +DEFAULT_DCA_buy_max_price_increase = 0 +# \ No newline at end of file diff --git a/PTMagic/_presets/Default/INDICATORS.PROPERTIES b/PTMagic/_presets/Default/INDICATORS.PROPERTIES index 20940dd..a6ecba4 100644 --- a/PTMagic/_presets/Default/INDICATORS.PROPERTIES +++ b/PTMagic/_presets/Default/INDICATORS.PROPERTIES @@ -1,78 +1,30 @@ # #################################### # ####### PTMagic Current Setting ######## -# PTMagic_ActiveSetting = ElDorado-V4 -# PTMagic_LastChanged = 11/30/2018 16:41 +# PTMagic_ActiveSetting = Default +# PTMagic_LastChanged = 3/26/2018 11:52 AM # #################################### - -# Standard Deviation +# BB_std = 2 -# Define how many candles back to look back +BB_candle_period = 300 BB_length = 20 -# Define the period (in seconds) used by all BB calculation of ProfitTrailer. -BB_candle_period = 900 -# Define how many candles back to look and see if the SMA lines just crossed. -SMA_cross_candles = 4 -# Define the period (in seconds) used to calculate the SMA lines -SMA_candle_period = 3600 -# Define the SMA time frame (in candles) used to calculate the fast SMA line. -SMA_fast_length = 21 -# Define the SMA time frame (in candles) used to calculate the slow SMA line. -SMA_slow_length = 55 -# Define how many candles back to look and see if the EMA lines just crossed. -EMA_cross_candles = 12 -# Define the period (in seconds) used to calculate the EMA lines. -EMA_candle_period = 900 -# Define the EMA time frame (in candles) used to calculate the fast EMA line. -EMA_fast_length = 8 -# Define the EMA time frame (in candles) used to calculate the slow EMA line. -EMA_slow_length = 13 -# Define the period (in seconds) used to calculate the RSI lines. -RSI_candle_period = 900 -# Define the RSI time frame (in candles) used by all RSI calculations -RSI_length = 2 -# Define the period (in seconds) used to calculate the STOCH. -STOCH_candle_period = 900 -# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations +# +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_length = 14 +# STOCH_length = 14 -# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. -# Both K and D represent lines on a price action chart. -# The first line (known as K) displays the current close (ie. the percentage of the -# price at closing) in relation to the price range (high/low) along the number of -# candles used to look back along the price action chart. -STOCH_K = 1 -# The second line (known as D) is a simple moving average of the first line, typically -# based on the last three candle periods for smoothing. -STOCH_D = 1 -# Define the period (in seconds) used to calculate the MACD lines. -MACD_candle_period = 900 -# Define the MA time frame (in candles) used to calculate the fast MACD line. +# +MACD_candle_period = 300 MACD_fast_length = 12 -# Define the MA time frame (in candles) used to calculate the slow MACD line. MACD_slow_length = 26 -# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD MACD_signal = 9 -# Define the period (in seconds) used to calculate the RSI lines. -OBV_candle_period = 900 -# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values -OBV_length = 50 -# The number (integer) of the first OBV value used for the calculation of the percentage change. -OBV_signal = 1 -# Always uses 5 minute candles -SOM_trigger_length = 288 -# -# -STOCHRSI_candle_period = 900 -STOCHRSIK_candle_period = 900 -STOCHRSID_candle_period = 900 -# -STOCHRSI_stoch_length = 14 -STOCHRSIK_stoch_length = 14 -STOCHRSID_stoch_length = 14 -# -STOCHRSI_rsi_length = 14 -STOCHRSIK_rsi_length = 14 -STOCHRSID_rsi_length = 14 -# -STOCHRSIK_K = 3 -STOCHRSID_K = 3 -STOCHRSID_D = 3 \ No newline at end of file +# \ No newline at end of file diff --git a/PTMagic/_presets/Default/PAIRS.PROPERTIES b/PTMagic/_presets/Default/PAIRS.PROPERTIES index 9ca9f00..35670dc 100644 --- a/PTMagic/_presets/Default/PAIRS.PROPERTIES +++ b/PTMagic/_presets/Default/PAIRS.PROPERTIES @@ -1,165 +1,67 @@ # #################################### # ####### PTMagic Current Setting ######## # PTMagic_ActiveSetting = Default -# PTMagic_LastChanged = 2/16/2019 4:05 PM +# PTMagic_LastChanged = 23.05.2018 07:29 # #################################### + # +market = USDT # -# BTC PT2.2/PTM2.1 +start_balance = 1105.17429444 +USDT_dust = 3.50 # -# -#======================================== -# >>> Hotconfig <<< -#======================================== -#http://localhost:8082/settings/sellOnlyMode?type=&enabled=false -# -#--------------------------------- -#xxx_reset_stored_average = true -#xxx_bought_price = xxxxxxx -# -#XXX_DCA_set_buy_times = 0 -# -# ================================== DCA -# -DEFAULT_DCA_enabled = -0.1 -#BNB_DCA_enabled = false -#BAT_DCA_enabled = -#NPXS_DCA_enabled = false -# -# -#======================================== -# Saftey Triggers -#======================================== -# -#NANO_panic_sell_enabled = true -# -DEFAULT_sell_only_mode_enabled = false -DEFAULT_trading_enabled = true -#consecutive_buy_trigger = 4 -#consecutive_sell_trigger = 1 -# -#price_trigger_market = BTC -#price_rise_trigger = 5 -#price_rise_recover_trigger = 4 -#price_drop_trigger = 8 -#price_drop_recover_trigger = 6.4 -# -#======================================== -# Money Management $ $ $ -#======================================== -market = BTC -start_balance = 2.3 -max_trading_pairs = 14 -DEFAULT_initial_cost = 0 -DEFAULT_initial_cost_percentage = 4 -keep_balance_percentage = 75 -# -#======================================== -# WHAT TO TRADE -#======================================== -enabled_pairs = ALL -DEFAULT_buy_min_change_percentage = -3 -DEFAULT_buy_max_change_percentage = 20 -pair_min_listed_days = 15 -# -DEFAULT_min_buy_volume = 350 -# -DEFAULT_min_buy_price = 0.00000250 -DEFAULT_min_orderbook_volume_percentage = 120 -DEFAULT_max_buy_spread = 1 -#DEFAULT_sell_wall_orderbook_depth = 40 -#DEFAULT_sell_wall_diff_percentage = 600 -DEFAULT_rebuy_timeout = 10 -# -# ------------------------------ DO NOT TRADE +enabled_pairs = ADA, BCC, BTC, BTG, ETH, LTC, NEO, OMG, XMR, XRP, ZEC hidden_pairs = ALL -#ZIL_trading_enabled = false # -#KMD_sell_only_mode_enabled = true +max_trading_pairs = 5 # -# ------------------------------ DELISTING -CLOAK_trading_enabled = false -MOD_trading_enabled = false -SALT_trading_enabled = false -SUB_trading_enabled = false -WINGS_trading_enabled = false +keep_balance = 0 +keep_balance_percentage = 0 # -#======================================== -# BUY -#======================================== +consecutive_buy_trigger = 0 +consecutive_sell_trigger = 0 # -DEFAULT_A_buy_strategy = EMAGAIN -DEFAULT_A_buy_value = -0.23 -DEFAULT_A_buy_value_limit = 0 +DEFAULT_trading_enabled = true +DEFAULT_sell_only_mode_enabled = true # -DEFAULT_trailing_buy = 0.27 +pair_min_listed_days = 14 +DEFAULT_DCA_enabled = true # -DEFAULT_B_buy_strategy = LOWBB -DEFAULT_B_buy_value = 25 +DEFAULT_initial_cost = 10 +DEFAULT_initial_cost_percentage = 0 +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_C_buy_strategy = STOCHRSIK -DEFAULT_C_buy_value = 25 -DEFAULT_C_buy_value_limit = 0 -# -DEFAULT_D_buy_strategy = DISABLED -DEFAULT_D_buy_value = 0 -DEFAULT_D_buy_value_limit = 0 -DEFAULT_E_buy_strategy = DISABLED -DEFAULT_E_buy_value = 0 -DEFAULT_E_buy_value_limit = 0 -# -#======================================== -# SELL -#======================================== -orderbook_profit_calculation = true +DEFAULT_trailing_buy = 0 # DEFAULT_A_sell_strategy = GAIN -DEFAULT_A_sell_value = 1.73 -DEFAULT_trailing_profit_type = GROW -DEFAULT_trailing_profit = 0.33 +DEFAULT_A_sell_value = 1 # -DEFAULT_B_sell_strategy = HIGHBB -DEFAULT_B_sell_value = 50 -# -#DEFAULT_C_sell_strategy = STOCHRSIK -DEFAULT_C_sell_strategy = RSI -DEFAULT_C_sell_value = 50 -# -DEFAULT_take_profit_wait_time = 90 -DEFAULT_take_profit_percentage = 0.75 -DEFAULT_take_profit_reset_percentage_move = 0.25 -orderbook_profit_calculation = true +DEFAULT_B_sell_strategy = RSI +DEFAULT_B_sell_value = 40 # +DEFAULT_trailing_profit = 0.16 DEFAULT_max_profit = 0 -DEFAULT_pending_order_wait_time = 0 -DEFAULT_combined_cancel_pending_trigger = 0 +# DEFAULT_stop_loss_trigger = 0 DEFAULT_stop_loss_timeout = 0 +DEFAULT_panic_sell_enabled = false +DEFAULT_rebuy_timeout = 5 # -#======================================== +DEFAULT_buy_min_price_increase = 0 +DEFAULT_buy_max_price_increase = 0 # -#------------------------- TUSD +DEFAULT_pending_order_wait_time = 0 +DEFAULT_combined_cancel_pending_trigger = 0 # -#TUSD_A_sell_value = 3 -#TUSD_trailing_profit = 0.75 -#TUSD_trailing_profit_type = GROWTH -#TUSD_B_sell_value = 75 -# -#TUSD_take_profit_wait_time = 90 -#TUSD_take_profit_reset_percentage_move = .25 -# -#TUSD_DCA_enabled = false -# -#======================================== -# -#------------------------ STOP LOSS TRIGGERS -# -#TRX_stop_loss_trigger = -2 -#TUSD_stop_loss_trigger = -3.5 -# -#======================================== -#---------------------------------------- -# Coin Specific STRATEGY -#---------------------------------------- diff --git a/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties b/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties deleted file mode 100644 index 6c56eb3..0000000 --- a/PTMagic/_presets/Sideways/ElDorado-V4-INDICATORS.properties +++ /dev/null @@ -1,78 +0,0 @@ -# #################################### -# ####### PTMagic Current Setting ######## -# PTMagic_ActiveSetting = ElDorado-V4 -# PTMagic_LastChanged = 11/30/2018 16:41 -# #################################### -# -# Standard Deviation -BB_std = 2 -# Define how many candles back to look back -BB_length = 20 -# Define the period (in seconds) used by all BB calculation of ProfitTrailer. -BB_candle_period = 900 -# Define how many candles back to look and see if the SMA lines just crossed. -SMA_cross_candles = 4 -# Define the period (in seconds) used to calculate the SMA lines -SMA_candle_period = 3600 -# Define the SMA time frame (in candles) used to calculate the fast SMA line. -SMA_fast_length = 21 -# Define the SMA time frame (in candles) used to calculate the slow SMA line. -SMA_slow_length = 55 -# Define how many candles back to look and see if the EMA lines just crossed. -EMA_cross_candles = 12 -# Define the period (in seconds) used to calculate the EMA lines. -EMA_candle_period = 900 -# Define the EMA time frame (in candles) used to calculate the fast EMA line. -EMA_fast_length = 8 -# Define the EMA time frame (in candles) used to calculate the slow EMA line. -EMA_slow_length = 13 -# Define the period (in seconds) used to calculate the RSI lines. -RSI_candle_period = 900 -# Define the RSI time frame (in candles) used by all RSI calculations -RSI_length = 2 -# Define the period (in seconds) used to calculate the STOCH. -STOCH_candle_period = 900 -# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations -STOCH_length = 14 -# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. -# Both K and D represent lines on a price action chart. -# The first line (known as K) displays the current close (ie. the percentage of the -# price at closing) in relation to the price range (high/low) along the number of -# candles used to look back along the price action chart. -STOCH_K = 1 -# The second line (known as D) is a simple moving average of the first line, typically -# based on the last three candle periods for smoothing. -STOCH_D = 1 -# Define the period (in seconds) used to calculate the MACD lines. -MACD_candle_period = 900 -# Define the MA time frame (in candles) used to calculate the fast MACD line. -MACD_fast_length = 12 -# Define the MA time frame (in candles) used to calculate the slow MACD line. -MACD_slow_length = 26 -# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD -MACD_signal = 9 -# Define the period (in seconds) used to calculate the RSI lines. -OBV_candle_period = 900 -# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values -OBV_length = 50 -# The number (integer) of the first OBV value used for the calculation of the percentage change. -OBV_signal = 1 -# Always uses 5 minute candles -SOM_trigger_length = 288 -# -# -STOCHRSI_candle_period = 900 -STOCHRSIK_candle_period = 900 -STOCHRSID_candle_period = 900 -# -STOCHRSI_stoch_length = 14 -STOCHRSIK_stoch_length = 14 -STOCHRSID_stoch_length = 14 -# -STOCHRSI_rsi_length = 14 -STOCHRSIK_rsi_length = 14 -STOCHRSID_rsi_length = 14 -# -STOCHRSIK_K = 3 -STOCHRSID_K = 3 -STOCHRSID_D = 3 \ No newline at end of file diff --git a/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties b/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties deleted file mode 100644 index d47a85b..0000000 --- a/PTMagic/_presets/SidewaysUp/ElDorado-V4-INDICATORS.properties +++ /dev/null @@ -1,78 +0,0 @@ -# #################################### -# ####### PTMagic Current Setting #### -# PTMagic_ActiveSetting = ElDorado-V4 -# PTMagic_LastChanged = 11/30/2018 16:41 -# #################################### - -# Standard Deviation -BB_std = 2 -# Define how many candles back to look back -BB_length = 20 -# Define the period (in seconds) used by all BB calculation of ProfitTrailer. -BB_candle_period = 900 -# Define how many candles back to look and see if the SMA lines just crossed. -SMA_cross_candles = 4 -# Define the period (in seconds) used to calculate the SMA lines -SMA_candle_period = 3600 -# Define the SMA time frame (in candles) used to calculate the fast SMA line. -SMA_fast_length = 21 -# Define the SMA time frame (in candles) used to calculate the slow SMA line. -SMA_slow_length = 55 -# Define how many candles back to look and see if the EMA lines just crossed. -EMA_cross_candles = 12 -# Define the period (in seconds) used to calculate the EMA lines. -EMA_candle_period = 900 -# Define the EMA time frame (in candles) used to calculate the fast EMA line. -EMA_fast_length = 8 -# Define the EMA time frame (in candles) used to calculate the slow EMA line. -EMA_slow_length = 13 -# Define the period (in seconds) used to calculate the RSI lines. -RSI_candle_period = 900 -# Define the RSI time frame (in candles) used by all RSI calculations -RSI_length = 2 -# Define the period (in seconds) used to calculate the STOCH. -STOCH_candle_period = 900 -# Define the Stochastics RSI time frame (in candles) used by all STOCHRSI calculations -STOCH_length = 14 -# The Stochastic Oscillator (STOCH) is range bound between 0 and 100. -# Both K and D represent lines on a price action chart. -# The first line (known as K) displays the current close (ie. the percentage of the -# price at closing) in relation to the price range (high/low) along the number of -# candles used to look back along the price action chart. -STOCH_K = 1 -# The second line (known as D) is a simple moving average of the first line, typically -# based on the last three candle periods for smoothing. -STOCH_D = 1 -# Define the period (in seconds) used to calculate the MACD lines. -MACD_candle_period = 900 -# Define the MA time frame (in candles) used to calculate the fast MACD line. -MACD_fast_length = 12 -# Define the MA time frame (in candles) used to calculate the slow MACD line. -MACD_slow_length = 26 -# Define the time frame (in days) of the EMA (Exponential Moving Average) of the MACD -MACD_signal = 9 -# Define the period (in seconds) used to calculate the RSI lines. -OBV_candle_period = 900 -# Total count of candles used to calculate the OBV values, e.g. 15 means we have 15 OBV values -OBV_length = 50 -# The number (integer) of the first OBV value used for the calculation of the percentage change. -OBV_signal = 1 -# Always uses 5 minute candles -SOM_trigger_length = 288 -# -# -STOCHRSI_candle_period = 900 -STOCHRSIK_candle_period = 900 -STOCHRSID_candle_period = 900 -# -STOCHRSI_stoch_length = 14 -STOCHRSIK_stoch_length = 14 -STOCHRSID_stoch_length = 14 -# -STOCHRSI_rsi_length = 14 -STOCHRSIK_rsi_length = 14 -STOCHRSID_rsi_length = 14 -# -STOCHRSIK_K = 3 -STOCHRSID_K = 3 -STOCHRSID_D = 3 From f68ae43f41b99e1bb4e05c4f19faa775a5dfbdec Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sat, 9 Mar 2019 09:38:46 +0100 Subject: [PATCH 3/3] Fixes to marketdata in non UTC timezones + small tweaks --- Core/Main/PTMagic.cs | 60 ++++++++++++---------------- Core/MarketAnalyzer/BaseAnalyzer.cs | 14 ++++++- Core/MarketAnalyzer/Binance.cs | 43 +++++++++++--------- Core/MarketAnalyzer/Bittrex.cs | 10 +++-- Core/MarketAnalyzer/CoinMarketCap.cs | 10 ++--- Core/MarketAnalyzer/Poloniex.cs | 10 +++-- 6 files changed, 79 insertions(+), 68 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 26753a8..43a6be9 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -604,6 +604,7 @@ namespace Core.Main this.Log.DoLogInfo("Detected a '" + e.ChangeType.ToString() + "' change in the following preset file: " + e.FullPath); // Reprocess now + this.EnforceSettingsReapply = true; PTMagicIntervalTimer_Elapsed(new object(), null); // Enable the file watcher again @@ -961,7 +962,7 @@ namespace Core.Main FileInfo generalSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.general.json"); FileInfo analyzerSettingsFile = new FileInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "settings.analyzer.json"); - if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || EnforceSettingsReapply) + if (generalSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck || analyzerSettingsFile.LastWriteTimeUtc > this.LastSettingFileCheck) { Log.DoLogInfo("Detected configuration changes. Reloading settings..."); @@ -1199,7 +1200,6 @@ namespace Core.Main } else if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Binance", StringComparison.InvariantCultureIgnoreCase)) { - // Get most recent market data from Binance this.ExchangeMarketList = Binance.GetMarketData(this.LastRuntimeSummary.MainMarket, this.MarketInfos, this.PTMagicConfiguration, this.Log); } @@ -1379,14 +1379,7 @@ namespace Core.Main if (this.EnforceSettingsReapply || !activeSettingName.Equals(triggeredSetting.SettingName, StringComparison.InvariantCultureIgnoreCase)) { // Check if we need to force a refresh of the settings - if (this.EnforceSettingsReapply) - { - this.Log.DoLogInfo("Reapplying '" + activeSettingName + "' as the settings.analyzer.json or a preset file got changed."); - } - else - { - this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); - } + this.Log.DoLogInfo("Setting '" + activeSettingName + "' currently active. Checking for flood protection..."); // If the setting we are about to activate is the default one, do not list matched triggers if (triggeredSetting.SettingName.Equals(this.DefaultSettingName, StringComparison.InvariantCultureIgnoreCase)) @@ -1402,6 +1395,10 @@ namespace Core.Main { this.Log.DoLogInfo("Switching global settings to '" + triggeredSetting.SettingName + "'..."); } + else + { + this.Log.DoLogInfo("Applying '" + triggeredSetting.SettingName + "' as the settings.analyzer.json or a preset file got changed."); + } SettingsHandler.CompileProperties(this, triggeredSetting); this.GlobalSettingWritten = true; @@ -1412,35 +1409,31 @@ namespace Core.Main // Build Telegram message string telegramMessage; - if (!EnforceSettingsReapply) + telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; + + if (matchedTriggers.Count > 0) { - telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Setting switched to '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; - - if (matchedTriggers.Count > 0) + telegramMessage += "\n\n*Matching Triggers:*"; + foreach (string triggerResult in matchedTriggers) { - telegramMessage += "\n\n*Matching Triggers:*"; - foreach (string triggerResult in matchedTriggers) - { - telegramMessage += "\n" + triggerResult; - } - } - - if (this.AverageMarketTrendChanges.Keys.Count > 0) - { - telegramMessage += "\n\n*Market Trends:*"; - foreach (string key in this.AverageMarketTrendChanges.Keys) - { - telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; - } + telegramMessage += "\n" + triggerResult; } } - else + + if (this.AverageMarketTrendChanges.Keys.Count > 0) { - telegramMessage = this.PTMagicConfiguration.GeneralSettings.Application.InstanceName + ": Reapplying settings '*" + SystemHelper.SplitCamelCase(triggeredSetting.SettingName) + "*'."; + telegramMessage += "\n\n*Market Trends:*"; + foreach (string key in this.AverageMarketTrendChanges.Keys) + { + telegramMessage += "\n" + key + ": " + this.AverageMarketTrendChanges[key].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; + } } // Send Telegram message - if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); + if (this.PTMagicConfiguration.GeneralSettings.Telegram.IsEnabled) + { + TelegramHelper.SendMessage(this.PTMagicConfiguration.GeneralSettings.Telegram.BotToken, this.PTMagicConfiguration.GeneralSettings.Telegram.ChatId, telegramMessage, this.PTMagicConfiguration.GeneralSettings.Telegram.SilentMode, this.Log); + } // Record last settings run this.LastSetting = activeSettingName; @@ -2483,10 +2476,7 @@ namespace Core.Main } } - if (!this.LastRuntimeSummary.MarketSummary.ContainsKey(marketPair)) - { - this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); - } + this.LastRuntimeSummary.MarketSummary.Add(marketPair, mpSummary); } this.Log.DoLogInfo("Summary: Current single market properties saved."); diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index ca38f1b..70648d8 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -345,7 +345,17 @@ namespace Core.MarketAnalyzer return output; } - public static List GetMarketTrendChanges(string platform, string mainMarket, MarketTrend marketTrend, List marketList, Dictionary recentMarkets, Dictionary trendMarkets, string sortBy, bool isGlobal, PTMagicConfiguration systemConfiguration, LogHelper log) + public static List GetMarketTrendChanges( + string platform, + string mainMarket, + MarketTrend marketTrend, + List marketList, + Dictionary recentMarkets, + Dictionary trendMarkets, + string sortBy, + bool isGlobal, + PTMagicConfiguration systemConfiguration, + LogHelper log) { List result = new List(); @@ -368,7 +378,6 @@ namespace Core.MarketAnalyzer if (platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && excludeMainCurrency) { - // Check if this is the main currency (only for CoinMarketCap) if (recentMarketPair.Value.Symbol.Equals(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { @@ -377,6 +386,7 @@ namespace Core.MarketAnalyzer continue; } } + Market recentMarket = recentMarkets[recentMarketPair.Key]; if (trendMarkets.ContainsKey(recentMarketPair.Key)) diff --git a/Core/MarketAnalyzer/Binance.cs b/Core/MarketAnalyzer/Binance.cs index bb7337a..d8a212b 100644 --- a/Core/MarketAnalyzer/Binance.cs +++ b/Core/MarketAnalyzer/Binance.cs @@ -11,6 +11,7 @@ using Core.ProfitTrailer; using System.Net; using System.Threading; using System.Threading.Tasks; +using System.Collections.Concurrent; namespace Core.MarketAnalyzer { @@ -75,24 +76,24 @@ namespace Core.MarketAnalyzer float marketVolume = currencyTicker["volume"].ToObject(); if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase)) { - if(marketLastPrice > 0 && marketVolume > 0 ) + if (marketLastPrice > 0 && marketVolume > 0) { - // Set last values in case any error occurs - lastMarket = marketName; - lastTicker = currencyTicker; + // Set last values in case any error occurs + lastMarket = marketName; + lastTicker = currencyTicker; - Market market = new Market(); - market.Position = markets.Count + 1; - market.Name = marketName; - market.Symbol = currencyTicker["symbol"].ToString(); - market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); - market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); - market.MainCurrencyPriceUSD = mainCurrencyPrice; + Market market = new Market(); + market.Position = markets.Count + 1; + market.Name = marketName; + market.Symbol = currencyTicker["symbol"].ToString(); + market.Price = SystemHelper.TextToDouble(currencyTicker["lastPrice"].ToString(), 0, "en-US"); + market.Volume24h = SystemHelper.TextToDouble(currencyTicker["quoteVolume"].ToString(), 0, "en-US"); + market.MainCurrencyPriceUSD = mainCurrencyPrice; - markets.Add(market.Name, market); + markets.Add(market.Name, market); - result.Add(market.Name); + result.Add(market.Name); } else { @@ -108,7 +109,7 @@ namespace Core.MarketAnalyzer Binance.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -167,7 +168,7 @@ namespace Core.MarketAnalyzer log.DoLogInfo("Binance - Checking first seen dates for " + markets.Count + " markets. This may take a while..."); int marketsChecked = 0; - + foreach (string key in markets.Keys) { // Save market info @@ -360,13 +361,17 @@ namespace Core.MarketAnalyzer // Get Ticks for all markets log.DoLogDebug("Binance - Getting ticks for '" + markets.Count + "' markets"); - Dictionary> marketTicks = new Dictionary>(); + ConcurrentDictionary> marketTicks = new ConcurrentDictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Binance.GetMarketTicks(key, totalTicks, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, GetMarketTicks(key, totalTicks, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) { @@ -436,4 +441,4 @@ namespace Core.MarketAnalyzer } } -} +} \ No newline at end of file diff --git a/Core/MarketAnalyzer/Bittrex.cs b/Core/MarketAnalyzer/Bittrex.cs index 5343ac8..28771b8 100644 --- a/Core/MarketAnalyzer/Bittrex.cs +++ b/Core/MarketAnalyzer/Bittrex.cs @@ -115,7 +115,7 @@ namespace Core.MarketAnalyzer Bittrex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -235,11 +235,15 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Bittrex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Bittrex.GetMarketTicks(key, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) { diff --git a/Core/MarketAnalyzer/CoinMarketCap.cs b/Core/MarketAnalyzer/CoinMarketCap.cs index 3bd9d61..5ed2902 100644 --- a/Core/MarketAnalyzer/CoinMarketCap.cs +++ b/Core/MarketAnalyzer/CoinMarketCap.cs @@ -53,11 +53,10 @@ namespace Core.MarketAnalyzer CoinMarketCap.CheckForMarketDataRecreation(markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); - + // Save the data + DateTime fileDateTime = DateTime.UtcNow; 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); - log.DoLogInfo("CoinMarketCap - Market data saved."); FileHelper.CleanupFiles(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Constants.PTMagicPathData + Path.DirectorySeparatorChar + Constants.PTMagicPathCoinMarketCap + Path.DirectorySeparatorChar, systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours); @@ -139,11 +138,10 @@ namespace Core.MarketAnalyzer markets24h.Add(markets[key].Name, market24h); } - 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(); - + // Save the 24hr market data + DateTime fileDateTime = DateTime.UtcNow.AddHours(-24); 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); - log.DoLogInfo("CoinMarketCap - 24h market data rebuilt."); } } diff --git a/Core/MarketAnalyzer/Poloniex.cs b/Core/MarketAnalyzer/Poloniex.cs index b3ebedb..08a25ec 100644 --- a/Core/MarketAnalyzer/Poloniex.cs +++ b/Core/MarketAnalyzer/Poloniex.cs @@ -99,7 +99,7 @@ namespace Core.MarketAnalyzer Poloniex.CheckForMarketDataRecreation(mainMarket, markets, systemConfiguration, log); - DateTime fileDateTime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, 0).ToUniversalTime(); + DateTime fileDateTime = DateTime.UtcNow; 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); @@ -269,11 +269,15 @@ namespace Core.MarketAnalyzer log.DoLogDebug("Poloniex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - Parallel.ForEach( markets.Keys, + Parallel.ForEach(markets.Keys, new ParallelOptions { MaxDegreeOfParallelism = 5 }, (key) => { - marketTicks.Add(key, Poloniex.GetMarketTicks(key, systemConfiguration, log)); + if (!marketTicks.TryAdd(key, Bittrex.GetMarketTicks(key, systemConfiguration, log))) + { + // Failed to add ticks to dictionary + throw new Exception("Failed to add ticks for " + key + " to the memory dictionary, results may be incorrectly calculated!"); + } if ((marketTicks.Count % 10) == 0) {