Exemplo n.º 1
0
        public void StockListToChart(List <string> stockList)
        {
            GraphPane mPane = zedGraphControl1.GraphPane;//获取索引到GraphPane面板上

            //每一只股票的最新的一个值做比较
            Dictionary <string, double> stockDatDic = new Dictionary <string, double>();

            for (int j = 0; j < stockList.Count; j++)
            {
                //内部把token和Url,日期,数据周期,等参数封包了,只暴露了股票代码参数,默认从20190601开始的数据
                StockData             sData1 = HttpHelper.PostUrl(stockList[j]);
                List <List <string> > maList = sData1.HoladMaList();
                maList.Reverse();

                PointPairList dataList = new PointPairList();

                for (int i = 0; i < maList.Count; i++)
                {
                    PointPair pairData = new PointPair();

                    double x = 0.00;
                    double.TryParse(maList[i][1], out x);

                    double y = 0.00;
                    double.TryParse(maList[i][4], out y);

                    pairData.X = x;
                    pairData.Y = y;

                    dataList.Add(pairData);
                }

                double dataLast = 0.00;
                double.TryParse(maList[maList.Count - 1][4], out dataLast);

                stockDatDic.Add(stockList[j], dataLast);

                LineItem mCure = mPane.AddCurve(stockList[j], dataList, GetRandomColor(), SymbolType.None);
                zedGraphControl1.AxisChange();//画到zedGraphControl1控件中,此句必加
            }

            //把最大的值作为最强的,最小的最为最弱的,作为标题方便查看
            //按照Value降序排列选出最大和最小的值的那只股票
            string minkey = stockDatDic.Keys.Select(x => new { x, y = stockDatDic[x] }).OrderBy(x => x.y).First().x;
            string maxkey = stockDatDic.Keys.Select(x => new { x, y = stockDatDic[x] }).OrderByDescending(x => x.y).First().x;

            string title = string.Format("Max:{0},Min:{1}", maxkey, minkey);

            this.Text = title;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据板块和个股数据源获取各个股票的数据以及处理的数据
        /// </summary>
        public static void BKStockDatList(BanKuaiDta data)
        {
            Dictionary <string, List <List <string> > > stockDataDic = new Dictionary <string, List <List <string> > >();

            for (int j = 0; j < data.BanKuaiStockList.Count; j++)
            {
                //内部把token和Url,日期,数据周期,等参数封包了,只暴露了股票代码参数,默认从20190601开始的数据
                StockData             sData1 = HttpHelper.PostUrl(data.BanKuaiStockList[j]);
                List <List <string> > maList = sData1.HoladMaList();

                if (maList.Count <= 0)
                {
                    continue;
                }
                maList.Reverse();

                stockDataDic.Add(data.BanKuaiStockList[j], maList);
            }

            m_banKuaiStockDataDic.Add(data.BanKuaiName, stockDataDic);
        }