- 매수 기능 추가

This commit is contained in:
2016-12-09 09:51:00 +09:00
parent 958f523b9c
commit 034c061a1b
12 changed files with 482 additions and 20 deletions

View File

@@ -17,7 +17,7 @@ namespace NewsCrawler
{
public partial class NewsForm : Form
{
CybosHelper m_CybosHelper = new CybosHelper();
CybosHelper m_CybosHelper = null;
CodeList m_CodeList = null;
TextCondition m_Condition = null;
ConfigForm m_ConfigForm = null;
@@ -27,6 +27,7 @@ namespace NewsCrawler
System.Timers.Timer m_CrawlTimer = new System.Timers.Timer();
int m_iCrawlInterval = 500;
bool m_bBrowserReload = false;
bool m_bBuy = false;
@@ -68,6 +69,8 @@ namespace NewsCrawler
m_CrawlTimer.Interval=m_iCrawlInterval;
m_CrawlTimer.Start();
m_CybosHelper = new CybosHelper();
Test();
}
@@ -76,12 +79,26 @@ namespace NewsCrawler
if(Util.IsDebugging() == false)
return;
InsertItem("[test] 덕산하이메탈, 덕산네오룩스 66만여주 취득14:38", new DateTime(2016, 11, 30, 14, 38, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914371817318", "asiae", false);
InsertItem("[test] 자연과환경, 12월15일~22일 주주명부폐쇄14:19", new DateTime(2016, 11, 30, 14, 19, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914193170301", "asiae", false);
InsertItem("[test] 이엠코리아, 한국항공우주산업과 3억원 규모 공급계약14:06", new DateTime(2016, 11, 30, 14, 06, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914055964082", "asiae", false);
InsertItem("[test] 덕산하이메탈, 덕산네오룩스 66만여주 취득14:38", new DateTime(2016, 11, 30, 00, 00, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914371817318", "asiae", false);
InsertItem("[test] 자연과환경, 12월15일~22일 주주명부폐쇄14:19", new DateTime(2016, 11, 30, 00, 00, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914193170301", "asiae", false);
InsertItem("[test] 이엠코리아, 한국항공우주산업과 3억원 규모 공급계약14:06", new DateTime(2016, 11, 30, 00, 00, 00), "http://www.asiae.co.kr/news/sokbo/sokbo_view.htm?idxno=2016112914055964082", "asiae", false);
}
private void BuyItem(CodeList.CODE_VALUE Code)
{
if(m_bBuy == false)
return;
m_CybosHelper.Buy(Code, Config.GetBuyPrice());
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
}
public void OnManualItemBuy(CodeList.CODE_VALUE Code)
{
BuyItem(Code);
}
void ProcessSearchAndBuy(string strTitle, string strRef)
{
CodeList.CODE_VALUE Code = m_CodeList.SearchCode(strTitle);
@@ -102,11 +119,21 @@ namespace NewsCrawler
else if((Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.MANUAL)
Util.Log(Util.LOG_TYPE.MANUAL_CODE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
else
{
Util.Log(Util.LOG_TYPE.POSITIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
BuyItem(Code);
}
break;
case TextCondition.TYPE.MANUAL:
Util.Log(Util.LOG_TYPE.MANUAL_KEYWORD, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
if(m_bBuy == true)
{
ModelessPopup ManualPopup = new ModelessPopup(this);
ManualPopup.SetMessage(string.Format("{0} 매수하시겠습니까?", Code.ToString()), Code);
ManualPopup.Show();
}
break;
case TextCondition.TYPE.NOT_MATCHED:
@@ -673,6 +700,16 @@ namespace NewsCrawler
{
Util.Clear();
}
private void chBuy_CheckedChanged(object sender, EventArgs e)
{
m_bBuy = chBuy.Checked;
if(m_bBuy == true)
Util.Log(Util.LOG_TYPE.VERVOSE, "매수 시작");
else
Util.Log(Util.LOG_TYPE.VERVOSE, "매수 취소");
}
}