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);

            //원천 데이터를 변경하는 로직 추가
            sourceDatas = T_CandleAntiCandleItemData.GetFlow(sourceDatas);

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);

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

            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, averageDatas, base.timeInterval, 9);
        }
Exemple #2
0
        private void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            string code = dgv.Rows[e.RowIndex].Cells[0].Value as string;
            string name = dgv.Rows[e.RowIndex].Cells[1].Value as string;

            tbSelectedCode2.Text = code;
            tbSelectedName2.Text = name;

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetJongmokSiseData(code, "2", "0", "300");
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }
                int totalCnt = sourceDatas.Count;
                if (totalCnt > 300)
                {
                    sourceDatas.RemoveRange(0, totalCnt - 300);
                }
                var averageDatas = PPUtils.GetBalancedAverageDatas(code, sourceDatas, 4);
                sourceDatas      = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);

                chart.LoadDataAndApply(code, sourceDatas, averageDatas, TimeIntervalEnum.Day, 9);
                chart.SetYFormat("N0");
            });
        }
Exemple #3
0
        private void metroLabel5_Click(object sender, EventArgs e)
        {
            string code = tbSelectedCode2.Text;

            TimeIntervalEnum timeInterval    = chkTD.Checked ? TimeIntervalEnum.Day : TimeIntervalEnum.Week;
            string           timeIntervalStr = chkTD.Checked ? "2" : "3";

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetJongmokSiseData(code, timeIntervalStr, "0", "300");
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }
                int totalCnt = sourceDatas.Count;
                if (totalCnt > 300)
                {
                    sourceDatas.RemoveRange(0, totalCnt - 300);
                }

                var averageDatas = PPUtils.GetAverageDatas(code, sourceDatas, 9);
                sourceDatas      = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart.LoadDataAndApply(code, sourceDatas, averageDatas, averageDatas, timeInterval, 9);
                chart.SetYFormat("N0");
            });
        }
Exemple #4
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);
        }
Exemple #5
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);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, averageDatas, base.timeInterval, 9);
        }
Exemple #6
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);

            //if (true)
            //{
            //    double rate = 0.0;
            //    if (timeInterval == TimeIntervalEnum.Week) rate = 2.5;
            //    if (timeInterval == TimeIntervalEnum.Day) rate = 1.0;
            //    if (timeInterval == TimeIntervalEnum.Minute_180) rate = 0.7;
            //    if (timeInterval == TimeIntervalEnum.Minute_120) rate = 0.5;
            //    if (timeInterval == TimeIntervalEnum.Minute_60) rate = 0.3;
            //    sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true, rate, null);
            //}

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);

            //var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, averageDatas, base.timeInterval, 9);
        }
        private void lblTitlePgr_Click(object sender, EventArgs e)
        {
            string code = tbSelectedCode.Text;

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetUpJongSiseData(code, "2", "0", "100");
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }
                int totalCnt = sourceDatas.Count;
                if (totalCnt > 100)
                {
                    sourceDatas.RemoveRange(0, totalCnt - 100);
                }
                var averageDatas = PPUtils.GetAverageDatas(code, sourceDatas, 9);
                sourceDatas      = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart.LoadDataAndApply(code, sourceDatas, averageDatas, averageDatas, TimeIntervalEnum.Day, 9);
                chart.SetYFormat("N0");
            });
        }
Exemple #8
0
        private void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            string   code = dgv.Rows[e.RowIndex].Cells[1].Value as string;
            string   name = dgv.Rows[e.RowIndex].Cells[2].Value as string;
            DateTime dt   = Convert.ToDateTime(dgv.Rows[e.RowIndex].Cells[0].Value);

            tbSelectedCode2.Text = code;
            tbSelectedName2.Text = name;
            selectedNode         = dgv.Rows[e.RowIndex].Tag as XmlNode;
            selectedIndex        = e.RowIndex;

            TimeIntervalEnum timeInterval    = chkTD.Checked ? TimeIntervalEnum.Day : TimeIntervalEnum.Week;
            string           timeIntervalStr = chkTD.Checked ? "2" : "3";

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetJongmokSiseData(code, timeIntervalStr, "0", "300");
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }
                int totalCnt = sourceDatas.Count;
                if (totalCnt > 300)
                {
                    sourceDatas.RemoveRange(0, totalCnt - 300);
                }
                var averageDatas = PPUtils.GetAverageDatas(code, sourceDatas, 9);
                sourceDatas      = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart.LoadDataAndApply(code, sourceDatas, averageDatas, averageDatas, timeInterval, 9);
                chart.SetYFormat("N0");
                chart.ClearChartLabel("↓");
                chart.DisplayChartLabel(dt, Color.DarkRed, "↓", "↓");
            });
        }
