Removed Obsolete SellLog code
This commit is contained in:
parent
d45ac106ad
commit
b6bba9deea
|
@ -61,7 +61,7 @@ namespace Core.Main.DataObjects.PTMagicData
|
||||||
public int RefreshSeconds { get; set; } = 30;
|
public int RefreshSeconds { get; set; } = 30;
|
||||||
public int BagAnalyzerRefreshSeconds { get; set; } = 5;
|
public int BagAnalyzerRefreshSeconds { get; set; } = 5;
|
||||||
public int BuyAnalyzerRefreshSeconds { get; set; } = 5;
|
public int BuyAnalyzerRefreshSeconds { get; set; } = 5;
|
||||||
public int MaxSalesRecords { get; set; } = 99999;
|
//public int MaxSalesRecords { get; set; } = 99999;
|
||||||
public int MaxTopMarkets { get; set; } = 20;
|
public int MaxTopMarkets { get; set; } = 20;
|
||||||
public int MaxDailySummaries { get; set; } = 10;
|
public int MaxDailySummaries { get; set; } = 10;
|
||||||
public int MaxMonthlySummaries { get; set; } = 10;
|
public int MaxMonthlySummaries { get; set; } = 10;
|
||||||
|
@ -399,20 +399,20 @@ namespace Core.Main.DataObjects.PTMagicData
|
||||||
public double Last24hVolume { get; set; } = 0;
|
public double Last24hVolume { get; set; } = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SellLogData
|
// public class SellLogData
|
||||||
{
|
// {
|
||||||
public double SoldAmount { get; set; }
|
// public double SoldAmount { get; set; }
|
||||||
public DateTime SoldDate { get; set; }
|
// public DateTime SoldDate { get; set; }
|
||||||
public int BoughtTimes { get; set; }
|
// public int BoughtTimes { get; set; }
|
||||||
public string Market { get; set; }
|
// public string Market { get; set; }
|
||||||
public double ProfitPercent { get; set; }
|
// public double ProfitPercent { get; set; }
|
||||||
public double Profit { get; set; }
|
// public double Profit { get; set; }
|
||||||
public double AverageBuyPrice { get; set; }
|
// public double AverageBuyPrice { get; set; }
|
||||||
public double TotalCost { get; set; }
|
// public double TotalCost { get; set; }
|
||||||
public double SoldPrice { get; set; }
|
// public double SoldPrice { get; set; }
|
||||||
public double SoldValue { get; set; }
|
// public double SoldValue { get; set; }
|
||||||
public double TotalSales { get; set; }
|
// public double TotalSales { get; set; }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public class StatsData
|
public class StatsData
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Core.Main.DataObjects
|
||||||
get { return _totalSales; }
|
get { return _totalSales; }
|
||||||
set { _totalSales = value; }
|
set { _totalSales = value; }
|
||||||
}
|
}
|
||||||
private List<SellLogData> _sellLog = new List<SellLogData>();
|
//private List<SellLogData> _sellLog = new List<SellLogData>();
|
||||||
private List<DCALogData> _dcaLog = new List<DCALogData>();
|
private List<DCALogData> _dcaLog = new List<DCALogData>();
|
||||||
private List<BuyLogData> _buyLog = new List<BuyLogData>();
|
private List<BuyLogData> _buyLog = new List<BuyLogData>();
|
||||||
private string _ptmBasePath = "";
|
private string _ptmBasePath = "";
|
||||||
|
@ -46,7 +46,7 @@ namespace Core.Main.DataObjects
|
||||||
private DateTime _monthlyStatsRefresh = DateTime.UtcNow;
|
private DateTime _monthlyStatsRefresh = DateTime.UtcNow;
|
||||||
private DateTime _statsRefresh = DateTime.UtcNow;
|
private DateTime _statsRefresh = DateTime.UtcNow;
|
||||||
private DateTime _buyLogRefresh = DateTime.UtcNow;
|
private DateTime _buyLogRefresh = DateTime.UtcNow;
|
||||||
private DateTime _sellLogRefresh = DateTime.UtcNow;
|
//private DateTime _sellLogRefresh = DateTime.UtcNow;
|
||||||
private DateTime _dcaLogRefresh = DateTime.UtcNow;
|
private DateTime _dcaLogRefresh = DateTime.UtcNow;
|
||||||
private DateTime _miscRefresh = DateTime.UtcNow;
|
private DateTime _miscRefresh = DateTime.UtcNow;
|
||||||
private DateTime _propertiesRefresh = DateTime.UtcNow;
|
private DateTime _propertiesRefresh = DateTime.UtcNow;
|
||||||
|
@ -585,56 +585,56 @@ namespace Core.Main.DataObjects
|
||||||
Order = monthlyStatsDataJson["order"],
|
Order = monthlyStatsDataJson["order"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public List<SellLogData> SellLog
|
// public List<SellLogData> SellLog
|
||||||
{
|
// {
|
||||||
get
|
// get
|
||||||
{
|
// {
|
||||||
|
|
||||||
if (_sellLog == null || (DateTime.UtcNow > _sellLogRefresh))
|
// if (_sellLog == null || (DateTime.UtcNow > _sellLogRefresh))
|
||||||
{
|
// {
|
||||||
lock (_sellLock)
|
// lock (_sellLock)
|
||||||
{
|
// {
|
||||||
// Thread double locking
|
// // Thread double locking
|
||||||
if (_sellLog == null || (DateTime.UtcNow > _sellLogRefresh))
|
// if (_sellLog == null || (DateTime.UtcNow > _sellLogRefresh))
|
||||||
{
|
// {
|
||||||
_sellLog.Clear();
|
// _sellLog.Clear();
|
||||||
|
|
||||||
|
|
||||||
// Page through the sales data summarizing it.
|
// // Page through the sales data summarizing it.
|
||||||
bool exitLoop = false;
|
// bool exitLoop = false;
|
||||||
int pageIndex = 1;
|
// int pageIndex = 1;
|
||||||
|
|
||||||
// 1 record per page to allow user to set max records to retrieve
|
// // 1 record per page to allow user to set max records to retrieve
|
||||||
int maxPages = _systemConfiguration.GeneralSettings.Monitor.MaxSalesRecords;
|
// int maxPages = _systemConfiguration.GeneralSettings.Monitor.MaxSalesRecords;
|
||||||
int requestedPages = 0;
|
// int requestedPages = 0;
|
||||||
|
|
||||||
while (!exitLoop && requestedPages < maxPages)
|
// while (!exitLoop && requestedPages < maxPages)
|
||||||
{
|
// {
|
||||||
var sellDataPage = GetDataFromProfitTrailer("/api/v2/data/sales?Page=1&perPage=1&sort=SOLDDATE&sortDirection=DESCENDING&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)
|
// if (sellDataPage != null && sellDataPage.data.Count > 0)
|
||||||
{
|
// {
|
||||||
// Add sales data page to collection
|
// // Add sales data page to collection
|
||||||
this.BuildSellLogData(sellDataPage);
|
// this.BuildSellLogData(sellDataPage);
|
||||||
pageIndex++;
|
// pageIndex++;
|
||||||
requestedPages++;
|
// requestedPages++;
|
||||||
Console.WriteLine($"Importing salesLog: {pageIndex}");
|
// Console.WriteLine($"Importing salesLog: {pageIndex}");
|
||||||
|
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
// All data retrieved
|
// // All data retrieved
|
||||||
exitLoop = true;
|
// exitLoop = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Update sell log refresh time
|
// // Update sell log refresh time
|
||||||
_sellLogRefresh = DateTime.UtcNow.AddSeconds(_systemConfiguration.GeneralSettings.Monitor.RefreshSeconds -1);
|
// _sellLogRefresh = DateTime.UtcNow.AddSeconds(_systemConfiguration.GeneralSettings.Monitor.RefreshSeconds -1);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return _sellLog;
|
// return _sellLog;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
public List<DCALogData> DCALog
|
public List<DCALogData> DCALog
|
||||||
|
@ -736,18 +736,18 @@ Console.WriteLine($"Importing salesLog: {pageIndex}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double GetSnapshotBalance(DateTime snapshotDateTime)
|
// public double GetSnapshotBalance(DateTime snapshotDateTime)
|
||||||
{
|
// {
|
||||||
double result = _misc.StartBalance;
|
// double result = _misc.StartBalance;
|
||||||
|
|
||||||
result += this.SellLog.FindAll(sl => sl.SoldDate.Date < snapshotDateTime.Date).Sum(sl => sl.Profit);
|
// result += this.SellLog.FindAll(sl => sl.SoldDate.Date < snapshotDateTime.Date).Sum(sl => sl.Profit);
|
||||||
result += this.TransactionData.Transactions.FindAll(t => t.UTCDateTime < snapshotDateTime).Sum(t => t.Amount);
|
// result += this.TransactionData.Transactions.FindAll(t => t.UTCDateTime < snapshotDateTime).Sum(t => t.Amount);
|
||||||
|
|
||||||
// Calculate holdings for snapshot date
|
// // Calculate holdings for snapshot date
|
||||||
result += this.DCALog.FindAll(pairs => pairs.FirstBoughtDate <= snapshotDateTime).Sum(pairs => pairs.CurrentValue);
|
// result += this.DCALog.FindAll(pairs => pairs.FirstBoughtDate <= snapshotDateTime).Sum(pairs => pairs.CurrentValue);
|
||||||
|
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private dynamic GetDataFromProfitTrailer(string callPath, bool arrayReturned = false)
|
private dynamic GetDataFromProfitTrailer(string callPath, bool arrayReturned = false)
|
||||||
{
|
{
|
||||||
|
@ -803,39 +803,39 @@ Console.WriteLine($"Importing salesLog: {pageIndex}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void BuildSellLogData(dynamic rawSellLogData)
|
// private void BuildSellLogData(dynamic rawSellLogData)
|
||||||
{
|
// {
|
||||||
foreach (var rsld in rawSellLogData.data)
|
// foreach (var rsld in rawSellLogData.data)
|
||||||
{
|
// {
|
||||||
SellLogData sellLogData = new SellLogData();
|
// SellLogData sellLogData = new SellLogData();
|
||||||
sellLogData.SoldAmount = rsld.soldAmount;
|
// sellLogData.SoldAmount = rsld.soldAmount;
|
||||||
sellLogData.BoughtTimes = rsld.boughtTimes;
|
// sellLogData.BoughtTimes = rsld.boughtTimes;
|
||||||
sellLogData.Market = rsld.market;
|
// sellLogData.Market = rsld.market;
|
||||||
sellLogData.ProfitPercent = rsld.profit;
|
// sellLogData.ProfitPercent = rsld.profit;
|
||||||
sellLogData.SoldPrice = rsld.currentPrice;
|
// sellLogData.SoldPrice = rsld.currentPrice;
|
||||||
sellLogData.AverageBuyPrice = rsld.avgPrice;
|
// sellLogData.AverageBuyPrice = rsld.avgPrice;
|
||||||
sellLogData.TotalCost = rsld.totalCost;
|
// sellLogData.TotalCost = rsld.totalCost;
|
||||||
sellLogData.Profit = rsld.profitCurrency;
|
// sellLogData.Profit = rsld.profitCurrency;
|
||||||
|
|
||||||
|
|
||||||
//Convert Unix Timestamp to Datetime
|
// //Convert Unix Timestamp to Datetime
|
||||||
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
// System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
||||||
dtDateTime = dtDateTime.AddSeconds((double)rsld.soldDate).ToUniversalTime();
|
// dtDateTime = dtDateTime.AddSeconds((double)rsld.soldDate).ToUniversalTime();
|
||||||
|
|
||||||
|
|
||||||
// Profit Trailer sales are saved in UTC
|
// // Profit Trailer sales are saved in UTC
|
||||||
DateTimeOffset ptSoldDate = DateTimeOffset.Parse(dtDateTime.Year.ToString() + "-" + dtDateTime.Month.ToString("00") + "-" + dtDateTime.Day.ToString("00") + "T" + dtDateTime.Hour.ToString("00") + ":" + dtDateTime.Minute.ToString("00") + ":" + dtDateTime.Second.ToString("00"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
// DateTimeOffset ptSoldDate = DateTimeOffset.Parse(dtDateTime.Year.ToString() + "-" + dtDateTime.Month.ToString("00") + "-" + dtDateTime.Day.ToString("00") + "T" + dtDateTime.Hour.ToString("00") + ":" + dtDateTime.Minute.ToString("00") + ":" + dtDateTime.Second.ToString("00"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
|
|
||||||
|
|
||||||
// Convert UTC sales time to local offset time
|
// // Convert UTC sales time to local offset time
|
||||||
|
|
||||||
ptSoldDate = ptSoldDate.ToOffset(OffsetTimeSpan);
|
// ptSoldDate = ptSoldDate.ToOffset(OffsetTimeSpan);
|
||||||
|
|
||||||
sellLogData.SoldDate = ptSoldDate.DateTime;
|
// sellLogData.SoldDate = ptSoldDate.DateTime;
|
||||||
|
|
||||||
_sellLog.Add(sellLogData);
|
// _sellLog.Add(sellLogData);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, dynamic rawPendingLogData, dynamic rawWatchModeLogData)
|
private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, dynamic rawPendingLogData, dynamic rawWatchModeLogData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Monitor.Pages
|
||||||
public string ProfitChartDataJSON = "";
|
public string ProfitChartDataJSON = "";
|
||||||
public string SalesChartDataJSON = "";
|
public string SalesChartDataJSON = "";
|
||||||
public IEnumerable<KeyValuePair<string, double>> TopMarkets = null;
|
public IEnumerable<KeyValuePair<string, double>> TopMarkets = null;
|
||||||
public DateTime MinSellLogDate = Constants.confMinDate;
|
//public DateTime MinSellLogDate = Constants.confMinDate;
|
||||||
public DateTimeOffset DateTimeNow = Constants.confMinDate;
|
public DateTimeOffset DateTimeNow = Constants.confMinDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -247,12 +247,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
@* <div class="form-group row">
|
||||||
<label class="col-md-4 col-form-label">Max Sales Records<i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The number of sales records PTMagic pulls from Profit Trailer. Changes require a Monitor Restart."></i></label>
|
<label class="col-md-4 col-form-label">Max Sales Records<i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The number of sales records PTMagic pulls from Profit Trailer. Changes require a Monitor Restart."></i></label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" class="form-control" name="Monitor_MaxSalesRecords" value="@Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxSalesRecords.ToString(new System.Globalization.CultureInfo("en-US"))">
|
<input type="text" class="form-control" name="Monitor_MaxSalesRecords" value="@Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxSalesRecords.ToString(new System.Globalization.CultureInfo("en-US"))">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> *@
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-4 col-form-label">Max Top Markets <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The amount of top markets being show in your Sales Analyzer."></i></label>
|
<label class="col-md-4 col-form-label">Max Top Markets <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The amount of top markets being show in your Sales Analyzer."></i></label>
|
||||||
|
@ -276,7 +276,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-4 col-form-label">Max Dashboard Buy Entries <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The amount of entries being shown in your dashboard for possible buys."></i></label>
|
<label class="col-md-4 col-form-label">Max Dashboard Buy Entries <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The amount of possible buys shown in your dashboard. Setting this to 0 completely hides the PBL table."></i></label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" class="form-control" name="Monitor_MaxDashboardBuyEntries" value="@Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries.ToString(new System.Globalization.CultureInfo("en-US"))">
|
<input type="text" class="form-control" name="Monitor_MaxDashboardBuyEntries" value="@Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries.ToString(new System.Globalization.CultureInfo("en-US"))">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace Monitor.Pages
|
||||||
PTMagicConfiguration.GeneralSettings.Monitor.BagAnalyzerRefreshSeconds = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_BagAnalyzerRefreshSeconds"], PTMagicConfiguration.GeneralSettings.Monitor.BagAnalyzerRefreshSeconds);
|
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.BuyAnalyzerRefreshSeconds = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_BuyAnalyzerRefreshSeconds"], PTMagicConfiguration.GeneralSettings.Monitor.BuyAnalyzerRefreshSeconds);
|
||||||
PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform = HttpContext.Request.Form["Monitor_LinkPlatform"];
|
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.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.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.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);
|
PTMagicConfiguration.GeneralSettings.Monitor.MaxMonthlySummaries = SystemHelper.TextToInteger(HttpContext.Request.Form["Monitor_MaxMonthlySummaries"], PTMagicConfiguration.GeneralSettings.Monitor.MaxMonthlySummaries);
|
||||||
|
|
|
@ -82,9 +82,9 @@
|
||||||
double sellTriggerPrice = Model.DCALogData.AverageBuyPrice + (Model.DCALogData.AverageBuyPrice * Model.DCALogData.SellTrigger / 100);
|
double sellTriggerPrice = Model.DCALogData.AverageBuyPrice + (Model.DCALogData.AverageBuyPrice * Model.DCALogData.SellTrigger / 100);
|
||||||
|
|
||||||
double averageProfitPercent = 0;
|
double averageProfitPercent = 0;
|
||||||
if (Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Count > 0) {
|
@* if (Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Count > 0) {
|
||||||
averageProfitPercent = Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Average(p => p.ProfitPercent);
|
averageProfitPercent = Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Average(p => p.ProfitPercent);
|
||||||
}
|
} *@
|
||||||
|
|
||||||
double investedFiatValue = Math.Round(Model.DCALogData.TotalCost * Model.Summary.MainMarketPrice, 2);
|
double investedFiatValue = Math.Round(Model.DCALogData.TotalCost * Model.Summary.MainMarketPrice, 2);
|
||||||
double currentValue = Math.Round(Model.DCALogData.Amount * Model.DCALogData.CurrentPrice, 8);
|
double currentValue = Math.Round(Model.DCALogData.Amount * Model.DCALogData.CurrentPrice, 8);
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
@page
|
|
||||||
@model SalesListModel
|
|
||||||
@{
|
|
||||||
Layout = null;
|
|
||||||
}
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title mt-0">Showing @Model.SellLog.Count sales for @Model.SalesTimeframe</h4>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<table id="sales-list" class="table table-sm">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Sold Time</th>
|
|
||||||
<th>Market</th>
|
|
||||||
<th class="text-right">Avg. Bought Price</th>
|
|
||||||
<th class="text-right">DCA</th>
|
|
||||||
<th class="text-right">Sold Price</th>
|
|
||||||
<th class="text-right">Sold Amount</th>
|
|
||||||
<th class="text-right">Bought Cost</th>
|
|
||||||
<th class="text-right">Sold Value</th>
|
|
||||||
<th class="text-right">Profit @Model.Summary.MainMarket</th>
|
|
||||||
<th class="text-right">Profit @Model.Summary.MainFiatCurrency</th>
|
|
||||||
<th class="text-right">Profit %</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (Core.Main.DataObjects.PTMagicData.SellLogData sellLogEntry in Model.SellLog) {
|
|
||||||
double profitFiat = Math.Round(sellLogEntry.Profit * Model.Summary.MainMarketPrice, 2);
|
|
||||||
<tr>
|
|
||||||
<td>@sellLogEntry.SoldDate.ToShortDateString() @sellLogEntry.SoldDate.ToLongTimeString()</td>
|
|
||||||
<td><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, sellLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@sellLogEntry.Market</a></td>
|
|
||||||
<td class="text-right">@sellLogEntry.AverageBuyPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right">
|
|
||||||
@if (sellLogEntry.BoughtTimes > 0) {
|
|
||||||
@sellLogEntry.BoughtTimes;
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
<td class="text-right">@sellLogEntry.SoldPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right">@sellLogEntry.SoldAmount.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right">@sellLogEntry.TotalCost.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right">@sellLogEntry.SoldValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right text-autocolor">@sellLogEntry.Profit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right text-autocolor">@profitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))</td>
|
|
||||||
<td class="text-right text-autocolor">@sellLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function () {
|
|
||||||
//Buttons examples
|
|
||||||
var table = $('#sales-list').DataTable({
|
|
||||||
lengthChange: false,
|
|
||||||
searching: false,
|
|
||||||
paging: false,
|
|
||||||
info: false,
|
|
||||||
ordering: false,
|
|
||||||
buttons: ['copy', 'excel', 'pdf']
|
|
||||||
});
|
|
||||||
|
|
||||||
table.buttons().container()
|
|
||||||
.appendTo('#sales-list_wrapper .col-md-6:eq(0)');
|
|
||||||
|
|
||||||
$('.btn-trend-relation').click(function () {
|
|
||||||
var relation = $(this).data('trend-relation');
|
|
||||||
|
|
||||||
$('.btn-trend-relation').addClass('btn-custom');
|
|
||||||
$(this).removeClass('btn-custom');
|
|
||||||
|
|
||||||
if (relation == 'absolute') {
|
|
||||||
$('#trends-absolute').removeClass('hidden');
|
|
||||||
$('#trends-relative').addClass('hidden');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$('#trends-absolute').addClass('hidden');
|
|
||||||
$('#trends-relative').removeClass('hidden');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
|
@ -1,49 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Core.Main;
|
|
||||||
using Core.Helper;
|
|
||||||
using Core.Main.DataObjects;
|
|
||||||
using Core.Main.DataObjects.PTMagicData;
|
|
||||||
using Core.MarketAnalyzer;
|
|
||||||
|
|
||||||
namespace Monitor.Pages {
|
|
||||||
public class SalesListModel : _Internal.BasePageModelSecure {
|
|
||||||
public ProfitTrailerData PTData = null;
|
|
||||||
private string salesDateString = "";
|
|
||||||
private string salesMonthString = "";
|
|
||||||
|
|
||||||
public string SalesTimeframe = "";
|
|
||||||
public DateTime SalesDate = Constants.confMinDate;
|
|
||||||
public List<SellLogData> SellLog = new List<SellLogData>();
|
|
||||||
|
|
||||||
public void OnGet() {
|
|
||||||
// Initialize Config
|
|
||||||
base.Init();
|
|
||||||
|
|
||||||
BindData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BindData() {
|
|
||||||
salesDateString = GetStringParameter("d", "");
|
|
||||||
salesMonthString = GetStringParameter("m", "");
|
|
||||||
|
|
||||||
PTData = this.PtDataObject;
|
|
||||||
|
|
||||||
if (!salesDateString.Equals("")) {
|
|
||||||
SalesDate = SystemHelper.TextToDateTime(salesDateString, Constants.confMinDate);
|
|
||||||
if (SalesDate != Constants.confMinDate) {
|
|
||||||
SalesTimeframe = SalesDate.ToShortDateString();
|
|
||||||
SellLog = PTData.SellLog.FindAll(sl => sl.SoldDate.Date == SalesDate.Date).OrderByDescending(sl => sl.SoldDate).ToList();
|
|
||||||
}
|
|
||||||
} else if (!salesMonthString.Equals("")) {
|
|
||||||
SalesDate = SystemHelper.TextToDateTime(salesMonthString + "-01", Constants.confMinDate);
|
|
||||||
if (SalesDate != Constants.confMinDate) {
|
|
||||||
SalesTimeframe = SalesDate.ToString("MMMM yyyy", new System.Globalization.CultureInfo("en-US"));
|
|
||||||
SellLog = PTData.SellLog.FindAll(sl => sl.SoldDate.Date.Month == SalesDate.Month && sl.SoldDate.Date.Year == SalesDate.Year).OrderByDescending(sl => sl.SoldDate).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,10 +11,8 @@
|
||||||
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
|
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
|
||||||
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
|
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
|
||||||
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
|
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
|
||||||
//"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
|
"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
|
"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": {
|
"Monitor": {
|
||||||
|
@ -28,7 +26,6 @@
|
||||||
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
|
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
|
||||||
"RefreshSeconds": 30, // The refresh interval of your monitor main page
|
"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
|
"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
|
"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
|
"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
|
"MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
|
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
|
||||||
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
|
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
|
||||||
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
|
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
|
||||||
//"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
|
||||||
"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
|
"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
|
"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
|
|
||||||
},
|
},
|
||||||
"Monitor": {
|
"Monitor": {
|
||||||
"IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start
|
"IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start
|
||||||
|
@ -28,7 +26,6 @@
|
||||||
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
|
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
|
||||||
"RefreshSeconds": 30, // The refresh interval of your monitor main page
|
"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
|
"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
|
"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
|
"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
|
"MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer
|
||||||
|
|
Loading…
Reference in New Issue