diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 25865a1..fa6f69b 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -48,7 +48,7 @@ namespace Core.Main.DataObjects.PTMagicData public string TimezoneOffset { get; set; } = "+0:00"; public string MainFiatCurrency { get; set; } = "USD"; public string CoinMarketCapAPIKey { get; set; } - public string FreeCurrencyConverterAPIKey { get; set; } + //public string FreeCurrencyConverterAPIKey { get; set; } } public class Monitor @@ -64,6 +64,7 @@ namespace Core.Main.DataObjects.PTMagicData public int RefreshSeconds { get; set; } = 30; public int BagAnalyzerRefreshSeconds { get; set; } = 5; public int BuyAnalyzerRefreshSeconds { get; set; } = 5; + public int MaxSalesRecords { get; set; } = 99999; public int MaxTopMarkets { get; set; } = 20; public int MaxDailySummaries { get; set; } = 10; public int MaxMonthlySummaries { get; set; } = 10; diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index df01a9a..ca04707 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -113,14 +113,19 @@ namespace Core.Main.DataObjects bool exitLoop = false; int pageIndex = 1; - while (!exitLoop) + int maxPages = _systemConfiguration.GeneralSettings.Monitor.MaxSalesRecords; + int requestedPages = 0; + + while (!exitLoop && requestedPages < maxPages) { - var sellDataPage = GetDataFromProfitTrailer("/api/v2/data/sales?perPage=5000&sort=SOLDDATE&sortDirection=ASCENDING&page=" + pageIndex); + var sellDataPage = GetDataFromProfitTrailer("/api/v2/data/sales?Page=1&perPage=1&sort=SOLDDATE&sortDirection=DESCENDING&page=" + pageIndex); if (sellDataPage != null && sellDataPage.data.Count > 0) { // Add sales data page to collection this.BuildSellLogData(sellDataPage); pageIndex++; + requestedPages++; + } else { @@ -130,7 +135,7 @@ namespace Core.Main.DataObjects } // Update sell log refresh time - _sellLogRefresh = DateTime.UtcNow.AddSeconds(_systemConfiguration.GeneralSettings.Monitor.RefreshSeconds - 1); + _sellLogRefresh = DateTime.UtcNow.AddSeconds(_systemConfiguration.GeneralSettings.Monitor.RefreshSeconds -1); } } } diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 82460d6..9c6e1b3 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -721,14 +721,14 @@ namespace Core.Main } // Check for CurrencyConverterApi Key - if (!this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey.Equals("")) - { - this.Log.DoLogInfo("FreeCurrencyConverterApi KEY found"); - } - else - { - this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified. That's ok! But you can only use USD; apply for a key at: https://freecurrencyrates.com/en"); - } + //if (!this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey.Equals("")) + //{ + // this.Log.DoLogInfo("FreeCurrencyConverterApi KEY found"); + //} + //else + //{ + // this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified. That's ok! But you can only use USD; apply for a key at: https://freecurrencyrates.com/en"); + //} } catch (System.NullReferenceException) { @@ -1132,28 +1132,28 @@ namespace Core.Main this.LastRuntimeSummary.MainFiatCurrency = this.LastMainFiatCurrency; this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = this.LastMainFiatCurrencyExchangeRate; - if (this.LastFiatCurrencyCheck < DateTime.UtcNow.AddHours(-12) && !this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency.Equals("USD", StringComparison.InvariantCultureIgnoreCase)) - { - try - { - this.LastRuntimeSummary.MainFiatCurrency = this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency; - this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey, this.Log); - this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency; - this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate; + // if (this.LastFiatCurrencyCheck < DateTime.UtcNow.AddHours(-12) && !this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency.Equals("USD", StringComparison.InvariantCultureIgnoreCase)) + // { + // try + // { + // this.LastRuntimeSummary.MainFiatCurrency = this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency; + // this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey, this.Log); + // this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency; + // this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate; - this.LastFiatCurrencyCheck = DateTime.UtcNow; - } - catch (Exception ex) - { + // this.LastFiatCurrencyCheck = DateTime.UtcNow; + // } + // catch (Exception ex) + // { - // Fallback to USD in case something went wrong - this.Log.DoLogError("Fixer.io exchange rate check error: " + ex.Message); - this.LastRuntimeSummary.MainFiatCurrency = "USD"; - this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = 1; - this.LastMainFiatCurrency = "USD"; - this.LastMainFiatCurrencyExchangeRate = 1; - } - } + // // Fallback to USD in case something went wrong + // this.Log.DoLogError("Fixer.io exchange rate check error: " + ex.Message); + // this.LastRuntimeSummary.MainFiatCurrency = "USD"; + // this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = 1; + // this.LastMainFiatCurrency = "USD"; + // this.LastMainFiatCurrencyExchangeRate = 1; + // } + // } } // Get current PT properties diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index cdd873b..1750c2e 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -437,7 +437,7 @@ namespace Core.ProfitTrailer } else { - strategyText += "FORM "; + strategyText += ""; } } else diff --git a/Monitor/Pages/SalesAnalyzer.cshtml b/Monitor/Pages/SalesAnalyzer.cshtml index f75c554..28240e1 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml +++ b/Monitor/Pages/SalesAnalyzer.cshtml @@ -25,7 +25,7 @@ totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); } } - Total Account Value:   @totalCurrentValueString @Model.Summary.MainMarket + Total Current Value:   @totalCurrentValueString @Model.Summary.MainMarket Starting Value:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance   @Model.Summary.MainMarket diff --git a/Monitor/Pages/SettingsGeneral.cshtml b/Monitor/Pages/SettingsGeneral.cshtml index 4989f93..82b7166 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml +++ b/Monitor/Pages/SettingsGeneral.cshtml @@ -124,12 +124,12 @@ -
+ @*
- +
-
+
*@
@@ -145,12 +145,12 @@
-
+ @*
-
+
*@ @@ -196,14 +196,14 @@
- +
- +
@@ -241,6 +241,13 @@
+ +
+ +
+
+ +
diff --git a/Monitor/Pages/SettingsGeneral.cshtml.cs b/Monitor/Pages/SettingsGeneral.cshtml.cs index d5f3c1e..39f6035 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml.cs +++ b/Monitor/Pages/SettingsGeneral.cshtml.cs @@ -74,11 +74,11 @@ namespace Monitor.Pages PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerMonitorURL = HttpContext.Request.Form["Application_ProfitTrailerMonitorURL"]; PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken = HttpContext.Request.Form["Application_ProfitTrailerServerAPIToken"]; PTMagicConfiguration.GeneralSettings.Application.TimezoneOffset = HttpContext.Request.Form["Application_TimezoneOffset"]; - PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency = HttpContext.Request.Form["Application_MainFiatCurrency"]; + //PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency = HttpContext.Request.Form["Application_MainFiatCurrency"]; PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes = SystemHelper.TextToInteger(HttpContext.Request.Form["Application_FloodProtectionMinutes"], PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes); PTMagicConfiguration.GeneralSettings.Application.InstanceName = HttpContext.Request.Form["Application_InstanceName"]; PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey = HttpContext.Request.Form["Application_CoinMarketCapAPIKey"]; - PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey = HttpContext.Request.Form["Application_FreeCurrencyConverterAPIKey"]; + //PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey = HttpContext.Request.Form["Application_FreeCurrencyConverterAPIKey"]; PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = HttpContext.Request.Form["Monitor_IsPasswordProtected"].Equals("on"); PTMagicConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart = HttpContext.Request.Form["Monitor_OpenBrowserOnStart"].Equals("on"); PTMagicConfiguration.GeneralSettings.Monitor.AnalyzerChart = HttpContext.Request.Form["Monitor_AnalyzerChart"]; @@ -89,6 +89,7 @@ namespace Monitor.Pages PTMagicConfiguration.GeneralSettings.Monitor.BagAnalyzerRefreshSeconds = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_BagAnalyzerRefreshSeconds"], PTMagicConfiguration.GeneralSettings.Monitor.BagAnalyzerRefreshSeconds); PTMagicConfiguration.GeneralSettings.Monitor.BuyAnalyzerRefreshSeconds = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_BuyAnalyzerRefreshSeconds"], PTMagicConfiguration.GeneralSettings.Monitor.BuyAnalyzerRefreshSeconds); PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform = HttpContext.Request.Form["Monitor_LinkPlatform"]; + PTMagicConfiguration.GeneralSettings.Monitor.MaxSalesRecords = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_MaxSalesRecords"], PTMagicConfiguration.GeneralSettings.Monitor.MaxSalesRecords); PTMagicConfiguration.GeneralSettings.Monitor.MaxTopMarkets = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_MaxTopMarkets"], PTMagicConfiguration.GeneralSettings.Monitor.MaxTopMarkets); PTMagicConfiguration.GeneralSettings.Monitor.MaxDailySummaries = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_MaxDailySummaries"], PTMagicConfiguration.GeneralSettings.Monitor.MaxDailySummaries); PTMagicConfiguration.GeneralSettings.Monitor.MaxMonthlySummaries = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_MaxMonthlySummaries"], PTMagicConfiguration.GeneralSettings.Monitor.MaxMonthlySummaries); diff --git a/Monitor/Pages/StatusSummary.cshtml b/Monitor/Pages/StatusSummary.cshtml index b3d31fc..46eb477 100644 --- a/Monitor/Pages/StatusSummary.cshtml +++ b/Monitor/Pages/StatusSummary.cshtml @@ -67,7 +67,7 @@
-

