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

            //원천 데이터를 변경하는 로직 추가
            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);
        }
Ejemplo n.º 2
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");
            });
        }
Ejemplo 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 sourceDatas1 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Minute_300);

            var sourceDatas2 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Day);

            if (sourceDatas1 != null && sourceDatas1.Count > 0)
            {
                var averageDatas1 = PPUtils.GetAverageDatas(itemCode, sourceDatas1, 9);
                qMin1.LoadDataAndApply(itemCode, averageDatas1, TimeIntervalEnum.Minute_300, 3);
            }
            if (sourceDatas2 != null && sourceDatas2.Count > 0)
            {
                var averageDatas2 = PPUtils.GetAverageDatas(itemCode, sourceDatas2, 9);
                qMin2.LoadDataAndApply(itemCode, averageDatas2, TimeIntervalEnum.Day, 3);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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;

            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");
            });
        }
Ejemplo n.º 7
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;
            }
            int cnt = 7;
            List <S_CandleItemData> sourceDatas1 = sourceDatas.GetRange(sourceDatas.Count - cnt, cnt);

            chart1.LoadDataAndApply(itemCode, sourceDatas1, base.timeInterval);
            cnt = 19;
            List <S_CandleItemData> sourceDatas2 = sourceDatas.GetRange(sourceDatas.Count - cnt, cnt);

            chart2.LoadDataAndApply(itemCode, sourceDatas2, base.timeInterval);
            cnt = 29;
            List <S_CandleItemData> sourceDatas3 = sourceDatas.GetRange(sourceDatas.Count - cnt, cnt);

            chart3.LoadDataAndApply(itemCode, sourceDatas3, base.timeInterval);
            cnt = 37;
            List <S_CandleItemData> sourceDatas4 = sourceDatas.GetRange(sourceDatas.Count - cnt, cnt);

            chart4.LoadDataAndApply(itemCode, sourceDatas4, base.timeInterval);

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

            cnt = 7;
            List <S_CandleItemData> sourceDatas5 = averageDatas.GetRange(averageDatas.Count - cnt, cnt);

            chart5.LoadDataAndApply(itemCode, sourceDatas5, base.timeInterval);
            cnt = 19;
            List <S_CandleItemData> sourceDatas6 = averageDatas.GetRange(averageDatas.Count - cnt, cnt);

            chart6.LoadDataAndApply(itemCode, sourceDatas6, base.timeInterval);
            cnt = 29;
            List <S_CandleItemData> sourceDatas7 = averageDatas.GetRange(averageDatas.Count - cnt, cnt);

            chart7.LoadDataAndApply(itemCode, sourceDatas7, base.timeInterval);
            cnt = 37;
            List <S_CandleItemData> sourceDatas8 = averageDatas.GetRange(averageDatas.Count - cnt, cnt);

            chart8.LoadDataAndApply(itemCode, sourceDatas8, base.timeInterval);
        }
Ejemplo n.º 8
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas180 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Tick_180);
            var sourceDatas360 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Tick_360);
            var sourceDatas720 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Tick_720);
            var sourceDatas1080 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Tick_1080);
            var sourceDatas1440 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Tick_1440);

            if (sourceDatas180 != null && sourceDatas180.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas180, 7);
                qTick180.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_180, 3);
            }
            if (sourceDatas360 != null && sourceDatas360.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas360, 7);
                qTick360.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_360, 3);
            }
            if (sourceDatas720 != null && sourceDatas720.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas720, 7);
                qTick720.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_720, 3);
                qTick721.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_720, 3);
            }
            if (sourceDatas1080 != null && sourceDatas1080.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas1080, 7);
                qTick1080.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_1080, 3);
            }
            if (sourceDatas1440 != null && sourceDatas1440.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas1440, 7);
                qTick1440.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Tick_1440, 3);
            }
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

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

            if (candles == null || candles.Count == 0)
            {
                return;
            }
            List <S_LineItemData> sourceDatas = new List <S_LineItemData>();
            var list = PPUtils.GetSixPointsByCandles(candles);

            foreach (var m in list)
            {
                //S_LineItemData sourceData = new S_LineItemData(
                //    itemCode
                //    , m.OpenPrice
                //    , m.HighPrice
                //    , m.LowPrice
                //    , m.ClosePrice
                //    , m.DTime
                //    );
                //sourceDatas.Add(sourceData);
            }

            chart.loadDataAndApply(itemCode, sourceDatas, base.timeInterval, 7);

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

            chart2.loadDataAndApply(itemCode, averageDatas, base.timeInterval, 7);
        }
