- 리스트에 종목명 추가
- 공시 요청 여부 추가 - 공시 특허권취득 추가
This commit is contained in:
135
NewsForm.cs
135
NewsForm.cs
@@ -21,10 +21,12 @@ namespace NewsCrawler
|
||||
{
|
||||
class NEWS_ITEM
|
||||
{
|
||||
public NEWS_ITEM(int iID, string strTitle, string strName, string strCode, DateTime NewsTime, DateTime ResTime, string strRef, string strURL, float fElapseT)
|
||||
public NEWS_ITEM(int iID, string strTitle, string strCode, CodeList.CODE_VALUE Code,
|
||||
DateTime NewsTime, DateTime ResTime, string strRef, string strURL, float fElapseT)
|
||||
{
|
||||
m_iID = iID;
|
||||
m_strCode = strCode;
|
||||
m_Code = Code;
|
||||
m_NewsTime = NewsTime;
|
||||
m_ResTime = ResTime;
|
||||
m_strRef = strRef;
|
||||
@@ -88,9 +90,6 @@ namespace NewsCrawler
|
||||
|
||||
//ExcelHandler m_Excel = null;
|
||||
|
||||
float m_fSupplyContractRate;
|
||||
float m_fRevenueRate;
|
||||
|
||||
object m_lvListLock = new object();
|
||||
|
||||
|
||||
@@ -109,8 +108,6 @@ namespace NewsCrawler
|
||||
m_Condition = new TextCondition();
|
||||
m_CybosHelper = new CybosHelper(this);
|
||||
m_Crawler = new Crawler(this);
|
||||
m_fSupplyContractRate = Config.GetSupplyContractRate();
|
||||
m_fRevenueRate = Config.GetRevenueRate();
|
||||
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, "========== NewsCrawler 실행 ==========");
|
||||
|
||||
@@ -227,70 +224,59 @@ namespace NewsCrawler
|
||||
|
||||
void ProcessSearchAndBuy(NEWS_ITEM NewsItem)
|
||||
{
|
||||
CodeList.CODE_VALUE Code = null;
|
||||
if(NewsItem.m_strCode == "")
|
||||
Code = m_CodeList.SearchCode(NewsItem.m_strTitle);
|
||||
else
|
||||
Code = m_CodeList.GetCode(NewsItem.m_strCode);
|
||||
|
||||
if(Code == null)
|
||||
return;
|
||||
|
||||
NewsItem.m_Code = Code;
|
||||
|
||||
TextCondition.RESULT MatchResult = m_Condition.Match(NewsItem.m_strTitle);
|
||||
switch(MatchResult.m_enType)
|
||||
{
|
||||
case TextCondition.TYPE.NEGATIVE:
|
||||
Util.Log(Util.LOG_TYPE.NEGATIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
Util.Log(Util.LOG_TYPE.NEGATIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.POSITIVE:
|
||||
if((Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
else if((Code.m_enType&CodeList.CODE_TYPE.DUPLICATED) == CodeList.CODE_TYPE.DUPLICATED)
|
||||
Util.Log(Util.LOG_TYPE.DUPLICATED, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
else if((Code.m_enType&CodeList.CODE_TYPE.MANUAL) == CodeList.CODE_TYPE.MANUAL)
|
||||
if((NewsItem.m_Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
else if((NewsItem.m_Code.m_enType&CodeList.CODE_TYPE.DUPLICATED) == CodeList.CODE_TYPE.DUPLICATED)
|
||||
Util.Log(Util.LOG_TYPE.DUPLICATED, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
else if((NewsItem.m_Code.m_enType&CodeList.CODE_TYPE.MANUAL) == CodeList.CODE_TYPE.MANUAL)
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_CODE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_CODE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
|
||||
if(m_bBuy == true)
|
||||
{
|
||||
ModelessPopup ManualPopup = new ModelessPopup(this);
|
||||
ManualPopup.SetMessage(string.Format("{0}\n[{1}] {2}\n(keyword:{3}, code:{4})\n\n매수하시겠습니까?",
|
||||
DateTime.Now.ToString("[hh:mm:ss]"),
|
||||
NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code), Code);
|
||||
NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code), NewsItem.m_Code);
|
||||
ManualPopup.TopMost = true;
|
||||
ManualPopup.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuyItem(Code);
|
||||
Util.Log(Util.LOG_TYPE.POSITIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
BuyItem(NewsItem.m_Code);
|
||||
Util.Log(Util.LOG_TYPE.POSITIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
}
|
||||
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
m_CodeList.AddDuplicatedList(NewsItem.m_Code.m_strCode, NewsItem.m_Code.m_strName);
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.MANUAL:
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_KEYWORD, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_KEYWORD, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||
|
||||
if(m_bBuy == true)
|
||||
{
|
||||
ModelessPopup ManualPopup = new ModelessPopup(this);
|
||||
ManualPopup.SetMessage(string.Format("{0}\n[{1}] {2}\n(keyword:{3}, code:{4})\n\n매수하시겠습니까?",
|
||||
DateTime.Now.ToString("[hh:mm:ss]"),
|
||||
NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, Code), Code);
|
||||
NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code), NewsItem.m_Code);
|
||||
ManualPopup.TopMost = true;
|
||||
ManualPopup.Show();
|
||||
}
|
||||
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
m_CodeList.AddDuplicatedList(NewsItem.m_Code.m_strCode, NewsItem.m_Code.m_strName);
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.NOT_MATCHED:
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("[NOT_MATCHED] [{0}] {1}({2})", NewsItem.m_strRef, NewsItem.m_strTitle, Code.ToString()));
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("[NOT_MATCHED] [{0}] {1}({2})", NewsItem.m_strRef, NewsItem.m_strTitle, NewsItem.m_Code.ToString()));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -306,9 +292,9 @@ namespace NewsCrawler
|
||||
return;
|
||||
}
|
||||
|
||||
if(fRate < m_fSupplyContractRate)
|
||||
if(fRate < Config.GetSupplyContractRate())
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][공급계약체결] 매출액 대비율 낮음({0}, {1}% / {2}%)", strCodeName, fRate, m_fSupplyContractRate));
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][공급계약체결] 매출액 대비율 낮음({0}, {1}% / {2}%)", strCodeName, fRate, Config.GetSupplyContractRate()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,9 +337,9 @@ namespace NewsCrawler
|
||||
return;
|
||||
}
|
||||
|
||||
if (fRate < m_fRevenueRate)
|
||||
if (fRate < Config.GetRevenueRate())
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][영업실적] 당기순이익률 낮음({0}, {1}% / {2}%)", strCodeName, fRate, m_fRevenueRate));
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][영업실적] 당기순이익률 낮음({0}, {1}% / {2}%)", strCodeName, fRate, Config.GetRevenueRate()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -426,16 +412,43 @@ namespace NewsCrawler
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
}
|
||||
|
||||
public void OnSupplyContractRateChanged(float fRate)
|
||||
public void OnReceivedPatent(string strCodeName)
|
||||
{
|
||||
m_fSupplyContractRate = fRate;
|
||||
Config.SetSupplyContractRate(fRate);
|
||||
}
|
||||
CodeList.CODE_VALUE Code = m_CodeList.GetCodeByName(strCodeName);
|
||||
if(Code == null)
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][특허권취득] 종목을 찾을 수 없음({0})", strCodeName));
|
||||
return;
|
||||
}
|
||||
|
||||
public void OnRevenueRateChanged(float fRate)
|
||||
{
|
||||
m_fRevenueRate = fRate;
|
||||
Config.SetRevenueRate(fRate);
|
||||
string strRef = "DartAPI";
|
||||
string strTitle = string.Format("특허권취득 - {0}", strCodeName);
|
||||
|
||||
if((Code.m_enType & CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1}", strRef, strTitle));
|
||||
else if((Code.m_enType & CodeList.CODE_TYPE.DUPLICATED) == CodeList.CODE_TYPE.DUPLICATED)
|
||||
Util.Log(Util.LOG_TYPE.DUPLICATED, string.Format("[{0}] {1}", strRef, strTitle));
|
||||
else if((Code.m_enType & CodeList.CODE_TYPE.MANUAL) == CodeList.CODE_TYPE.MANUAL)
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_CODE, string.Format("[{0}] {1}", strRef, strTitle));
|
||||
|
||||
if(m_bBuy == true)
|
||||
{
|
||||
ModelessPopup ManualPopup = new ModelessPopup(this);
|
||||
ManualPopup.SetMessage(string.Format("{0}\n[{1}] {2}\n\n매수하시겠습니까?",
|
||||
DateTime.Now.ToString("[hh:mm:ss]"),
|
||||
strRef, strTitle), Code);
|
||||
ManualPopup.TopMost = true;
|
||||
ManualPopup.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuyItem(Code);
|
||||
Util.Log(Util.LOG_TYPE.POSITIVE, string.Format("[{0}] {1}", strRef, strTitle));
|
||||
}
|
||||
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
}
|
||||
|
||||
public bool IsDuplicatedURL(string strURL)
|
||||
@@ -462,16 +475,27 @@ namespace NewsCrawler
|
||||
|
||||
int iID = lvList.Items.Count+1;
|
||||
|
||||
CodeList.CODE_VALUE Code = null;
|
||||
if(bInitial == false)
|
||||
ProcessSearchAndBuy(new NEWS_ITEM(iID, strTitle, strName, strCode, time, ResTime, strRef, strURL, (float)dElapseT));
|
||||
{
|
||||
if(strCode == "")
|
||||
Code = m_CodeList.SearchCode(strTitle);
|
||||
else
|
||||
Code = m_CodeList.GetCode(strCode);
|
||||
|
||||
if(Code != null)
|
||||
ProcessSearchAndBuy(new NEWS_ITEM(iID, strTitle, strCode, Code, time, ResTime, strRef, strURL, (float)dElapseT));
|
||||
}
|
||||
|
||||
|
||||
lvList.Items.Add(new ListViewItem(new string[] {
|
||||
iID.ToString(),
|
||||
time.ToString("HH:mm:ss"),
|
||||
ResTime.ToString("HH:mm:ss:fff"),
|
||||
string.Format("{0:n3} ms", dElapseT),
|
||||
strRef,
|
||||
strTitle,
|
||||
string.Format("{0:n4} ms", dElapseT),
|
||||
(Code != null) ? Code.m_strName : "",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@@ -530,7 +554,8 @@ namespace NewsCrawler
|
||||
{
|
||||
m_Crawler.ReadKIND();
|
||||
m_Crawler.ReadDart();
|
||||
m_Crawler.ReadDartAPI();
|
||||
if(Config.CheckDartAPI())
|
||||
m_Crawler.ReadDartAPI();
|
||||
m_Crawler.ReadEtoday();
|
||||
//m_Crawler.ReadEtoday2();
|
||||
m_Crawler.ReadAsiaE();
|
||||
@@ -647,14 +672,14 @@ namespace NewsCrawler
|
||||
if(Data.m_iTryCnt < 3 && Data.m_iPriceHigh == 0)
|
||||
break;
|
||||
|
||||
if(Data.m_bLog == false)
|
||||
{
|
||||
//Data.m_bLog = m_Excel.AddRow(Data.m_NewsItem.m_NewsTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_ResTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_strRef, Data.m_NewsItem.m_strTitle, Data.m_NewsItem.m_fElapseT,
|
||||
// Data.m_iPriceStart,
|
||||
// Data.m_iPriceLow, (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
|
||||
// Data.m_iPriceHigh, (Data.m_iPriceHigh-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
|
||||
// Data.m_NewsItem.m_strURL);
|
||||
}
|
||||
//if(Data.m_bLog == false)
|
||||
//{
|
||||
// Data.m_bLog = m_Excel.AddRow(Data.m_NewsItem.m_NewsTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_ResTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_strRef, Data.m_NewsItem.m_strTitle, Data.m_NewsItem.m_fElapseT,
|
||||
// Data.m_iPriceStart,
|
||||
// Data.m_iPriceLow, (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
|
||||
// Data.m_iPriceHigh, (Data.m_iPriceHigh-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
|
||||
// Data.m_NewsItem.m_strURL);
|
||||
//}
|
||||
|
||||
if(Data.m_bLog == false)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user