public HistSeriesChartViewModel()
        {
            var rollsetting = new RollSettings {DataSource = RollDataSource.CarbonLive};
            futureRollCache = new FutureRollCache(rollsetting);   // we use carbon live for this.
            futureContracts = FutureContractsFactory.CreateFutureContracts();

            var task = new Task(() =>
            {
                try
                {
                    var bonds = Generator.Go(Generator.CashBondRolling.Monthly);
                            var dictionary = new Dictionary<BondCurves, List<CTDLine<BondSpreads>>>
                      {
                        {BondCurves.USD3mLibor, Generator.GetSpreads(bonds, BondCurves.USD3mLibor)}
                      };

                      m_cd = new ChartDataSource(chartComponents_: new[]
                                {
                                new ChartComponent(),
                                new ChartComponent(),
                                new ChartComponent()
                                },
                                            bonds_: bonds,
                                            spreads_: dictionary
                                            );
                        
                      // subscribe to live curve and live bonds
                      m_live = new LiveDataModel(bonds.Last());
                    
                }
                catch (Exception ex_)
                {
                    Logger.Error("Error building CTD data for seasonality application", typeof(HistSeriesChartViewModel), ex_);
                }
            });

            task.ContinueWith( t =>
            {
                // hook up carbon and live data result
                m_live.SubscribeForLiveCurveAndBondPrices();                
            });

            task.ContinueWith(t => m_live.BondSpreadModel().BondSpreadResultObservable().Where(b => b != null)
                                .ObserveOn(SynchronizationContext.Current)
                                .Subscribe(LiveChartUpdate), TaskScheduler.FromCurrentSynchronizationContext());
            task.Start();

        }
Ejemplo n.º 2
0
 public LiveBondSpreadModel(CTDLine<Bond> bond, LiveDataModel liveDataModel)
 {
     _bond = bond;
     _liveDataModel = liveDataModel;
 }
 public void ShouldGetLiveBondPrices()
 {
     // get the last ct/ctd bond
     var bond = Generator.Go(Generator.CashBondRolling.Monthly).Last();
     var liveDataModel = new LiveDataModel(bond);            
 }