- 임시 커밋
This commit is contained in:
@@ -57,6 +57,8 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
Console.WriteLine("Code Search Test");
|
Console.WriteLine("Code Search Test");
|
||||||
|
|
||||||
|
Console.WriteLine(SearchCode("[fnRASSI]씨트리(047920) 전일대비 6.77% 상승"));
|
||||||
|
|
||||||
Console.WriteLine(SearchCode("[클릭 e종목]로엔, 본격적으로 시작되는 카카오 시너"));
|
Console.WriteLine(SearchCode("[클릭 e종목]로엔, 본격적으로 시작되는 카카오 시너"));
|
||||||
Console.WriteLine(SearchCode("[클릭 e종목]\"SK텔레콤, 투자심리 개선 가능성 주목해"));
|
Console.WriteLine(SearchCode("[클릭 e종목]\"SK텔레콤, 투자심리 개선 가능성 주목해"));
|
||||||
Console.WriteLine(SearchCode("[클릭 e종목]SK하이닉스, 추가 상승 낙관적"));
|
Console.WriteLine(SearchCode("[클릭 e종목]SK하이닉스, 추가 상승 낙관적"));
|
||||||
@@ -260,7 +262,9 @@ namespace NewsCrawler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string strReplace = Regex.Replace(strText, @"(\(|\[|\<).*(\)|\]|\>)", "");
|
string strReplace = Regex.Replace(strText, @"(\[).*(\])", "");
|
||||||
|
strReplace = Regex.Replace(strReplace, @"(\().*(\))", "");
|
||||||
|
strReplace = Regex.Replace(strReplace, @"(\<).*(\>)", "");
|
||||||
string[] words = strReplace.Trim().Split(' ');
|
string[] words = strReplace.Trim().Split(' ');
|
||||||
string strCodeWord = words[0];
|
string strCodeWord = words[0];
|
||||||
|
|
||||||
|
|||||||
22
Config.cs
22
Config.cs
@@ -29,6 +29,8 @@ namespace NewsCrawler
|
|||||||
m_Data.Add("ann-rights-issue", true);
|
m_Data.Add("ann-rights-issue", true);
|
||||||
m_Data.Add("ann-patent", true);
|
m_Data.Add("ann-patent", true);
|
||||||
m_Data.Add("ann-patent-search-string", new Regex("(미국|중국)"));
|
m_Data.Add("ann-patent-search-string", new Regex("(미국|중국)"));
|
||||||
|
m_Data.Add("ann-profit-change", true);
|
||||||
|
m_Data.Add("ann-profit-change-rate", 50.0f);
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
Migration();
|
Migration();
|
||||||
@@ -174,8 +176,11 @@ namespace NewsCrawler
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void SetAnnouncement(bool bDartAPI,
|
public static void SetAnnouncement(bool bDartAPI,
|
||||||
bool bSupply, bool bRevenue, bool bRightsIssue, bool bPatent,
|
bool bSupply, float fSupplyContractRate,
|
||||||
float fSupplyContractRate, float fRevenueRate, string strPatent)
|
bool bRevenue, float fRevenueRate,
|
||||||
|
bool bRightsIssue,
|
||||||
|
bool bPatent, string strPatent,
|
||||||
|
bool bProfitChange, float fProfitChangeRate)
|
||||||
{
|
{
|
||||||
m_Data["ann-dart-api"] = bDartAPI;
|
m_Data["ann-dart-api"] = bDartAPI;
|
||||||
|
|
||||||
@@ -190,6 +195,9 @@ namespace NewsCrawler
|
|||||||
m_Data["ann-patent"] = bPatent;
|
m_Data["ann-patent"] = bPatent;
|
||||||
m_Data["ann-patent-search-string"] = strPatent;
|
m_Data["ann-patent-search-string"] = strPatent;
|
||||||
|
|
||||||
|
m_Data["ann-profit-change"] = bProfitChange;
|
||||||
|
m_Data["ann-profit-change-rate"] = fProfitChangeRate;
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +241,16 @@ namespace NewsCrawler
|
|||||||
{
|
{
|
||||||
return (Regex)m_Data["ann-patent-search-string"];
|
return (Regex)m_Data["ann-patent-search-string"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool CheckProfitChange()
|
||||||
|
{
|
||||||
|
return (bool)m_Data["ann-profit-change"];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetProfitChangeRate()
|
||||||
|
{
|
||||||
|
return (float)m_Data["ann-profit-change-rate"];
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
50
ConfigForm.Designer.cs
generated
50
ConfigForm.Designer.cs
generated
@@ -65,6 +65,7 @@
|
|||||||
this.groupBox12 = new System.Windows.Forms.GroupBox();
|
this.groupBox12 = new System.Windows.Forms.GroupBox();
|
||||||
this.btAnApply = new System.Windows.Forms.Button();
|
this.btAnApply = new System.Windows.Forms.Button();
|
||||||
this.tbAnPatent = new System.Windows.Forms.TextBox();
|
this.tbAnPatent = new System.Windows.Forms.TextBox();
|
||||||
|
this.chAnProfitChange = new System.Windows.Forms.CheckBox();
|
||||||
this.chAnPatent = new System.Windows.Forms.CheckBox();
|
this.chAnPatent = new System.Windows.Forms.CheckBox();
|
||||||
this.chAnRightsIssue = new System.Windows.Forms.CheckBox();
|
this.chAnRightsIssue = new System.Windows.Forms.CheckBox();
|
||||||
this.chAnRevenue = new System.Windows.Forms.CheckBox();
|
this.chAnRevenue = new System.Windows.Forms.CheckBox();
|
||||||
@@ -75,6 +76,8 @@
|
|||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.tbAnSupplyContractRate = new System.Windows.Forms.TextBox();
|
this.tbAnSupplyContractRate = new System.Windows.Forms.TextBox();
|
||||||
this.label9 = new System.Windows.Forms.Label();
|
this.label9 = new System.Windows.Forms.Label();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.tbAnProfitChange = new System.Windows.Forms.TextBox();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
this.groupBox6.SuspendLayout();
|
this.groupBox6.SuspendLayout();
|
||||||
@@ -442,8 +445,11 @@
|
|||||||
//
|
//
|
||||||
// groupBox12
|
// groupBox12
|
||||||
//
|
//
|
||||||
|
this.groupBox12.Controls.Add(this.label5);
|
||||||
|
this.groupBox12.Controls.Add(this.tbAnProfitChange);
|
||||||
this.groupBox12.Controls.Add(this.btAnApply);
|
this.groupBox12.Controls.Add(this.btAnApply);
|
||||||
this.groupBox12.Controls.Add(this.tbAnPatent);
|
this.groupBox12.Controls.Add(this.tbAnPatent);
|
||||||
|
this.groupBox12.Controls.Add(this.chAnProfitChange);
|
||||||
this.groupBox12.Controls.Add(this.chAnPatent);
|
this.groupBox12.Controls.Add(this.chAnPatent);
|
||||||
this.groupBox12.Controls.Add(this.chAnRightsIssue);
|
this.groupBox12.Controls.Add(this.chAnRightsIssue);
|
||||||
this.groupBox12.Controls.Add(this.chAnRevenue);
|
this.groupBox12.Controls.Add(this.chAnRevenue);
|
||||||
@@ -455,14 +461,14 @@
|
|||||||
this.groupBox12.Controls.Add(this.tbAnSupplyContractRate);
|
this.groupBox12.Controls.Add(this.tbAnSupplyContractRate);
|
||||||
this.groupBox12.Location = new System.Drawing.Point(280, 316);
|
this.groupBox12.Location = new System.Drawing.Point(280, 316);
|
||||||
this.groupBox12.Name = "groupBox12";
|
this.groupBox12.Name = "groupBox12";
|
||||||
this.groupBox12.Size = new System.Drawing.Size(262, 209);
|
this.groupBox12.Size = new System.Drawing.Size(262, 270);
|
||||||
this.groupBox12.TabIndex = 19;
|
this.groupBox12.TabIndex = 19;
|
||||||
this.groupBox12.TabStop = false;
|
this.groupBox12.TabStop = false;
|
||||||
this.groupBox12.Text = "공시";
|
this.groupBox12.Text = "공시";
|
||||||
//
|
//
|
||||||
// btAnApply
|
// btAnApply
|
||||||
//
|
//
|
||||||
this.btAnApply.Location = new System.Drawing.Point(93, 163);
|
this.btAnApply.Location = new System.Drawing.Point(91, 211);
|
||||||
this.btAnApply.Name = "btAnApply";
|
this.btAnApply.Name = "btAnApply";
|
||||||
this.btAnApply.Size = new System.Drawing.Size(72, 39);
|
this.btAnApply.Size = new System.Drawing.Size(72, 39);
|
||||||
this.btAnApply.TabIndex = 5;
|
this.btAnApply.TabIndex = 5;
|
||||||
@@ -478,6 +484,18 @@
|
|||||||
this.tbAnPatent.TabIndex = 8;
|
this.tbAnPatent.TabIndex = 8;
|
||||||
this.tbAnPatent.Text = "(미국|중국)";
|
this.tbAnPatent.Text = "(미국|중국)";
|
||||||
//
|
//
|
||||||
|
// chAnProfitChange
|
||||||
|
//
|
||||||
|
this.chAnProfitChange.AutoSize = true;
|
||||||
|
this.chAnProfitChange.Checked = true;
|
||||||
|
this.chAnProfitChange.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.chAnProfitChange.Location = new System.Drawing.Point(16, 169);
|
||||||
|
this.chAnProfitChange.Name = "chAnProfitChange";
|
||||||
|
this.chAnProfitChange.Size = new System.Drawing.Size(96, 16);
|
||||||
|
this.chAnProfitChange.TabIndex = 7;
|
||||||
|
this.chAnProfitChange.Text = "손익구조변동";
|
||||||
|
this.chAnProfitChange.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// chAnPatent
|
// chAnPatent
|
||||||
//
|
//
|
||||||
this.chAnPatent.AutoSize = true;
|
this.chAnPatent.AutoSize = true;
|
||||||
@@ -580,17 +598,36 @@
|
|||||||
//
|
//
|
||||||
this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label9.AutoSize = true;
|
this.label9.AutoSize = true;
|
||||||
this.label9.Location = new System.Drawing.Point(12, 516);
|
this.label9.Location = new System.Drawing.Point(12, 577);
|
||||||
this.label9.Name = "label9";
|
this.label9.Name = "label9";
|
||||||
this.label9.Size = new System.Drawing.Size(132, 12);
|
this.label9.Size = new System.Drawing.Size(132, 12);
|
||||||
this.label9.TabIndex = 20;
|
this.label9.TabIndex = 20;
|
||||||
this.label9.Text = "Version : 2017.02.05.17";
|
this.label9.Text = "Version : 2017.02.07.09";
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(215, 170);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(15, 12);
|
||||||
|
this.label5.TabIndex = 10;
|
||||||
|
this.label5.Text = "%";
|
||||||
|
//
|
||||||
|
// tbAnProfitChange
|
||||||
|
//
|
||||||
|
this.tbAnProfitChange.Location = new System.Drawing.Point(136, 167);
|
||||||
|
this.tbAnProfitChange.Name = "tbAnProfitChange";
|
||||||
|
this.tbAnProfitChange.Size = new System.Drawing.Size(73, 21);
|
||||||
|
this.tbAnProfitChange.TabIndex = 9;
|
||||||
|
this.tbAnProfitChange.Text = "5.0";
|
||||||
|
this.tbAnProfitChange.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||||
|
this.tbAnProfitChange.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbAnProfitChange_KeyPress);
|
||||||
//
|
//
|
||||||
// ConfigForm
|
// ConfigForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(548, 537);
|
this.ClientSize = new System.Drawing.Size(548, 598);
|
||||||
this.Controls.Add(this.label9);
|
this.Controls.Add(this.label9);
|
||||||
this.Controls.Add(this.groupBox12);
|
this.Controls.Add(this.groupBox12);
|
||||||
this.Controls.Add(this.groupBox11);
|
this.Controls.Add(this.groupBox11);
|
||||||
@@ -673,5 +710,8 @@
|
|||||||
private System.Windows.Forms.CheckBox chAnPatent;
|
private System.Windows.Forms.CheckBox chAnPatent;
|
||||||
private System.Windows.Forms.Button btAnApply;
|
private System.Windows.Forms.Button btAnApply;
|
||||||
private System.Windows.Forms.CheckBox chAnDartAPI;
|
private System.Windows.Forms.CheckBox chAnDartAPI;
|
||||||
|
private System.Windows.Forms.CheckBox chAnProfitChange;
|
||||||
|
private System.Windows.Forms.Label label5;
|
||||||
|
private System.Windows.Forms.TextBox tbAnProfitChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,6 +157,12 @@ namespace NewsCrawler
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tbAnProfitChange_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if(char.IsDigit(e.KeyChar) == false && e.KeyChar != '.')
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void btAnApply_Click(object sender, EventArgs e)
|
private void btAnApply_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
float fSupplyContractRate;
|
float fSupplyContractRate;
|
||||||
@@ -165,9 +171,15 @@ namespace NewsCrawler
|
|||||||
float fRevenueRate;
|
float fRevenueRate;
|
||||||
float.TryParse(tbAnRevenueRate.Text, out fRevenueRate);
|
float.TryParse(tbAnRevenueRate.Text, out fRevenueRate);
|
||||||
|
|
||||||
|
float fProfitChange;
|
||||||
|
float.TryParse(tbAnProfitChange.Text, out fProfitChange);
|
||||||
|
|
||||||
Config.SetAnnouncement(chAnDartAPI.Checked,
|
Config.SetAnnouncement(chAnDartAPI.Checked,
|
||||||
chAnSupply.Checked, chAnRevenue.Checked, chAnRightsIssue.Checked, chAnPatent.Checked,
|
chAnSupply.Checked, fSupplyContractRate,
|
||||||
fSupplyContractRate, fRevenueRate, tbAnPatent.Text);
|
chAnRevenue.Checked, fRevenueRate,
|
||||||
|
chAnRightsIssue.Checked,
|
||||||
|
chAnPatent.Checked, tbAnPatent.Text,
|
||||||
|
chAnProfitChange.Checked, fProfitChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
118
Crawler.cs
118
Crawler.cs
@@ -16,6 +16,7 @@ namespace NewsCrawler
|
|||||||
NewsForm m_Listener = null;
|
NewsForm m_Listener = null;
|
||||||
DateTime m_Today = DateTime.Now;
|
DateTime m_Today = DateTime.Now;
|
||||||
int m_iDartAPIRetry = 5;
|
int m_iDartAPIRetry = 5;
|
||||||
|
Regex m_ProfitChange = new Regex("30%.*이상.*(변경|변동)");
|
||||||
|
|
||||||
public Crawler(NewsForm Listener)
|
public Crawler(NewsForm Listener)
|
||||||
{
|
{
|
||||||
@@ -45,6 +46,10 @@ namespace NewsCrawler
|
|||||||
ReadRevenue(false, "LS산전", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170126800581");
|
ReadRevenue(false, "LS산전", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170126800581");
|
||||||
ReadRightsIssue(false, "옴니텔", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170126000525");
|
ReadRightsIssue(false, "옴니텔", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170126000525");
|
||||||
ReadPatent(false, "인트론바이오", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170125900080");
|
ReadPatent(false, "인트론바이오", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170125900080");
|
||||||
|
ReadProfitChange(false, "세하", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170206800276");
|
||||||
|
ReadProfitChange(false, "아세아", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170206800894");
|
||||||
|
|
||||||
|
//ReadDartAPITest(false, "http://dart.fss.or.kr/api/search.json?end_dt=20170206&sort=date&series=desc&page_set=100");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResponseAsiaE(IAsyncResult result)
|
void ResponseAsiaE(IAsyncResult result)
|
||||||
@@ -660,6 +665,90 @@ namespace NewsCrawler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResponseProfitChange(IAsyncResult result)
|
||||||
|
{
|
||||||
|
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
|
||||||
|
HttpWebRequest HttpReq = State.m_HTTPReq;
|
||||||
|
bool bInitial = State.m_bInitial;
|
||||||
|
State.m_Timer.Stop();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
|
||||||
|
{
|
||||||
|
using(Stream dataStream = response.GetResponseStream())
|
||||||
|
{
|
||||||
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
|
{
|
||||||
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
|
||||||
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
|
string strBody = jObj["reportBody"];
|
||||||
|
strBody = strBody.Replace("\\\"", "\"");
|
||||||
|
strBody = strBody.Replace("\r\n", "");
|
||||||
|
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
|
||||||
|
doc.LoadHtml(strBody);
|
||||||
|
|
||||||
|
string strXPath = "//tr";
|
||||||
|
var lists = doc.DocumentNode.SelectNodes(strXPath);
|
||||||
|
foreach(var item in lists)
|
||||||
|
{
|
||||||
|
var cols = item.SelectNodes(".//td");
|
||||||
|
for(int i = 0; i<cols.Count-1; i++)
|
||||||
|
{
|
||||||
|
if(cols[i].InnerText.Contains("영업이익") == true)
|
||||||
|
{
|
||||||
|
if(cols[cols.Count-1].InnerText.Contains("흑자전환") == true)
|
||||||
|
{
|
||||||
|
m_Listener.OnReceivedProfitChange(State.m_strCodeName, true, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strRate = cols[cols.Count-1].InnerText;
|
||||||
|
strRate = strRate.Replace("%", "");
|
||||||
|
strRate = strRate.Replace(" ", "");
|
||||||
|
|
||||||
|
float fProfit;
|
||||||
|
float.TryParse(strRate, NumberStyles.Float, CultureInfo.InvariantCulture, out fProfit);
|
||||||
|
m_Listener.OnReceivedProfitChange(State.m_strCodeName, false, fProfit);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpReq.EndGetResponse(result);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadProfitChange(bool bInitial, string strCodeName, string strURL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpWebRequest HttpReq = WebRequest.Create(strURL) as HttpWebRequest;
|
||||||
|
HttpReq.Credentials = CredentialCache.DefaultCredentials;
|
||||||
|
HttpReq.Timeout = 2000;
|
||||||
|
|
||||||
|
REQUEST_STATUS State = new REQUEST_STATUS();
|
||||||
|
State.m_HTTPReq = HttpReq;
|
||||||
|
State.m_bInitial = bInitial;
|
||||||
|
State.m_Timer.Start();
|
||||||
|
State.m_strCodeName = strCodeName;
|
||||||
|
|
||||||
|
HttpReq.BeginGetResponse(new AsyncCallback(ResponseProfitChange), State);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ResponseDartAPI(IAsyncResult result)
|
void ResponseDartAPI(IAsyncResult result)
|
||||||
{
|
{
|
||||||
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
|
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
|
||||||
@@ -709,6 +798,8 @@ namespace NewsCrawler
|
|||||||
ReadRightsIssue(bInitial, strCodeName, strViewURL);
|
ReadRightsIssue(bInitial, strCodeName, strViewURL);
|
||||||
else if(Config.CheckPatent() && strCodeName != "" && strTitle.Contains("특허권취득") && m_Listener.IsDuplicatedURL(strURL) == false)
|
else if(Config.CheckPatent() && strCodeName != "" && strTitle.Contains("특허권취득") && m_Listener.IsDuplicatedURL(strURL) == false)
|
||||||
ReadPatent(bInitial, strCodeName, strViewURL);
|
ReadPatent(bInitial, strCodeName, strViewURL);
|
||||||
|
else if(Config.CheckProfitChange() && strCodeName != "" && m_ProfitChange.IsMatch(strTitle) && m_Listener.IsDuplicatedURL(strURL) == false)
|
||||||
|
ReadProfitChange(bInitial, strCodeName, strViewURL);
|
||||||
|
|
||||||
m_Listener.InsertItem(strTitle, strCodeName, "",
|
m_Listener.InsertItem(strTitle, strCodeName, "",
|
||||||
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
|
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
|
||||||
@@ -757,6 +848,33 @@ namespace NewsCrawler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReadDartAPITest(bool bInitial, string strURL)
|
||||||
|
{
|
||||||
|
if(m_iDartAPIRetry <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string strAuthKey = Config.GetDartAPIKey();
|
||||||
|
strURL += "&auth="+strAuthKey;
|
||||||
|
HttpWebRequest HttpReq = WebRequest.Create(strURL) as HttpWebRequest;
|
||||||
|
HttpReq.Credentials = CredentialCache.DefaultCredentials;
|
||||||
|
HttpReq.Timeout = 2000;
|
||||||
|
|
||||||
|
REQUEST_STATUS State = new REQUEST_STATUS();
|
||||||
|
State.m_HTTPReq = HttpReq;
|
||||||
|
State.m_bInitial = bInitial;
|
||||||
|
State.m_Timer.Start();
|
||||||
|
State.m_strAuthKey = strAuthKey;
|
||||||
|
|
||||||
|
HttpReq.BeginGetResponse(new AsyncCallback(ResponseDartAPI), State);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResponseKIND(IAsyncResult result)
|
void ResponseKIND(IAsyncResult result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
if(iType == 1 || iType == 2)
|
if(iType == 1 || iType == 2)
|
||||||
{
|
{
|
||||||
m_Listener.InsertItem(strContents, "", strCode,
|
m_Listener.InsertItem(strContents, strName, strCode,
|
||||||
DateTime.ParseExact(iTime.ToString("0000"), "HHmm", CultureInfo.CurrentCulture),
|
DateTime.ParseExact(iTime.ToString("0000"), "HHmm", CultureInfo.CurrentCulture),
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
"", "CYBOS", 0, false);
|
"", "CYBOS", 0, false);
|
||||||
@@ -173,6 +173,7 @@ namespace NewsCrawler
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int iCurPrice = GetCurPrice(Code);
|
int iCurPrice = GetCurPrice(Code);
|
||||||
|
iCurPrice = (int)(iCurPrice*1.015);
|
||||||
int iCount = iMaxPrice/iCurPrice;
|
int iCount = iMaxPrice/iCurPrice;
|
||||||
|
|
||||||
m_CP0311.SetInputValue(0, 2);
|
m_CP0311.SetInputValue(0, 2);
|
||||||
@@ -180,10 +181,10 @@ namespace NewsCrawler
|
|||||||
m_CP0311.SetInputValue(2, Config.GetSubAccount());
|
m_CP0311.SetInputValue(2, Config.GetSubAccount());
|
||||||
m_CP0311.SetInputValue(3, Code.m_strCode);
|
m_CP0311.SetInputValue(3, Code.m_strCode);
|
||||||
m_CP0311.SetInputValue(4, iCount);
|
m_CP0311.SetInputValue(4, iCount);
|
||||||
m_CP0311.SetInputValue(5, 0);
|
m_CP0311.SetInputValue(5, iCurPrice);
|
||||||
m_CP0311.SetInputValue(7, "0");
|
m_CP0311.SetInputValue(7, "01");
|
||||||
m_CP0311.SetInputValue(8, "03");
|
m_CP0311.SetInputValue(8, "01");
|
||||||
m_CP0311.BlockRequest2(0);
|
m_CP0311.BlockRequest2(1);
|
||||||
|
|
||||||
Util.Log(Util.LOG_TYPE.BUY, string.Format("code:{0} {1}주 현재가 {2}원, 시장가 매수", Code.ToString(), iCount, iCurPrice));
|
Util.Log(Util.LOG_TYPE.BUY, string.Format("code:{0} {1}주 현재가 {2}원, 시장가 매수", Code.ToString(), iCount, iCurPrice));
|
||||||
}
|
}
|
||||||
|
|||||||
49
NewsForm.cs
49
NewsForm.cs
@@ -167,7 +167,7 @@ namespace NewsCrawler
|
|||||||
m_PriceCheckTimer.Elapsed += PriceCheckTimer_Elapsed;
|
m_PriceCheckTimer.Elapsed += PriceCheckTimer_Elapsed;
|
||||||
m_PriceCheckTimer.Start();
|
m_PriceCheckTimer.Start();
|
||||||
|
|
||||||
m_bBuy = true;
|
m_bBuy = chBuy.Checked;
|
||||||
|
|
||||||
Test();
|
Test();
|
||||||
}
|
}
|
||||||
@@ -451,6 +451,53 @@ namespace NewsCrawler
|
|||||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnReceivedProfitChange(string strCodeName, bool bBlackCheckers, float fProfit)
|
||||||
|
{
|
||||||
|
string strKeyword = string.Format("손익구조 변동({0})", bBlackCheckers?"흑자전환":fProfit+"%");
|
||||||
|
|
||||||
|
CodeList.CODE_VALUE Code = m_CodeList.GetCodeByName(strCodeName);
|
||||||
|
if(Code == null)
|
||||||
|
{
|
||||||
|
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][{0}] 종목을 찾을 수 없음({1})", strKeyword, strCodeName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bBlackCheckers == false && fProfit < Config.GetProfitChangeRate())
|
||||||
|
{
|
||||||
|
Util.Log(Util.LOG_TYPE.VERVOSE, string.Format("[DartAPI][{0}] 영업이익률 낮음({1}, {2}% / {3}%)", strKeyword, strCodeName, fProfit, Config.GetProfitChangeRate()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strRef = "DartAPI";
|
||||||
|
string strTitle = string.Format("{0} - {1}", strKeyword, 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)
|
public bool IsDuplicatedURL(string strURL)
|
||||||
{
|
{
|
||||||
if(strURL == "")
|
if(strURL == "")
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ ann-revenue-rate=35.5
|
|||||||
ann-rights-issue=True
|
ann-rights-issue=True
|
||||||
ann-patent=True
|
ann-patent=True
|
||||||
ann-patent-search-string=(미국|중국)
|
ann-patent-search-string=(미국|중국)
|
||||||
|
ann-profit-change=True
|
||||||
|
ann-profit-change-rate=5
|
||||||
|
ann-black-checkers=True
|
||||||
account=335261568
|
account=335261568
|
||||||
sub-account=10
|
sub-account=10
|
||||||
dart-api-key1=840943e5370eb9037057beab35f4468fa9a6ce5c
|
dart-api-key1=840943e5370eb9037057beab35f4468fa9a6ce5c
|
||||||
|
|||||||
Reference in New Issue
Block a user