29 lines
987 B
C#
29 lines
987 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using MarketData.MarketDataModel;
|
|
using MarketData.Numerical;
|
|
using Microsoft.Research.DynamicDataDisplay.DataSources;
|
|
using MarketData;
|
|
|
|
namespace TradeBlotter.Model
|
|
{
|
|
public class DividendLoadModel
|
|
{
|
|
private DividendLoadModel()
|
|
{
|
|
}
|
|
public static CompositeDataSource GenerateCompositeDataSource(DividendLoadCollection dividendLoadCollection)
|
|
{
|
|
if (null == dividendLoadCollection || 0 == dividendLoadCollection.Count) return null;
|
|
CompositeDataSource compositeDataSource;
|
|
var xData = new EnumerableDataSource<DateTime>(dividendLoadCollection.Select(x => new DateTime(x.Year,12,31)));
|
|
xData.SetXMapping(x => (x.Ticks / 10000000000.0));
|
|
var yData = new EnumerableDataSource<double>(dividendLoadCollection.Select(y => y.DividendLoadPcnt));
|
|
yData.SetYMapping(y => y);
|
|
compositeDataSource = xData.Join(yData);
|
|
return compositeDataSource;
|
|
}
|
|
}
|
|
}
|