예제 #1
0
        private void OnGetStockCode()
        {
            TaskCompletionSource <bool> tcs = null;

            tcs = new TaskCompletionSource <bool>();

            //Task.Delay(3000).Wait();
            _clsDataAccessUtil.Delay(3000);

            tcs.SetResult(true);

            string strStockCode = "";

            strStockCode = GetStockCode();
            if (strStockCode == "End")
            {
                return;
            }
            GetOpt10005Caller(strStockCode);

            proBar10005.Value = _seqNo;

            WriteTextSafe(strStockCode + "(" + ClsAxKH.GetMasterCodeName(strStockCode) + ")" + " 작업 중");

            //   tcs.SetResult(true);
        }
예제 #2
0
        private void OnGetStockCode()
        {
            TaskCompletionSource <bool> tcs = null;

            tcs = new TaskCompletionSource <bool>();

            string strStockCode = "";

            strStockCode = GetStockCode();
            if (strStockCode == "End")
            {
                return;
            }

            if (strStockCode == "")
            {
                OnGetStockCode();
                return;
            }

            //WaitTime();

            GetOpt10081Caller(strStockCode);

            proBar10081.Value = _seqNo;

            WriteTextSafe(strStockCode + "(" + ClsAxKH.GetMasterCodeName(strStockCode) + ")" + " 작업 중");

            tcs.SetResult(true);
        }
