get API properties
This commit is contained in:
parent
8c920665c2
commit
f93677b55a
|
@ -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
|
||||
{
|
||||
|
@ -486,6 +499,7 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public double CurrentPrice { get; set; }
|
||||
public int BoughtTimes { get; set; }
|
||||
public double PercChange { get; set; }
|
||||
public double Volume { get; set; }
|
||||
public List<Strategy> BuyStrategies { get; set; } = new List<Strategy>();
|
||||
}
|
||||
|
||||
|
@ -499,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
|
||||
}
|
||||
|
|
|
@ -15,14 +15,15 @@ namespace Core.Main.DataObjects
|
|||
public class ProfitTrailerData
|
||||
{
|
||||
private SummaryData _summary = null;
|
||||
private PropertiesData _properties = null;
|
||||
private List<SellLogData> _sellLog = new List<SellLogData>();
|
||||
private List<DCALogData> _dcaLog = new List<DCALogData>();
|
||||
private List<BuyLogData> _buyLog = new List<BuyLogData>();
|
||||
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<SellLogData> 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)
|
||||
|
@ -453,6 +486,7 @@ namespace Core.Main.DataObjects
|
|||
buyLogData.ProfitPercent = rbld.profit;
|
||||
buyLogData.CurrentPrice = rbld.currentPrice;
|
||||
buyLogData.PercChange = rbld.percChange;
|
||||
buyLogData.Volume = rbld.volume;
|
||||
|
||||
if (rbld.positive != null)
|
||||
{
|
||||
|
|
|
@ -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"}
|
Loading…
Reference in New Issue