- DartAPI 요청 버그 수정

- 8092 종목명 찾기 수정
- 실패한 종목명 배경색 추가
This commit is contained in:
2017-02-05 16:55:15 +09:00
parent f33be2f4eb
commit 994e0168a8
4 changed files with 21 additions and 28 deletions

View File

@@ -221,7 +221,7 @@ namespace NewsCrawler
public static bool CheckRightsIssue()
{
return (bool)m_Data["ann-ann-rights-issue"];
return (bool)m_Data["ann-rights-issue"];
}
public static bool CheckPatent()

View File

@@ -692,7 +692,8 @@ namespace NewsCrawler
return;
}
foreach(var data in jObj["list"])
var List = jObj["list"];
foreach(var data in List)
{
string strTime = "00:00";
string strTitle = data["rpt_nm"];
@@ -728,8 +729,8 @@ namespace NewsCrawler
public void ReadDartAPI(bool bInitial = false)
{
if (Util.IsDebugging() == true)
return;
//if (Util.IsDebugging() == true)
// return;
if(m_iDartAPIRetry <= 0)
return;
@@ -737,7 +738,7 @@ namespace NewsCrawler
try
{
string strAuthKey = Config.GetDartAPIKey();
string strURL = "http://dart.fss.or.kr/api/search.json?auth="+strAuthKey+"&end_dt="+m_Today.ToString("yyyyMMdd");
string strURL = "http://dart.fss.or.kr/api/search.json?auth="+strAuthKey+"&end_dt="+m_Today.ToString("yyyyMMdd")+"&sort=date&series=desc&page_set=100";
HttpWebRequest HttpReq = WebRequest.Create(strURL) as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;

View File

@@ -475,27 +475,18 @@ namespace NewsCrawler
int iID = lvList.Items.Count+1;
CodeList.CODE_VALUE Code = null;
if(bInitial == false)
{
if(strCode == "")
Code = m_CodeList.SearchCode(strTitle);
else
Code = m_CodeList.GetCode(strCode);
CodeList.CODE_VALUE Code = m_CodeList.SearchCode(strTitle);
if(bInitial == false && Code != null)
ProcessSearchAndBuy(new NEWS_ITEM(iID, strTitle, strCode, Code, time, ResTime, strRef, strURL, (float)dElapseT));
if(Code != null)
ProcessSearchAndBuy(new NEWS_ITEM(iID, strTitle, strCode, Code, time, ResTime, strRef, strURL, (float)dElapseT));
}
lvList.Items.Add(new ListViewItem(new string[] {
var AddedItem = 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,
(Code != null) ? Code.m_strName : "",
(Code != null) ? Code.m_strName : strName,
"",
"",
"",
@@ -503,13 +494,14 @@ namespace NewsCrawler
"",
strURL }));
if(lvList.Items.Count == 0)
AddedItem.UseItemStyleForSubItems = false;
if(Code == null && strCode != "")
AddedItem.SubItems[chCodeName.Index].BackColor = Color.Gray;
if(lvList.Items.Count < 2)
{
foreach (ColumnHeader col in lvList.Columns)
{
if (!(col == chPriceS || col == chPriceLow || col == chPriceHigh))
col.Width = -2;
}
foreach(ColumnHeader col in lvList.Columns)
col.Width = -2;
}
lock(m_URLs)
@@ -597,7 +589,6 @@ namespace NewsCrawler
ListViewItem item = lvList.Items.Cast<ListViewItem>().FirstOrDefault(s => s.SubItems[chId.Index].Text == Data.m_iID.ToString());
item.SubItems[chPriceLow.Index].Text = string.Format("{0:n0}", Data.m_iPriceLow);
float fLowRate = (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart;
item.UseItemStyleForSubItems = false;
item.SubItems[chPriceLowP.Index].Text = string.Format("{0:n}", fLowRate);
if(fLowRate > 0)
item.SubItems[chPriceLowP.Index].ForeColor = Color.Red;
@@ -621,7 +612,6 @@ namespace NewsCrawler
item.SubItems[chPriceLow.Index].Text = string.Format("{0:n0}", Data.m_iPriceLow);
float fLowRate = (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart;
item.SubItems[chPriceLowP.Index].Text = string.Format("{0:n}", fLowRate);
item.UseItemStyleForSubItems = false;
if(fLowRate > 0)
item.SubItems[chPriceLowP.Index].ForeColor = Color.Red;
else if(fLowRate < 0)

View File

@@ -30,6 +30,7 @@ namespace NewsCrawler
delegate void InsertLogDelegate(RichTextBox LogBox, LOG_TYPE enType, string strLog);
static InsertLogDelegate m_InsertLogDelegate = new InsertLogDelegate(InsertLog);
static object m_LogLock = new object();
public static void SetLogView(RichTextBox logBox)
{
@@ -104,7 +105,8 @@ namespace NewsCrawler
string strTime = DateTime.Now.ToString("[HH:mm:ss:fff] ");
string strMessage = strTime+strLogLevel+strLog;
File.AppendAllText(m_strLogFile, strMessage+Environment.NewLine, new UTF8Encoding(true));
lock(m_LogLock)
File.AppendAllText(m_strLogFile, strMessage+Environment.NewLine, new UTF8Encoding(true));
if(m_LogBox != null)
InsertLog(m_LogBox, enType, strMessage+Environment.NewLine);