Exemplo n.º 1
0
        public int RegisterData(Array strings, RtdCallBack callBack)
        {
            lock (this)
            {
                int id = CUR_TOPIC_ID++;
                Boolean bNewValue = true;
                _server.ConnectData(id, ref strings, ref bNewValue);

                _dict.Add(id, callBack);

                return id;
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Config cfg = new Config("config.txt");

            RtdCallBack callBack = new RtdCallBack(Program.CallBack);

            String spotBondCode = cfg.GetValue(KTB_SPOT_INDEX);

            List<String> targetIP = GetTargetIP(cfg);
            RegisterClient(targetIP);
            Register_Bond(spotBondCode, callBack);

            while (true)
            {
                Console.Read();
            }
        }
Exemplo n.º 3
0
        static void Register_Bond(String code, RtdCallBack callBack)
        {
            String bondSpotLogFile = String.Format("bond_spot_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"));
            //=RTD("infomax.rtd","","SB","KR1035017063","BOCOCUR05",IMEN("현재가격"))

            {
                String registerKey = "BOCOCUR05";
                String registerSubKey = Const.kCurPrice2; // 현재가격
                Register_Raw(code, registerKey, registerSubKey, "CurPrice", bondSpotLogFile, callBack);
            }

            {
                String registerKey = "BOCOCUR05";
                String registerSubKey = Const.kCurRate; // 현재수익률
                Register_Raw(code, registerKey, registerSubKey, "CurRate", bondSpotLogFile, callBack);
            }

            {
                //=RTD("infomax.rtd","","SB","KR1035017063","BOGBBID5",IMEN("매도가격1"))
                String registerKey = "BOGBBID5";
                String registerSubKey = Const.kAskPrice1; // 매도가격1
                Register_Raw(code, registerKey, registerSubKey, "AskPrice1", bondSpotLogFile, callBack);
            }

            {
                //=RTD("infomax.rtd","","SB","KR1035017063","BOGBBID5",IMEN("매수가격1"))
                String registerKey = "BOGBBID5";
                String registerSubKey = Const.kBidPrice1; // 매수가격1
                Register_Raw(code, registerKey, registerSubKey, "BidPrice1", bondSpotLogFile, callBack);
            }
        }
Exemplo n.º 4
0
        static void Register_Raw(String code, String registerKey, String registerSubKey, String displayKey, String logOutPath, RtdCallBack callBack)
        {
            object[] input = new object[] { "SB", code, registerKey, registerSubKey };

            int key = RtdClient.Ins().RegisterData(input, callBack);
            String description = String.Format("{0}|{1}", code, displayKey);

            _keyToDescription.Add(key, description);
            _keyToLogFile.Add(key, logOutPath);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Config cfg = new Config("config.txt");

            RtdCallBack callBack = new RtdCallBack(Program.CallBack);

            String kospiCode = cfg.GetValue(KOSPI_INDEX);
            String kospiFutureCode_1 = cfg.GetValue(KOSPI_FUTURE_INDEX_1);
            String kospiFutureCode_2 = cfg.GetValue(KOSPI_FUTURE_INDEX_2);

            String kospiFutureSpreadCode = cfg.GetValue(KOSPI_FUTURE_SPREAD);

            String usdKrwFutureCode_1 = cfg.GetValue(DOLLAR_FUTURE_INDEX_1);
            String usdKrwFutureCode_2 = cfg.GetValue(DOLLAR_FUTURE_INDEX_2);
            String usdKrwFutureSpreadCode = cfg.GetValue(DOLLAR_FUTURE_SPREAD);

            String bondFutureCode_1 = cfg.GetValue(KTB_FUTURE_INDEX_1);
            String bondFutureCode_2 = cfg.GetValue(KTB_FUTURE_INDEX_2);
            String bondFutureSpreadCode = cfg.GetValue(KTB_FUTURE_SPREAD);

            String spotBondCode = cfg.GetValue(KTB_SPOT_INDEX);

            List<String> targetIP = GetTargetIP(cfg);
            RegisterClient(targetIP);

            Register_KospiFuture(kospiFutureCode_1, callBack);
            Register_KospiFuture(kospiFutureCode_2, callBack);
            Register_KospiFuture(kospiFutureSpreadCode, callBack);

            Register_UsdKrw(usdKrwFutureCode_1, callBack);
            Register_UsdKrw(usdKrwFutureCode_2, callBack);
            Register_UsdKrw(usdKrwFutureSpreadCode, callBack);

            Register_BondFuture(bondFutureCode_1, callBack);
            Register_BondFuture(bondFutureCode_2, callBack);
            Register_BondFuture(bondFutureSpreadCode, callBack);

            Register_UsdKrwSpot("SEOULFX", "FXFUOE", "FXFUOD", callBack);
            Register_UsdKrwSpot("KOREAFX", "FXMUOE", "FXMUOD", callBack);
            Register_UsdKrwSpot("TOTALFX", "FXAFOE", "FXAFOD", callBack);

            Register_Bond(spotBondCode, callBack);
            Register_Kospi(kospiCode, callBack);

            while (true)
            {
                Console.Read();
            }
        }
