Work on StopLimits
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eremex.AvaloniaUI.Charts;
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.Utils;
|
||||
using PortfolioManager.DataSeriesViewModels;
|
||||
|
||||
namespace PortfolioManager.Models
|
||||
@@ -37,5 +38,25 @@ namespace PortfolioManager.Models
|
||||
};
|
||||
return compositeDataSource;
|
||||
}
|
||||
|
||||
public static CompositeDataSource CreateCompositeDataSource(DateTime xSource,StopLimits stopLimits)
|
||||
{
|
||||
if (null == stopLimits || 0 == stopLimits.Count) return Empty();
|
||||
foreach(StopLimit stopLimit in stopLimits)
|
||||
{
|
||||
stopLimit.EffectiveDate = xSource;
|
||||
}
|
||||
SortedDateTimeDataAdapter sortedDateTimeDataAdapter = new SortedDateTimeDataAdapter();
|
||||
List<StopLimit> sortedStopLimits = stopLimits.OrderBy(x => x.EffectiveDate).ToList();
|
||||
foreach (StopLimit stopLimit in sortedStopLimits)
|
||||
{
|
||||
sortedDateTimeDataAdapter.Add(stopLimit.EffectiveDate, stopLimit.StopPrice);
|
||||
}
|
||||
CompositeDataSource compositeDataSource = new CompositeDataSource()
|
||||
{
|
||||
DataAdapter = sortedDateTimeDataAdapter
|
||||
};
|
||||
return compositeDataSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user