Ejemplo n.º 11
0
        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");
            });
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
0
        private void BtnLoadCandle_Click(object sender, EventArgs e)
        {
            try
            {
                int loadCnt = 5;
                if (chkIsUseLastCandle.Checked)
                {
                    loadCnt = 6;
                }

                TimeIntervalEnum timeInterval = TimeIntervalEnum.Minute_05;
                if (cbxTime.SelectedIndex == 1)
                {
                    timeInterval = TimeIntervalEnum.Minute_10;
                }
                else if (cbxTime.SelectedIndex == 2)
                {
                    timeInterval = TimeIntervalEnum.Minute_30;
                }
                else if (cbxTime.SelectedIndex == 3)
                {
                    timeInterval = TimeIntervalEnum.Hour_01;
                }
                else if (cbxTime.SelectedIndex == 4)
                {
                    timeInterval = TimeIntervalEnum.Hour_02;
                }

                var list        = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(rule.ItemCode, timeInterval);
                var avglist     = PPUtils.GetAverageDatas(rule.ItemCode, list, 5);
                var displayList = list.GetRange(list.Count - 10, 10);
                chart1.IsAutoScrollX = false;
                chart1.LoadDataAndApply(rule.ItemCode, displayList, timeInterval, 0);

                //챠크라
                if (rule.BaseCandleItemType == "1")
                {
                    var newList  = list.GetRange(list.Count - 6, loadCnt);
                    var newItem  = PP.Chakra.PPUtils.GetMergeCandle(newList);
                    var newList2 = new List <PP.Chakra.S_CandleItemData>();
                    newList2.Add(newItem);
                    rule.BaseCandleItem       = newItem;
                    chartChakra.IsAutoScrollX = false;
                    chartChakra.LoadDataAndApply(rule.ItemCode, newList2, timeInterval, 0);
                }
                //양자평균
                else if (rule.BaseCandleItemType == "2")
                {
                    var newList  = avglist.GetRange(avglist.Count - 6, loadCnt);
                    var newItem  = PP.Chakra.PPUtils.GetMergeCandle(newList);
                    var newList2 = new List <PP.Chakra.S_CandleItemData>();
                    newList2.Add(newItem);
                    rule.BaseCandleItem       = newItem;
                    chartChakra.IsAutoScrollX = false;
                    chartChakra.loadDataAndApply(rule.ItemCode, newList2, timeInterval, 0);
                }
                //다이아몬드
                else if (rule.BaseCandleItemType == "3")
                {
                    var newList  = list.GetRange(list.Count - 6, loadCnt);
                    var newItem  = PP.Chakra.PPUtils.GetMergeDiamondCandle(newList);
                    var newList2 = new List <PP.Chakra.S_CandleItemData>();
                    var sCandle  = newItem.GetCandleItem();
                    newList2.Add(sCandle);
                    rule.BaseCandleItem       = sCandle;
                    chartChakra.IsAutoScrollX = false;
                    chartChakra.loadDataAndApply(rule.ItemCode, newList2, timeInterval, 0);
                }

                chartReal.LoadDataAndApply(rule.ItemCode, list, timeInterval, 0);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 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;
            }

            int totalCnt = sourceDatas.Count;

            if (totalCnt > Config.SharedData.SelectedItemCount)
            {
                sourceDatas.RemoveRange(0, totalCnt - Config.SharedData.SelectedItemCount);
            }

            chart.LoadDataAndApply(itemCode, sourceDatas, base.timeInterval, 7);
            List <S_CandleItemData> sourceDatas2     = new List <S_CandleItemData>();
            List <T_MirrorItemData> transformedDatas = new List <T_MirrorItemData>();

            foreach (var m in sourceDatas)
            {
                T_MirrorItemData tData = new T_MirrorItemData(m, sourceDatas);
                tData.Transform();
                transformedDatas.Add(tData);
            }
            foreach (var m in transformedDatas)
            {
                S_CandleItemData sourceData = new S_CandleItemData(
                    itemCode
                    , m.T_OpenPrice
                    , m.T_HighPrice
                    , m.T_LowPrice
                    , m.T_ClosePrice
                    , m.Volume
                    , m.DTime
                    );

                sourceDatas2.Add(sourceData);
            }
            chart2.LoadDataAndApply(itemCode, sourceDatas2, base.timeInterval, 7);

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

            chart3.LoadDataAndApply(itemCode, averageDatas, base.timeInterval, 7);

            List <S_CandleItemData> sourceDatas4      = new List <S_CandleItemData>();
            List <T_MirrorItemData> transformedDatas2 = new List <T_MirrorItemData>();

            foreach (var m in averageDatas)
            {
                T_MirrorItemData tData = new T_MirrorItemData(m, sourceDatas);
                tData.Transform();
                transformedDatas2.Add(tData);
            }
            foreach (var m in transformedDatas2)
            {
                S_CandleItemData sourceData = new S_CandleItemData(
                    itemCode
                    , m.T_OpenPrice
                    , m.T_HighPrice
                    , m.T_LowPrice
                    , m.T_ClosePrice
                    , m.Volume
                    , m.DTime
                    );

                sourceDatas4.Add(sourceData);
            }
            chart4.LoadDataAndApply(itemCode, sourceDatas4, base.timeInterval, 7);
        }
