- 매도 가격을 매도호가의 한호가 아래로 설정
- 미체결 화면 추가
This commit is contained in:
@@ -48,7 +48,7 @@ namespace AutoSellerNS
|
||||
|
||||
if(m_iCheckCount >= Config.GetBidCount() && m_Listener.IsSelling() == true)
|
||||
{
|
||||
m_CybosHelper.SellItem(m_strCode, m_iCurPrice, m_Listener.GetSellableCount(m_strCode));
|
||||
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}원)", m_strCodeName, Config.GetBidCount(), m_iCurPrice, m_iMaxPrice));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace AutoSellerNS
|
||||
m_iTrailingCount++;
|
||||
if(m_iTrailingCount >= Config.GetTrailingCnt() && m_Listener.IsSelling() == true)
|
||||
{
|
||||
m_CybosHelper.SellItem(m_strCode, m_iCurPrice, m_Listener.GetSellableCount(m_strCode));
|
||||
m_CybosHelper.SellItem(m_strCode, m_Listener.GetSellableCount(m_strCode), m_aiAskPrice[0]);
|
||||
Util.Log(Util.LOG_TYPE.SELL, string.Format("[트레일링 매도] {0} ({1}% {2}회) (현재가 {2:n0}원, 최고가 {3:n0}원)", m_strCodeName, Config.GetTrailingRate(), Config.GetTrailingCnt(), m_iCurPrice, m_iMaxPrice));
|
||||
}
|
||||
|
||||
@@ -211,6 +211,40 @@ namespace AutoSellerNS
|
||||
return aItems;
|
||||
}
|
||||
|
||||
public List<AutoSeller.NCITEM> UpdateNC()
|
||||
{
|
||||
List<AutoSeller.NCITEM> NCItems = new List<AutoSeller.NCITEM>();
|
||||
|
||||
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
|
||||
CP5339.SetInputValue(0, Config.GetAccount());
|
||||
CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
CP5339.BlockRequest2(0);
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue)
|
||||
{
|
||||
int iCnt = CP5339.GetHeaderValue(5);
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
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);
|
||||
|
||||
NCItems.Add(Item);
|
||||
}
|
||||
|
||||
bContinue = (CP5339.Continue != 0);
|
||||
if(bContinue)
|
||||
CP5339.BlockRequest2(0);
|
||||
}
|
||||
|
||||
return NCItems;
|
||||
}
|
||||
|
||||
private void CpConclusion_Received()
|
||||
{
|
||||
string strType = m_CpConclusion.GetHeaderValue(14);
|
||||
@@ -285,6 +319,18 @@ namespace AutoSellerNS
|
||||
StockCur.m_CybosHelper = this;
|
||||
StockCur.m_strCode = Item.m_strCode;
|
||||
StockCur.m_strCodeName = Item.m_strCodeName;
|
||||
|
||||
DSCBO1Lib.StockJpbid2 JpBid = new DSCBO1Lib.StockJpbid2();
|
||||
JpBid.SetInputValue(0, Item.m_strCode);
|
||||
JpBid.BlockRequest2(0);
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
StockCur.m_aiAskPrice[i] = JpBid.GetDataValue(0, i);
|
||||
StockCur.m_aiAskCount[i] = JpBid.GetDataValue(2, i);
|
||||
StockCur.m_aiBidPrice[i] = JpBid.GetDataValue(1, i);
|
||||
StockCur.m_aiBidCount[i] = JpBid.GetDataValue(3, i);
|
||||
}
|
||||
|
||||
StockCur.m_StockCur = new DSCBO1Lib.StockCur();
|
||||
StockCur.m_StockCur.SetInputValue(0, Item.m_strCode);
|
||||
StockCur.m_StockCur.Received += StockCur.OnRecievedPrice;
|
||||
@@ -299,16 +345,39 @@ namespace AutoSellerNS
|
||||
}
|
||||
}
|
||||
|
||||
public void SellItem(string strCode, int iPrice, int iCnt)
|
||||
int GetCallUnitValue(int iValue)
|
||||
{
|
||||
int iUnit = 1;
|
||||
if(iValue < 1000)
|
||||
iUnit = 1;
|
||||
else if(iValue < 5000)
|
||||
iUnit = 5;
|
||||
else if(iValue < 10000)
|
||||
iUnit = 10;
|
||||
else if(iValue < 50000)
|
||||
iUnit = 50;
|
||||
else if(iValue < 100000)
|
||||
iUnit = 100;
|
||||
else if(iValue < 500000)
|
||||
iUnit = 500;
|
||||
else
|
||||
iUnit = 1000;
|
||||
|
||||
return (iValue/iUnit)*iUnit;
|
||||
}
|
||||
|
||||
public void SellItem(string strCode, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iSellPrice = iAskPrice-GetCallUnitValue(iAskPrice);
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311();
|
||||
Td0311.SetInputValue(0, "1");
|
||||
Td0311.SetInputValue(1, Config.GetAccount());
|
||||
Td0311.SetInputValue(2, Config.GetSubAccount());
|
||||
Td0311.SetInputValue(3, strCode);
|
||||
Td0311.SetInputValue(4, iCnt);
|
||||
Td0311.SetInputValue(5, 0);
|
||||
Td0311.SetInputValue(8, "03");
|
||||
Td0311.SetInputValue(5, iSellPrice);
|
||||
Td0311.SetInputValue(8, "01");
|
||||
Td0311.BlockRequest2(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user