From 74aede9da7680d0ee64a3812833ef896f77fa935 Mon Sep 17 00:00:00 2001 From: mjjo53 Date: Fri, 17 Nov 2017 10:41:13 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=A4=EC=88=98=20=EA=B5=AC=EB=B6=84=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20simulation=20input=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoSeller.Designer.cs | 2 +- CybosHelper.cs | 18 +++++++++++++++--- SimulationHelper.cs | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/AutoSeller.Designer.cs b/AutoSeller.Designer.cs index 7152ec9..57a61e8 100644 --- a/AutoSeller.Designer.cs +++ b/AutoSeller.Designer.cs @@ -907,7 +907,7 @@ this.materialLabel3.Name = "materialLabel3"; this.materialLabel3.Size = new System.Drawing.Size(165, 19); this.materialLabel3.TabIndex = 6; - this.materialLabel3.Text = "Version : 2017.03.27.11"; + this.materialLabel3.Text = "Version : 2017.11.18.01"; // // materialLabel2 // diff --git a/CybosHelper.cs b/CybosHelper.cs index 7622b63..f98c4fd 100644 --- a/CybosHelper.cs +++ b/CybosHelper.cs @@ -353,21 +353,31 @@ namespace AutoSellerNS string strCodeName = m_CpConclusion.GetHeaderValue(2); int iConclusionCnt = m_CpConclusion.GetHeaderValue(3); int iPrice = m_CpConclusion.GetHeaderValue(4); + int iOrderNumber = m_CpConclusion.GetHeaderValue(5); + int iOrgOrderNumber = m_CpConclusion.GetHeaderValue(6); string strCancel = m_CpConclusion.GetHeaderValue(16); + string strOrderCondition = m_CpConclusion.GetHeaderValue(19); int iBookValue = m_CpConclusion.GetHeaderValue(21); int iRemainCnt = m_CpConclusion.GetHeaderValue(23); string strBidOrAsk = bBid ? "매수" : "매도"; + if (strOrderCondition == "0") + strOrderCondition = "없음"; + else if (strOrderCondition == "1") + strOrderCondition = "IOC"; + else if (strOrderCondition == "2") + strOrderCondition = "FOK"; + switch (iType) { case 1: // 체결 m_Listener.UpdateItem(strCode, strCodeName, bBid, iConclusionCnt, iRemainCnt, iBookValue); m_Listener.UpdateNCItem(); - Util.Log(bBid?Util.LOG_TYPE.BUY:Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 체결 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt)); + Util.Log(bBid?Util.LOG_TYPE.BUY:Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 체결 ({3:n0}원 {4}주) - {5}", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt, strOrderCondition)); break; case 2: // 확인 - Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("{0}:{1} {2} 확인", strCodeName, strCode, strBidOrAsk)); + Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("{0}:{1} {2} 확인 - {3} ({4}:{5})", strCodeName, strCode, strBidOrAsk, strOrderCondition, iOrderNumber, iOrgOrderNumber)); break; case 3: // 거부 @@ -376,7 +386,9 @@ namespace AutoSellerNS case 4: // 접수 m_Listener.UpdateNCItem(); - Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 접수 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt)); + Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 접수 ({3:n0}원 {4}주) - {5}", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt, strOrderCondition)); + if (bBid == true) + SimulationHelper.InsertSimulationLog(strCode, strCodeName, iPrice); break; } } diff --git a/SimulationHelper.cs b/SimulationHelper.cs index 683a056..c49decb 100644 --- a/SimulationHelper.cs +++ b/SimulationHelper.cs @@ -211,7 +211,7 @@ namespace AutoSellerNS var tokens = strLine.Split('\t'); var strDate = tokens[0]; - var strNewTime = tokens[1]; + var strNewsTime = tokens[1]; var strSimulationTime = tokens[2]; var strCodeName = tokens[3]; strCodeName = strCodeName.Trim(); @@ -1000,6 +1000,19 @@ namespace AutoSellerNS // } }); } + + public static void InsertSimulationLog(string strCode, string strCodeName, int iPrice) + { + DateTime time = DateTime.Now; + string strPath = Util.GetSimulationPath() + "/0-input-" + time.Date.ToString("yyyy-MM-dd") + ".txt"; + File.AppendAllText(strPath, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", + time.ToString("yyyy-MM-dd"), + time.ToString("hh:mm:ss"), + time.ToString("hh:mm:ss"), + strCodeName, + strCode, + iPrice), new UTF8Encoding(true)); + } } }