Exemple #1
0
        public void getbalance()
        {
            axKHOpenAPI.SetInputValue("계좌번호", "8106398111");
            axKHOpenAPI.SetInputValue("비밀번호", "");
            axKHOpenAPI.SetInputValue("상장폐지조회구분", "0");
            axKHOpenAPI.SetInputValue("비밀번호입력매체구분", "00");
            //            axKHOpenAPI.SetInputValue("조회구분", "2");

            int nRet = axKHOpenAPI.CommRqData("계좌평가현황요청", "OPW00004", 0, "6001");
        }
Exemple #2
0
        public void RequestItem(string ItemCode, ReceiveAfter delFunc)
        {
            if (!init)
            {
                return;
            }

            if (afterEventFunction.ContainsKey(ItemCode) == false)
            {
                afterEventFunction.Add(ItemCode, delFunc);
            }
            else
            {
                afterEventFunction[ItemCode] = delFunc;
            }


            Task requestItemInfoTaskMinute = new Task(() =>
            {
                axKHOpenAPI1.SetInputValue("종목코드", ItemCode);
                axKHOpenAPI1.SetInputValue("틱범위", "5");
                axKHOpenAPI1.SetInputValue("수정주가구분", "0");
                int result = axKHOpenAPI1.CommRqData(ConstName.RECEIVE_TR_DATA_MINUTE_CHART + ":" + screenNumber, "opt10080", 0, "1080");
                if (result != ErrorCode.정상처리)
                {
                    Core.CoreEngine.GetInstance().SendLogErrorMessage("ERROR : " + result.ToString());
                }
            });

            Core.CoreEngine.GetInstance().requestTrDataManager.RequestTrData(requestItemInfoTaskMinute);
        }
Exemple #3
0
 public void requestStockDataByCode(String code, String date)
 {
     kiWoomApi.SetInputValue("종목코드", code);
     kiWoomApi.SetInputValue("기준일자", date);
     kiWoomApi.SetInputValue("수정주가구분", "0");
     int result = kiWoomApi.CommRqData("일봉조회", "opt10081", 0, "1002");
 }
Exemple #4
0
 private void accountRefreshBtn_Click(object sender, EventArgs e)
 {
     axKHOpenAPI1.SetInputValue("계좌번호", Form1.account);
     axKHOpenAPI1.SetInputValue("비밀번호", "");
     axKHOpenAPI1.SetInputValue("상장폐지조회구분", "0");
     axKHOpenAPI1.SetInputValue("비밀번호입력매체구분", "00");
     axKHOpenAPI1.CommRqData(ConstName.RECEIVE_TR_DATA_ACCOUNT_INFO_FORM2, "OPW00004", 0, Form1.GetScreenNum().ToString());
 }
        // 계좌평가현황요청
        public int RequestAccountInfo()
        {
            conn.SetInputValue("계좌번호", AccountNo);
            conn.SetInputValue("비밀번호", "kps2401");
            conn.SetInputValue("상장폐지조회구분", "0");
            conn.SetInputValue("비밀번호입력매체구분", "00");

            return(conn.CommRqData("계좌평가현황요청", "OPW00004", 0, "0"));
        }
Exemple #6
0
        public void RequestKospi(ReceiveAfter delFunc, CHART_TYPE typeChart = CHART_TYPE.MINUTE_5)
        {
            refreshCheck.Checked = true;
            afterEventFunction   = delFunc;
            ItemName.Text        = "코스피지수";
            Task requestItemInfoTask = new Task(() =>
            {
                axKHOpenAPI1.SetInputValue("업종코드", "001");
                axKHOpenAPI1.SetInputValue("틱범위", "5:5분");
                axKHOpenAPI1.SetInputValue("수정주가구분", "1");

                int result = axKHOpenAPI1.CommRqData(ConstName.RECEIVE_TR_DATA_KOSPI_MINUTE_CHART + ":" + screenNumber, "OPT20005", 0, "1080");
                if (result != ErrorCode.정상처리)
                {
                    Core.CoreEngine.GetInstance().SendLogErrorMessage("ERROR : " + result.ToString());
                }
            });

            Core.CoreEngine.GetInstance().requestTrDataManager.RequestTrData(requestItemInfoTask);
            KospiInfo info = new KospiInfo();

            UpDownInfoText.Text = info.GetStockKospi();
        }
Exemple #7
0
 public void ReqChartData(string itemCode)
 {
     if (axKHOpenAPI1.GetConnectState() == 1)
     {
         if (!string.IsNullOrEmpty(itemCode))
         {
             Task requestItemInfoTask = new Task(() =>
             {
                 axKHOpenAPI1.SetInputValue("종목코드", itemCode);
                 axKHOpenAPI1.SetInputValue("틱범위", "30");
                 axKHOpenAPI1.SetInputValue("수정주가구분", "0");
                 axKHOpenAPI1.CommRqData("틱데이터차트조회", "opt10079", 0, "1080");
             });
             Core.CoreEngine.GetInstance().requestTrDataManager.RequestTrData(requestItemInfoTask);
         }
     }
 }
Exemple #8
0
        private void AddTrailing(TrailingPercentageItemForSave saved)
        {
            Task requestItemInfoTask = new Task(() =>
            {
                TrailingItem itemAdd = saved.ReloadTrailingItem();

                foreach (var strategyItem in form.tradingStrategyList)
                {
                    if (saved.strategySave.buyCondition.Name == strategyItem.buyCondition.Name)
                    {
                        itemAdd.strategy = strategyItem;
                    }
                }

                axKHOpenAPI1.SetInputValue("종목코드", itemAdd.itemCode);
                int result = axKHOpenAPI1.CommRqData(ConstName.RECEIVE_REAL_DATA_HOGA, "opt10004", 0, Form1.GetScreenNum().ToString());

                form.SetTrailingItem(itemAdd);
            });

            RequestTrDataManager.GetInstance().RequestTrData(requestItemInfoTask);
        }
