/// <summary> 매수 전 종목 </summary> private void CheckBuyProcessByRealData(AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveRealDataEvent e, string code, int price) { //장외 if (DateTime.Now.Hour < 9 || (DateTime.Now.Hour >= 15 && DateTime.Now.Minute >= 19)) { return; } if (_processErrorFlag) { return; } if (TODAY_LIST_BUY_PRICE.ContainsKey(code)) { if (price > 0) { float targetPrice = TODAY_LIST_BUY_PRICE[code]; if (price >= targetPrice) { //매수 ProcessBuyByRealData(e, code, TODAY_LIST_FIRST_PRICE[code], price); _logManager.AddBuyCount(); } } else { string log = string.Format("Error On Find Now Price.\nCode : {0}\n", code); Console.WriteLine(log); _processErrorFlag = true; } } else { //targetPRice 등록 //TODO : 시가 또는 price 파라미터값으로 int startPrice = int.Parse(axKHOpenAPI2.GetCommRealData(code, 16).Trim().Replace("-", "")); if (startPrice != 0) { float targetPrice = startPrice * TARGET_PRICE_RATE; string log = string.Format("Init TargetPrice.\nName : {0}\nNow Price : {1}\nTarget Price : {2}", code, startPrice, targetPrice); Console.WriteLine("\n"); Console.WriteLine(log); Console.WriteLine("\n"); if (TODAY_LIST_BUY_PRICE.ContainsKey(code) == false) { TODAY_LIST_BUY_PRICE.Add(code, targetPrice); } else { Console.WriteLine("Error On Add Dict"); _processErrorFlag = true; return; } if (TODAY_LIST_FIRST_PRICE.ContainsKey(code) == false) { TODAY_LIST_FIRST_PRICE.Add(code, startPrice); } else { Console.WriteLine("Error On Add Dict"); _processErrorFlag = true; return; } CheckBuyProcessByRealData(e, code, price); } else { string log = string.Format("Error On Init TargetPrice.\nCode : {0}", code); Console.WriteLine(log); _processErrorFlag = true; } } }