Esempio n. 1
0
        void t0441_ReceiveData(string szTrCode)
        {
            int cnt = t0441.GetBlockCount("t0441OutBlock1");

            for (int i = 0; i < cnt; i++)
            {
                DataRow newrow = table_잔고현황.NewRow();
                newrow["종목코드"]   = t0441.GetFieldData("t0441OutBlock1", "expcode", i);
                newrow["종목명"]    = 종목명불러오기(t0441.GetFieldData("t0441OutBlock1", "expcode", i));
                newrow["매매구분"]   = t0441.GetFieldData("t0441OutBlock1", "medosu", i);
                newrow["잔고수량"]   = t0441.GetFieldData("t0441OutBlock1", "jqty", i);
                newrow["청산가능수량"] = t0441.GetFieldData("t0441OutBlock1", "cqty", i);
                newrow["평균진입단가"] = t0441.GetFieldData("t0441OutBlock1", "pamt", i);
                newrow["현재가"]    = t0441.GetFieldData("t0441OutBlock1", "price", i);
                newrow["평가손익"]   = t0441.GetFieldData("t0441OutBlock1", "dtsunik1", i);
                table_잔고현황.Rows.Add(newrow);

                현재가요청(newrow["종목코드"].ToString());
            }

            if (t0441.IsNext)
            {
                연속키_t0441_cts_expcode  = t0441.GetFieldData("t0441OutBlock", "cts_expcode", 0);
                연속키_t0441_cts_medocd   = t0441.GetFieldData("t0441OutBlock", "cts_medocd", 0);
                myTimer_t0441.Interval = 1000;
                myTimer_t0441.Start();
            }
            else
            {
                myTimer_t0441.Stop();
            }
        }
Esempio n. 2
0
        void t0434_ReceiveData(string szTrCode)
        {
            int cnt = t0434.GetBlockCount("t0434OutBlock1");

            for (int i = 0; i < cnt; i++)
            {
                DataRow newrow_체결  = table_체결현황.NewRow();
                DataRow newrow_미체결 = table_미체결현황.NewRow();

                string 주문번호  = int.Parse(t0434.GetFieldData("t0434OutBlock1", "ordno", i)).ToString();
                string 매도매수  = t0434.GetFieldData("t0434OutBlock1", "medosu", i);
                string 주문수량  = t0434.GetFieldData("t0434OutBlock1", "qty", i);
                string 주문가격  = t0434.GetFieldData("t0434OutBlock1", "price", i);
                string 체결수량  = t0434.GetFieldData("t0434OutBlock1", "cheqty", i);
                string 체결가격  = t0434.GetFieldData("t0434OutBlock1", "cheprice", i);
                string 미체결수량 = t0434.GetFieldData("t0434OutBlock1", "ordrem", i);
                string 종목코드  = t0434.GetFieldData("t0434OutBlock1", "expcode", i);
                string 종목명   = 종목명불러오기(t0434.GetFieldData("t0434OutBlock1", "expcode", i));
                if (int.Parse(체결수량) > 0)
                {
                    newrow_체결["주문번호"] = 주문번호;
                    newrow_체결["종목코드"] = 종목코드;
                    newrow_체결["종목명"]  = 종목명;
                    newrow_체결["매매구분"] = 매도매수;
                    newrow_체결["주문가격"] = 주문가격;
                    newrow_체결["주문수량"] = 주문수량;
                    newrow_체결["체결가격"] = 체결가격;
                    newrow_체결["체결수량"] = 체결수량;

                    table_체결현황.Rows.Add(newrow_체결);
                }

                if (int.Parse(미체결수량) > 0)
                {
                    newrow_미체결["주문번호"]  = 주문번호;
                    newrow_미체결["종목코드"]  = 종목코드;
                    newrow_미체결["종목명"]   = 종목명;
                    newrow_미체결["매매구분"]  = 매도매수;
                    newrow_미체결["주문가격"]  = 주문가격;
                    newrow_미체결["주문수량"]  = 주문수량;
                    newrow_미체결["미체결수량"] = 미체결수량;

                    table_미체결현황.Rows.Add(newrow_미체결);
                }
            }

            if (t0434.IsNext)
            {
                연속키_t0434_cts_ordno    = t0434.GetFieldData("t0434OutBlock", "cts_ordno", 0);
                myTimer_t0434.Interval = 1000;
                myTimer_t0434.Start();
            }
            else
            {
                myTimer_t0434.Stop();
            }
        }