Active Settings

+

Active Settings  

@{ string maxCostCaption = "Initial"; } @@ -86,8 +86,6 @@ } - DCA Level - @Model.Summary.DCALevels.ToString(new System.Globalization.CultureInfo("en-US")) Min Vol. @Model.Summary.MinBuyVolume.ToString(new System.Globalization.CultureInfo("en-US")) @@ -101,62 +99,7 @@
-
-

Active Buy Strategies

- - - - @if (Model.Summary.BuyStrategies.Count == 0) { - - - - - - - } else { - char buyStrategyIndex = 'A'; - foreach (Core.Main.DataObjects.PTMagicData.StrategySummary buyStrategy in Model.Summary.BuyStrategies) { - - - - - - - buyStrategyIndex++; - } - } - -
Buy Strat.@Model.Summary.BuyStrategyBuy Value@Model.Summary.BuyValue.ToString(new System.Globalization.CultureInfo("en-US"))
Buy Strat. @buyStrategyIndex@buyStrategy.NameBuy Value @buyStrategyIndex@buyStrategy.Value.ToString(new System.Globalization.CultureInfo("en-US"))
-
- -
-

Active Sell Strategies

- - - - @if (Model.Summary.SellStrategies.Count == 0) { - - - - - - - } else { - char sellStrategyIndex = 'A'; - foreach (Core.Main.DataObjects.PTMagicData.StrategySummary sellStrategy in Model.Summary.SellStrategies) { - - - - - - - sellStrategyIndex++; - } - } - -
Sell Strat.@Model.Summary.SellStrategySell Value@Model.Summary.SellValue.ToString(new System.Globalization.CultureInfo("en-US"))
Sell Strat. @sellStrategyIndex@sellStrategy.NameSell Value @sellStrategyIndex@sellStrategy.Value.ToString(new System.Globalization.CultureInfo("en-US"))
-
-
+
diff --git a/Monitor/wwwroot/assets/css/style.css b/Monitor/wwwroot/assets/css/style.css index a81c70b..6eb5cfe 100644 --- a/Monitor/wwwroot/assets/css/style.css +++ b/Monitor/wwwroot/assets/css/style.css @@ -639,7 +639,7 @@ a.text-dark:hover { } .bg-success { - background-color: #81c868 !important; + background-color: #296a12 !important; } .bg-info { @@ -647,11 +647,11 @@ a.text-dark:hover { } .bg-warning { - background-color: #ffbd4a !important; + background-color: #563a09 !important; } .bg-danger { - background-color: #f05050 !important; + background-color: #6e0e0e !important; } .bg-muted { @@ -759,7 +759,7 @@ a.text-dark:hover { } .label-success { - background-color: #81c868; + background-color: #3b5e2f; } .label-info { @@ -767,11 +767,11 @@ a.text-dark:hover { } .label-warning { - background-color: #ffbd4a; + background-color: #847f0a; } .label-danger { - background-color: #f05050; + background-color: #601f1f; } .label-purple { @@ -829,7 +829,7 @@ a.text-dark:hover { } .badge-success { - background-color: #81c868; + background-color: #307516; } .badge-info { @@ -837,11 +837,11 @@ a.text-dark:hover { } .badge-warning { - background-color: #ffbd4a; + background-color: #6f5019; } .badge-danger { - background-color: #f05050; + background-color: #6a1414; } .badge-purple { diff --git a/PTMagic.sln b/PTMagic.sln new file mode 100644 index 0000000..1f9a9e3 --- /dev/null +++ b/PTMagic.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{DC985FA9-87CC-4C60-A587-E646E74A1A4A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monitor", "Monitor\Monitor.csproj", "{D967C466-E4BF-40A9-84FD-698079FAD3D5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PTMagic", "PTMagic\PTMagic.csproj", "{D81F5541-438E-42C7-B6E7-B859875B18A8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DC985FA9-87CC-4C60-A587-E646E74A1A4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC985FA9-87CC-4C60-A587-E646E74A1A4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC985FA9-87CC-4C60-A587-E646E74A1A4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC985FA9-87CC-4C60-A587-E646E74A1A4A}.Release|Any CPU.Build.0 = Release|Any CPU + {D967C466-E4BF-40A9-84FD-698079FAD3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D967C466-E4BF-40A9-84FD-698079FAD3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D967C466-E4BF-40A9-84FD-698079FAD3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D967C466-E4BF-40A9-84FD-698079FAD3D5}.Release|Any CPU.Build.0 = Release|Any CPU + {D81F5541-438E-42C7-B6E7-B859875B18A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D81F5541-438E-42C7-B6E7-B859875B18A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D81F5541-438E-42C7-B6E7-B859875B18A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D81F5541-438E-42C7-B6E7-B859875B18A8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C3646F7E-91F6-4D66-9B1B-2B74317580A4} + EndGlobalSection +EndGlobal diff --git a/PTMagic/_defaults/_default_settings_PT_2.x/settings.general.json b/PTMagic/_defaults/_default_settings_PT_2.x/settings.general.json index 4f9bb22..beb9ffe 100644 --- a/PTMagic/_defaults/_default_settings_PT_2.x/settings.general.json +++ b/PTMagic/_defaults/_default_settings_PT_2.x/settings.general.json @@ -12,11 +12,11 @@ "Exchange": "Bittrex", // The exchange your are running Profit Trailer on "StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer "TimezoneOffset": "+0:00", // Your timezone offset from UTC time - "MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor + //"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor "FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute "InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them "CoinMarketCapAPIKey": "", //CoinMarketCap Api - "FreeCurrencyConverterAPIKey": "" // If "MainFiatCurrency" above is anything other than USD, you must obtain an API key from https://free.currencyconverterapi.com/free-api-key + //"FreeCurrencyConverterAPIKey": "" // If "MainFiatCurrency" above is anything other than USD, you must obtain an API key from https://free.currencyconverterapi.com/free-api-key }, "Monitor": { "IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start @@ -28,6 +28,7 @@ "GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers "RefreshSeconds": 30, // The refresh interval of your monitor main page "LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it + "MaxSalesRecords": 99999, // The maximum number of sales records pulled from Profit Trailer. Changes require a Monitor Restart. "MaxTopMarkets": 20, // The amount of top markets being shown in your Sales Analyzer "MaxDailySummaries": 10, // The amount of "Last Days" being shown in your Sales Analyzer "MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer diff --git a/_Development/DevSettings/settings.general.json b/_Development/DevSettings/settings.general.json index 4f9bb22..beb9ffe 100644 --- a/_Development/DevSettings/settings.general.json +++ b/_Development/DevSettings/settings.general.json @@ -12,11 +12,11 @@ "Exchange": "Bittrex", // The exchange your are running Profit Trailer on "StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer "TimezoneOffset": "+0:00", // Your timezone offset from UTC time - "MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor + //"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor "FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute "InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them "CoinMarketCapAPIKey": "", //CoinMarketCap Api - "FreeCurrencyConverterAPIKey": "" // If "MainFiatCurrency" above is anything other than USD, you must obtain an API key from https://free.currencyconverterapi.com/free-api-key + //"FreeCurrencyConverterAPIKey": "" // If "MainFiatCurrency" above is anything other than USD, you must obtain an API key from https://free.currencyconverterapi.com/free-api-key }, "Monitor": { "IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start @@ -28,6 +28,7 @@ "GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers "RefreshSeconds": 30, // The refresh interval of your monitor main page "LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it + "MaxSalesRecords": 99999, // The maximum number of sales records pulled from Profit Trailer. Changes require a Monitor Restart. "MaxTopMarkets": 20, // The amount of top markets being shown in your Sales Analyzer "MaxDailySummaries": 10, // The amount of "Last Days" being shown in your Sales Analyzer "MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer