실시간으로 수정

This commit is contained in:
2016-07-14 00:52:17 +09:00
parent 06a27f7b0e
commit 069557e102
16 changed files with 412 additions and 957 deletions

View File

@@ -10,8 +10,8 @@ namespace upper_limit_crawler
{
CPFORETRADELib.CpForeTdUtil m_Util = new CPFORETRADELib.CpForeTdUtil();
DSCBO1Lib.CpConclusion m_Conclusion = new DSCBO1Lib.CpConclusion();
CPTRADELib.CpTd0311 m_Td0311Bid = new CPTRADELib.CpTd0311();
CPTRADELib.CpTd0311 m_Td0311Ask = new CPTRADELib.CpTd0311();
//CPTRADELib.CpTd0311 m_Td0311Bid = new CPTRADELib.CpTd0311();
//CPTRADELib.CpTd0311 m_Td0311Ask = new CPTRADELib.CpTd0311();
string[] m_astrAccounts = null;
@@ -51,7 +51,7 @@ namespace upper_limit_crawler
string strTradeType = m_Conclusion.GetHeaderValue(16);
string strLog = string.Format("[{0}:{1}] {2:###,###,###}원 {3:###,###,###}주 (총{4:###,###,###}원) ", strCodeName, strCode, iPrice, iCount, iPrice *iCount);
string strLog = "";
if (strResult == "1") // 체결
{ strLog += "체결"; }
@@ -62,6 +62,8 @@ namespace upper_limit_crawler
else if (strResult == "4") // 접수
{ strLog += "접수"; }
strLog += string.Format("[{0}:{1}] {2:###,###,###}원 {3:###,###,###}주 (총{4:###,###,###}원) ", strCodeName, strCode, iPrice, iCount, iPrice * iCount);
if (strTradeType == "1") // 정상주문
{ strLog += " (정상주문)"; }
else if (strTradeType == "2") // 정정주문
@@ -114,58 +116,61 @@ namespace upper_limit_crawler
public void Buy(string strCode, int iUnitPrice, int iBidAmount)
{
lock(lockBuy)
//lock(lockBuy)
{
int iCnt = iBidAmount / iUnitPrice;
iCnt = 1;
m_Td0311Bid.SetInputValue(0, "2");
m_Td0311Bid.SetInputValue(1, m_astrAccounts[0]);
m_Td0311Bid.SetInputValue(3, strCode);
m_Td0311Bid.SetInputValue(4, iCnt); // 수량
m_Td0311Bid.SetInputValue(5, iUnitPrice); // 단가
m_Td0311Bid.SetInputValue(7, "0");
m_Td0311Bid.SetInputValue(8, "03");
CPTRADELib.CpTd0311 Td0311Bid = new CPTRADELib.CpTd0311();
Td0311Bid.SetInputValue(0, "2");
Td0311Bid.SetInputValue(1, m_astrAccounts[0]);
Td0311Bid.SetInputValue(3, strCode);
Td0311Bid.SetInputValue(4, iCnt); // 수량
Td0311Bid.SetInputValue(5, 0); // 단가
Td0311Bid.SetInputValue(7, "0");
Td0311Bid.SetInputValue(8, "03");
m_Td0311Bid.BlockRequest();
Td0311Bid.BlockRequest();
}
}
public void Sell(string strCode, int iUnitPrice, int iCnt)
{
lock (lockSell)
//lock (lockSell)
{
//long iCnt = (long)Math.Floor(fAskAmount/fCurPrice);
//iCnt=1;
CPTRADELib.CpTd0311 Td0311Ask = new CPTRADELib.CpTd0311();
m_Td0311Ask.SetInputValue(0, "1");
m_Td0311Ask.SetInputValue(1, m_astrAccounts[0]);
m_Td0311Ask.SetInputValue(3, strCode);
m_Td0311Ask.SetInputValue(4, iCnt); // 수량
m_Td0311Ask.SetInputValue(5, iUnitPrice); // 단가
m_Td0311Ask.SetInputValue(7, "0");
m_Td0311Ask.SetInputValue(8, "03");
Td0311Ask.SetInputValue(0, "1");
Td0311Ask.SetInputValue(1, m_astrAccounts[0]);
Td0311Ask.SetInputValue(3, strCode);
Td0311Ask.SetInputValue(4, iCnt); // 수량
Td0311Ask.SetInputValue(5, iUnitPrice); // 단가
Td0311Ask.SetInputValue(7, "0");
Td0311Ask.SetInputValue(8, "03");
m_Td0311Ask.BlockRequest();
Td0311Ask.BlockRequest();
}
}
public void SellCurPrice(string strCode, int iCnt)
{
lock (lockSell)
//lock (lockSell)
{
//long iCnt = (long)Math.Floor(fAskAmount/fCurPrice);
//iCnt=1;
m_Td0311Ask.SetInputValue(0, "1");
m_Td0311Ask.SetInputValue(1, m_astrAccounts[0]);
m_Td0311Ask.SetInputValue(3, strCode);
m_Td0311Ask.SetInputValue(4, iCnt); // 수량
m_Td0311Ask.SetInputValue(5, 0); // 단가
m_Td0311Ask.SetInputValue(7, "0");
m_Td0311Ask.SetInputValue(8, "03");
CPTRADELib.CpTd0311 Td0311Ask = new CPTRADELib.CpTd0311();
m_Td0311Ask.BlockRequest();
Td0311Ask.SetInputValue(0, "1");
Td0311Ask.SetInputValue(1, m_astrAccounts[0]);
Td0311Ask.SetInputValue(3, strCode);
Td0311Ask.SetInputValue(4, iCnt); // 수량
Td0311Ask.SetInputValue(5, 0); // 단가
Td0311Ask.SetInputValue(7, "0");
Td0311Ask.SetInputValue(8, "03");
Td0311Ask.BlockRequest();
}
}
}