Exemple #9
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            TimeIntervalEnum timeInterval = TimeIntervalEnum.Minute_60;

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

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

            if (sourceDatas != null && sourceDatas.Count > 0)
            {
                var averageDatas1 = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);
                var averageDatas2 = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
                var averageDatas3 = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);

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

                qMin1.LoadDataAndApply(itemCode, sourceDatas, timeInterval, 3);
                qMin2.LoadDataAndApply(itemCode, averageDatas1, timeInterval, 3);
                qMin3.LoadDataAndApply(itemCode, averageDatas2, timeInterval, 3);
                qMin4.LoadDataAndApply(itemCode, averageDatas3, timeInterval, 3);
            }
        }
Exemple #10
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;
            }
            for (int i = 0; i < sourceDatas.Count; i++)
            {
                int pIdx = i - 1 < 0 ? 0 : i - 1;
                int nIdx = i + 1 > sourceDatas.Count - 1 ? sourceDatas.Count - 1 : i + 1;

                sourceDatas[i].PreCandleItem  = sourceDatas[pIdx];
                sourceDatas[i].NextCandleItem = sourceDatas[nIdx];
            }
            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.
            //var removeGapSourceDatas = PPUtils.RemoveGapPrice(sourceDatas);

            int averageCount = 9;

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

            var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, averageCount);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
            chart.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
        }
Exemple #11
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";
            }
        }
Exemple #12
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);

            int averageCount = 9;

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

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, averageCount, false);

            //var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, averageCount);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
            chart1.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, averageCount);

            //var removeGapSourceDatas = PPUtils.RemoveGapPrice(sourceDatas);
            //var averageDatas2 = PPUtils.GetBalancedAverageDatas(itemCode, removeGapSourceDatas, 4);

            for (int i = 0; i < averageCount; i++)
            {
                averageDatas.RemoveAt(0);
            }

            averageDatas.RemoveAt(0);
            averageDatas.RemoveAt(0);
            averageDatas.RemoveAt(0);
            chart2.LoadDataAndApply(itemCode, averageDatas, averageDatas, timeInterval, averageCount);
        }
Exemple #13
0
        private void dgvList_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            string code = dgvList.Rows[e.RowIndex].Tag as string;
            string name = dgvList.Rows[e.RowIndex].Cells[0].Value as string;

            tbSelectedCode.Text = code;
            tbSelectedName.Text = name;

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetUpJongSiseData(code, "2", "0", "100");
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }
                int totalCnt = sourceDatas.Count;
                if (totalCnt > 100)
                {
                    sourceDatas.RemoveRange(0, totalCnt - 100);
                }
                var averageDatas = PPUtils.GetBalancedAverageDatas(code, sourceDatas, 4);
                sourceDatas      = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart.LoadDataAndApply(code, sourceDatas, averageDatas, TimeIntervalEnum.Day, 9);
                chart.SetYFormat("N0");
            });

            dgv.Rows.Clear();
            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetUpJongJongMokData(code);
                if (sourceDatas == null || sourceDatas.Count == 0)
                {
                    return;
                }

                foreach (var item in sourceDatas)
                {
                    this.Invoke(new Action(() => {
                        int rIdx = dgv.Rows.Add(item.종목코드
                                                , item.종목명
                                                , item.시가
                                                , item.고가
                                                , item.저가
                                                , item.현재가
                                                , item.전일대비구분
                                                , item.등락율 + "%"
                                                , item.전일대비
                                                , item.외인순매수
                                                , item.기관순매수
                                                , item.거래대금
                                                , item.거래증가율
                                                , item.시가총액
                                                );

                        // 1:상한 2:상승 3:보합 4:하한 5:하락
                        if (item.전일대비구분 == "1")
                        {
                            dgv.Rows[rIdx].Cells[6].Value                   = "▲";
                            dgv.Rows[rIdx].Cells[6].Style.ForeColor         =
                                dgv.Rows[rIdx].Cells[7].Style.ForeColor     =
                                    dgv.Rows[rIdx].Cells[8].Style.ForeColor = Color.Red;
                        }
                        else if (item.전일대비구분 == "2")
                        {
                            dgv.Rows[rIdx].Cells[6].Value                   = "△";
                            dgv.Rows[rIdx].Cells[6].Style.ForeColor         =
                                dgv.Rows[rIdx].Cells[7].Style.ForeColor     =
                                    dgv.Rows[rIdx].Cells[8].Style.ForeColor = Color.Red;
                        }
                        else if (item.전일대비구분 == "3")
                        {
                            dgv.Rows[rIdx].Cells[6].Value = "◇";
                        }
                        else if (item.전일대비구분 == "5")
                        {
                            dgv.Rows[rIdx].Cells[6].Value                   = "▽";
                            dgv.Rows[rIdx].Cells[6].Style.ForeColor         =
                                dgv.Rows[rIdx].Cells[7].Style.ForeColor     =
                                    dgv.Rows[rIdx].Cells[8].Style.ForeColor = Color.Blue;
                        }
                        else if (item.전일대비구분 == "4")
                        {
                            dgv.Rows[rIdx].Cells[6].Value                   = "▼";
                            dgv.Rows[rIdx].Cells[6].Style.ForeColor         =
                                dgv.Rows[rIdx].Cells[7].Style.ForeColor     =
                                    dgv.Rows[rIdx].Cells[8].Style.ForeColor = Color.Blue;
                        }

                        if (item.거래증가율 > 0)
                        {
                            dgv.Rows[rIdx].Cells[11].Style.ForeColor
                                = dgv.Rows[rIdx].Cells[12].Style.ForeColor = Color.Red;
                        }
                        else if (item.거래증가율 < 0)
                        {
                            dgv.Rows[rIdx].Cells[11].Style.ForeColor
                                = dgv.Rows[rIdx].Cells[12].Style.ForeColor = Color.Blue;
                        }
                    }));
                }
            });
        }
