뻗는 부분 수정
This commit is contained in:
@@ -59,7 +59,7 @@ namespace AutoSellerNS
|
||||
// CPStockChart.SetInputValue(4, 100000);
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
@@ -96,7 +96,7 @@ namespace AutoSellerNS
|
||||
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
@@ -149,7 +149,7 @@ namespace AutoSellerNS
|
||||
// CPStockChart.SetInputValue(3, StartDT.ToString("yyyyMMdd"));
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
@@ -184,7 +184,7 @@ namespace AutoSellerNS
|
||||
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
@@ -236,7 +236,7 @@ namespace AutoSellerNS
|
||||
CPStockBid.SetInputValue(2, 20000);
|
||||
CPStockBid.SetInputValue(3, 'C');
|
||||
CPStockBid.SetInputValue(4, "2000");
|
||||
CPStockBid.BlockRequest2(0);
|
||||
CPStockBid.BlockRequest2(1);
|
||||
|
||||
List<object[]> aaRows = new List<object[]>();
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
while(m_CybosHelper.GetLimitRemainCountRQ() < 2)
|
||||
Thread.Sleep(100);
|
||||
CPStockBid.BlockRequest2(0);
|
||||
CPStockBid.BlockRequest2(1);
|
||||
}
|
||||
|
||||
m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
@@ -450,6 +450,7 @@ namespace AutoSellerNS
|
||||
double dTimeSub = (double)aParams[10];
|
||||
int iTimeDiffLimit = (int)aParams[11];
|
||||
int iIgnorePrice = (int)aParams[12];
|
||||
bool bHalfTrailing = (bool)aParams[13];
|
||||
|
||||
var tokens = strLine.Split('\t');
|
||||
|
||||
@@ -521,7 +522,7 @@ namespace AutoSellerNS
|
||||
int iPrice = (int)(double)Sheet.Cells[iRow, 3].Value;
|
||||
int iAskPrice = (int)(double)Sheet.Cells[iRow, 4].Value;
|
||||
int iBidPrice = (int)(double)Sheet.Cells[iRow, 5].Value;
|
||||
int iConclusionCnt = (int)(double)Sheet.Cells[iRow, 8].Value;
|
||||
int iConclusionCnt = (int)(double)Sheet.Cells[iRow, 7].Value;
|
||||
|
||||
int iTimeDiff = 0;
|
||||
if(iPrevTime > 0)
|
||||
@@ -661,7 +662,7 @@ namespace AutoSellerNS
|
||||
if(iAskCount >= Math.Round(dCheckCount))
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 조건1 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 조건 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}% ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -673,6 +674,7 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -705,7 +707,7 @@ namespace AutoSellerNS
|
||||
if(iTrailingCount >= Config.GetTrailingCnt())
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링 매도 \n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}% ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -717,6 +719,7 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -735,10 +738,10 @@ namespace AutoSellerNS
|
||||
break;
|
||||
}
|
||||
|
||||
if(iTimeDiff >= iTimeDiffLimit)
|
||||
if(bHalfTrailing == true && iMaxPrice/(float)iStartPrice >= 1.02 && iPrice < (iStartPrice+iMaxPrice)/2)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 제한시간 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링2 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원 {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -750,6 +753,61 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
(iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
|
||||
dCheckCount
|
||||
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
double dSlope = 0;
|
||||
if(m_PriceList.Count >= 5)
|
||||
{
|
||||
List<Point> LastSample = new List<Point>();
|
||||
for(int i = 0; i<5; i++)
|
||||
{
|
||||
Point Pos = new Point();
|
||||
Pos.X = m_PriceList[m_PriceList.Count-i-1];
|
||||
Pos.X = Pos.X/m_CybosHelper.GetUnitValue(Pos.X);
|
||||
|
||||
Pos.Y = 5-i;
|
||||
|
||||
LastSample.Add(Pos);
|
||||
}
|
||||
|
||||
double xBar = LastSample.Average(p => p.X);
|
||||
double yBar = LastSample.Average(p => p.Y);
|
||||
|
||||
double dividend = LastSample.Sum(p => (p.X - xBar) * (p.Y - yBar));
|
||||
double divisor = (double)LastSample.Sum(p => Math.Pow(p.X - xBar, 2));
|
||||
|
||||
dSlope = dividend / divisor;
|
||||
Sheet.Cells[iRow, 13].Value = dSlope;
|
||||
}
|
||||
|
||||
|
||||
if(iTimeDiff >= iTimeDiffLimit)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 제한시간 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
iStartPrice,
|
||||
StartDT.ToString("HH:mm:ss"),
|
||||
iStartRow,
|
||||
|
||||
iPrice,
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -774,7 +832,7 @@ namespace AutoSellerNS
|
||||
if(iRow == iMaxRow)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 종료 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 종료 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -841,11 +899,12 @@ namespace AutoSellerNS
|
||||
double dTimeSub = (double)aParams[9];
|
||||
int iTimeDiffLimit = (int)aParams[10];
|
||||
int iIgnorePrice = (int)aParams[11];
|
||||
bool bHalfTrailing = (bool)aParams[12];
|
||||
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11}, {12}원 이하 무시, 비교 방식 : {13}\n",
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n\t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11}, {12}원 이하 무시, \n\t\t트레일링2 : {13}, 비교 방식 : {14}\n",
|
||||
Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt(),
|
||||
iListCnt, dFastSD, dFastUpCnt, dFastDownCnt, dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
dTimeSub, iTimeDiffLimit, iIgnorePrice,
|
||||
dTimeSub, iTimeDiffLimit, iIgnorePrice, bHalfTrailing,
|
||||
strMethod
|
||||
));
|
||||
|
||||
@@ -861,7 +920,7 @@ namespace AutoSellerNS
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
iCompareType, strMethod,
|
||||
strLine, dTimeSub, iTimeDiffLimit,
|
||||
iIgnorePrice }));
|
||||
iIgnorePrice, bHalfTrailing }));
|
||||
|
||||
aTasks.Add(task);
|
||||
}
|
||||
@@ -891,6 +950,7 @@ namespace AutoSellerNS
|
||||
double dTimeSub;
|
||||
int iTimeDiffLimit;
|
||||
int iIgnorePrice;
|
||||
bool bHalfTrailing;
|
||||
|
||||
int.TryParse(m_AutoSeller.tbSMListSize.Text, out iListCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastSD.Text, out dFastSD);
|
||||
@@ -902,6 +962,7 @@ namespace AutoSellerNS
|
||||
double.TryParse(m_AutoSeller.tbSMTimeSub.Text, out dTimeSub);
|
||||
int.TryParse(m_AutoSeller.tbSMTimeDiffLimit.Text, out iTimeDiffLimit);
|
||||
int.TryParse(m_AutoSeller.tbSMIgnorePrice.Text, out iIgnorePrice);
|
||||
bHalfTrailing = m_AutoSeller.chSMHalfTrailing.Checked;
|
||||
|
||||
string strMethod = "";
|
||||
m_AutoSeller.cbSMMethod.Invoke(new Action(() => {
|
||||
@@ -931,7 +992,7 @@ namespace AutoSellerNS
|
||||
dFastSD, dFastUpCnt, dFastDownCnt,
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
iCompareType, strMethod, dTimeSub, iTimeDiffLimit,
|
||||
iIgnorePrice
|
||||
iIgnorePrice, bHalfTrailing
|
||||
});
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user