- BlackList에 5분 적용
This commit is contained in:
26
ULDataMgr.cs
26
ULDataMgr.cs
@@ -20,6 +20,18 @@ namespace upper_limit_crawler
|
||||
public float m_fLossCut;
|
||||
}
|
||||
|
||||
public struct BLACKLIST
|
||||
{
|
||||
public BLACKLIST(string strCode, int iTime)
|
||||
{
|
||||
m_strCode = strCode;
|
||||
m_iTime = iTime;
|
||||
}
|
||||
|
||||
public string m_strCode;
|
||||
public int m_iTime;
|
||||
}
|
||||
|
||||
public class ULDataMgr
|
||||
{
|
||||
public SETTING m_Setting = new SETTING();
|
||||
@@ -27,7 +39,7 @@ namespace upper_limit_crawler
|
||||
ULTrader m_Trader = new ULTrader();
|
||||
|
||||
Dictionary<string, ULWatchItem> m_WatchList = new Dictionary<string, ULWatchItem>();
|
||||
List<string> m_BlackList = new List<string>();
|
||||
List<BLACKLIST> m_BlackList = new List<BLACKLIST>();
|
||||
|
||||
public ULDataMgr()
|
||||
{
|
||||
@@ -99,12 +111,20 @@ namespace upper_limit_crawler
|
||||
|
||||
public void AddBlackList(string strCode)
|
||||
{
|
||||
m_BlackList.Add(strCode);
|
||||
int iTime = int.Parse(UlUtil.GetCurTime().ToString("HHmmss"));
|
||||
BLACKLIST black = new BLACKLIST(strCode, iTime);
|
||||
m_BlackList.Add(black);
|
||||
}
|
||||
|
||||
bool IsIn5Min(int iTime)
|
||||
{
|
||||
int iCurTime = int.Parse(UlUtil.GetCurTime().ToString("HHmmss"));
|
||||
return (iTime >= iCurTime - 500);
|
||||
}
|
||||
|
||||
public bool IsInBlackList(string strCode)
|
||||
{
|
||||
return m_BlackList.Contains(strCode);
|
||||
return m_BlackList.Any(r => r.m_strCode == strCode && IsIn5Min(r.m_iTime));
|
||||
}
|
||||
|
||||
public Dictionary<string, ULWatchItem> GetWatchList()
|
||||
|
||||
Reference in New Issue
Block a user