Exemple #14
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);

            //if (true)
            //{
            //    double rate = 0.0;
            //    if (timeInterval == TimeIntervalEnum.Week) rate = 2.5;
            //    if (timeInterval == TimeIntervalEnum.Day) rate = 1.0;
            //    if (timeInterval == TimeIntervalEnum.Minute_180) rate = 0.7;
            //    if (timeInterval == TimeIntervalEnum.Minute_120) rate = 0.5;
            //    if (timeInterval == TimeIntervalEnum.Minute_60) rate = 0.3;
            //    sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true, rate, null);
            //}

            var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);

            //var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            //var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);

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

            //파라볼릭 보조지표를 위한 로직
            var optionSourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , TimeIntervalEnum.Day);
            var optionAverageDatas = PPUtils.GetAverageDatas(itemCode, optionSourceDatas, 9);

            var qs = PP.Chakra.Indicators.Indicator.ConverterCandleQuote(optionSourceDatas.ToList <S_CandleItemData>());
            var qa = PP.Chakra.Indicators.Indicator.ConverterCandleQuote(optionAverageDatas.ToList <S_CandleItemData>());

            chart.LoadDataAndApply(itemCode
                                   , sourceDatas
                                   , Indicator.GetParabolicSar(qs, 0.02m, 0.2m, true).ToList()
                                   , Indicator.GetParabolicSar(qs, 0.02m, 0.2m, false).ToList()
                                   , base.timeInterval
                                   , 9);
            chart2.LoadDataAndApply(itemCode
                                    , averageDatas
                                    , Indicator.GetParabolicSar(qa, 0.02m, 0.2m, true).ToList()
                                    , Indicator.GetParabolicSar(qa, 0.02m, 0.2m, false).ToList()
                                    , base.timeInterval
                                    , 9);
        }
Exemple #15
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;
            }

            chart.SelectedPType = selectedType;

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

            isLoading = false;

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

            for (int i = 0; i < sourceDatas.Count; i++)
            {
                int pIdx = i - 1 < 0 ? 0 : i - 1;
                int nIdx = i + 1 > sourceDatas.Count - 1 ? sourceDatas.Count - 1 : i + 1;

                sourceDatas[i].PreCandleItem  = sourceDatas[pIdx];
                sourceDatas[i].NextCandleItem = sourceDatas[nIdx];
            }

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

            CreateVirtualData(sourceDatas);

            int averageCount = 9;

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

            int averageBCount = 4;

            if (timeInterval == TimeIntervalEnum.Minute_01 ||
                timeInterval == TimeIntervalEnum.Minute_05 ||
                timeInterval == TimeIntervalEnum.Minute_10 ||
                timeInterval == TimeIntervalEnum.Minute_15 ||
                timeInterval == TimeIntervalEnum.Minute_30)
            {
                averageBCount = 8;
            }

            var averageDatas  = PPUtils.GetAverageDatas(itemCode, sourceDatas, averageCount, false);
            var averageBDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, averageBCount, false);

            for (int i = 0; i < averageDatas.Count; i++)
            {
                int pIdx = i - 1 < 0 ? 0 : i - 1;
                int nIdx = i + 1 > averageDatas.Count - 1 ? averageDatas.Count - 1 : i + 1;

                averageDatas[i].PreCandleItem  = averageDatas[pIdx];
                averageDatas[i].NextCandleItem = averageDatas[nIdx];
            }
            for (int i = 0; i < averageBDatas.Count; i++)
            {
                int pIdx = i - 1 < 0 ? 0 : i - 1;
                int nIdx = i + 1 > averageBDatas.Count - 1 ? averageBDatas.Count - 1 : i + 1;

                averageBDatas[i].PreCandleItem  = averageBDatas[pIdx];
                averageBDatas[i].NextCandleItem = averageBDatas[nIdx];
            }

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

            chart.LoadDataAndApply(itemCode, sourceDatas, averageDatas, averageBDatas, base.timeInterval, 5);
        }
Exemple #16
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);
        }
Exemple #17
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";
            }
        }