Beispiel #1
0
        /// <summary>
        /// 사용자가 설정한 조건식 리스트를 가져온다.
        /// </summary>
        /// <returns>조건식리스트</returns>
        public ConditionInfo[] GetConditionInfoList()
        {
            List <ConditionInfo> list = new List <ConditionInfo>();

            // 서버에 저장된 사용자 조건식을 가져온다.
            int ret = m_axKHOpenAPI.GetConditionLoad();

            Debug.Assert(ret != 0);
            if (ret > 0)
            {
                string str = m_axKHOpenAPI.GetConditionNameList();
                log.Debug("수신받은 조건식목록='" + str + "'");
                char[]   sep     = new char[] { ';' };
                string[] strList = str.Split(sep, StringSplitOptions.RemoveEmptyEntries);

                foreach (string sItem in strList)
                {
                    string[] strKV = sItem.Split('^');
                    Debug.Assert(strKV.Length == 2);

                    ConditionInfo info = new ConditionInfo(Convert.ToInt32(strKV[0]), strKV[1]);
                    list.Add(info);
                }
            }
            return(list.ToArray());
        }
Beispiel #2
0
        /// <summary>
        /// 사용자가 설정한 조건식 리스트를 가져온다.
        /// </summary>
        /// <returns>조건식리스트</returns>
        public ConditionInfo[] GetConditionInfoList()
        {
            List <ConditionInfo> list = new List <ConditionInfo>();

            if (!IsConnected)
            {
                return(list.ToArray());
            }

            // 서버에 저장된 사용자 조건식을 가져온다.
            int ret = m_axKHOpenAPI.GetConditionLoad();

            Debug.Assert(ret != 0);
            if (ret > 0)
            {
                int lRet = 0;
                m_axKHOpenAPI.OnReceiveConditionVer += delegate(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveConditionVerEvent e)
                {
                    log.Debug(string.Format("anonymous method as an event handler, iRet={0}, sMsg={1}", e.lRet, e.sMsg));
                    lRet = e.lRet;
                    autoReset.Set();
                };

                // OnReceiveConditionVer 수신대기(최대 3초간)
                autoReset.WaitOne(3000);

                if (lRet != 1)
                {
                    return(list.ToArray());
                }

                string str = m_axKHOpenAPI.GetConditionNameList();
                log.Debug("수신받은 조건식목록='" + str + "'");
                char[]   sep     = new char[] { ';' };
                string[] strList = str.Split(sep, StringSplitOptions.RemoveEmptyEntries);

                foreach (string sItem in strList)
                {
                    string[] strKV = sItem.Split('^');
                    Debug.Assert(strKV.Length == 2);

                    ConditionInfo info = new ConditionInfo(Convert.ToInt32(strKV[0]), strKV[1]);
                    list.Add(info);
                }
            }
            return(list.ToArray());
        }
Beispiel #3
0
 /// <summary>
 /// 조건검색 결과 요청(실시간)
 /// </summary>
 /// <param name="info">요청할 조건검색식 정보</param>
 /// <returns>성공시 true</returns>
 public bool RequestSearchCondition(ConditionInfo info)
 {
     /*  SendCondition
      *  -반환값 : FALSE(실패), TRUE(성공)
      *  -파라메터 설명
      *      strScrNo : 화면번호
      *      strConditionName :GetConditionNameList()로 불러온 조건명중 하나의 조건명.
      *      nIndex : GetCondionNameList()로 불러온 조건인덱스.
      *      nSearch : 일반조회(0), 실시간조회(1), 연속조회(2)
      *          nSearch 를 0으로 조회하면 단순 해당 조건명(식)에 맞는 종목리스트를
      *          받아올 수 있습니다. 1로 조회하면 해당 조건명(식)에 맞는 종목리스트를 받아
      *          오면서 실시간으로 편입, 이탈하는 종목을 받을 수 있는 조건이 됩니다.
      *          -1번으로 조회 할 수 있는 화면 개수는 최대 10개까지 입니다.
      *          -2은 OnReceiveTrCondition 이벤트 함수에서 마지막 파라메터인 nNext가 “2”로
      *          들어오면 종목이 더 있기 때문에 다음 조회를 원할 때 OnReceiveTrCondition
      *          이벤트 함수에서 사용하시면 됩니다.
      *  -결과값
      *  OnReceiveTrCondition(LPCTSTR sScrNo, LPCTSTR strCodeList, LPCTSTR strConditionName, int nIndex, int nNext)
      *  이벤트 함수로 종목리스트가 들어옵니다.
      */
     return(m_axKHOpenAPI.SendCondition(SCR_NO_SEARCH_CONDITION, info.Name, (int)info.Index, (int)SearchConditionType.Realtime) == 1);
 }