diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 0489937..202b77b 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -361,6 +361,19 @@ namespace Core.Main.DataObjects.PTMagicData } #endregion + #region Properties Objects + public class Properties + { + public string Currency { get; set; } = ""; + public bool Shorting { get; set; } = false; + public bool Margin { get; set; } = false; + public string UpTime { get; set; } = ""; + public int Port { get; set; } = 0; + public bool IsLeverageExchange { get; set; } = false; + public string BaseUrl { get; set; } = ""; + } + #endregion + #region Transaction Objects public class Transaction { @@ -500,5 +513,15 @@ namespace Core.Main.DataObjects.PTMagicData public double DustValue { get; set; } public string Market { get; set; } } + public class PropertiesData + { + public string Currency { get; set; } + public bool Shorting { get; set; } + public bool Margin { get; set; } + public string UpTime { get; set; } + public int Port { get; set; } + public bool IsLeverageExchange { get; set; } + public string BaseUrl { get; set; } + } #endregion } diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index 230eb78..9cfa063 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -15,14 +15,15 @@ namespace Core.Main.DataObjects public class ProfitTrailerData { private SummaryData _summary = null; + private PropertiesData _properties = null; private List _sellLog = new List(); private List _dcaLog = new List(); private List _buyLog = new List(); private string _ptmBasePath = ""; private PTMagicConfiguration _systemConfiguration = null; private TransactionData _transactionData = null; - private DateTime _buyLogRefresh = DateTime.UtcNow, _sellLogRefresh = DateTime.UtcNow, _dcaLogRefresh = DateTime.UtcNow, _summaryRefresh = DateTime.UtcNow; - private volatile object _buyLock = new object(), _sellLock = new object(), _dcaLock = new object(), _summaryLock = new object(); + private DateTime _buyLogRefresh = DateTime.UtcNow, _sellLogRefresh = DateTime.UtcNow, _dcaLogRefresh = DateTime.UtcNow, _summaryRefresh = DateTime.UtcNow, _propertiesRefresh = DateTime.UtcNow; + private volatile object _buyLock = new object(), _sellLock = new object(), _dcaLock = new object(), _summaryLock = new object(), _propertiesLock = new object(); private TimeSpan? _offsetTimeSpan = null; // Constructor @@ -75,6 +76,26 @@ namespace Core.Main.DataObjects return _summary; } } + public PropertiesData Properties + { + get + { + if (_properties == null || (DateTime.UtcNow > _propertiesRefresh)) + { + lock (_propertiesLock) + { + // Thread double locking + if (_properties == null || (DateTime.UtcNow > _propertiesRefresh)) + { + _properties = BuildSummaryData(GetDataFromProfitTrailer("api/v2/data/properties")); + _propertiesRefresh = DateTime.UtcNow.AddSeconds(_systemConfiguration.GeneralSettings.Monitor.RefreshSeconds - 1); + } + } + } + + return _properties; + } + } public List SellLog { get @@ -286,7 +307,19 @@ namespace Core.Main.DataObjects DustValue = PTData.totalDustCurrentValue }; } - + private PropertiesData BuildProptertiesData(dynamic PTProperties) + { + return new PropertiesData() + { + Currency = PTProperties.currency, + Shorting = PTProperties.shorting, + Margin = PTProperties.margin, + UpTime = PTProperties.upTime, + Port = PTProperties.port, + IsLeverageExchange = PTProperties.isLeverageExchange, + BaseUrl = PTProperties.baseUrl + }; + } private void BuildSellLogData(dynamic rawSellLogData) { foreach (var rsld in rawSellLogData.data) diff --git a/Core/Helper/SystemHelper.cs b/Core/Helper/SystemHelper.cs index 398b403..73cd7d6 100644 --- a/Core/Helper/SystemHelper.cs +++ b/Core/Helper/SystemHelper.cs @@ -547,6 +547,19 @@ namespace Core.Helper result += pairName; } + else if (platform.Equals("TradingViewFutures")) + { + result = "https://www.tradingview.com/chart/?symbol="; + + string pairName = SystemHelper.StripBadCode(market, Constants.WhiteListMinimal); + + if (pairName.StartsWith(mainMarket)) + { + pairName = pairName.Replace(mainMarket, "") + mainMarket; + } + + result += pairName + "PERP"; + } else { switch (exchange) diff --git a/Monitor/Pages/SettingsGeneral.cshtml b/Monitor/Pages/SettingsGeneral.cshtml index 1fdfa3e..5447e0b 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml +++ b/Monitor/Pages/SettingsGeneral.cshtml @@ -241,8 +241,9 @@
diff --git a/Monitor/Pages/_get/BagDetails.cshtml b/Monitor/Pages/_get/BagDetails.cshtml index 273794f..88f2a35 100644 --- a/Monitor/Pages/_get/BagDetails.cshtml +++ b/Monitor/Pages/_get/BagDetails.cshtml @@ -125,9 +125,9 @@ DCA Buy Strategies @if (buyDisabled) { - @Html.Raw(buyStrategyText) + @Html.Raw(buyStrategyText) } else { - @Html.Raw(buyStrategyText) + @Html.Raw(buyStrategyText) } diff --git a/Monitor/Pages/_get/BagList.cshtml b/Monitor/Pages/_get/BagList.cshtml index b1f7eb4..2323bc1 100644 --- a/Monitor/Pages/_get/BagList.cshtml +++ b/Monitor/Pages/_get/BagList.cshtml @@ -110,9 +110,9 @@ // Buy strats @if (buyDisabled) { - @Html.Raw(buyStrategyText) + @Html.Raw(buyStrategyText) } else { - @Html.Raw(buyStrategyText) + @Html.Raw(buyStrategyText) } // BS Value @@ -144,7 +144,7 @@ } // Sell Strats - @Html.Raw(sellStrategyText) + @Html.Raw(sellStrategyText) // SSV @Html.Raw(currentSellValueText) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 188ea87..b1e0c91 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -18,9 +18,9 @@ Market - Ask - Volume - 24H + 24H + Volume + Ask Buy Strategies @@ -59,9 +59,9 @@ } else { @buyLogEntry.Market } - @buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) - @string.Format("{0}", (buyLogEntry.Volume24h).ToString()) @string.Format("{0}%", (buyLogEntry.PercChange * 100).ToString("#,#0.00")) + @string.Format("{0}", (buyLogEntry.Volume24).ToString()) + @buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @if (buyDisabled) { @Html.Raw(buyStrategyText) } else { diff --git a/_Development/ApiProperties.txt b/_Development/ApiProperties.txt new file mode 100644 index 0000000..01887ca --- /dev/null +++ b/_Development/ApiProperties.txt @@ -0,0 +1,61 @@ + +PT API properties (unavailable via swagger UI) +-------------------------------------------- + +{"sellOnlyMode":false +"role":"A" +"enableConfig":true +"enableShutdown":true +"passwordSet":true +"language":"ENUS" +"currency":"USD" +"skin":"dark" +"testMode":false +"shorting":true +"margin":false +"testnet":false +"activeConfig":"MyConfig1" +"availableConfigs":"[\"MyConfig1\" +\"MyConfig2\" +\"MyConfig3\" +\"MyConfig4\" +\"MyConfig5\"]" +"availableSignalProviders":"[]" +"publicConfigs":"[\"public-ProfitTrailer_Three_Amigos-V4\" +\"public-ProfitTrailer_Conners2RSI-V2\" +\"public-ProfitTrailer_Fibonacci_Day_Trader-V1\" +\"public-ProfitTrailer_Signals_Template-V2\" +\"public-AwesomeSignals_Starter-V1\" +\"public-ProfitTrailer_Nifty_Fifty-V1\" +\"public-CryptosetSignal_ADVconfig-V5\" +\"public-ProfitTrailer_Trade_Panther-V1\" +\"public-Collective_Signals_Template-V4\" +\"public-ProfitTrailer_Fibonacci_Swing_Trader-V2\" +\"public-ProfitTrailer_RocketMan-V2\" +\"public-ProfitTrailer_OldFaithful-V6\" +\"public-ProfitTrailer_FrankenStrategy-V8\" +\"public-ProfitTrailer_Jobbing_The_Market-V5\" +\"public-ProfitTrailer_Golden_Cross-V3\" +\"public-ProfitTrailer_Spanish_Cross-V5\" +\"public-ProfitTrailer_Monte_Carlo-V8\" +\"public-ProfitTrailer_Bride_of_FrankenStrategy-V5\" +\"public-ProfitTrailer_Base_Settings-V3\" +\"public-ProfitTrailer_DoubleCross-V8\" +\"public-ProfitTrailer_ElToro-V7\" +\"public-ProfitTrailer_ElDorado-V8\"]" +"myPublicConfigs":"[]" +"myProducts":"[]" +"isAllowedToPublish":false +"maxConfigsAllowed":13 +"licenseType":"PRO" +"upTime":"2020-07-17T15:30:44.140" +"port":8095 +"sslEnabled":false +"displayAdvancedStats":true +"displayFullVersion":true +"displayButtons":true +"isMarketOrderSupported":true +"isLeverageExchange":true +"hasTestNet":false +"isPTFeederEnabled":false +"baseUrl":"http://x.x.x.x:xxxx"} \ No newline at end of file