update
This commit is contained in:
@@ -174,22 +174,25 @@ namespace AutoSellerNS
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void UpdateItems()
|
||||
{
|
||||
if (Config.GetAccount() == "")
|
||||
return;
|
||||
|
||||
m_CP6033.SetInputValue(0, Config.GetAccount());
|
||||
m_CP6033.SetInputValue(1, Config.GetSubAccount());
|
||||
m_CP6033.SetInputValue(2, 50);
|
||||
|
||||
string Msg1 = m_CP6033.GetDibMsg1();
|
||||
string Msg2 = m_CP6033.GetDibMsg2();
|
||||
int iStatus = m_CP6033.GetDibStatus();
|
||||
|
||||
if (iStatus == 1)
|
||||
return;
|
||||
|
||||
if (iStatus == -1)
|
||||
m_Listener.ErrorCallback($"Update Item Error\nStatus: {iStatus}\nMsg1: {Msg1}\nMsg2: {Msg2}");
|
||||
|
||||
m_CP6033.SetInputValue(0, Config.GetAccount());
|
||||
m_CP6033.SetInputValue(1, Config.GetSubAccount());
|
||||
m_CP6033.SetInputValue(2, 50);
|
||||
m_CP6033.Request();
|
||||
}
|
||||
|
||||
@@ -275,8 +278,8 @@ namespace AutoSellerNS
|
||||
|
||||
public void UpdateNC()
|
||||
{
|
||||
m_CP5339.SetInputValue(0, Config.GetAccount());
|
||||
m_CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
if (Config.GetAccount() == "")
|
||||
return;
|
||||
|
||||
string Msg1 = m_CP5339.GetDibMsg1();
|
||||
string Msg2 = m_CP5339.GetDibMsg2();
|
||||
@@ -284,6 +287,11 @@ namespace AutoSellerNS
|
||||
if (iStatus == 1)
|
||||
return;
|
||||
|
||||
if (iStatus == -1)
|
||||
m_Listener.ErrorCallback($"UpdateNC Item Error\nStatus: {iStatus}\nMsg1: {Msg1}\nMsg2: {Msg2}");
|
||||
|
||||
m_CP5339.SetInputValue(0, Config.GetAccount());
|
||||
m_CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
m_CP5339.Request();
|
||||
}
|
||||
|
||||
@@ -334,12 +342,19 @@ namespace AutoSellerNS
|
||||
int iPrice = m_CpConclusion.GetHeaderValue(4);
|
||||
int iOrderNumber = m_CpConclusion.GetHeaderValue(5);
|
||||
int iOrgOrderNumber = m_CpConclusion.GetHeaderValue(6);
|
||||
string strCancel = m_CpConclusion.GetHeaderValue(16);
|
||||
string strOrderType = m_CpConclusion.GetHeaderValue(16);
|
||||
string strOrderCondition = m_CpConclusion.GetHeaderValue(19);
|
||||
int iBookValue = m_CpConclusion.GetHeaderValue(21);
|
||||
int iRemainCnt = m_CpConclusion.GetHeaderValue(23);
|
||||
string strBidOrAsk = bBid ? "매수" : "매도";
|
||||
|
||||
if (strOrderType == "1")
|
||||
strOrderType = "정상 주문";
|
||||
else if (strOrderType == "2")
|
||||
strOrderType = "정정 주문";
|
||||
else if (strOrderType == "3")
|
||||
strOrderType = "취소 주문";
|
||||
|
||||
if (strOrderCondition == "0")
|
||||
strOrderCondition = "없음";
|
||||
else if (strOrderCondition == "1")
|
||||
@@ -350,22 +365,29 @@ namespace AutoSellerNS
|
||||
switch (iType)
|
||||
{
|
||||
case 1: // 체결
|
||||
m_Listener.UpdateItem();
|
||||
m_Listener.UpdateItem(bBid, strCodeName, strCode, iPrice, iConclusionCnt);
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid?Util.LOG_TYPE.BUY_CONCLUSION:Util.LOG_TYPE.SELL_CONCLUSION, string.Format("{0}:{1} {2} 체결 ({3:n0}원 {4}주) - {5}", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt, strOrderCondition));
|
||||
//if (strOrderType == "정상 주문")
|
||||
// m_Listener.UpdateNCItem(true, bBid, strCodeName, strCode, iPrice, iConclusionCnt);
|
||||
Util.Log(bBid?Util.LOG_TYPE.BUY_CONCLUSION:Util.LOG_TYPE.SELL_CONCLUSION, string.Format("{0}:{1} {2} {3} 체결 ({4:n0}원 {5}주) - {6}",
|
||||
strCodeName, strCode, strBidOrAsk, strOrderType, iPrice, iConclusionCnt, strOrderCondition));
|
||||
break;
|
||||
|
||||
case 2: // 확인
|
||||
Util.Log(Util.LOG_TYPE.VERBOSE, string.Format("{0}:{1} {2} 확인 - {3} ({4}:{5})", strCodeName, strCode, strBidOrAsk, strOrderCondition, iOrderNumber, iOrgOrderNumber));
|
||||
Util.Log(Util.LOG_TYPE.VERBOSE, string.Format("{0}:{1} {2} {3} 확인 - {4} ({5}:{6})",
|
||||
strCodeName, strCode, strBidOrAsk, strOrderType, strOrderCondition, iOrderNumber, iOrgOrderNumber));
|
||||
break;
|
||||
|
||||
case 3: // 거부
|
||||
Util.Log(Util.LOG_TYPE.VERBOSE, string.Format("{0}:{1} {2} 거부", strCodeName, strCode, strBidOrAsk));
|
||||
Util.Log(Util.LOG_TYPE.VERBOSE, string.Format("{0}:{1} {2} {3} 거부", strCodeName, strCode, strBidOrAsk, strOrderType));
|
||||
break;
|
||||
|
||||
case 4: // 접수
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 접수 ({3:n0}원 {4}주) - {5}", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt, strOrderCondition));
|
||||
//if(strOrderType == "정상 주문")
|
||||
// m_Listener.UpdateNCItem(false, bBid, strCodeName, strCode, iPrice, iConclusionCnt);
|
||||
Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} {3} 접수 ({4:n0}원 {5}주) - {6}",
|
||||
strCodeName, strCode, strBidOrAsk, strOrderType, iPrice, iConclusionCnt, strOrderCondition));
|
||||
if (bBid == false)
|
||||
{
|
||||
if(m_aStockCur.ContainsKey(strCode) == true)
|
||||
@@ -498,7 +520,7 @@ namespace AutoSellerNS
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
int iSellPrice = iAskPrice - GetUnitValue(iAskPrice);
|
||||
int iSellPrice = iAskPrice;
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311();
|
||||
Td0311.SetInputValue(0, "1");
|
||||
@@ -563,8 +585,9 @@ namespace AutoSellerNS
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
CancelItem(strCode, iOrgOrderNo).Wait();
|
||||
SellItem(strCode, iCnt, iAskPrice).Wait();
|
||||
var a = CancelItem(strCode, iOrgOrderNo);
|
||||
Thread.Sleep(2000);
|
||||
a = SellItem(strCode, iCnt, iAskPrice);
|
||||
|
||||
string strCode2;
|
||||
m_ItemsInCorrection.TryRemove(iOrgOrderNo, out strCode2);
|
||||
|
||||
Reference in New Issue
Block a user