Example #1
0
        public override void loadData()
        {
            if (isLoading)
            {
                return;
            }

            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            string selectedType = this.SelectedType;

            if (string.IsNullOrEmpty(selectedType))
            {
                selectedType = SharedData.SelectedType;
            }

            isLoading = true;
            List <S_CandleItemData> sourceDatas = LoadData(itemCode, selectedType);

            isLoading = false;

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

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

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

            int averageCount = 9;

            if (timeInterval == TimeIntervalEnum.Minute_01 ||
                timeInterval == TimeIntervalEnum.Minute_05 ||
                timeInterval == TimeIntervalEnum.Minute_10 ||
                timeInterval == TimeIntervalEnum.Minute_30)
            {
                averageCount = 9;
            }

            var pAverageDatas = PPUtils.GetAverageDatas(itemCode, plusQuantumDatas, averageCount);
            var mAverageDatas = PPUtils.GetAverageDatas(itemCode, minusQuantumDatas, averageCount);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
            chart.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
        }
Example #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);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.

            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";
            }
        }