예제 #3
0
        private void GetOpt10060Caller(Opt10060TransType opt10060TransType, string stockCode, string MaxDate, string MinDate)
        {
            if (_opt10060 != null)
            {
                _opt10060.Dispose();
                _opt10060 = null;
            }
            _opt10060 = new ClsOpt10060();
            TaskCompletionSource <bool> tcs = null;

            tcs = new TaskCompletionSource <bool>();
            if (tcs == null || tcs.Task.IsCompleted)
            {
                return;
            }

            DataTable   dtDate = new DataTable();
            KiwoomQuery kiwoom = new KiwoomQuery();

            _opt10060.SetInit(_FormId);

            switch (opt10060TransType)
            {
            case Opt10060TransType.PriceMaesu:
                WriteTextSafe(stockCode + "(" + ClsAxKH.GetMasterCodeName(stockCode) + ")" + " Price(매수)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaeSu);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "1", MaeMaeGb: "1", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.PriceMaedo:
                WaitTime();
                WriteTextSafe(stockCode + " Price(매도)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaedo);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "1", MaeMaeGb: "2", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.QtyMaesu:
                WaitTime();
                WriteTextSafe(stockCode + " QTY(매수)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060MaeSu);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "2", MaeMaeGb: "1", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.QtyMaeDo:
                WaitTime();
                WriteTextSafe(stockCode + " QTY(매도)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060Maedo);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "2", MaeMaeGb: "2", UnitG: "", nPrevNext: 0);
                break;

            default:
                break;
            }

            tcs.SetResult(true);
        }
예제 #4
0
        public FrmOpt10005Caller()
        {
            InitializeComponent();

            _clsDataAccessUtil = new ClsDataAccessUtil();

            ClsAxKH.AxKH_10005_OnReceived += new ClsAxKH.OnReceivedEventHandler(Opt10005_OnReceived);

            Func <DataTable> funcGetStockData = () =>
            {
                RichQuery oRichQuery = new RichQuery();
                return(oRichQuery.p_ScodeQuery("1", "", "", false).Tables[0].Copy());
            };

            _dtStockCode = funcGetStockData();

            foreach (DataRow dr in _dtStockCode.Rows)
            {
                if (ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString().Trim()) == "")
                {
                    continue;
                }

                _StockQueue.Enqueue(dr["STOCK_CODE"].ToString());
            }

            proBar10005.Maximum = _dtStockCode.Rows.Count;

            if (System.DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
            {
                _stdDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
            }
            else if (System.DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
            {
                _stdDate = DateTime.Today.AddDays(-2).ToString("yyyyMMdd");
            }
            else
            {
                int i = Int32.Parse(System.DateTime.Now.ToString("HH") + System.DateTime.Now.ToString("ss"));

                if (i > 1600)
                {
                    _stdDate = CDateTime.FormatDate(System.DateTime.Now.Date.ToShortDateString());
                }
                else if (System.DateTime.Now.DayOfWeek == DayOfWeek.Monday)
                {
                    _stdDate = DateTime.Today.AddDays(-3).ToString("yyyyMMdd");
                }
                else
                {
                    _stdDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
                }
            }
        }
예제 #5
0
        private void OnGetStockCode()
        {
            string strStockCode = "";

            strStockCode = GetStockCode();

            if (strStockCode == "End")
            {
                BtnStart.Text = "작업 완료";
                return;
            }

            _seqNo            = _seqNo + 1;
            proBar10015.Value = _seqNo;
            proBar10081.Value = _seqNo;
            proBar10060.Value = _seqNo;

            if (strStockCode == "")
            {
                OnGetStockCode();
                return;
            }

            WaitTime();

            string stockName = ClsAxKH.GetMasterCodeName(stockCode: strStockCode);

            // 종목명을 못 가져오면 상장폐지된 종목으로 생각.
            if (stockName == "")
            {
                OnGetStockCode();
                return;
            }

            if (_NoJob10015 != true)
            {
                GetOpt10015Caller(strStockCode, _stdDate, "");
            }
            else if (_NoJob10081 != true)
            {
                GetOpt10081Caller(strStockCode);
            }
            else if (_NoJob10060 != true)
            {
                GetOpt10060Caller(Opt10060TransType.PriceMaesu, strStockCode, "", "");
            }
            else
            {
                OnGetStockCode();
            }

            WriteTextSafe(strStockCode + " 작업 중");
            //   tcs.SetResult(true);
        }
예제 #6
0
        public FrmOpt10001Caller(DataTable UserDt, bool AutoStart = false, bool chk100Click = false)
        {
            InitializeComponent();

            _clsDataAccessUtil = new ClsDataAccessUtil();

            ClsAxKH.AxKH_10001_OnReceived += new ClsAxKH.OnReceivedEventHandler(Opt10001_OnReceived);

            Func <DataTable> funcGetStockData = () =>
            {
                if (UserDt != null)
                {
                    return(UserDt.Copy());
                }
                else
                {
                    RichQuery oRichQuery = new RichQuery();
                    return(oRichQuery.p_ScodeQuery("1", "", "", false).Tables[0].Copy());
                }
            };

            _dtStockCode = funcGetStockData();

            foreach (DataRow dr in _dtStockCode.Rows)
            {
                if (ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString().Trim()) == "")
                {
                    continue;
                }

                _StockQueue.Enqueue(dr["STOCK_CODE"].ToString());
            }

            proBar10001.Maximum = _dtStockCode.Rows.Count;

            chk100.Checked = chk100Click;

            _AutoStart = AutoStart;

            if (AutoStart == true)
            {
                string text         = "";
                string errorMessage = null;
                text = "OPT10001 작업 Start";
                ClsTelegramBot.SendMessage(text, out errorMessage);
                OnGetStockCode();
            }
        }
예제 #7
0
        public FrmOpt10081Caller(DataTable UserDt, bool AutoStart = false, bool chk100Click = false)
        {
            InitializeComponent();

            _clsDataAccessUtil = new ClsDataAccessUtil();

            ClsAxKH.AxKH_10081_OnReceived += new ClsAxKH.OnReceivedEventHandler(Opt10081_OnReceived);

            Func <DataTable> funcGetStockData = () =>
            {
                if (UserDt != null)
                {
                    return(UserDt.Copy());
                }
                else
                {
                    RichQuery oRichQuery = new RichQuery();
                    return(oRichQuery.p_ScodeQuery("1", "", "", false).Tables[0].Copy());
                }
            };

            _dtStockCode = funcGetStockData();

            foreach (DataRow dr in _dtStockCode.Rows)
            {
                if (ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString().Trim()) == "")
                {
                    continue;
                }

                _StockQueue.Enqueue(dr["STOCK_CODE"].ToString());
            }

            proBar10081.Maximum = _dtStockCode.Rows.Count;

            _stdDate = _clsCollectOptDataFunc.GetAvailableDate();

            dtpStdDate.Value = _clsUtil.StringToDateTime(_stdDate);

            chk100.Checked = chk100Click;

            _AutoStart = AutoStart;

            if (AutoStart == true)
            {
                btn10081_Click(null, new EventArgs());
            }
        }
예제 #8
0
        private void OnGetStockCode()
        {
            string strStockCode = "";

            strStockCode = GetStockCode();

            if (strStockCode == "End")
            {
                string text         = "";
                string errorMessage = null;
                text = "OPT10001 작업 완료";
                ClsTelegramBot.SendMessage(text, out errorMessage);
                if (_AutoStart == true)
                {
                    ClsTesterUtil clsTesterUtil = new ClsTesterUtil();
                    Form          oform         = new Woom.Tester.Forms.FrmOpt10060CallerPer(null, true, true);

                    clsTesterUtil.ShowChildForm(oform, false, this);
                }

                return;
            }

            if (strStockCode == "")
            {
                OnGetStockCode();
                return;
            }

            string stockName = ClsAxKH.GetMasterCodeName(stockCode: strStockCode);

            // 종목명을 못 가져오면 상장폐지된 종목으로 생각.
            if (stockName == "")
            {
                OnGetStockCode();
                return;
            }

            WaitTime();

            GetOpt10001Caller(strStockCode);

            proBar10001.Value = _seqNo;

            WriteTextSafe(strStockCode + " 작업 중");
            //   tcs.SetResult(true);
        }
예제 #9
0
        private void SearchNews()
        {
            try
            {
                if (chkStockName.Checked == true)
                {
                    textBoxKeyword.Text = ClsAxKH.GetMasterCodeName(_stockCode);
                }
                else
                {
                    textBoxKeyword.Text = _stockCode;
                }

                ClsDataGridViewUtil clsDataGridViewUtil = new ClsDataGridViewUtil();

                if (chkAddSearch.Checked == true)
                {
                    // clsDataGridViewUtil.RemoveGridViewRow(dgvNaverSearch);
                }
                else
                {
                    clsDataGridViewUtil.RemoveGridViewRow(dgvNaverSearch);
                    _row = 0;
                }


                string results = getResults();
                results = results.Replace("<b>", "");
                results = results.Replace("</b>", "");
                results = results.Replace("&lt;", "<");
                results = results.Replace("&gt;", ">");

                var parseJson       = JObject.Parse(results);
                var countsOfDisplay = Convert.ToInt32(parseJson["display"]);
                var countsOfResults = Convert.ToInt32(parseJson["total"]);


                for (int i = 0; i < countsOfDisplay; i++)
                {
                    var title = parseJson["items"][i]["title"].ToString();
                    title = title.Replace("&quot;", "\"");

                    var description = parseJson["items"][i]["description"].ToString();
                    description = description.Replace("&quot;", "\"");

                    var link = parseJson["items"][i]["link"].ToString();

                    if (_row > 0 && dgvNaverSearch.Rows[0].Cells["No"].Value.ToString() != "")
                    {
                        DataGridViewRow dataGridViewRow = (DataGridViewRow)dgvNaverSearch.Rows[0].Clone();
                        dataGridViewRow.Cells[0].Value = (_row = +1).ToString();
                        dataGridViewRow.Cells[1].Value = textBoxKeyword.Text;
                        dataGridViewRow.Cells[2].Value = title;
                        dataGridViewRow.Cells[3].Value = description;
                        dataGridViewRow.Cells[4].Value = link;

                        dgvNaverSearch.Rows.Insert(0, dataGridViewRow);
                    }
                    else
                    {
                        dgvNaverSearch.Rows.Add();
                        dgvNaverSearch.Rows[_row].Cells["No"].Value  = (_row + 1).ToString();
                        dgvNaverSearch.Rows[_row].Cells["검색명"].Value = textBoxKeyword.Text;
                        dgvNaverSearch.Rows[_row].Cells["제목"].Value  = title;
                        dgvNaverSearch.Rows[_row].Cells["본문"].Value  = description;
                        dgvNaverSearch.Rows[_row].Cells["링크"].Value  = link;
                    }

                    _row = _row + 1;
                }
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.Message);
            }
        }
예제 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dt">작업할 종목들</param>
        /// <param name="stdDate">기준일로부터 최근 3개월</param>
        public FrmOptDayJobCaller(DataTable dt, String stdDate)
        {
            InitializeComponent();
            _stdDate           = stdDate;
            _clsDataAccessUtil = new ClsDataAccessUtil();

            ClsAxKH.AxKH_10015_OnReceived += new ClsAxKH.OnReceivedEventHandler(Opt10015_OnReceived);
            ClsAxKH.AxKH_10081_OnReceived += new ClsAxKH.OnReceivedEventHandler(Opt10081_OnReceived);

            if (dt == null)
            {
                Func <DataTable> funcGetStockData = () =>
                {
                    RichQuery oRichQuery = new RichQuery();
                    return(oRichQuery.p_ScodeQuery("1", "", "", false).Tables[0].Copy());
                };

                _dtStockCode = funcGetStockData();
            }
            else
            {
                Func <DataTable> funcGetStockData = () =>
                {
                    RichQuery oRichQuery = new RichQuery();
                    return(oRichQuery.p_ScodeQuery("1", "", "", false).Tables[0].Copy());
                };

                _dtStockCode = dt.Copy();
                dt           = null;
            }

            foreach (DataRow dr in _dtStockCode.Rows)
            {
                if (ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString().Trim()) == "")
                {
                    continue;
                }

                _StockQueue.Enqueue(dr["STOCK_CODE"].ToString());
            }

            proBar10015.Maximum = _dtStockCode.Rows.Count;
            proBar10060.Maximum = _dtStockCode.Rows.Count;
            proBar10081.Maximum = _dtStockCode.Rows.Count;

            if (_stdDate == "")
            {
                if (System.DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
                {
                    _stdDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
                }
                else if (System.DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
                {
                    _stdDate = DateTime.Today.AddDays(-2).ToString("yyyyMMdd");
                }
                else
                {
                    int i = Int32.Parse(System.DateTime.Now.ToString("HH") + System.DateTime.Now.ToString("ss"));

                    if (i > 1600)
                    {
                        _stdDate = CDateTime.FormatDate(System.DateTime.Now.Date.ToShortDateString());
                    }
                    else if (System.DateTime.Now.DayOfWeek == DayOfWeek.Monday)
                    {
                        _stdDate = DateTime.Today.AddDays(-3).ToString("yyyyMMdd");
                    }
                    else
                    {
                        _stdDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
                    }
                }
            }

            string  reDate  = "";
            ClsUtil clsUtil = new ClsUtil();

            reDate = clsUtil.Mid(_stdDate, 1, 4) + "-" + clsUtil.Mid(_stdDate, 5, 2) + clsUtil.Mid(_stdDate, 7, 2);

            DateTime dtDate = Convert.ToDateTime(reDate);

            _minDate = dtDate.AddDays(Convert.ToInt32(DayOfWeek.Monday) - Convert.ToInt32(dtDate.DayOfWeek)).ToString("yyyyMMdd");

            proBar10015.Value = _StockQueue.Count;
            proBar10081.Value = _StockQueue.Count;
            proBar10060.Value = _StockQueue.Count;

            OnGetStockCode();

            BtnStart.Text = "작업 중";
        }
예제 #11
0
        private void GetOptStockInfo(string stockCode)
        {
            if (stockCode == null)
            {
                return;
            }

            if (stockCode == "")
            {
                return;
            }
            KiwoomQuery kiwoomQuery = new KiwoomQuery();
            DataTable   dt          = new DataTable();

            ClsCollectOptDataFunc clsCollectOptDataFunc = new ClsCollectOptDataFunc();
            string stdDate = clsCollectOptDataFunc.AvailableTradingDate();

            dt = kiwoomQuery.p_StockCodeOptInfoQuery(query: "1", stockCode: stockCode, stockDate: stdDate, bln3tier: false).Tables[0].Copy();

            if (dt.Rows.Count > 0)
            {
                dgvStockInfo.Rows.Add();

                DataRow dr = dt.Rows[0];

                dgvStockInfo.Rows[_row].Cells["STOCK_CODE"].Value = dr["STOCK_CODE"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["종목명"].Value        = ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString().Trim());
                dgvStockInfo.Rows[_row].Cells["현재가"].Value        = dr["현재가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["거래량"].Value        = dr["거래량"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["거래대금"].Value       = dr["거래대금"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["시가"].Value         = dr["시가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["고가"].Value         = dr["고가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["저가"].Value         = dr["저가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["기준일"].Value        = dr["CALL_DATE"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["결산월"].Value        = dr["결산월"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["액면가"].Value        = dr["액면가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["자본금"].Value        = dr["자본금"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["상장주식"].Value       = dr["상장주식"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["신용비율"].Value       = dr["신용비율"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["연중최고"].Value       = dr["연중최고"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["연중최저"].Value       = dr["연중최저"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["시가총액"].Value       = dr["시가총액"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["시가총액비중"].Value     = dr["시가총액비중"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["외인소진률"].Value      = dr["외인소진률"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["대용가"].Value        = dr["대용가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["PER"].Value        = dr["PER"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["EPS"].Value        = dr["EPS"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["ROE"].Value        = dr["ROE"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["PBR"].Value        = dr["PBR"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["EV"].Value         = dr["EV"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["BPS"].Value        = dr["BPS"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["매출액"].Value        = dr["매출액"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["영업이익"].Value       = dr["영업이익"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["당기순이익"].Value      = dr["당기순이익"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최고250"].Value      = dr["최고250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최저250"].Value      = dr["최저250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최고가일250"].Value    = dr["최고가일250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최고가대비율250"].Value  = dr["최고가대비율250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최저가일250"].Value    = dr["최저가일250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["최저가대비율250"].Value  = dr["최저가대비율250"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["유통주식"].Value       = dr["유통주식"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["유통비율"].Value       = dr["유통비율"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["종가"].Value         = dr["종가"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["전일대비기호"].Value     = dr["전일대비기호"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["전일대비"].Value       = dr["전일대비"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["등락율"].Value        = dr["등락율"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["거래량"].Value        = dr["거래량"].ToString().Trim();
                dgvStockInfo.Rows[_row].Cells["거래대금"].Value       = dr["거래대금"].ToString().Trim();
                dgvStockInfo.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);

                _row = _row + 1;
            }

            dt = null;
        }
예제 #12
0
        /// <summary>
        /// 주식 시장별 종목코드 리스트를 ';'로 구분해서 전달합니다.
        /// 시장구분값을 ""공백으로하면 전체시장 코드리스트를 전달합니다.
        /// </summary>
        /// <param name="stockGb">0 : 코스피  10 : 코스닥 3 : ELW  8 : ETF       50 : KONEX      4 :  뮤추얼펀드  5 : 신주인수권       6 : 리츠  9 : 하이얼펀드   30 : K-OTC  999 : ALL(코스피, 코스닥) </param>
        /// <returns></returns>
        public DataTable GetCodeListByMarketCallBackDataTable(string stockGb)
        {
            DataTable Dt = new DataTable();
            DataRow   dr;
            string    CodeList;

            string[] ArrayStockCode;

            Dt.Columns.Add("STOCK_CODE", Type.GetType("System.String"));
            Dt.Columns.Add("STOCK_NAME", Type.GetType("System.String"));

            if (stockGb != "999")
            {
                CodeList = ClsAxKH.AxKH.GetCodeListByMarket(stockGb);

                if (CodeList == "")
                {
                    return(null);
                }
                else
                {
                    ArrayStockCode = CodeList.Split(';');
                    foreach (string stockCode in ArrayStockCode)
                    {
                        dr = Dt.NewRow();
                        dr["STOCK_CODE"] = stockCode;
                        dr["STOCK_NAME"] = ClsAxKH.GetMasterCodeName(stockCode);

                        Dt.Rows.Add(dr);
                    }
                }
            }
            else
            {
                CodeList = ClsAxKH.AxKH.GetCodeListByMarket("0");

                if (CodeList == "")
                {
                    return(null);
                }
                else
                {
                    ArrayStockCode = CodeList.Split(';');
                    foreach (string stockCode in ArrayStockCode)
                    {
                        dr = Dt.NewRow();
                        dr["STOCK_CODE"] = stockCode;
                        dr["STOCK_NAME"] = ClsAxKH.GetMasterCodeName(stockCode);

                        Dt.Rows.Add(dr);
                    }
                }

                CodeList = "";

                CodeList = ClsAxKH.AxKH.GetCodeListByMarket("10");

                if (CodeList == "")
                {
                    return(null);
                }
                else
                {
                    ArrayStockCode = CodeList.Split(';');
                    foreach (string stockCode in ArrayStockCode)
                    {
                        dr = Dt.NewRow();
                        dr["STOCK_CODE"] = stockCode;
                        dr["STOCK_NAME"] = ClsAxKH.GetMasterCodeName(stockCode);

                        Dt.Rows.Add(dr);
                    }
                }
            }


            return(Dt);
        }
예제 #13
0
        private void GetNewStockCode()
        {
            DataTable             dt                    = new DataTable();
            DataTable             dt2                   = new DataTable();
            RichQuery             richQuery             = new RichQuery();
            ClsGetKoaStudioMethod clsGetKoaStudioMethod = new ClsGetKoaStudioMethod();

            dt  = richQuery.p_ScodeQuery(query: "1", stockCode: "", ybYongCode: "", bln3tier: false).Tables[0].Copy();
            dt2 = clsGetKoaStudioMethod.GetCodeListByMarketCallBackDataTable(stockGb: "999");
            int    row       = 0;
            string stockName = "";

            dgv1.DataSource = dt;

            var rows = from t1 in dt2.AsEnumerable()
                       join t2 in dt.AsEnumerable() on t1.Field <string>("STOCK_CODE") equals t2.Field <string>("STOCK_CODE") into tg
                       from tcheck in tg.DefaultIfEmpty()
                           where tcheck == null
                       select t1;

            foreach (DataRow dr in rows)
            {
                if (dr["STOCK_CODE"].ToString().Trim() == "")
                {
                    continue;
                }

                stockName = ClsAxKH.GetMasterCodeName(dr["STOCK_CODE"].ToString());

                if (stockName.Contains("스팩") == true)
                {
                    continue;
                }

                if (stockName.Contains("KOSEF") == true)
                {
                    continue;
                }


                if (stockName.Contains("일본") == true)
                {
                    continue;
                }

                if (stockName.Contains("TIGER") == true)
                {
                    continue;
                }

                if (stockName.Contains("KBSTAR") == true)
                {
                    continue;
                }

                if (stockName.Contains("KINDEX") == true)
                {
                    continue;
                }

                if (stockName.Contains("국고") == true)
                {
                    continue;
                }

                if (stockName.Contains("단기") == true)
                {
                    continue;
                }


                if (stockName.Contains("선물") == true)
                {
                    continue;
                }

                if (stockName.Contains("나스닥") == true)
                {
                    continue;
                }

                if (stockName.Contains("ARIRANG") == true)
                {
                    continue;
                }

                if (stockName.Contains("HANARO") == true)
                {
                    continue;
                }

                if (stockName.Contains(" ETN") == true)
                {
                    continue;
                }

                if (stockName.Contains("KODEX") == true)
                {
                    continue;
                }

                if (stockName.Contains("QV ") == true)
                {
                    continue;
                }

                if (stockName.Contains("TRUE ") == true)
                {
                    continue;
                }

                if (stockName.Contains("미래에셋 ") == true)
                {
                    continue;
                }

                if (stockName.Contains("삼성 ") == true)
                {
                    continue;
                }

                if (stockName.Contains("신한 ") == true)
                {
                    continue;
                }

                if (stockName.Contains("FOCUS ") == true)
                {
                    continue;
                }

                if (stockName.Contains("SMART ") == true)
                {
                    continue;
                }

                if (stockName.Contains("TREX ") == true)
                {
                    continue;
                }

                if (stockName.Contains("파워 ") == true)
                {
                    continue;
                }

                if (stockName.Contains("흥국 ") == true)
                {
                    continue;
                }

                dgv0.Rows.Add();



                dgv0.Rows[row].Cells["STOCK_CODE"].Value = dr["STOCK_CODE"].ToString();
                dgv0.Rows[row].Cells["STOCK_NAME"].Value = stockName;

                row = row + 1;
            }
        }