Пример #1
0
        private void OnEventConnect(object sender, _DKHOpenAPIEvents_OnEventConnectEvent e)
        {
            if (e.nErrCode == 0 && Identify(axAPI.GetLoginInfo("USER_ID"), axAPI.GetLoginInfo("USER_NAME")) == true)
            {
                Account = axAPI.GetLoginInfo("ACCLIST");
                Code    = ErrorCode == 0 ? axAPI.GetFutureCodeByIndex(e.nErrCode) : axAPI.GetFutureCodeByIndex(ErrorCode);

                if (Account == null)
                {
                    Box.Show("This Account is not Registered.", "Caution", waiting);

                    SendExit?.Invoke(this, new ForceQuit(end));
                }
                if (!axAPI.GetLoginInfo("GetServerGubun").Equals("1"))
                {
                    Box.Show("It's a Real Investment. . .♬♬♬", "Caution", waiting);
                }

                axAPI.KOA_Functions("ShowAccountWindow", "");
                RemainingDay();

                return;
            }
            Box.Show("등록되지 않은 사용자이거나\n로그인이 원활하지 않습니다.\n프로그램을 종료합니다.", "오류", waiting);
            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #2
0
        public void StartProgress()
        {
            if (axAPI != null)
            {
                axAPI.CommConnect();

                return;
            }
            Box.Show("API Not Found!!", "Caution", waiting);

            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #3
0
        public void StartProgress(IStrategy st, IConfirm confirm)
        {
            if (axAPI != null)
            {
                this.confirm = confirm;
                this.st      = st;
                ErrorCode    = axAPI.CommConnect();
                ErrorCode    = 915;

                return;
            }
            Box.Show("API Not Found. . .", "Caution", waiting);
            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #4
0
        private void OnReceiveRealData(object sender, _DKHOpenAPIEvents_OnReceiveRealDataEvent e)
        {
            sb = new StringBuilder(512);

            foreach (int fid in Array.Find(catalog, o => o.ToString().Contains(e.sRealType)))
            {
                sb.Append(axAPI.GetCommRealData(e.sRealKey, fid)).Append(',');
            }

            if (e.sRealType.Equals(sRealType[0]))
            {
                SendTick?.Invoke(this, new TickEvent(sb));
                SendDay?.Invoke(this, new DayEvent(sb));

                return;
            }
            if (e.sRealType.Equals(sRealType[1]) && int.Parse(sb.ToString().Substring(0, 6)) > 153459)
            {
                string[] fg = sb.ToString().Split(',');

                if (fg[52].Contains("-"))
                {
                    fg[52] = fg[52].Substring(1);
                }

                double price = double.Parse(fg[52]);

                SendTick?.Invoke(this, new TickEvent(false, fg[0], price, 0));
                SendDay?.Invoke(this, new DayEvent(false, price));

                return;
            }
            if (e.sRealType.Equals(sRealType[2]))
            {
                string[] tg = sb.ToString().Split(',');

                if (tg[0].Equals("e") && Deadline == false)
                {
                    Deadline = true;

                    Request();

                    SendExit?.Invoke(this, new ForceQuit(0));
                }
                return;
            }
            sb = null;
        }
Пример #5
0
        public void StartProgress(int type)
        {
            if (axAPI != null)
            {
                ErrorCode = axAPI.CommConnect();

                if (type != 0)
                {
                    ErrorCode = type;
                }

                return;
            }
            Box.Show("API Not Found. . .", "Caution", waiting);
            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #6
0
        public void StartProgress()
        {
            if (axAPI != null)
            {
                Error_code = axAPI.CommConnect();

                if (Error_code != 0)
                {
                    SendError?.Invoke(this, new Error(Error_code));

                    Box.Show("Connection Failed!!", "Caution", waiting);

                    SendExit?.Invoke(this, new ForceQuit(end));
                }
                return;
            }
            Box.Show("API Not Found!!", "Caution", waiting);

            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #7
0
        private void OnEventConnect(object sender, _DKHOpenAPIEvents_OnEventConnectEvent e)
        {
            if (!axAPI.GetLoginInfo("GetServerGubun").Equals("1") && e.nErrCode == 0 && confirm.Identify(axAPI.GetLoginInfo("USER_ID"), axAPI.GetLoginInfo("USER_NAME")) && !ErrorCode.Equals(915))
            {
                if (DialogResult.Yes == MessageBox.Show("Do You Want to Retrieve Recent Data?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    Delay.delay = 4150;
                    Request();
                }
                SendConfirm?.Invoke(this, new Identify("The Remaining Validity Period is ", CallBasicInformation(e.nErrCode)));

                return;
            }
            else if (ErrorCode.Equals(915) && e.nErrCode.Equals(0))
            {
                CallBasicInformation(e.nErrCode);

                return;
            }
            Box.Show("등록되지 않은 사용자이거나 모의투자로 접속하셨습니다.\n\n프로그램을 종료합니다.", "오류", waiting);
            SendExit?.Invoke(this, new ForceQuit(end));
        }