Exemplo n.º 1
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.
            //SetChangeOpenPrice(itemCode, sourceDatas);

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
            List <S_CandleItemData> rcSDatas1, rcSDatas2;

            if (IsUseDetailCal)
            {
                if (IsUseAverageData)
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas2(itemCode, averageDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas2(itemCode, averageDatas, 5, true);
                }
                else
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas2(itemCode, sourceDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas2(itemCode, sourceDatas, 5, true);
                }
            }
            else
            {
                if (IsUseAverageData)
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas(itemCode, averageDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas(itemCode, averageDatas, 5, true);
                }
                else
                {
                    rcSDatas1 = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, false);
                    rcSDatas2 = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, true);
                }
            }

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, rcSDatas1[0].DTime);

            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, rcSDatas1, base.timeInterval, 9);
            chart3.LoadDataAndApply(itemCode, rcSDatas2, base.timeInterval, 9);

            //chart2.SetDataPointColor(Color.Black, Color.Black, Color.Black);
            //chart3.SetDataPointColor(Color.Black, Color.Black, Color.Black);
        }
Exemplo n.º 2
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);

            string chartTitle = "양자::";

            if (OriginSourceType == OriginSourceTypeEnum.Normal)
            {
                chartTitle += "Orgin::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Whim)
            {
                sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true);
                chartTitle += "Whim::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Second)
            {
                sourceDatas = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, false);
                chartTitle += "Second::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.SecondQutum)
            {
                sourceDatas = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, true);
                chart1.SetCandleColor(0, "Blue", "Red");
                chart2.SetCandleColor(0, "Blue", "Red");
                chart3.SetCandleColor(0, "Blue", "Red");
                chart4.SetCandleColor(0, "Blue", "Red");

                chartTitle += "SQutum::";
            }

            if (true || AverageType == AverageTypeEnum.Normal)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 5);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart1.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart2.LoadDataAndApply(itemCode, averageDatas, averageDatas, base.timeInterval, 5);
                chart1.Title = chartTitle + "Normal";
                chart2.Title = chartTitle + "Normal";
            }
            if (true || AverageType == AverageTypeEnum.Balanced)
            {
                var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 4);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart3.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart3.Title = chartTitle + "Balanced";
            }
            if (true || AverageType == AverageTypeEnum.Accumulated)
            {
                var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart4.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart4.Title = chartTitle + "Accumulated";
            }
        }
Exemplo n.º 3
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.

            var quantumDatas      = PPUtils.GetANodeDatas(sourceDatas);
            var plusQuantumDatas  = quantumDatas.plusList;
            var minusQuantumDatas = quantumDatas.minusList;

            //SetChangeOpenPrice(itemCode, plusQuantumDatas);
            //SetChangeOpenPrice(itemCode, minusQuantumDatas);

            string chartTitle = "ANode::";

            if (OriginSourceType == OriginSourceTypeEnum.Normal)
            {
                chartTitle += "Orgin::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Whim)
            {
                plusQuantumDatas  = PPUtils.GetRecreateWhimDatas(itemCode, plusQuantumDatas, true);
                minusQuantumDatas = PPUtils.GetRecreateWhimDatas(itemCode, minusQuantumDatas, true);
                chartTitle       += "Whim::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Second)
            {
                plusQuantumDatas  = PPUtils.GetRecreateSecondDatas(itemCode, plusQuantumDatas, 5, false);
                minusQuantumDatas = PPUtils.GetRecreateSecondDatas(itemCode, minusQuantumDatas, 5, false);
                chartTitle       += "Second::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.SecondQutum)
            {
                plusQuantumDatas  = PPUtils.GetRecreateSecondDatas(itemCode, plusQuantumDatas, 5, true);
                minusQuantumDatas = PPUtils.GetRecreateSecondDatas(itemCode, minusQuantumDatas, 5, true);
                chartTitle       += "SQutum::";
            }

            if (true || AverageType == AverageTypeEnum.Normal)
            {
                var averageDatas  = PPUtils.GetAverageDatas(itemCode, sourceDatas, 5);
                var pAverageDatas = PPUtils.GetAverageDatas(itemCode, plusQuantumDatas, 5);
                var mAverageDatas = PPUtils.GetAverageDatas(itemCode, minusQuantumDatas, 5);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart1.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart2.LoadDataAndApply(itemCode, averageDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart1.Title = chartTitle + "Normal";
                chart2.Title = chartTitle + "Normal";
            }
            if (true || AverageType == AverageTypeEnum.Balanced)
            {
                var averageDatas  = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 4);
                var pAverageDatas = PPUtils.GetBalancedAverageDatas(itemCode, plusQuantumDatas, 4);
                var mAverageDatas = PPUtils.GetBalancedAverageDatas(itemCode, minusQuantumDatas, 4);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart3.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart3.Title = chartTitle + "Balanced";
            }
            if (true || AverageType == AverageTypeEnum.Accumulated)
            {
                var averageDatas  = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
                var pAverageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, plusQuantumDatas, 9);
                var mAverageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, minusQuantumDatas, 9);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart4.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart4.Title = chartTitle + "Accumulated";
            }
        }