- 시뮬레이션의 파라미터를 실제에서 조정할 수 있도록

- 얼마 이하의 매수, 매도 체결은 무시하도록
This commit is contained in:
2017-03-20 11:33:41 +09:00
parent 74e599d6bc
commit 24fe10afd8
5 changed files with 563 additions and 38 deletions

View File

@@ -449,6 +449,7 @@ namespace AutoSellerNS
string strLine = (string)aParams[9];
double dTimeSub = (double)aParams[10];
int iTimeDiffLimit = (int)aParams[11];
int iIgnorePrice = (int)aParams[12];
var tokens = strLine.Split('\t');
@@ -485,6 +486,7 @@ namespace AutoSellerNS
int iTrailingCount = 0;
int iMaxPrice = int.MinValue;
int iMaxPriceRow = 0;
int iStockCount = 0;
int iStartRow = 0;
int iPrevPrice = 0;
@@ -499,8 +501,16 @@ namespace AutoSellerNS
Sheet.Cells[1, 9].Value = "표준편차";
Sheet.Cells[1, 10].Value = "매도 제한";
Sheet.Cells[1, 11].Value = "매도 수";
Sheet.Cells[1, 12].Value = "시가 대비";
int iFillColumns = 12;
Sheet.View.FreezePanes(2, 1);
Color BidFontColor = Color.FromArgb(235, 0, 0);
Color BidBackColor = Color.FromArgb(249, 150, 150);
Color AskFontColor = Color.FromArgb(0, 91, 240);
Color AskBackColor = Color.FromArgb(127, 179, 243);
Color MaxBackColor = Color.FromArgb(91, 205, 102);
double dPrevStdDev = 0;
string strReturnMsg = "";
int iPrevTime = 0;
@@ -511,6 +521,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 iTimeDiff = 0;
if(iPrevTime > 0)
@@ -532,6 +543,15 @@ namespace AutoSellerNS
{
bStart = true;
iStartRow = iRow;
iMaxPriceRow = iRow;
iMaxPrice = iStartPrice;
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iRow, i].Style.Fill.BackgroundColor.SetColor(BidBackColor);
}
m_PriceList.Clear();
m_PriceList.Add(iPrice);
@@ -539,7 +559,7 @@ namespace AutoSellerNS
else if((RowDT-StartDT).Minutes > 10)
{
InsertLog(string.Format("[{0}] [{1}] 매수 가격 찾기 실패\n",
StartDT.ToString("yyyy-MM-dd"),
StartDT.ToString("yyyy-MM-dd"),
strCodeName));
break;
}
@@ -615,18 +635,26 @@ namespace AutoSellerNS
Sheet.Cells[iRow, 9].Value = dStdDev;
Sheet.Cells[iRow, 9].Style.Numberformat.Format = "0.00";
Sheet.Cells[iRow, 10].Value = dCheckCount;
float fProfitRate = (iPrice/(float)iStartPrice - 1.0f)*100;
Sheet.Cells[iRow, 12].Value = fProfitRate;
Sheet.Cells[iRow, 12].Style.Numberformat.Format = "0.00";
Sheet.Cells[iRow, 12].Style.Font.Color.SetColor(fProfitRate > 0 ? BidFontColor : fProfitRate < 0 ? AskFontColor : Color.Black);
// 호가 비교 - 매수호가 기준
if(iPrice <= iBidPrice)
if(iPrice*iConclusionCnt > iIgnorePrice)
{
iAskCount++;
Sheet.Cells[iRow, 7].Style.Font.Color.SetColor(Color.Blue);
}
else
{
iAskCount = 0;
Sheet.Cells[iRow, 7].Style.Font.Color.SetColor(Color.Red);
if(iPrice <= iBidPrice)
{
iAskCount++;
Sheet.Cells[iRow, 7].Style.Font.Color.SetColor(AskFontColor);
}
else
{
iAskCount = 0;
Sheet.Cells[iRow, 7].Style.Font.Color.SetColor(BidFontColor);
}
}
Sheet.Cells[iRow, 11].Value = iAskCount;
@@ -652,6 +680,14 @@ namespace AutoSellerNS
dCheckCount
);
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iRow, i].Style.Fill.BackgroundColor.SetColor(AskBackColor);
}
break;
}
@@ -659,7 +695,12 @@ namespace AutoSellerNS
iTrailingCount = 0;
else if(iPrice <= iMaxPrice*(100-Config.GetTrailingRate())/100)
iTrailingCount++;
iMaxPrice = Math.Max(iPrice, iMaxPrice);
if(iPrice > iMaxPrice)
{
iMaxPrice = iPrice;
iMaxPriceRow = iRow;
}
if(iTrailingCount >= Config.GetTrailingCnt())
{
@@ -685,6 +726,12 @@ namespace AutoSellerNS
);
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iRow, i].Style.Fill.BackgroundColor.SetColor(AskBackColor);
}
break;
}
@@ -712,6 +759,12 @@ namespace AutoSellerNS
);
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iRow, i].Style.Fill.BackgroundColor.SetColor(AskBackColor);
}
break;
}
@@ -742,6 +795,12 @@ namespace AutoSellerNS
);
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iRow, i].Style.Fill.BackgroundColor.SetColor(AskBackColor);
}
break;
}
@@ -749,6 +808,15 @@ namespace AutoSellerNS
iPrevTime = iTime;
}
if(iStartRow > 0)
{
for(int i = 1; i<=iFillColumns; i++)
{
Sheet.Cells[iMaxPriceRow, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
Sheet.Cells[iMaxPriceRow, i].Style.Fill.BackgroundColor.SetColor(MaxBackColor);
}
}
Sheet.Cells.AutoFitColumns(0);
Sheet.Select(ExcelAddress.GetAddress(Math.Max(iStartRow, 1), 1), true);
@@ -772,11 +840,12 @@ namespace AutoSellerNS
string strMethod = (string)aParams[8];
double dTimeSub = (double)aParams[9];
int iTimeDiffLimit = (int)aParams[10];
int iIgnorePrice = (int)aParams[11];
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11} 비교 방식 : {12}\n",
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11}, {12}원 이하 무시, 비교 방식 : {13}\n",
Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt(),
iListCnt, dFastSD, dFastUpCnt, dFastDownCnt, dSlowSD, dSlowUpCnt, dSlowDownCnt,
dTimeSub, iTimeDiffLimit,
dTimeSub, iTimeDiffLimit, iIgnorePrice,
strMethod
));
@@ -791,7 +860,8 @@ namespace AutoSellerNS
dFastSD, dFastUpCnt, dFastDownCnt,
dSlowSD, dSlowUpCnt, dSlowDownCnt,
iCompareType, strMethod,
strLine, dTimeSub, iTimeDiffLimit }));
strLine, dTimeSub, iTimeDiffLimit,
iIgnorePrice }));
aTasks.Add(task);
}
@@ -820,6 +890,7 @@ namespace AutoSellerNS
double dSlowDownCnt;
double dTimeSub;
int iTimeDiffLimit;
int iIgnorePrice;
int.TryParse(m_AutoSeller.tbSMListSize.Text, out iListCnt);
double.TryParse(m_AutoSeller.tbSMFastSD.Text, out dFastSD);
@@ -830,6 +901,7 @@ namespace AutoSellerNS
double.TryParse(m_AutoSeller.tbSMSlowDownCnt.Text, out dSlowDownCnt);
double.TryParse(m_AutoSeller.tbSMTimeSub.Text, out dTimeSub);
int.TryParse(m_AutoSeller.tbSMTimeDiffLimit.Text, out iTimeDiffLimit);
int.TryParse(m_AutoSeller.tbSMIgnorePrice.Text, out iIgnorePrice);
string strMethod = "";
m_AutoSeller.cbSMMethod.Invoke(new Action(() => {
@@ -858,7 +930,8 @@ namespace AutoSellerNS
iListCnt,
dFastSD, dFastUpCnt, dFastDownCnt,
dSlowSD, dSlowUpCnt, dSlowDownCnt,
iCompareType, strMethod, dTimeSub, iTimeDiffLimit
iCompareType, strMethod, dTimeSub, iTimeDiffLimit,
iIgnorePrice
});
// }
// }