using System;
using System.Collections.Generic;
using System.Linq;
using MarketData.MarketDataModel;
using Microsoft.Research.DynamicDataDisplay.DataSources;

namespace TradeBlotter.Model
{
  public class StochasticsModel
  {
    private StochasticsModel()
    {
    }
    public static CompositeDataSource PcntK(Stochastics stochastics)
    {
      if (null == stochastics) return null;
      CompositeDataSource compositeDataSource;
      var xData = new EnumerableDataSource<DateTime>(stochastics.Select(x => x.Date.Date));
      xData.SetXMapping(x => (x.Ticks / 10000000000.0));
      var yData = new EnumerableDataSource<double>(stochastics.Select(y => y.PK));
      yData.SetYMapping(y => y);
      compositeDataSource = xData.Join(yData);
      return compositeDataSource;
    }
    public static CompositeDataSource PcntD(Stochastics stochastics)
    {
      if (null == stochastics) return null;
      CompositeDataSource compositeDataSource;
      var xData = new EnumerableDataSource<DateTime>(stochastics.Select(x => x.Date.Date));
      xData.SetXMapping(x => (x.Ticks / 10000000000.0));
      var yData = new EnumerableDataSource<double>(stochastics.Select(y => y.PD));
      yData.SetYMapping(y => y);
      compositeDataSource = xData.Join(yData);
      return compositeDataSource;
    }
  }
}
