Example #1
0
        void _backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Do something
            Object argument = e.Argument;
            // BackgroundWorker에서 수행할 일을 정의합니다.
            IEnumerable <Stock> stockList = StockManager.getStockList().Cast <Stock>();
            int cnt = 1;

            foreach (Stock st in stockList)
            {
                setStatus("조회중" + "[" + cnt++ + "]", st.name);
                RequestCountUtil.add();

                setPastPrice(st.code);
                StockManager.evaluateBuy(st.code);

                if (st.buyPoint > 7)
                {
                    addMsg("name", st.name);
                    addMsg("buyPoint", st.buyPoint);
                    StockPrice sp = st.getLastPrice();
                    addMsg("rate5", sp.rate5);
                }
            }
        }
Example #2
0
        private void btnStockCode_Click(object sender, RoutedEventArgs e)
        {
            short cnt = m_CpStockCode.GetCount();

            addMsg("StockCodeCount", cnt.ToString());

            //for (short i = 0; i < cnt; i++) {
            for (short i = (short)(cnt - 1); i >= 0; i--)
            {
                Object code     = m_CpStockCode.GetData(0, i);
                Object name     = m_CpStockCode.GetData(1, i);
                Object fullCode = m_CpStockCode.GetData(2, i);
                //addMsg("code", code);
                //addMsg("name", name);
                //addMsg("fullCode", fullCode);


                Regex regex = new Regex(@"KOSPI|KODEX|SMART|ARIRANG|KBSTAR|TIGER|KINDEX|KOSEF|대신B\d{3}");
                if (regex.IsMatch(name.ToString()))
                {
                    continue;
                }

                StockManager.addStock(code, name, fullCode);
            }

            cbStockCode.ItemsSource   = StockManager.getStockList();
            cbStockCode.SelectedIndex = 0;
        }
Example #3
0
        private void setPastPrice(object code)
        {
            m_StockChart.SetInputValue(0, code); // 종목코드
            m_StockChart.SetInputValue(1, '2');  // 개수로 요청
            m_StockChart.SetInputValue(4, 120);  // 요청개수

            // 0: 날짜
            // 1: 시가
            // 5: 종가
            // 8: 거래량
            object[] types = { 0, 1, 5, 8 };
            m_StockChart.SetInputValue(5, types); // 요청 데이터 타입

            m_StockChart.SetInputValue(6, 'D');   // 챠트 구분
            m_StockChart.BlockRequest();

            object cnt = m_StockChart.GetHeaderValue(3);

            //addMsg("cnt", cnt);

            for (int i = 0; i < Convert.ToInt16(cnt); i++)
            {
                object date       = m_StockChart.GetDataValue(0, i);
                object priceStart = m_StockChart.GetDataValue(1, i);
                object priceEnd   = m_StockChart.GetDataValue(2, i);
                object volumn     = m_StockChart.GetDataValue(3, i);
                //addMsg("date", date);
                //addMsg("priceStart", priceStart);
                //addMsg("priceEnd", priceEnd);
                //addMsg("volumn", volumn);
                StockPrice stockPrice = new StockPrice(date, priceStart, priceEnd, volumn);

                StockManager.addStockPrice(code, stockPrice);
            }

            // 모두 입력후에 평균을 계산한다.
            StockManager.calculateAvg(code);
        }