뻗는 부분 수정
This commit is contained in:
@@ -107,7 +107,7 @@ namespace AutoSellerNS
|
||||
m_iMaxPrice));
|
||||
}
|
||||
|
||||
if(iTimeDiff >= Config.GetTimeLimit())
|
||||
if(iTimeDiff >= Config.GetTimeLimit() && m_Listener.IsSelling() == true)
|
||||
{
|
||||
m_CybosHelper.SellItem(m_strCode, m_Listener.GetSellableCount(m_strCode), m_aiAskPrice[0]);
|
||||
Util.Log(Util.LOG_TYPE.SELL, string.Format("[시간제한 매도] {0} ({1}초) (현재가 {2:n0}원, 최고가 {3:n0}원)",
|
||||
@@ -223,7 +223,6 @@ namespace AutoSellerNS
|
||||
Item.m_iAvailableQuantity = m_6033.GetDataValue(15, i);
|
||||
Item.m_dBookUnitPrice = m_6033.GetDataValue(17, i);
|
||||
Item.m_iProfitUnitPrice = m_6033.GetDataValue(18, i);
|
||||
Item.m_iSellableCnt = m_6033.GetDataValue(15, i);
|
||||
|
||||
if(strCodeList.Length > 0)
|
||||
strCodeList += ",";
|
||||
@@ -242,7 +241,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
DSCBO1Lib.StockMst2 StockMst = new DSCBO1Lib.StockMst2();
|
||||
StockMst.SetInputValue(0, strCodeList);
|
||||
StockMst.BlockRequest2(0);
|
||||
StockMst.BlockRequest2(1);
|
||||
int iCnt = StockMst.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
@@ -272,43 +271,54 @@ namespace AutoSellerNS
|
||||
return aItems;
|
||||
}
|
||||
|
||||
static int iUpdateNCIdx = 1;
|
||||
public List<AutoSeller.NCITEM> UpdateNC()
|
||||
{
|
||||
int iIdx = iUpdateNCIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("UpdateNC Start ({0}, {1}, {2}, {3})", iIdx,
|
||||
GetLimitRemainCountRQ(), GetLimitRemainCountSB(), GetLimitRemainCountTrade()
|
||||
));
|
||||
|
||||
while(GetLimitRemainCountTrade() < 1)
|
||||
Thread.Sleep(500);
|
||||
|
||||
List<AutoSeller.NCITEM> NCItems = new List<AutoSeller.NCITEM>();
|
||||
lock(m_NCItemLock)
|
||||
|
||||
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
|
||||
CP5339.SetInputValue(0, Config.GetAccount());
|
||||
CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
CP5339.BlockRequest2(1);
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue)
|
||||
{
|
||||
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
|
||||
CP5339.SetInputValue(0, Config.GetAccount());
|
||||
CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
CP5339.BlockRequest2(0);
|
||||
int iCnt = CP5339.GetHeaderValue(5);
|
||||
Console.WriteLine("icnt : {0}", iCnt);
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue)
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
int iCnt = CP5339.GetHeaderValue(5);
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
AutoSeller.NCITEM Item = new AutoSeller.NCITEM();
|
||||
AutoSeller.NCITEM Item = new AutoSeller.NCITEM();
|
||||
|
||||
Item.m_strCode = CP5339.GetDataValue(3, i);
|
||||
Item.m_strCodeName = CP5339.GetDataValue(4, i);
|
||||
Item.m_strDesc = CP5339.GetDataValue(5, i);
|
||||
Item.m_iOrderPrice = CP5339.GetDataValue(7, i);
|
||||
Item.m_iRemainCnt = CP5339.GetDataValue(11, i);
|
||||
Item.m_bAsk = (CP5339.GetDataValue(13, i) == "1");
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(2, i);
|
||||
if(Item.m_iOrgOrderNo == 0)
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(1, i);
|
||||
Item.m_strCode = CP5339.GetDataValue(3, i);
|
||||
Item.m_strCodeName = CP5339.GetDataValue(4, i);
|
||||
Item.m_strDesc = CP5339.GetDataValue(5, i);
|
||||
Item.m_iOrderPrice = CP5339.GetDataValue(7, i);
|
||||
Item.m_iRemainCnt = CP5339.GetDataValue(11, i);
|
||||
Item.m_bAsk = (CP5339.GetDataValue(13, i) == "1");
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(2, i);
|
||||
if(Item.m_iOrgOrderNo == 0)
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(1, i);
|
||||
|
||||
NCItems.Add(Item);
|
||||
}
|
||||
|
||||
bContinue = (CP5339.Continue != 0);
|
||||
if(bContinue)
|
||||
CP5339.BlockRequest2(0);
|
||||
NCItems.Add(Item);
|
||||
}
|
||||
|
||||
bContinue = (CP5339.Continue != 0);
|
||||
if(bContinue)
|
||||
CP5339.BlockRequest2(1);
|
||||
}
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("UpdateNC End ({0})", iIdx));
|
||||
|
||||
return NCItems;
|
||||
}
|
||||
|
||||
@@ -332,6 +342,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
case 1: // 체결
|
||||
m_Listener.UpdateItem(strCode, strCodeName, bBid, iConclusionCnt, iRemainCnt, iBookValue);
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid?Util.LOG_TYPE.BUY:Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 체결 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt));
|
||||
break;
|
||||
|
||||
@@ -344,7 +355,7 @@ namespace AutoSellerNS
|
||||
break;
|
||||
|
||||
case 4: // 접수
|
||||
m_Listener.OnReceipt();
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 접수 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt));
|
||||
break;
|
||||
}
|
||||
@@ -390,7 +401,7 @@ namespace AutoSellerNS
|
||||
|
||||
DSCBO1Lib.StockJpbid2 JpBid = new DSCBO1Lib.StockJpbid2();
|
||||
JpBid.SetInputValue(0, Item.m_strCode);
|
||||
JpBid.BlockRequest2(0);
|
||||
JpBid.BlockRequest2(1);
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
StockCur.m_aiAskPrice[i] = JpBid.GetDataValue(0, i);
|
||||
@@ -440,8 +451,12 @@ namespace AutoSellerNS
|
||||
return (iValue/iUnit)*iUnit;
|
||||
}
|
||||
|
||||
static int iSellIdx = 1;
|
||||
public void SellItem(string strCode, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iIdx = iSellIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("SellItem Start ({0})", iIdx));
|
||||
|
||||
int iSellPrice = iAskPrice-GetUnitValue(iAskPrice);
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311();
|
||||
@@ -452,22 +467,34 @@ namespace AutoSellerNS
|
||||
Td0311.SetInputValue(4, iCnt);
|
||||
Td0311.SetInputValue(5, iSellPrice);
|
||||
Td0311.SetInputValue(8, "01");
|
||||
Td0311.BlockRequest2(0);
|
||||
Td0311.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("SellItem End ({0})", iIdx));
|
||||
}
|
||||
|
||||
static int iCancelIdx = 1;
|
||||
public void CancelItem(string strCode, int iOrgOrderNo)
|
||||
{
|
||||
int iIdx = iCancelIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CancelItem Start ({0})", iIdx));
|
||||
|
||||
CPTRADELib.CpTd0314 Td0314 = new CPTRADELib.CpTd0314();
|
||||
Td0314.SetInputValue(1, iOrgOrderNo);
|
||||
Td0314.SetInputValue(2, Config.GetAccount());
|
||||
Td0314.SetInputValue(3, Config.GetSubAccount());
|
||||
Td0314.SetInputValue(4, strCode);
|
||||
Td0314.SetInputValue(5, 0);
|
||||
Td0314.BlockRequest2(0);
|
||||
Td0314.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CancelItem End ({0})", iIdx));
|
||||
}
|
||||
|
||||
static int iCorrectIdx = 1;
|
||||
public void CorrectionItem(string strCode, int iOrgOrderNo, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iIdx = iCorrectIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CorrectionItem Start ({0})", iIdx));
|
||||
|
||||
int iSellPrice = iAskPrice-GetUnitValue(iAskPrice);
|
||||
|
||||
//CancelItem(strCode, iOrgOrderNo);
|
||||
@@ -481,7 +508,9 @@ namespace AutoSellerNS
|
||||
Td0313.SetInputValue(4, strCode);
|
||||
Td0313.SetInputValue(5, 0);
|
||||
Td0313.SetInputValue(6, iSellPrice);
|
||||
Td0313.BlockRequest2(0);
|
||||
Td0313.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CorrectionItem End ({0})", iIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user