Ejemplo n.º 15
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";
            }
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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;

            List <S_CandleItemData> sourceDatas1 = null;
            List <S_CandleItemData> sourceDatas2 = null;
            List <S_CandleItemData> sourceDatas3 = null;
            List <S_CandleItemData> sourceDatas4 = null;

            isLoading = true;
            string selectedType = this.SelectedType;

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

            if (selectedType == "국내지수")
            {
                this.timeInterval = TimeIntervalEnum.Minute_05;
                sourceDatas1      = XingContext.Instance.ClientContext.GetUpJongSiseData(itemCode, "1", "5", "500");
                sourceDatas2      = XingContext.Instance.ClientContext.GetUpJongSiseData(itemCode, "1", "10", "300");
                sourceDatas3      = XingContext.Instance.ClientContext.GetUpJongSiseData(itemCode, "1", "30", "100");
                sourceDatas4      = XingContext.Instance.ClientContext.GetUpJongSiseData(itemCode, "2", "0", "50");
            }
            else if (selectedType == "국내종목")
            {
                this.timeInterval = TimeIntervalEnum.Minute_05;
                sourceDatas1      = XingContext.Instance.ClientContext.GetJongmokSiseData(itemCode, "1", "5", "500");
                sourceDatas2      = XingContext.Instance.ClientContext.GetJongmokSiseData(itemCode, "1", "10", "300");
                sourceDatas3      = XingContext.Instance.ClientContext.GetJongmokSiseData(itemCode, "1", "30", "100");
                sourceDatas4      = XingContext.Instance.ClientContext.GetJongmokSiseData(itemCode, "2", "0", "50");
            }

            else if (selectedType == "해외선물")
            {
                this.timeInterval = TimeIntervalEnum.Minute_05;
                sourceDatas1      = XingContext.Instance.ClientContext.GetWorldFutureSiseData(itemCode, "5M");
                sourceDatas2      = XingContext.Instance.ClientContext.GetWorldFutureSiseData(itemCode, "30M");
                sourceDatas3      = XingContext.Instance.ClientContext.GetWorldFutureSiseData(itemCode, "H");
                sourceDatas4      = XingContext.Instance.ClientContext.GetWorldFutureSiseData(itemCode, "D");
            }
            else
            {
                return;
            }

            isLoading = false;

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

            int averageCount = 9;

            var averageDatas1 = PPUtils.GetAverageDatas(itemCode, sourceDatas1, averageCount, false);
            var averageDatas2 = PPUtils.GetAverageDatas(itemCode, sourceDatas2, averageCount, false);
            var averageDatas3 = PPUtils.GetAverageDatas(itemCode, sourceDatas3, averageCount, false);
            var averageDatas4 = PPUtils.GetAverageDatas(itemCode, sourceDatas4, averageCount, false);

            chart1.LoadDataAndApply(itemCode, averageDatas1, averageDatas2, averageDatas3, averageDatas4, base.timeInterval, averageCount);
        }
