- elk update
- 모의투자
This commit is contained in:
24
CodeList.cs
24
CodeList.cs
@@ -80,6 +80,9 @@ namespace NewsCrawler
|
|||||||
Console.WriteLine(SearchCode("[특징주] 에이치엘비-생명, 아파티닙 글로벌 임상 3상 최종 승인 소식에 상승세"));
|
Console.WriteLine(SearchCode("[특징주] 에이치엘비-생명, 아파티닙 글로벌 임상 3상 최종 승인 소식에 상승세"));
|
||||||
Console.WriteLine(SearchCode("진도군, 112건의 계약심사 통해 예산 10억원 절감"));
|
Console.WriteLine(SearchCode("진도군, 112건의 계약심사 통해 예산 10억원 절감"));
|
||||||
|
|
||||||
|
Console.WriteLine(SearchCode("[특징주] 브레인콘텐츠, 삼성전자 폴더블폰"));
|
||||||
|
Console.WriteLine(SearchCode("[아시아경제] 큐젠바이오텍, 미국 지사 설립 추진"));
|
||||||
|
|
||||||
Console.WriteLine("Test End");
|
Console.WriteLine("Test End");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,10 +277,10 @@ namespace NewsCrawler
|
|||||||
string strReplace = Regex.Replace(strText, @"(\[).*(\])", "");
|
string strReplace = Regex.Replace(strText, @"(\[).*(\])", "");
|
||||||
strReplace = Regex.Replace(strReplace, @"(\().*(\))", "");
|
strReplace = Regex.Replace(strReplace, @"(\().*(\))", "");
|
||||||
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];
|
||||||
|
|
||||||
CODE_VALUE Result = m_CodeList.Find(s => strCodeWord.Contains(s.m_strName));
|
CODE_VALUE Result = m_CodeList.Find(s => (s.m_strName == strCodeWord));
|
||||||
if(Result != null)
|
if(Result != null)
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
@@ -306,5 +309,22 @@ namespace NewsCrawler
|
|||||||
CODE_VALUE Result = m_CodeList.Find(s => s.m_strName == strCodeName);
|
CODE_VALUE Result = m_CodeList.Find(s => s.m_strName == strCodeName);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllDeny()
|
||||||
|
{
|
||||||
|
return m_CodeList.Where(r => r.m_enType == CODE_TYPE.DENIAL).Select<CODE_VALUE, string>(c => c.m_strName).ToList();
|
||||||
|
}
|
||||||
|
public List<string> GetAllDuplicated()
|
||||||
|
{
|
||||||
|
return m_CodeList.Where(r => r.m_enType == CODE_TYPE.DUPLICATED).Select<CODE_VALUE, string>(c => c.m_strName).ToList();
|
||||||
|
}
|
||||||
|
public List<string> GetAllManual()
|
||||||
|
{
|
||||||
|
return m_CodeList.Where(r => r.m_enType == CODE_TYPE.MANUAL).Select<CODE_VALUE, string>(c => c.m_strName).ToList();
|
||||||
|
}
|
||||||
|
public List<string> GetAllSynonym()
|
||||||
|
{
|
||||||
|
return m_SynonymList.Select(r => $"{r.m_strName}={r.m_strName}").ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
public static void SetMockTrading(bool bMock)
|
public static void SetMockTrading(bool bMock)
|
||||||
{
|
{
|
||||||
m_Data.Add("mock-trading", bMock);
|
m_Data["mock-trading"] = bMock;
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,5 +264,10 @@ namespace NewsCrawler
|
|||||||
{
|
{
|
||||||
return (bool)m_Data["mock-trading"];
|
return (bool)m_Data["mock-trading"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, object> GetAllConfig()
|
||||||
|
{
|
||||||
|
return m_Data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
74
ConfigForm.Designer.cs
generated
74
ConfigForm.Designer.cs
generated
@@ -36,6 +36,9 @@
|
|||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.btnCodeManualEdit = new System.Windows.Forms.Button();
|
this.btnCodeManualEdit = new System.Windows.Forms.Button();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBox13 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.btnDuplicatedKeywordApply = new System.Windows.Forms.Button();
|
||||||
|
this.btnDuplicatedKeywordEdit = new System.Windows.Forms.Button();
|
||||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||||
this.btnSynonymApply = new System.Windows.Forms.Button();
|
this.btnSynonymApply = new System.Windows.Forms.Button();
|
||||||
this.btnSynonymEdit = new System.Windows.Forms.Button();
|
this.btnSynonymEdit = new System.Windows.Forms.Button();
|
||||||
@@ -79,11 +82,9 @@
|
|||||||
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.cbMockTrading = new System.Windows.Forms.CheckBox();
|
this.cbMockTrading = new System.Windows.Forms.CheckBox();
|
||||||
this.groupBox13 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.btnDuplicatedKeywordApply = new System.Windows.Forms.Button();
|
|
||||||
this.btnDuplicatedKeywordEdit = new System.Windows.Forms.Button();
|
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
|
this.groupBox13.SuspendLayout();
|
||||||
this.groupBox6.SuspendLayout();
|
this.groupBox6.SuspendLayout();
|
||||||
this.groupBox3.SuspendLayout();
|
this.groupBox3.SuspendLayout();
|
||||||
this.groupBox5.SuspendLayout();
|
this.groupBox5.SuspendLayout();
|
||||||
@@ -94,7 +95,6 @@
|
|||||||
this.groupBox10.SuspendLayout();
|
this.groupBox10.SuspendLayout();
|
||||||
this.groupBox11.SuspendLayout();
|
this.groupBox11.SuspendLayout();
|
||||||
this.groupBox12.SuspendLayout();
|
this.groupBox12.SuspendLayout();
|
||||||
this.groupBox13.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// tbVolume
|
// tbVolume
|
||||||
@@ -182,6 +182,37 @@
|
|||||||
this.groupBox2.TabStop = false;
|
this.groupBox2.TabStop = false;
|
||||||
this.groupBox2.Text = "키워드";
|
this.groupBox2.Text = "키워드";
|
||||||
//
|
//
|
||||||
|
// groupBox13
|
||||||
|
//
|
||||||
|
this.groupBox13.Controls.Add(this.btnDuplicatedKeywordApply);
|
||||||
|
this.groupBox13.Controls.Add(this.btnDuplicatedKeywordEdit);
|
||||||
|
this.groupBox13.Location = new System.Drawing.Point(190, 148);
|
||||||
|
this.groupBox13.Name = "groupBox13";
|
||||||
|
this.groupBox13.Size = new System.Drawing.Size(165, 58);
|
||||||
|
this.groupBox13.TabIndex = 13;
|
||||||
|
this.groupBox13.TabStop = false;
|
||||||
|
this.groupBox13.Text = "중복 등록 문구";
|
||||||
|
//
|
||||||
|
// btnDuplicatedKeywordApply
|
||||||
|
//
|
||||||
|
this.btnDuplicatedKeywordApply.Location = new System.Drawing.Point(86, 14);
|
||||||
|
this.btnDuplicatedKeywordApply.Name = "btnDuplicatedKeywordApply";
|
||||||
|
this.btnDuplicatedKeywordApply.Size = new System.Drawing.Size(72, 39);
|
||||||
|
this.btnDuplicatedKeywordApply.TabIndex = 4;
|
||||||
|
this.btnDuplicatedKeywordApply.Text = "적용";
|
||||||
|
this.btnDuplicatedKeywordApply.UseVisualStyleBackColor = true;
|
||||||
|
this.btnDuplicatedKeywordApply.Click += new System.EventHandler(this.btnDuplicatedKeywordApply_Click);
|
||||||
|
//
|
||||||
|
// btnDuplicatedKeywordEdit
|
||||||
|
//
|
||||||
|
this.btnDuplicatedKeywordEdit.Location = new System.Drawing.Point(8, 14);
|
||||||
|
this.btnDuplicatedKeywordEdit.Name = "btnDuplicatedKeywordEdit";
|
||||||
|
this.btnDuplicatedKeywordEdit.Size = new System.Drawing.Size(72, 39);
|
||||||
|
this.btnDuplicatedKeywordEdit.TabIndex = 4;
|
||||||
|
this.btnDuplicatedKeywordEdit.Text = "편집";
|
||||||
|
this.btnDuplicatedKeywordEdit.UseVisualStyleBackColor = true;
|
||||||
|
this.btnDuplicatedKeywordEdit.Click += new System.EventHandler(this.btnDuplicatedKeywordEdit_Click);
|
||||||
|
//
|
||||||
// groupBox6
|
// groupBox6
|
||||||
//
|
//
|
||||||
this.groupBox6.Controls.Add(this.btnSynonymApply);
|
this.groupBox6.Controls.Add(this.btnSynonymApply);
|
||||||
@@ -627,7 +658,7 @@
|
|||||||
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 : 2018.01.01.20";
|
this.label9.Text = "Version : 2018.01.04.12";
|
||||||
//
|
//
|
||||||
// cbMockTrading
|
// cbMockTrading
|
||||||
//
|
//
|
||||||
@@ -640,37 +671,6 @@
|
|||||||
this.cbMockTrading.UseVisualStyleBackColor = true;
|
this.cbMockTrading.UseVisualStyleBackColor = true;
|
||||||
this.cbMockTrading.CheckedChanged += new System.EventHandler(this.cbMockTrading_CheckedChanged);
|
this.cbMockTrading.CheckedChanged += new System.EventHandler(this.cbMockTrading_CheckedChanged);
|
||||||
//
|
//
|
||||||
// groupBox13
|
|
||||||
//
|
|
||||||
this.groupBox13.Controls.Add(this.btnDuplicatedKeywordApply);
|
|
||||||
this.groupBox13.Controls.Add(this.btnDuplicatedKeywordEdit);
|
|
||||||
this.groupBox13.Location = new System.Drawing.Point(190, 148);
|
|
||||||
this.groupBox13.Name = "groupBox13";
|
|
||||||
this.groupBox13.Size = new System.Drawing.Size(165, 58);
|
|
||||||
this.groupBox13.TabIndex = 13;
|
|
||||||
this.groupBox13.TabStop = false;
|
|
||||||
this.groupBox13.Text = "중복 등록 문구";
|
|
||||||
//
|
|
||||||
// btnDuplicatedKeywordApply
|
|
||||||
//
|
|
||||||
this.btnDuplicatedKeywordApply.Location = new System.Drawing.Point(86, 14);
|
|
||||||
this.btnDuplicatedKeywordApply.Name = "btnDuplicatedKeywordApply";
|
|
||||||
this.btnDuplicatedKeywordApply.Size = new System.Drawing.Size(72, 39);
|
|
||||||
this.btnDuplicatedKeywordApply.TabIndex = 4;
|
|
||||||
this.btnDuplicatedKeywordApply.Text = "적용";
|
|
||||||
this.btnDuplicatedKeywordApply.UseVisualStyleBackColor = true;
|
|
||||||
this.btnDuplicatedKeywordApply.Click += new System.EventHandler(this.btnDuplicatedKeywordApply_Click);
|
|
||||||
//
|
|
||||||
// btnDuplicatedKeywordEdit
|
|
||||||
//
|
|
||||||
this.btnDuplicatedKeywordEdit.Location = new System.Drawing.Point(8, 14);
|
|
||||||
this.btnDuplicatedKeywordEdit.Name = "btnDuplicatedKeywordEdit";
|
|
||||||
this.btnDuplicatedKeywordEdit.Size = new System.Drawing.Size(72, 39);
|
|
||||||
this.btnDuplicatedKeywordEdit.TabIndex = 4;
|
|
||||||
this.btnDuplicatedKeywordEdit.Text = "편집";
|
|
||||||
this.btnDuplicatedKeywordEdit.UseVisualStyleBackColor = true;
|
|
||||||
this.btnDuplicatedKeywordEdit.Click += new System.EventHandler(this.btnDuplicatedKeywordEdit_Click);
|
|
||||||
//
|
|
||||||
// ConfigForm
|
// ConfigForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||||
@@ -693,6 +693,7 @@
|
|||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
this.groupBox2.ResumeLayout(false);
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
this.groupBox13.ResumeLayout(false);
|
||||||
this.groupBox6.ResumeLayout(false);
|
this.groupBox6.ResumeLayout(false);
|
||||||
this.groupBox3.ResumeLayout(false);
|
this.groupBox3.ResumeLayout(false);
|
||||||
this.groupBox5.ResumeLayout(false);
|
this.groupBox5.ResumeLayout(false);
|
||||||
@@ -706,7 +707,6 @@
|
|||||||
this.groupBox11.PerformLayout();
|
this.groupBox11.PerformLayout();
|
||||||
this.groupBox12.ResumeLayout(false);
|
this.groupBox12.ResumeLayout(false);
|
||||||
this.groupBox12.PerformLayout();
|
this.groupBox12.PerformLayout();
|
||||||
this.groupBox13.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
tbAnSupplyContractRate.Text = Config.GetSupplyContractRate().ToString();
|
tbAnSupplyContractRate.Text = Config.GetSupplyContractRate().ToString();
|
||||||
tbAnRevenueRate.Text = Config.GetRevenueRate().ToString();
|
tbAnRevenueRate.Text = Config.GetRevenueRate().ToString();
|
||||||
|
|
||||||
|
cbMockTrading.Checked = Config.GetMockTrading();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenFile(string strName)
|
private void OpenFile(string strName)
|
||||||
|
|||||||
21
Crawler.cs
21
Crawler.cs
@@ -78,7 +78,10 @@ namespace NewsCrawler
|
|||||||
foreach(var item in lists)
|
foreach(var item in lists)
|
||||||
{
|
{
|
||||||
string strTitle1 = item.SelectSingleNode(".//a").GetAttributeValue("title", "");
|
string strTitle1 = item.SelectSingleNode(".//a").GetAttributeValue("title", "");
|
||||||
string strTitle2 = item.SelectSingleNode(".//a").FirstChild.InnerText;
|
var child = item.SelectSingleNode(".//a").FirstChild;
|
||||||
|
string strTitle2 = "";
|
||||||
|
if (child != null)
|
||||||
|
strTitle2 = child.InnerText;
|
||||||
string strTitle = (strTitle1.Length > strTitle2.Length ? strTitle1 : strTitle2);
|
string strTitle = (strTitle1.Length > strTitle2.Length ? strTitle1 : strTitle2);
|
||||||
string strTime = item.SelectSingleNode(".//span").InnerText;
|
string strTime = item.SelectSingleNode(".//span").InnerText;
|
||||||
string strURL = strServerURL+item.SelectSingleNode(".//a").GetAttributeValue("href", "");
|
string strURL = strServerURL+item.SelectSingleNode(".//a").GetAttributeValue("href", "");
|
||||||
@@ -309,6 +312,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
|
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
|
||||||
doc.LoadHtml(responseFromServer);
|
doc.LoadHtml(responseFromServer);
|
||||||
@@ -389,6 +394,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strBody = jObj["reportBody"];
|
string strBody = jObj["reportBody"];
|
||||||
@@ -464,6 +471,8 @@ namespace NewsCrawler
|
|||||||
using (StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using (StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strBody = jObj["reportBody"];
|
string strBody = jObj["reportBody"];
|
||||||
@@ -541,6 +550,8 @@ namespace NewsCrawler
|
|||||||
using (StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using (StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strBody = jObj["reportBody"];
|
string strBody = jObj["reportBody"];
|
||||||
@@ -613,6 +624,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strBody = jObj["reportBody"];
|
string strBody = jObj["reportBody"];
|
||||||
@@ -686,6 +699,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strBody = jObj["reportBody"];
|
string strBody = jObj["reportBody"];
|
||||||
@@ -770,6 +785,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
|
||||||
string strErrCode = jObj["err_code"];
|
string strErrCode = jObj["err_code"];
|
||||||
@@ -900,6 +917,8 @@ namespace NewsCrawler
|
|||||||
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
|
||||||
{
|
{
|
||||||
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
|
||||||
|
if (responseFromServer.Contains("정정"))
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
|
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
|
||||||
doc.LoadHtml(responseFromServer);
|
doc.LoadHtml(responseFromServer);
|
||||||
|
|||||||
@@ -1067,7 +1067,7 @@ namespace FluentFTP {
|
|||||||
// seek to required offset
|
// seek to required offset
|
||||||
fileData.Position = offset;
|
fileData.Position = offset;
|
||||||
|
|
||||||
} catch (Exception ex2) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,11 +1208,11 @@ namespace FluentFTP {
|
|||||||
Stream upStream = null;
|
Stream upStream = null;
|
||||||
try {
|
try {
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
bool checkFileExistsAgain = false;
|
//bool checkFileExistsAgain = false;
|
||||||
|
|
||||||
// check if the file exists, and skip, overwrite or append
|
// check if the file exists, and skip, overwrite or append
|
||||||
if (existsMode == FtpExists.NoCheck) {
|
if (existsMode == FtpExists.NoCheck) {
|
||||||
checkFileExistsAgain = true;
|
//checkFileExistsAgain = true;
|
||||||
} else {
|
} else {
|
||||||
if (!fileExistsKnown) {
|
if (!fileExistsKnown) {
|
||||||
fileExists = await FileExistsAsync(remotePath);
|
fileExists = await FileExistsAsync(remotePath);
|
||||||
@@ -1254,7 +1254,7 @@ namespace FluentFTP {
|
|||||||
// seek to required offset
|
// seek to required offset
|
||||||
fileData.Position = offset;
|
fileData.Position = offset;
|
||||||
|
|
||||||
} catch (Exception ex2) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ namespace FluentFTP {
|
|||||||
try {
|
try {
|
||||||
stream.Listen(m_stream.LocalEndPoint.Address, port);
|
stream.Listen(m_stream.LocalEndPoint.Address, port);
|
||||||
success = true;
|
success = true;
|
||||||
} catch (SocketException se) {
|
} catch (SocketException) {
|
||||||
#if NETFX
|
#if NETFX
|
||||||
// Already in use
|
// Already in use
|
||||||
if (se.ErrorCode != 10048)
|
if (se.ErrorCode != 10048)
|
||||||
@@ -448,7 +448,7 @@ namespace FluentFTP {
|
|||||||
stream.Listen(m_stream.LocalEndPoint.Address, port);
|
stream.Listen(m_stream.LocalEndPoint.Address, port);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
catch (SocketException se)
|
catch (SocketException)
|
||||||
{
|
{
|
||||||
#if NETFX
|
#if NETFX
|
||||||
// Already in use
|
// Already in use
|
||||||
|
|||||||
109
NewsForm.cs
109
NewsForm.cs
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -9,6 +10,7 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -819,8 +821,13 @@ namespace NewsCrawler
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
string strCodeName = lvList.SelectedItems[0].SubItems[chCodeName.Index].Text;
|
string strCodeName = lvList.SelectedItems[0].SubItems[chCodeName.Index].Text;
|
||||||
|
string strTitle = lvList.SelectedItems[0].SubItems[chTitle.Index].Text;
|
||||||
CodeList.CODE_VALUE Code = m_CodeList.GetCodeByName(strCodeName);
|
CodeList.CODE_VALUE Code = m_CodeList.GetCodeByName(strCodeName);
|
||||||
m_CybosHelper.Buy(Code, Config.GetBuyPrice());
|
if (Code == null)
|
||||||
|
Code = m_CodeList.SearchCode(strTitle);
|
||||||
|
|
||||||
|
if (Code != null)
|
||||||
|
ProcessSearchAndBuy(new NEWS_ITEM(-1, strTitle, Code.m_strCode, Code, DateTime.Now, DateTime.Now, "", "", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnConfigFormClosing()
|
public void OnConfigFormClosing()
|
||||||
@@ -872,6 +879,94 @@ namespace NewsCrawler
|
|||||||
Util.Clear();
|
Util.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HttpResult
|
||||||
|
{
|
||||||
|
public HttpStatusCode StatusCode;
|
||||||
|
public string strData;
|
||||||
|
};
|
||||||
|
|
||||||
|
async Task<HttpResult> Request(string url, HttpMethod method,
|
||||||
|
string data = null,
|
||||||
|
Dictionary<string, string> headers = null)
|
||||||
|
{
|
||||||
|
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||||
|
req.Method = method.ToString();
|
||||||
|
req.ContentType = "application/json";
|
||||||
|
if(headers != null)
|
||||||
|
{
|
||||||
|
foreach (var kv in headers)
|
||||||
|
req.Headers[kv.Key] = kv.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
Stream writeStream = req.GetRequestStream();
|
||||||
|
byte[] buffer = Encoding.UTF8.GetBytes(data);
|
||||||
|
await writeStream.WriteAsync(buffer, 0, buffer.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpWebResponse resp = null;
|
||||||
|
HttpResult result = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resp = await req.GetResponseAsync() as HttpWebResponse;
|
||||||
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
if (ex.Status == WebExceptionStatus.ProtocolError)
|
||||||
|
resp = ex.Response as HttpWebResponse;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Stream readStream = resp.GetResponseStream();
|
||||||
|
StreamReader sr = new StreamReader(readStream);
|
||||||
|
result = new HttpResult()
|
||||||
|
{
|
||||||
|
StatusCode = resp.StatusCode,
|
||||||
|
strData = await sr.ReadToEndAsync()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
async void SendConfiguration()
|
||||||
|
{
|
||||||
|
var oData = new
|
||||||
|
{
|
||||||
|
Mac = NetworkInterface.GetAllNetworkInterfaces()[0].GetPhysicalAddress().ToString(),
|
||||||
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
Config = Config.GetAllConfig(),
|
||||||
|
Keywords = new
|
||||||
|
{
|
||||||
|
Positive = m_Condition.GetAllPositive(),
|
||||||
|
PositiveForce = m_Condition.GetAllPositiveForce(),
|
||||||
|
Negative = m_Condition.GetAllNegative(),
|
||||||
|
Manual = m_Condition.GetAllManual(),
|
||||||
|
Duplicated = m_Condition.GetAllDuplicated(),
|
||||||
|
},
|
||||||
|
Codes = new
|
||||||
|
{
|
||||||
|
Deny = m_CodeList.GetAllDeny(),
|
||||||
|
Duplicated = m_CodeList.GetAllDuplicated(),
|
||||||
|
Manual = m_CodeList.GetAllManual(),
|
||||||
|
},
|
||||||
|
Synonym = m_CodeList.GetAllSynonym(),
|
||||||
|
};
|
||||||
|
|
||||||
|
string serverURL = "http://mjjo53.us.to:9200";
|
||||||
|
string index = "trading-news";
|
||||||
|
string doc = "default";
|
||||||
|
string id = $"{oData.Mac}-{oData.Date}";
|
||||||
|
JObject data = JObject.FromObject(oData);
|
||||||
|
string json = data.ToString(Newtonsoft.Json.Formatting.Indented);
|
||||||
|
|
||||||
|
Dictionary<string, string> headers = new Dictionary<string, string>();
|
||||||
|
headers["Authorization"] = "Basic dHJhZGVyOnNidG1hb2Fv";
|
||||||
|
|
||||||
|
var result = await Request($"{serverURL}/{index}/{doc}/{id}?pretty", HttpMethod.Post, json, headers);
|
||||||
|
}
|
||||||
|
|
||||||
private void chBuy_CheckedChanged(object sender, EventArgs e)
|
private void chBuy_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
m_bBuy = chBuy.Checked;
|
m_bBuy = chBuy.Checked;
|
||||||
@@ -885,10 +980,12 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
if (m_bBuy == true)
|
if (m_bBuy == true)
|
||||||
{
|
{
|
||||||
FileTransfer ft = new FileTransfer();
|
//FileTransfer ft = new FileTransfer();
|
||||||
string today = DateTime.Now.ToString("yyyy-MM-dd");
|
//string today = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
string macAddr = NetworkInterface.GetAllNetworkInterfaces()[0].GetPhysicalAddress().ToString();
|
//string macAddr = NetworkInterface.GetAllNetworkInterfaces()[0].GetPhysicalAddress().ToString();
|
||||||
ft.SendDir("/configure", macAddr + "/NewsCrawler/" + today);
|
//ft.SendDir("/configure", macAddr + "/NewsCrawler/" + today);
|
||||||
|
|
||||||
|
SendConfiguration();
|
||||||
|
|
||||||
Util.Log(Util.LOG_TYPE.VERVOSE, "매수 시작");
|
Util.Log(Util.LOG_TYPE.VERVOSE, "매수 시작");
|
||||||
}
|
}
|
||||||
|
|||||||
14
Program.cs
14
Program.cs
@@ -14,16 +14,16 @@ namespace NewsCrawler
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new NewsForm());
|
Application.Run(new NewsForm());
|
||||||
}
|
//}
|
||||||
catch(Exception ex)
|
//catch(Exception ex)
|
||||||
{
|
//{
|
||||||
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
// Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,5 +245,30 @@ namespace NewsCrawler
|
|||||||
Regex result = m_Duplicated.Find(s => s.IsMatch(strText));
|
Regex result = m_Duplicated.Find(s => s.IsMatch(strText));
|
||||||
return (result != null);
|
return (result != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllPositive()
|
||||||
|
{
|
||||||
|
return m_Positive.Select(a => a.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllPositiveForce()
|
||||||
|
{
|
||||||
|
return m_PositiveForce.Select(a => a.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllNegative()
|
||||||
|
{
|
||||||
|
return m_Negative.Select(a => a.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllManual()
|
||||||
|
{
|
||||||
|
return m_Manual.Select(a => a.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllDuplicated()
|
||||||
|
{
|
||||||
|
return m_Duplicated.Select(a => a.ToString()).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user