public ScriptChartContext GetWatchContext(DateTime dateFrom, DateTime dateTo)
        {
            ScriptChartContext context = new ScriptChartContext();

            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> spotRmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = TimeDoublePairUtil.ConvertToCurRate(spotRmds, 1.0F);

                data_10yr_spot.Legend = "10 yr spot data cur";
                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }

            {
                ScriptChartData data_10yr_future = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future.Data = TimeDoublePairUtil.ConvertToCurRate(rmds, 100.0F);
                data_10yr_future.Legend = "10 yr future data cur";

                context.ChartData.Add(data_10yr_future.Legend, data_10yr_future);
            }

            context.Description = "10yr future-spot chart.";

            return context;
        }
        public ScriptChartContext GetWatchContext(DateTime dateFrom, DateTime dateTo)
        {
            ScriptChartContext context = new ScriptChartContext();

            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> spotRmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = TimeDoublePairUtil.ConvertToCur(spotRmds, 1.0F);
                data_10yr_spot.Legend = "10 yr spot data cur";
                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);

                ScriptChartData data_10yr_future_regression = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future_regression.Data = TimeDoublePairUtil.ConvertToCur(rmds, 1.0F);
                data_10yr_future_regression.Data =
                    TimeDoublePairUtil.ConvertToRegression(data_10yr_future_regression.Data, data_10yr_spot.Data);
                data_10yr_future_regression.Legend = "10 yr future data cur regression";
                context.ChartData.Add(data_10yr_future_regression.Legend, data_10yr_future_regression);
            }

            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> rmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = TimeDoublePairUtil.ConvertToAsk(rmds, 1.0F);
                data_10yr_spot.Legend = "10 yr spot data ask";

                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }
            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> rmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = TimeDoublePairUtil.ConvertToBid(rmds, 1.0F);
                data_10yr_spot.Legend = "10 yr spot data bid";

                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }
            {
                ScriptChartData data_10yr_spot = new ScriptChartData();

                List<RawMarketData> spotRmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = TimeDoublePairUtil.ConvertToMid(spotRmds, 1.0F);
                data_10yr_spot.Legend = "10 yr spot data mid";
                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);

                ScriptChartData data_10yr_future_regression = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future_regression.Data = TimeDoublePairUtil.ConvertToMid(rmds, 1.0F);
                data_10yr_future_regression.Data =
                    TimeDoublePairUtil.ConvertToRegression(data_10yr_future_regression.Data, data_10yr_spot.Data);
                data_10yr_future_regression.Legend = "10 yr future data mid regression";
                context.ChartData.Add(data_10yr_future_regression.Legend, data_10yr_future_regression);
            }

            context.Description = "10yr future-spot chart.";

            return context;
        }
        void AddChartSeriesPoint(String legend, ScriptChartData data, ref double min, ref double max)
        {
            foreach (TimeDoublePair pair in data.Data)
            {
                double v = pair.DoubleValue;

                chart1.Series[legend].Points.AddXY(pair.TimeValue.ToString("HH:mm:ss.fff"), v);
                if (v > max)
                {
                    max = v;
                }

                if (v< min)
                {
                    min = v;
                }
            }
        }
Example #4
0
        public ScriptChartContext GetWatchContext(DateTime dateFrom, DateTime dateTo)
        {
            ScriptChartContext context = new ScriptChartContext();

            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> rmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = ConvertToCurPricesWithMultiplier(rmds, 1.0F);
                data_10yr_spot.Data = ConvertToDiffFromStart(data_10yr_spot.Data, _dataSpot10yr.GetFirstCurValue());
                data_10yr_spot.Legend = "10 yr spot data cur";

                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }
            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> rmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = ConvertToAskPricesWithMultiplier(rmds, 1.0F);
                data_10yr_spot.Data = ConvertToDiffFromStart(data_10yr_spot.Data, _dataSpot10yr.GetFirstCurValue());
                data_10yr_spot.Legend = "10 yr spot data ask";

                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }
            {
                ScriptChartData data_10yr_spot = new ScriptChartData();
                List<RawMarketData> rmds = _dataSpot10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_spot.Data = ConvertToBidPricesWithMultiplier(rmds, 1.0F);
                data_10yr_spot.Data = ConvertToDiffFromStart(data_10yr_spot.Data, _dataSpot10yr.GetFirstCurValue());
                data_10yr_spot.Legend = "10 yr spot data bid";

                context.ChartData.Add(data_10yr_spot.Legend, data_10yr_spot);
            }

            {
                ScriptChartData data_10yr_future = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future.Data = ConvertToCurPricesWithMultiplier(rmds, 100.0F);
                data_10yr_future.Data = ConvertToDiffFromStart(
                    data_10yr_future.Data, 100.0F * _dataFuture10yr.GetFirstCurValue());

                data_10yr_future.Legend = "10 yr future data cur";

                context.ChartData.Add(data_10yr_future.Legend, data_10yr_future);
            }
            {
                ScriptChartData data_10yr_future = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future.Data = ConvertToAskPricesWithMultiplier(rmds, 100.0F);
                data_10yr_future.Data = ConvertToDiffFromStart(
                    data_10yr_future.Data, 100.0F * _dataFuture10yr.GetFirstCurValue());

                data_10yr_future.Legend = "10 yr future data ask";

                context.ChartData.Add(data_10yr_future.Legend, data_10yr_future);
            }
            {
                ScriptChartData data_10yr_future = new ScriptChartData();
                List<RawMarketData> rmds = _dataFuture10yr.GetRmdData(dateFrom, dateTo);
                data_10yr_future.Data = ConvertToBidPricesWithMultiplier(rmds, 100.0F);
                data_10yr_future.Data = ConvertToDiffFromStart(
                    data_10yr_future.Data, 100.0F * _dataFuture10yr.GetFirstCurValue());

                data_10yr_future.Legend = "10 yr future data bid";

                context.ChartData.Add(data_10yr_future.Legend, data_10yr_future);
            }

            context.Description = "10yr future-spot chart.";

            return context;
        }