Ejemplo n.º 21
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";
            }
        }
Ejemplo n.º 22
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;
            TimeIntervalEnum timeInterval    = chkTD.Checked ? TimeIntervalEnum.Day : TimeIntervalEnum.Week;
            string           timeIntervalStr = chkTD.Checked ? "2" : "3";

            Task.Factory.StartNew(() => {
                var sourceDatas = XingContext.Instance.ClientContext.GetUpJongSiseData(code, timeIntervalStr, "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, timeInterval, 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;
                        }
                    }));
                }
            });
        }
Ejemplo n.º 23
0
        private void btnSearchJongmok_Click(object sender, EventArgs e)
        {
            if (!isRunningJongmok)
            {
                isRunningJongmok = true;
            }
            else
            {
                isRunningJongmok = false;
                return;
            }

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

            Task.Factory.StartNew(() =>
            {
                foreach (DataGridViewRow row in dgv.Rows)
                {
                    if (!isRunningJongmok)
                    {
                        return;
                    }
                    string code = row.Cells[0].Value as string;

                    Task.Factory.StartNew(() =>
                    {
                        var sourceDatas = XingContext.Instance.ClientContext.GetJongmokSiseData(code, timeIntervalStr, "0", "20");
                        if (sourceDatas == null || sourceDatas.Count == 0)
                        {
                            return;
                        }
                        var averageDatas = PPUtils.GetAverageDatas(code, sourceDatas, 9);

                        List <SmartCandleData> smartDataList = new List <SmartCandleData>();
                        SmartCandleData preSmartData         = null;
                        for (int i = 0; i < averageDatas.Count; i++)
                        {
                            var cData = averageDatas[i];
                            SmartCandleData smartData = new SmartCandleData(cData.ItemCode, cData.OpenPrice, cData.HighPrice, cData.LowPrice, cData.ClosePrice, cData.Volume, cData.DTime, preSmartData);
                            smartDataList.Add(smartData);
                            preSmartData = smartData;
                        }

                        var sR0 = getSmartLine(0, smartDataList);
                        var sR1 = getSmartLine(1, smartDataList);
                        var sR2 = getSmartLine(2, smartDataList);
                        var sR3 = getSmartLine(3, smartDataList);
                        var sR4 = getSmartLine(4, smartDataList);
                        var sR5 = getSmartLine(5, smartDataList);
                        var sR6 = getSmartLine(6, smartDataList);
                        var sR7 = getSmartLine(7, smartDataList);
                        var sR8 = getSmartLine(8, smartDataList);

                        //this.Invoke(new Action(() => {

                        row.Cells["S8"].Value           = sR8.Item1;
                        row.Cells["S8"].Style.ForeColor = sR8.Item2;
                        row.Cells["S7"].Value           = sR7.Item1;
                        row.Cells["S7"].Style.ForeColor = sR7.Item2;
                        row.Cells["S6"].Value           = sR6.Item1;
                        row.Cells["S6"].Style.ForeColor = sR6.Item2;
                        row.Cells["S5"].Value           = sR5.Item1;
                        row.Cells["S5"].Style.ForeColor = sR5.Item2;
                        row.Cells["S4"].Value           = sR4.Item1;
                        row.Cells["S4"].Style.ForeColor = sR4.Item2;
                        row.Cells["S3"].Value           = sR3.Item1;
                        row.Cells["S3"].Style.ForeColor = sR3.Item2;
                        row.Cells["S2"].Value           = sR2.Item1;
                        row.Cells["S2"].Style.ForeColor = sR2.Item2;
                        row.Cells["S1"].Value           = sR1.Item1;
                        row.Cells["S1"].Style.ForeColor = sR1.Item2;
                        row.Cells["S0"].Value           = sR0.Item1;
                        row.Cells["S0"].Style.ForeColor = sR0.Item2;

                        //}));
                    });

                    System.Threading.Thread.Sleep(2000);
                }
            });
        }
