public void Create() { if (m_options != null) return; m_options = new CMTRangeChartOptions(); cmbMarket1.AddItems(LiveMarkets.Markets); cmbMarket1.Bind(m_options, "Market1", new Validators.EnumDescValidator(BondMarket.None)); cmbMarket2.AddItems(LiveMarkets.Markets.Concat(new[] {BondMarket.None}).ToArray()); cmbMarket2.Bind(m_options, "Market2", new Validators.EnumDescValidator(BondMarket.None)); boundTextBox1.Bind(m_options, "Lookback", new Validators.IntValidator()); }
public void Create(CMTRangeChartData data_, CMTRangeChartOptions options_) { setupStuff(); BoxSetSeries series = (BoxSetSeries)ultraChart1.CompositeChart.Series[0]; series.BoxSets.Clear(); m_lineData_dt.Rows.Clear(); Array.ForEach(m_liveUpdaters.ToArray(), x => x.Dispose()); m_liveUpdaters.Clear(); if (data_ == null || data_.Historical == null) return; var values = data_.Historical.TakeEndValues(options_.Lookback); foreach(var point in CMTLine.DisplayPoints) { var fieldValues = values.GetColumnValues((int)point-1); if (fieldValues.Any(x => double.IsInfinity(x) || double.IsNaN(x))) continue; var last = data_.LiveLine[(int)point]; var label = string.Format("{0}Y", point); QuickSort.Sort(fieldValues); series.BoxSets.Add(new BoxSet() { Label = label, Min = fieldValues[0], Max = fieldValues.Last(), Q1 = fieldValues[(int)fieldValues.Length / 4], Q2 = fieldValues.Average(), Q3 = fieldValues[(int)fieldValues.Length / 4 * 3] }); var row = m_lineData_dt.LoadDataRow(new object[] { label, last }, true); m_liveUpdaters.Add(new LivePointUpdater(row, data_.LiveLine, (int)point)); } }
public static CMTRangeChartData GetRangeChartData(CMTRangeChartOptions options_, Focus focus_) { if (options_ == null || options_.Market1==BondMarket.None) return null; // if second market is 'None' then we're just looking to get CMT data for the single country if (options_.Market2 == BondMarket.None || options_.Market2 == options_.Market1) return new CMTRangeChartData() { Historical = GetHistoricalCMT(options_.Market1, focus_), LiveLine = CountryBondSource.GetInstance(options_.Market1).GetSmoothCurveGroupForFocus(options_.Focus).LiveCMT }; else { return new CMTRangeChartData() { Historical = GetHistoricalSpreads(options_.Market1, options_.Market2, focus_), LiveLine = GetCMTSpreadLiveDiff(options_.Market1, options_.Market2, options_.Focus) }; } }