Esempio n. 3
0
        private void ReceveData(XAQueryClass myXAQueryClass)
        {
            string[] names = Enum.GetNames(typeof(ColumnName));
            int      cnt_t0434OutBlock1 = myXAQueryClass.GetBlockCount("t0434OutBlock1");

            for (int i = 0; i < cnt_t0434OutBlock1; i++)
            {
                DataRow newrow = table.NewRow();
                foreach (string colname in names)
                {
                    newrow[colname] = myXAQueryClass.GetFieldData("t0434OutBlock1", colname, i);
                }
                table.Rows.Add(newrow);
            }
        }
Esempio n. 4
0
        void myXAQueryClass_t9945_ReceiveData(string szTrCode)
        {
            int cnt = myXAQueryClass_t9945.GetBlockCount("t9945OutBlock");

            for (int i = 0; i < cnt; i++)
            {
                string 종목명  = myXAQueryClass_t9945.GetFieldData("t9945OutBlock", "hname", i);
                string 단축코드 = myXAQueryClass_t9945.GetFieldData("t9945OutBlock", "shcode", i).Trim();
                string 확장코드 = myXAQueryClass_t9945.GetFieldData("t9945OutBlock", "expcode", i).Trim();

                string 소속부 = "";
                if (myXAQueryClass_t9945.GetFieldData("t9945InBlock", "gubun", 0) == "1")
                {
                    소속부 = "거래소";
                }
                else if (myXAQueryClass_t9945.GetFieldData("t9945InBlock", "gubun", 0) == "2")
                {
                    소속부 = "코스닥";
                }

                List <string> value = new List <string>();
                value.Add(종목명);
                value.Add(확장코드);
                value.Add(소속부);

                Form1.Master주식종목.Add(단축코드, value);

                종목수++;

                //Console.WriteLine(종목수 + "\t" + 단축코드 + "\t" + 종목명 + "\t" + 확장코드 + "\t" + 소속부);
                마지막code = 단축코드;
            }

            if (myXAQueryClass_t9945.GetFieldData("t9945InBlock", "gubun", 0) == "1")
            {
                myXAQueryClass_t1101.ResFileName     = @"C:\ETRADE\xingAPI\Res\t1101.res";
                myXAQueryClass_t1101.ReceiveData    += new _IXAQueryEvents_ReceiveDataEventHandler(myXAQueryClass_t1101_ReceiveData);
                myXAQueryClass_t1101.ReceiveMessage += new _IXAQueryEvents_ReceiveMessageEventHandler(myXAQueryClass_t1101_ReceiveMessage);

                myTimer_1.Interval = 220;
                myTimer_1.Tick    += new EventHandler(myTimer_1_Tick);

                myTimer_1.Start();
            }
        }
Esempio n. 5
0
        private void ReceveData(XAQueryClass myXAQueryClass)
        {
            string[] names = Enum.GetNames(typeof(ColumnName));
            int      cnt_t0441OutBlock1 = myXAQueryClass.GetBlockCount("t0441OutBlock1");

            for (int i = 0; i < cnt_t0441OutBlock1; i++)
            {
                DataRow newrow = table.NewRow();
                foreach (string colname in names)
                {
                    newrow[colname] = myXAQueryClass.GetFieldData("t0441OutBlock1", colname, i);
                }

                table.Rows.Add(newrow);
            }

            매매손익 = double.Parse(myXAQueryClass.GetFieldData("t0441OutBlock", "tdtsunik", 0));
            총손익계산();

            현재가Real요청();
        }
        void myXAQueryClass_t9944_ReceiveData(string szTrCode)
        {
            int cnt_t9944OutBlock = myXAQueryClass_t9944.GetBlockCount("t9944OutBlock");

            for (int i = 0; i < cnt_t9944OutBlock; i++)
            {
                List <string> list = new List <string>();
                string        단축코드 = myXAQueryClass_t9944.GetFieldData("t9944OutBlock", "shcode", i);
                string        yyyy = "";
                if (단축코드.Substring(3, 1) == "H")
                {
                    yyyy = "2013";
                }
                else if (단축코드.Substring(3, 1) == "J")
                {
                    yyyy = "2014";
                }
                else if (단축코드.Substring(3, 1) == "K")
                {
                    yyyy = "2015";
                }
                string 종목명  = myXAQueryClass_t9944.GetFieldData("t9944OutBlock", "hname", i);
                string 확장코드 = myXAQueryClass_t9944.GetFieldData("t9944OutBlock", "expcode", i);
                string 만기년월 = yyyy + 종목명.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1].Replace("월", "");
                list.Add(종목명);
                list.Add(확장코드);
                list.Add(만기년월);
                if (!Form1.Master선옵종목.ContainsKey(단축코드))
                {
                    Form1.Master선옵종목.Add(단축코드, list);
                }

                마지막코드 = 단축코드;
            }

            myTimer.Tick    += new EventHandler(myTimer_Tick);
            myTimer.Interval = 220;
            myTimer.Start();
        }
        void myXAQueryClass_t9943_ReceiveData(string szTrCode)
        {
            int cnt_t9943OutBlock = myXAQueryClass_t9943.GetBlockCount("t9943OutBlock");

            for (int i = 0; i < cnt_t9943OutBlock; i++)
            {
                List <string> list = new List <string>();
                string        단축코드 = myXAQueryClass_t9943.GetFieldData("t9943OutBlock", "shcode", i);

                if (단축코드.Substring(0, 1) == "4")
                {
                    continue;
                }

                string yyyy = "";
                if (단축코드.Substring(3, 1) == "H")
                {
                    yyyy = "2013";
                }
                else if (단축코드.Substring(3, 1) == "J")
                {
                    yyyy = "2014";
                }
                else if (단축코드.Substring(3, 1) == "K")
                {
                    yyyy = "2015";
                }
                string 종목명  = myXAQueryClass_t9943.GetFieldData("t9943OutBlock", "hname", i);
                string 확장코드 = myXAQueryClass_t9943.GetFieldData("t9943OutBlock", "expcode", i);
                string 만기년월 = yyyy + 종목명.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1].Replace("월물", "");
                list.Add(종목명);
                list.Add(확장코드);
                list.Add(만기년월);
                if (!Form1.Master선옵종목.ContainsKey(단축코드))
                {
                    Form1.Master선옵종목.Add(단축코드, list);
                }
            }
        }
