Merge pull request #129 from HojouFotytu/develop
Monitor edits & Pending
This commit is contained in:
commit
740d255bb2
|
@ -71,7 +71,7 @@ namespace Core.Main.DataObjects
|
|||
{
|
||||
if (rawPTData.dcaLogData != null)
|
||||
{
|
||||
this.BuildDCALogData(rawPTData.dcaLogData, rawPTData.gainLogData, _systemConfiguration);
|
||||
this.BuildDCALogData(rawPTData.dcaLogData, rawPTData.gainLogData, rawPTData.pendingLogData, _systemConfiguration);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -245,7 +245,7 @@ namespace Core.Main.DataObjects
|
|||
}
|
||||
}
|
||||
|
||||
private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, PTMagicConfiguration systemConfiguration)
|
||||
private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, dynamic rawPendingLogData, PTMagicConfiguration systemConfiguration)
|
||||
{
|
||||
foreach (var rdld in rawDCALogData)
|
||||
{
|
||||
|
@ -399,6 +399,66 @@ namespace Core.Main.DataObjects
|
|||
|
||||
_dcaLog.Add(dcaLogData);
|
||||
}
|
||||
|
||||
foreach (var rpld in rawPendingLogData)
|
||||
{
|
||||
DCALogData dcaLogData = new DCALogData();
|
||||
dcaLogData.Amount = rpld.totalAmount;
|
||||
dcaLogData.BoughtTimes = 0;
|
||||
dcaLogData.Market = rpld.market;
|
||||
dcaLogData.ProfitPercent = rpld.profit;
|
||||
dcaLogData.AverageBuyPrice = rpld.avgPrice;
|
||||
dcaLogData.TotalCost = rpld.totalCost;
|
||||
dcaLogData.BuyTriggerPercent = rpld.buyProfit;
|
||||
dcaLogData.CurrentPrice = rpld.currentPrice;
|
||||
dcaLogData.SellTrigger = rpld.triggerValue == null ? 0 : rpld.triggerValue;
|
||||
dcaLogData.PercChange = rpld.percChange;
|
||||
dcaLogData.BuyStrategy = rpld.buyStrategy == null ? "" : rpld.buyStrategy;
|
||||
dcaLogData.SellStrategy = rpld.sellStrategy == null ? "" : rpld.sellStrategy;
|
||||
dcaLogData.IsTrailing = false;
|
||||
|
||||
if (rpld.sellStrategies != null)
|
||||
{
|
||||
foreach (var ss in rpld.sellStrategies)
|
||||
{
|
||||
Strategy sellStrategy = new Strategy();
|
||||
sellStrategy.Type = ss.type;
|
||||
sellStrategy.Name = ss.name;
|
||||
sellStrategy.EntryValue = ss.entryValue;
|
||||
sellStrategy.EntryValueLimit = ss.entryValueLimit;
|
||||
sellStrategy.TriggerValue = ss.triggerValue;
|
||||
sellStrategy.CurrentValue = ss.currentValue;
|
||||
sellStrategy.CurrentValuePercentage = ss.currentValuePercentage;
|
||||
sellStrategy.Decimals = ss.decimals;
|
||||
sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
|
||||
dcaLogData.SellStrategies.Add(sellStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//Convert Unix Timestamp to Datetime
|
||||
System.DateTime rpldDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
||||
rpldDateTime = rpldDateTime.AddSeconds((double)rpld.firstBoughtDate).ToUniversalTime();
|
||||
|
||||
// Profit Trailer bought times are saved in UTC
|
||||
if (rpld.firstBoughtDate > 0)
|
||||
{
|
||||
DateTimeOffset ptFirstBoughtDate = DateTimeOffset.Parse(rpldDateTime.Year.ToString() + "-" + rpldDateTime.Month.ToString("00") + "-" + rpldDateTime.Day.ToString("00") + "T" + rpldDateTime.Hour.ToString("00") + ":" + rpldDateTime.Minute.ToString("00") + ":" + rpldDateTime.Second.ToString("00"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||
|
||||
// Convert UTC bought time to local offset time
|
||||
TimeSpan offsetTimeSpan = TimeSpan.Parse(systemConfiguration.GeneralSettings.Application.TimezoneOffset.Replace("+", ""));
|
||||
ptFirstBoughtDate = ptFirstBoughtDate.ToOffset(offsetTimeSpan);
|
||||
|
||||
dcaLogData.FirstBoughtDate = ptFirstBoughtDate.DateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
dcaLogData.FirstBoughtDate = Constants.confMinDate;
|
||||
}
|
||||
|
||||
_dcaLog.Add(dcaLogData);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildBuyLogData(dynamic rawBuyLogData)
|
||||
|
|
|
@ -25,14 +25,11 @@
|
|||
currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
||||
}
|
||||
}
|
||||
<th class="text-left">Estimated Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history, entries on the Transactions page and any currently held positions."></i></small></th>
|
||||
<th class="text-right">Starting Account Value: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting value found in your settings file"></i></small></th>
|
||||
<th class="m-t-0 header-title text-left">Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history, entries on the Transactions page and any currently held positions."></i></small></th>
|
||||
<th class="text-right">Starting Value: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting value found in your settings file"></i></small></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<h4 class="m-t-0 header-title text-center"></h4>
|
||||
<h4 class="m-t-0 header-title text-center"></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<link href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/css/tablesaw.css" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5 px-1">
|
||||
<div class="card-box px-2" style="height:305px;">
|
||||
|
@ -24,7 +23,14 @@
|
|||
</div>
|
||||
<div class="col-md-2 px-1">
|
||||
<div class="card-box px-2" style="height:305px;">
|
||||
<h4 class="m-t-0 header-title">Asset Distribution</h4>
|
||||
@{
|
||||
double currentBalance = Model.PTData.GetCurrentBalance();
|
||||
string currentBalanceString = currentBalance.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"));
|
||||
if (currentBalance > 100) {
|
||||
currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
||||
}
|
||||
}
|
||||
<div class="text-center"><small>TCV: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> </small></div>
|
||||
<div id="AssetDistribution">
|
||||
<svg style="height:290px;width:100%"></svg>
|
||||
</div>
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace Monitor.Pages {
|
|||
public string LastGlobalSetting = "Default";
|
||||
public DateTimeOffset DateTimeNow = Constants.confMinDate;
|
||||
public string AssetDistributionData = "";
|
||||
public double currentBalance = 0;
|
||||
public string currentBalanceString = "";
|
||||
public void OnGet() {
|
||||
// Initialize Config
|
||||
base.Init();
|
||||
|
@ -149,7 +151,6 @@ namespace Monitor.Pages {
|
|||
AssetDistributionData += "{label: 'Pairs',color: '#82E0AA',value: " + PairsBalance.ToString() + "},";
|
||||
AssetDistributionData += "{label: 'DCA',color: '#D98880',value: " + DCABalance.ToString() + "},";
|
||||
AssetDistributionData += "{label: 'Pending',color: '#F5B041',value: " + PendingBalance.ToString() + "},";
|
||||
AssetDistributionData += "{label: 'Dust',color: '#BB8FCE',value: " + DustBalance.ToString() + "},";
|
||||
AssetDistributionData += "{label: 'Balance',color: '#85C1E9',value: " + AvailableBalance.ToString() + "}]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@
|
|||
|
||||
<div class="col-md-7 px-1">
|
||||
<div class="card-box px-2">
|
||||
<h4 class="m-t-0 m-b-20 header-title"><b>Pairs & DCA (@Model.PTData.DCALog.Count)</b><small id="baglist-refresh-icon"></small><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BagAnalyzer">more</a></small></h4>
|
||||
<h4 class="m-t-0 m-b-20 header-title"><b>Pairs / DCA / Pending (@Model.PTData.DCALog.Count)</b><small id="baglist-refresh-icon"></small><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BagAnalyzer">more</a></small></h4>
|
||||
|
||||
@if (Model.PTData.DCALog.Count == 0) {
|
||||
|
||||
<p>Your Profit Trailer did not buy anything so far that's worth analyzing.</p>
|
||||
<p>Profit Trailer is not reporting any holdings on your exchange.</p>
|
||||
|
||||
} else {
|
||||
|
||||
|
|
Loading…
Reference in New Issue