Exemple #9
0
        public static void SendCommRqData(OptType optType, ArrayList optCall, string sRQName, string sTrCode, int nPrevNext, string sScreenNo)
        {
            lock (lockObject)
            {
                string stockCode = "";

                ArrayList arrlist = new ArrayList();
                arrlist.Add(sRQName);
                arrlist.Add(sTrCode);
                arrlist.Add(nPrevNext);
                arrlist.Add(sScreenNo);

                AxKHQueueList.Enqueue(arrlist);

                ArrayList item;

                AxKHQueueList.TryDequeue(out item);

                string sRQNameSet = "";

                switch (optType)
                {
                case OptType.Opt10001:
                    //_stockCode10001 = "";

                    //_stockCode10001 = optCall[0].ToString();
                    stockCode = optCall[0].ToString();
                    Opt10001(stockCode: optCall[0].ToString());

                    break;

                case OptType.Opt10005:
                    //_stockCode10005 = "";

                    //_stockCode10005 = optCall[0].ToString();

                    stockCode = optCall[0].ToString();
                    Opt10005(stockCode: optCall[0].ToString());
                    break;

                case OptType.Opt10015:
                    //_stockCode10015 = "";

                    //_stockCode10015 = optCall[0].ToString();
                    stockCode = optCall[0].ToString();
                    Opt10015(stockCode: optCall[0].ToString(), startDate: optCall[1].ToString());
                    break;

                case OptType.Opt10081:
                    //_stockCode10081 = "";

                    //_stockCode10081 = optCall[0].ToString();
                    stockCode = optCall[0].ToString();
                    Opt10081(stockCode: optCall[0].ToString(), stdDate: optCall[1].ToString(), modifyJugaGb: optCall[2].ToString());
                    break;

                case OptType.Opt10086:
                    // _stockCode10086 = "";

                    //_stockCode10086 = optCall[0].ToString();
                    stockCode = optCall[0].ToString();
                    Opt10086(stockCode: optCall[0].ToString(), stdDate: optCall[1].ToString(), displayGb: optCall[2].ToString());
                    break;

                case OptType.Opt10060:
                    // _stockCode10060 = "";
                    //_stockCode10060 = optCall[1].ToString();
                    stockCode = optCall[1].ToString();
                    Opt10060(startDate: optCall[0].ToString(), stockCode: optCall[1].ToString(), amountQtyGb: optCall[2].ToString(), maeMaeGb: optCall[3].ToString(), unitGb: optCall[4].ToString());
                    break;

                case OptType.Opt20068:
                    //_stockCode20068 = "";
                    //_stockCode20068 = optCall[3].ToString();
                    stockCode = optCall[3].ToString();
                    Opt20068(startDate: optCall[0].ToString(), endDate: optCall[1].ToString(), allGb: optCall[2].ToString(), stockCode: optCall[3].ToString());
                    break;

                case OptType.Opt90002:
                    //_kthCode90002 = "";
                    //_kthCode90002 = optCall[1].ToString();
                    stockCode = optCall[1].ToString();
                    Opt90002(dateGb: optCall[0].ToString(), kthCode: optCall[1].ToString());
                    break;

                default:
                    return;
                }

                for (int i = 0; i < optCall.Count; i++)
                {
                    if (sRQNameSet == "")
                    {
                        sRQNameSet = optCall[i].ToString();
                    }
                    else
                    {
                        sRQNameSet = sRQNameSet + "," + optCall[i].ToString();
                    }
                }

                ClsDbLogger.StoreLogger(loggergb: ClsDbLogger.LoggerGb.SendLoger, optCallNo: item[0].ToString() + " : " + "SetInputValue", transText: sRQNameSet);

                string sCommRqData = "";

                for (int i = 0; i < item.Count; i++)
                {
                    if (sCommRqData == "")
                    {
                        sCommRqData = item[i].ToString();
                    }
                    else
                    {
                        sCommRqData = sCommRqData + "," + item[i].ToString();
                    }
                }

                if (SPEED_CALL == true)
                {
                    SpeedSpendTime();
                }
                else
                {
                    RegularSpandTime();
                }

                ClsDbLogger.StoreLogger(loggergb: ClsDbLogger.LoggerGb.SendLoger, optCallNo: item[0].ToString() + " : " + "CommRqData", transText: sRQNameSet + "@" + sCommRqData);

                int nRet = AxKH.CommRqData(sRQName: item[0].ToString() + "," + sRQNameSet, sTrCode: item[1].ToString(), nPrevNext: Convert.ToInt32(item[2]), sScreenNo: item[3].ToString());

                //_CallOptTime = DateTime.Now;

                SendsRQName = item[0].ToString() + "," + sRQNameSet;

                //if (aTimer.Enabled == false)
                //{
                //    // StartTimer();
                //}

                if (ClsWoomErrorCode.GetErrorMessage(nRet) == true)
                {
                    //   Logger(Log.일반, "[OPT10081] : " + lsWoomErrorCode.GetErrorMessage());
                }
                else
                {
                    string erroText = ClsWoomErrorCode.GetErrorMessage();
                    ClsDbLogger.StoreLogger(loggergb: ClsDbLogger.LoggerGb.ErrorLoger, optCallNo: item[0].ToString(), transText: erroText);

                    // Logger(Log.에러, "[OPT10081] : " + Error.GetErrorMessage());
                }
            }
        }