Esempio n. 8
0
        void t0424_ReceiveData(string szTrCode)//주식잔고2
        {
            int cnt = t0424.GetBlockCount("t0424OutBlock1");

            for (int i = 0; i < cnt; i++)
            {
                string 종목코드   = t0424.GetFieldData("t0424OutBlock1", "expcode", i).Trim();
                string 잔고수량   = t0424.GetFieldData("t0424OutBlock1", "janqty", i);
                string 매도가능수량 = t0424.GetFieldData("t0424OutBlock1", "mdposqt", i);
                string 평균단가   = t0424.GetFieldData("t0424OutBlock1", "pamt", i);
                string 종목명    = t0424.GetFieldData("t0424OutBlock1", "hname", i);
                string 현재가    = t0424.GetFieldData("t0424OutBlock1", "price", i);
                string 평가손익   = t0424.GetFieldData("t0424OutBlock1", "dtsunik", i);

                DataRow newrow = table_잔고현황.NewRow();
                newrow["종목코드"]   = 종목코드;
                newrow["잔고수량"]   = 잔고수량;
                newrow["매도가능수량"] = 매도가능수량;
                newrow["평균단가"]   = 평균단가;
                newrow["종목명"]    = 종목명;
                newrow["현재가"]    = 현재가;
                newrow["평가손익"]   = 평가손익;
                table_잔고현황.Rows.Add(newrow);

                현재가요청(종목코드);
            }
            if (t0424.IsNext)
            {
                연속key_t0424 = t0424.GetFieldData("t0424OutBlock", "cts_expcode", 0);

                myTimer_t0424.Interval = 1000;
                myTimer_t0424.Start();
            }
            else
            {
                myTimer_t0424.Stop();
            }
        }
Esempio n. 9
0
        void t0425_ReceiveData(string szTrCode)//주식 체결/미체결
        {
            int cnt = t0425.GetBlockCount("t0425OutBlock1");

            for (int i = 0; i < cnt; i++)
            {
                string 주문번호  = t0425.GetFieldData("t0425OutBlock1", "ordno", i);
                string 종목코드  = t0425.GetFieldData("t0425OutBlock1", "expcode", i);
                string 주문수량  = t0425.GetFieldData("t0425OutBlock1", "qty", i);
                string 주문가격  = t0425.GetFieldData("t0425OutBlock1", "price", i);
                string 체결수량  = t0425.GetFieldData("t0425OutBlock1", "cheqty", i);
                string 체결가격  = t0425.GetFieldData("t0425OutBlock1", "cheprice", i);
                string 미체결수량 = t0425.GetFieldData("t0425OutBlock1", "ordrem", i);
                string 매매구분  = t0425.GetFieldData("t0425OutBlock1", "medosu", i);
                string 종목명   = 종목명불러오기(종목코드);
                //Console.WriteLine("체결수량 : " + 체결수량 + ",      미체결수량 : " + 미체결수량);

                if (int.Parse(체결수량) > 0)
                {
                    //Console.WriteLine("if (int.Parse(체결수량) > 0)");
                    DataRow newrow = table_체결현황.NewRow();
                    newrow["주문번호"] = 주문번호;
                    newrow["종목코드"] = 종목코드;
                    newrow["매매구분"] = 매매구분;
                    newrow["주문가격"] = 주문가격;
                    newrow["주문수량"] = 주문수량;
                    newrow["체결수량"] = 체결수량;
                    newrow["체결가격"] = 체결가격;
                    newrow["종목명"]  = 종목명;

                    table_체결현황.Rows.Add(newrow);
                }

                if (int.Parse(미체결수량) > 0)
                {
                    //Console.WriteLine("if (int.Parse(미체결수량) > 0)");
                    DataRow newrow1 = table_미체결현황.NewRow();
                    newrow1["주문번호"]  = 주문번호;
                    newrow1["종목코드"]  = 종목코드;
                    newrow1["매매구분"]  = 매매구분;
                    newrow1["주문가격"]  = 주문가격;
                    newrow1["주문수량"]  = 주문수량;
                    newrow1["미체결수량"] = 미체결수량;
                    newrow1["종목명"]   = 종목명;

                    table_미체결현황.Rows.Add(newrow1);
                }
            }

            if (t0425.IsNext)
            {
                연속key_t0425 = t0425.GetFieldData("t0425OutBlock", "cts_ordno", 0);

                myTimer_t0425.Interval = 1000;
                myTimer_t0425.Start();
            }
            else
            {
                myTimer_t0425.Stop();
            }
        }
