Example #1
0
        private void AxKHOpenAPI_OnReceiveTrData1(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            if (e.sRQName == "주식일봉차트조회")
            {
                string text = null;
                for (int nLoop = 0; nLoop < 10; nLoop++)
                {
                    text += (DateTime.Today.AddDays(nLoop * -1).ToString()) + " : ";

                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "현재가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "시가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "고가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "저가").Trim();
                    text += Environment.NewLine;
                }

                Program.writeFileOnCurrDir("주식일봉차트조회", text);
            }
            if (e.sRQName == "주식분봉차트조회")
            {
                string text = null;
                for (int nLoop = 0; nLoop < 10; nLoop++)
                {
                    text += (DateTime.Today.AddDays(nLoop * -1).ToString()) + " : ";

                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "현재가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "시가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "고가").Trim() + "/";
                    text += axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, nLoop, "저가").Trim();
                    text += Environment.NewLine;
                }

                Program.writeFileOnCurrDir("주식분봉차트조회", text);
            }
        }