Commit Latest

This commit is contained in:
2025-06-13 21:13:11 -04:00
parent 12b9c3cd72
commit 9bbfc9831f
7 changed files with 534 additions and 84 deletions

View File

@@ -4,6 +4,7 @@ using Eremex.AvaloniaUI.Charts;
using MarketData.MarketDataModel;
using MarketData.MarketDataModel.GainLoss;
using MarketData.Numerical;
using MarketData.Utils;
using PortfolioManager.DataSeriesViewModels;
namespace PortfolioManager.Models
@@ -27,16 +28,24 @@ namespace PortfolioManager.Models
{
if (null == price) return Empty();
SortedDateTimeDataAdapter sortedDateTimeDataAdapter = new SortedDateTimeDataAdapter();
sortedDateTimeDataAdapter.Add(price.Date, price.Close);
CompositeDataSource compositeDataSource = new CompositeDataSource()
{
DataAdapter = sortedDateTimeDataAdapter
};
return compositeDataSource;
}
// CompositeDataSource compositeDataSource;
// var xData = new EnumerableDataSource<DateTime>(new DateTime[]{price.Date});
// xData.SetXMapping(x => (x.Ticks / 10000000000.0));
// var yData = new EnumerableDataSource<double>(new double[]{price.Close});
// yData.SetYMapping(y => y);
// compositeDataSource = xData.Join(yData);
// return compositeDataSource;
return Empty();
public static CompositeDataSource CreateCompositeDataSource(DateTime xSource, double ySource)
{
if (Utility.IsEpoch(xSource)) return Empty();
SortedDateTimeDataAdapter sortedDateTimeDataAdapter = new SortedDateTimeDataAdapter();
sortedDateTimeDataAdapter.Add(xSource, ySource);
CompositeDataSource compositeDataSource = new CompositeDataSource()
{
DataAdapter = sortedDateTimeDataAdapter
};
return compositeDataSource;
}
// This is the active gain/loss as number or percent.