Exemplo n.º 6
0
        static void Register_UsdKrwSpot(
            String spotFlag, 
            String curPriceKey,
            String bidAskPriceKey,
            RtdCallBack callBack)
        {
            String usdKrwSpotLogFile = String.Format("fx_{1}_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"), spotFlag);
            const String code = "USDSP";

            // 현재가
            {
                //=RTD("infomax.rtd","","SB",MID($B4,1,5),"FXFUOE",IMEN("현재가"))

                object[] input = new object[] { "SB", code, curPriceKey, Const.kCurPrice };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}|{2}", spotFlag, code, "CurPrice");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwSpotLogFile);
            }

            //매도호가
            {
                //=RTD("infomax.rtd","","SB",MID($B4,1,5),"FXFUOD",IMEN("매도호가"))
                object[] input = new object[] { "SB", code, bidAskPriceKey, Const.kAskPrice };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}|{2}", spotFlag, code, "AskPrice");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwSpotLogFile);
            }

            //매수호가
            {
                //=RTD("infomax.rtd","","SB",MID($B4,1,5),"FXFUOD",IMEN("매수호가"))
                object[] input = new object[] { "SB", code, bidAskPriceKey, Const.kBidPrice };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}|{2}", spotFlag, code, "BidPrice");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwSpotLogFile);
            }
        }
Exemplo n.º 7
0
        static void Register_UsdKrw(String usdKrwFutureCode, RtdCallBack callBack)
        {
            String usdKrwLogFile = String.Format("usdkrw_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"));

            // 현재가
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTEXEC", Const.kCurPrice };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "CurPrice");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }
            //베이시스
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTTHEO", Const.kBasis };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "Basis");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }

            //매도호가
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTQUOT", Const.kAskPrice1 };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "AskPrice1");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }

            //매수호가
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTQUOT", Const.kBidPrice1 };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "BidPrice1");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }

            //매도수량
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTQUOT", Const.kAskCount1 };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "AskCount1");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }

            //매수수량
            {
                object[] input = new object[] { "SB", usdKrwFutureCode, "FUTQUOT", Const.kBidCount1 };

                int key = RtdClient.Ins().RegisterData(input, callBack);
                String description = String.Format("{0}|{1}", usdKrwFutureCode, "BidCount1");

                _keyToDescription.Add(key, description);
                _keyToLogFile.Add(key, usdKrwLogFile);
            }
        }
Exemplo n.º 8
0
 static void Register_Kospi(String code, RtdCallBack callBack)
 {
     String kospiSpotLogFile = String.Format("kospi_spot_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"));
     //=RTD("infomax.rtd","","SB","001","STCL1",IMEN("현재지수"))
     {
         String registerKey = "STCL1";
         String registerSubKey = Const.kCurIndexPrice; // 현재지수
         Register_Raw(code, registerKey, registerSubKey, "CurPrice", kospiSpotLogFile, callBack);
     }
 }
Exemplo n.º 9
0
        static void Register_BondFuture(String bondFutureCode, RtdCallBack callBack)
        {
            String bondFutureLogFile = String.Format("bond_future_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"));

            //=RTD("infomax.rtd","","SB","161EC000","FUTEXEC",IMEN("현재가"))
            Register_Raw(bondFutureCode, "FUTEXEC", Const.kCurPrice, "CurPrice", bondFutureLogFile, callBack);

            //=RTD("infomax.rtd","","SB","161EC000","FUTTHEO",IMEN("시장베이시스"))
            Register_Raw(bondFutureCode, "FUTTHEO", Const.kBasis, "Basis", bondFutureLogFile, callBack);

            //=RTD("infomax.rtd","","SB","161EC000","FUTQUOT",IMEN("매도호가1"))
            Register_Raw(bondFutureCode, "FUTQUOT", Const.kAskPrice1, "AskPrice1", bondFutureLogFile, callBack);

            //=RTD("infomax.rtd","","SB","161EC000","FUTQUOT",IMEN("매수호가1"))
            Register_Raw(bondFutureCode, "FUTQUOT", Const.kBidPrice1, "BidPrice1", bondFutureLogFile, callBack);

            //=RTD("infomax.rtd","","SB","161EC000","FUTQUOT",IMEN("매도잔량1"))
            Register_Raw(bondFutureCode, "FUTQUOT", Const.kAskCount1, "AskCount1", bondFutureLogFile, callBack);

            //=RTD("infomax.rtd","","SB","161EC000","FUTQUOT",IMEN("매수잔량1"))
            Register_Raw(bondFutureCode, "FUTQUOT", Const.kBidCount1, "BidCount1", bondFutureLogFile, callBack);
        }