Files
TradeBlotter/Model/RSIModel.cs
2024-02-23 06:58:53 -05:00

26 lines
789 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using MarketData.MarketDataModel;
using Microsoft.Research.DynamicDataDisplay.DataSources;
namespace TradeBlotter.Model
{
public class RSIModel
{
private RSIModel()
{
}
public static CompositeDataSource Pcnt(RSICollection rsiCollection)
{
if (null == rsiCollection) return null;
CompositeDataSource compositeDataSource;
var xData = new EnumerableDataSource<DateTime>(rsiCollection.Select(x => x.Date.Date));
xData.SetXMapping(x => (x.Ticks / 10000000000.0));
var yData = new EnumerableDataSource<double>(rsiCollection.Select(y => y.RSI));
yData.SetYMapping(y => y);
compositeDataSource = xData.Join(yData);
return compositeDataSource;
}
}
}