가격 체크 기능 추가
This commit is contained in:
@@ -14,6 +14,7 @@ namespace NewsCrawler
|
||||
CPFORETRADELib.CpForeTdUtil m_CPUtil = new CPFORETRADELib.CpForeTdUtil();
|
||||
DSCBO1Lib.StockMst m_CPStockMst = new DSCBO1Lib.StockMst();
|
||||
CPTRADELib.CpTd0311 m_CP0311 = new CPTRADELib.CpTd0311();
|
||||
CPSYSDIBLib.StockChart m_StockChart = new CPSYSDIBLib.StockChart();
|
||||
bool m_bInitialized = false;
|
||||
|
||||
System.Timers.Timer m_timer = new System.Timers.Timer();
|
||||
@@ -85,7 +86,7 @@ namespace NewsCrawler
|
||||
{
|
||||
m_timer.Enabled = false;
|
||||
|
||||
if(GetLimitRemainCountTrace() < 5)
|
||||
if(GetLimitRemainCountRQ() < 5)
|
||||
return;
|
||||
|
||||
CPSYSDIBLib.CpMarketWatch Watch = new CPSYSDIBLib.CpMarketWatch();
|
||||
@@ -132,7 +133,7 @@ namespace NewsCrawler
|
||||
return m_CPUtil.AccountNumber;
|
||||
}
|
||||
|
||||
public int GetLimitRemainCountTrace()
|
||||
public int GetLimitRemainCountTrade()
|
||||
{
|
||||
return m_CPCybos.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_TRADE_REQUEST);
|
||||
}
|
||||
@@ -152,6 +153,63 @@ namespace NewsCrawler
|
||||
return (m_CPCybos.IsConnect==1);
|
||||
}
|
||||
|
||||
public int GetCurPrice(CodeList.CODE_VALUE Code)
|
||||
{
|
||||
m_CPStockMst.SetInputValue(0, Code.m_strCode);
|
||||
m_CPStockMst.BlockRequest2(0);
|
||||
int iCurPrice = m_CPStockMst.GetHeaderValue(13);
|
||||
return iCurPrice;
|
||||
}
|
||||
|
||||
public void GetLowHighPrice(CodeList.CODE_VALUE Code, DateTime StartTime, int iAfterMin, out int iPriceLow, out int iPriceHigh)
|
||||
{
|
||||
iPriceLow = 1000000;
|
||||
iPriceHigh = 0;
|
||||
|
||||
if(GetLimitRemainCountRQ() < 5)
|
||||
return;
|
||||
|
||||
string strTime = StartTime.ToString("yyyyMMdd");
|
||||
|
||||
m_StockChart.SetInputValue(0, Code.m_strCode);
|
||||
m_StockChart.SetInputValue(1, '1');
|
||||
m_StockChart.SetInputValue(2, strTime);
|
||||
m_StockChart.SetInputValue(3, strTime);
|
||||
m_StockChart.SetInputValue(4, 20);
|
||||
m_StockChart.SetInputValue(5, new int[] { 0, 1, 2, 3, 4, 5, });
|
||||
m_StockChart.SetInputValue(6, 'm');
|
||||
m_StockChart.SetInputValue(7, 1);
|
||||
m_StockChart.BlockRequest2(0);
|
||||
|
||||
int iTimeStart;
|
||||
int.TryParse(StartTime.ToString("HHmm"), out iTimeStart);
|
||||
|
||||
int iCheckCnt = 0;
|
||||
|
||||
int iCount = m_StockChart.GetHeaderValue(3);
|
||||
for(int i=0; i<iCount; i++)
|
||||
{
|
||||
uint uiDate = m_StockChart.GetDataValue(0, i);
|
||||
long iTime = m_StockChart.GetDataValue(1, i);
|
||||
|
||||
if(iTime >= iTimeStart && iTime <= iTimeStart+iAfterMin)
|
||||
{
|
||||
long iPriceStartLocal = m_StockChart.GetDataValue(2, i);
|
||||
long iPriceHighLocal = m_StockChart.GetDataValue(3, i);
|
||||
long iPriceLowLocal = m_StockChart.GetDataValue(4, i);
|
||||
long iPriceEndLocal = m_StockChart.GetDataValue(5, i);
|
||||
|
||||
iPriceLow = Math.Min(iPriceLow, (int)iPriceLowLocal);
|
||||
iPriceHigh = Math.Max(iPriceLow, (int)iPriceHighLocal);
|
||||
|
||||
iCheckCnt++;
|
||||
}
|
||||
|
||||
if(iCheckCnt >= 5)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Buy(CodeList.CODE_VALUE Code, int iMaxPrice)
|
||||
{
|
||||
if(m_bInitialized == false)
|
||||
@@ -160,10 +218,7 @@ namespace NewsCrawler
|
||||
return;
|
||||
}
|
||||
|
||||
m_CPStockMst.SetInputValue(0, Code.m_strCode);
|
||||
m_CPStockMst.BlockRequest2(0);
|
||||
int iCurPrice = m_CPStockMst.GetHeaderValue(13);
|
||||
|
||||
int iCurPrice = GetCurPrice(Code);
|
||||
int iCount = iMaxPrice/iCurPrice;
|
||||
|
||||
m_CP0311.SetInputValue(0, 2);
|
||||
|
||||
Reference in New Issue
Block a user