Ejemplo n.º 24
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);

            bool isUseWhim = false;

            if (isUseWhim)
            {
                double rate = 0.0;
                if (timeInterval == TimeIntervalEnum.Week)
                {
                    rate = 2.5;
                }
                if (timeInterval == TimeIntervalEnum.Day)
                {
                    rate = 1.0;
                }
                if (timeInterval == TimeIntervalEnum.Hour_03)
                {
                    rate = 0.7;
                }
                if (timeInterval == TimeIntervalEnum.Hour_02)
                {
                    rate = 0.5;
                }
                if (timeInterval == TimeIntervalEnum.Hour_01)
                {
                    rate = 0.3;
                }
                sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true, rate, null);
            }


            List <S_CandleItemData> averageDatas = null;

            if (averageType == "일반")
            {
                averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);
            }
            else if (averageType == "밸런스")
            {
                averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            }
            else //if (averageType == "가중")
            {
                averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
            }

            var averageDatas2 = PPUtils.GetMovingAverageDurationFlow(itemCode, averageDatas, isStrengthed, inflectionPoint);
            var sourceDatas2  = PPUtils.GetDurationSum(itemCode, averageDatas2, sourceDatas);

            chart.LoadDataAndApply(itemCode, sourceDatas2, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, averageDatas2, base.timeInterval, 9);

            chart2.SetYFormat("N0");
        }
Ejemplo n.º 25
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas1 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Hour_01);
            var sourceDatas2 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Hour_02);
            var sourceDatas3 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Hour_03);
            var sourceDatas4 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Hour_06);
            var sourceDatas5 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Hour_12);
            var sourceDatas6 = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                base.SelectedItemData.Code
                , TimeIntervalEnum.Day);

            if (sourceDatas1 != null && sourceDatas1.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas1, 9);
                qMin1.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Hour_01, 3);
            }
            if (sourceDatas2 != null && sourceDatas2.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas2, 9);
                qMin2.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Hour_02, 3);
            }
            if (sourceDatas3 != null && sourceDatas3.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas3, 9);
                qMin3.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Hour_03, 3);
            }
            if (sourceDatas4 != null && sourceDatas4.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas4, 9);
                qMin4.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Hour_06, 3);
            }
            if (sourceDatas5 != null && sourceDatas5.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas5, 9);
                qMin5.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Hour_12, 3);
            }
            if (sourceDatas6 != null && sourceDatas6.Count > 0)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas6, 9);
                qMin6.LoadDataAndApply(itemCode, averageDatas, TimeIntervalEnum.Day, 3);
            }
        }
Ejemplo n.º 26
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.GetAverageDatas(itemCode, sourceDatas, averageCount);

            sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
            chart.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
            chart.Title = "";
        }