Esempio n. 10
0
 public int GetBlockCount(string blockName)
 {
     return(_xaQuery.GetBlockCount(blockName));
 }
Esempio n. 11
0
        private void ReceveData(XAQueryClass myXAQueryClass)
        {
            CallCodeList = new List <string>();
            PutCodeList  = new List <string>();

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                CallCodeList.Add("");
                PutCodeList.Add("");
            }



            int cnt_t2301OutBlock1 = myXAQueryClass.GetBlockCount("t2301OutBlock1");

            for (int i = 0; i < cnt_t2301OutBlock1; i++)
            {
                for (int j = 0; j < dataGridView2.Rows.Count; j++)
                {
                    if (dataGridView2.Rows[j].Cells[0].Value.ToString() + "0" == myXAQueryClass.GetFieldData("t2301OutBlock1", "actprice", i))//행사가
                    {
                        CallCodeList[j] = myXAQueryClass.GetFieldData("t2301OutBlock1", "optcode", i);
                        foreach (DataColumn col in CallTable.Columns)
                        {
                            CallTable.Rows[j][col] = myXAQueryClass.GetFieldData("t2301OutBlock1", col.ColumnName, i);
                        }
                        CallTable.Rows[j]["change"] = 전일대비구분포함(myXAQueryClass.GetFieldData("t2301OutBlock1", "sign", i)) + CallTable.Rows[j]["change"].ToString();
                    }
                }
            }

            int cnt_t2301OutBlock2 = myXAQueryClass.GetBlockCount("t2301OutBlock2");

            for (int i = 0; i < cnt_t2301OutBlock2; i++)
            {
                for (int j = 0; j < dataGridView2.Rows.Count; j++)
                {
                    if (dataGridView2.Rows[j].Cells[0].Value.ToString() + "0" == myXAQueryClass.GetFieldData("t2301OutBlock2", "actprice", i))//행사가
                    {
                        PutCodeList[j] = myXAQueryClass.GetFieldData("t2301OutBlock2", "optcode", i);

                        foreach (DataColumn col in PutTable.Columns)
                        {
                            PutTable.Rows[j][col] = myXAQueryClass.GetFieldData("t2301OutBlock2", col.ColumnName, i);
                        }

                        PutTable.Rows[j]["change"] = 전일대비구분포함(myXAQueryClass.GetFieldData("t2301OutBlock2", "sign", i)) + PutTable.Rows[j]["change"].ToString();
                    }
                }
            }

            //real등록
            myOC0.CallBackMethod += ReceiveRealData_OC0;
            myOH0.CallBackMethod += ReceiveRealData_OH0;
            myOMG.CallBackMethod += ReceiveRealData_OMG;

            foreach (DataRow row in CallTable.Rows)
            {
                Dictionary <string, string> InputDataTable = new Dictionary <string, string>();
                InputDataTable.Add("optcode", row["optcode"].ToString());
                myOC0.AdviseExcute(InputDataTable);
                myOH0.AdviseExcute(InputDataTable);
                myOMG.AdviseExcute(InputDataTable);
            }

            foreach (DataRow row in PutTable.Rows)
            {
                Dictionary <string, string> InputDataTable = new Dictionary <string, string>();
                InputDataTable.Add("optcode", row["optcode"].ToString());
                myOC0.AdviseExcute(InputDataTable);
                myOH0.AdviseExcute(InputDataTable);
                myOMG.AdviseExcute(InputDataTable);
            }
        }