sell 함수 추가
This commit is contained in:
125
ULTrader.cs
125
ULTrader.cs
@@ -10,7 +10,8 @@ namespace upper_limit_crawler
|
||||
{
|
||||
CPFORETRADELib.CpForeTdUtil m_Util = new CPFORETRADELib.CpForeTdUtil();
|
||||
DSCBO1Lib.CpConclusion m_Conclusion = new DSCBO1Lib.CpConclusion();
|
||||
CPTRADELib.CpTd0311 m_Td0311 = new CPTRADELib.CpTd0311();
|
||||
CPTRADELib.CpTd0311 m_Td0311Bid = new CPTRADELib.CpTd0311();
|
||||
CPTRADELib.CpTd0311 m_Td0311Ask = new CPTRADELib.CpTd0311();
|
||||
|
||||
string[] m_astrAccounts = null;
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace upper_limit_crawler
|
||||
|
||||
string strLog = string.Format("[{0}:{1}] {2:###,###,###}원 {3:###,###,###}주 (총{4:###,###,###}원) ", strCodeName, strCode, iPrice, iCount, iPrice *iCount);
|
||||
|
||||
if (strResult == "1") // 체결
|
||||
if (strResult == "1") // 체결
|
||||
{ strLog += "체결"; }
|
||||
else if (strResult == "2") // 확인
|
||||
{ strLog += "확인"; }
|
||||
@@ -53,7 +54,7 @@ namespace upper_limit_crawler
|
||||
else if (strResult == "4") // 접수
|
||||
{ strLog += "접수"; }
|
||||
|
||||
if (strTradeType == "1") // 정상주문
|
||||
if (strTradeType == "1") // 정상주문
|
||||
{ strLog += " (정상주문)"; }
|
||||
else if (strTradeType == "2") // 정정주문
|
||||
{ strLog += " (정정주문)"; }
|
||||
@@ -63,62 +64,76 @@ namespace upper_limit_crawler
|
||||
UlUtil.Trace(strLog);
|
||||
}
|
||||
|
||||
public void Buy(string strCode, float fCurPrice, float fBidAmount)
|
||||
//0 - (string)주문종류코드 주문구분
|
||||
// 1 매도
|
||||
// 2 매수
|
||||
//1 - (string)계좌번호
|
||||
//2 - (string)상품관리구분코드 계좌구분
|
||||
//3 - (string)종목코드
|
||||
//4 - (long)주문수량
|
||||
//5 - (long)주문단가
|
||||
//6 - (string)매매구분
|
||||
//7 - (string)주문조건구분코드 매매조건
|
||||
//0 없음
|
||||
//1 IOC
|
||||
//2 FOK
|
||||
//8 - (string)주문호가구분코드
|
||||
// 1 보통[default]
|
||||
// 2 임의
|
||||
// 3 시장가
|
||||
// 5 조건부지정가
|
||||
// 6 희망대량
|
||||
// 9 자사주
|
||||
// 12 최유리지정가
|
||||
// 13 최우선지정가
|
||||
// 10 스톡옵션자사주
|
||||
// 23 임의시장가
|
||||
// 25 임의조건부지정가
|
||||
// 51 장중대량
|
||||
// 52 장중바스켓
|
||||
// 61 개시전종가
|
||||
// 62 개시전종가대량
|
||||
// 63 개시전시간외바스켓
|
||||
// 67 개시전금전신탁자사주
|
||||
// 69 개시전대량자기
|
||||
// 71 신고대량(전장시가)
|
||||
// 72 시간외대량
|
||||
// 73 신고대량(종가)
|
||||
// 77 금전신탁종가대량
|
||||
// 11 금전신탁자사주
|
||||
// 80 시간외바스켓
|
||||
// 79 시간외대량자기
|
||||
|
||||
public void Buy(string strCode, long iBidPrice, long iBidAmount)
|
||||
{
|
||||
//0 - (string)주문종류코드 주문구분
|
||||
// 1 매도
|
||||
// 2 매수
|
||||
//1 - (string)계좌번호
|
||||
//2 - (string)상품관리구분코드 계좌구분
|
||||
//3 - (string)종목코드
|
||||
//4 - (long)주문수량
|
||||
//5 - (long)주문단가
|
||||
//6 - (string)매매구분
|
||||
//7 - (string)주문조건구분코드 매매조건
|
||||
//0 없음
|
||||
//1 IOC
|
||||
//2 FOK
|
||||
//8 - (string)주문호가구분코드
|
||||
// 1 보통[default]
|
||||
// 2 임의
|
||||
// 3 시장가
|
||||
// 5 조건부지정가
|
||||
// 6 희망대량
|
||||
// 9 자사주
|
||||
// 12 최유리지정가
|
||||
// 13 최우선지정가
|
||||
// 10 스톡옵션자사주
|
||||
// 23 임의시장가
|
||||
// 25 임의조건부지정가
|
||||
// 51 장중대량
|
||||
// 52 장중바스켓
|
||||
// 61 개시전종가
|
||||
// 62 개시전종가대량
|
||||
// 63 개시전시간외바스켓
|
||||
// 67 개시전금전신탁자사주
|
||||
// 69 개시전대량자기
|
||||
// 71 신고대량(전장시가)
|
||||
// 72 시간외대량
|
||||
// 73 신고대량(종가)
|
||||
// 77 금전신탁종가대량
|
||||
// 11 금전신탁자사주
|
||||
// 80 시간외바스켓
|
||||
// 79 시간외대량자기
|
||||
|
||||
// 최
|
||||
|
||||
long iCnt = (long)Math.Floor(fBidAmount / fCurPrice);
|
||||
long iCnt = iBidAmount/iBidPrice;
|
||||
iCnt = 1;
|
||||
|
||||
m_Td0311.SetInputValue(0, "2");
|
||||
m_Td0311.SetInputValue(1, m_astrAccounts[0]);
|
||||
m_Td0311.SetInputValue(3, strCode);
|
||||
m_Td0311.SetInputValue(4, iCnt); // 수량
|
||||
m_Td0311.SetInputValue(5, (long)fCurPrice); // 단가
|
||||
m_Td0311.SetInputValue(7, "0");
|
||||
m_Td0311.SetInputValue(8, "03");
|
||||
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, iBidPrice); // 단가
|
||||
m_Td0311Bid.SetInputValue(7, "0");
|
||||
m_Td0311Bid.SetInputValue(8, "03");
|
||||
|
||||
m_Td0311.BlockRequest();
|
||||
m_Td0311Bid.BlockRequest();
|
||||
}
|
||||
|
||||
public void Sell(string strCode, long iAskPrice, long iCnt)
|
||||
{
|
||||
//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, iAskPrice); // 단가
|
||||
m_Td0311Ask.SetInputValue(7, "0");
|
||||
m_Td0311Ask.SetInputValue(8, "03");
|
||||
|
||||
m_Td0311Ask.BlockRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user