- 시뮬레이션 작업 중
This commit is contained in:
@@ -132,7 +132,7 @@ namespace AutoSellerNS
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-" + strCodeName + "StockChart" + ".xlsx";
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
if(File.Exists(strOutFileName) == true)
|
||||
{
|
||||
if(StartDT.DayOfYear == DateTime.Now.DayOfYear)
|
||||
@@ -218,7 +218,7 @@ namespace AutoSellerNS
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-" + strCodeName + "StockChart" + ".xlsx";
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-JpBid-" + strCodeName + ".xlsx";
|
||||
if(File.Exists(strOutFileName) == true)
|
||||
{
|
||||
if(StartDT.DayOfYear == DateTime.Now.DayOfYear)
|
||||
@@ -300,7 +300,7 @@ namespace AutoSellerNS
|
||||
int iStartPrice;
|
||||
int.TryParse(strStartPrice, NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out iStartPrice);
|
||||
|
||||
string strFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-JpBid-" + strCodeName + ".xlsx";
|
||||
string strFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
|
||||
|
||||
FileInfo newFile = new FileInfo(strFileName);
|
||||
@@ -405,29 +405,35 @@ namespace AutoSellerNS
|
||||
{
|
||||
int iListCnt;
|
||||
double dFastSD;
|
||||
int iFastCnt;
|
||||
double dFastUpCnt;
|
||||
double dFastDownCnt;
|
||||
double dSlowSD;
|
||||
int iSlowCnt;
|
||||
double dSlowUpCnt;
|
||||
double dSlowDownCnt;
|
||||
|
||||
int.TryParse(m_AutoSeller.tbSMListSize.Text, out iListCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastSD.Text, out dFastSD);
|
||||
int.TryParse(m_AutoSeller.tbSMFastCnt.Text, out iFastCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastUpCnt.Text, out dFastUpCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastDownCnt.Text, out dFastDownCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMSlowSD.Text, out dSlowSD);
|
||||
int.TryParse(m_AutoSeller.tbSMSlowCnt.Text, out iSlowCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMSlowUpCnt.Text, out dSlowUpCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMSlowDownCnt.Text, out dSlowDownCnt);
|
||||
|
||||
bool bAverageCompare;
|
||||
if(m_AutoSeller.cbSMMethod.SelectedText == "평균 비교")
|
||||
if((string)m_AutoSeller.cbSMMethod.SelectedItem == "평균 비교")
|
||||
bAverageCompare = true;
|
||||
else
|
||||
bAverageCompare = false;
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, Slow : {6}, {7}, 비교 방식 : {8}\n",
|
||||
Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt(),
|
||||
iListCnt, dFastSD, iFastCnt, dSlowSD, iSlowCnt, m_AutoSeller.cbSMMethod.SelectedItem
|
||||
iListCnt, dFastSD, dFastUpCnt, dSlowSD, dSlowUpCnt, m_AutoSeller.cbSMMethod.SelectedItem
|
||||
));
|
||||
|
||||
int iTotalProfit = 0;
|
||||
int iTotalBid = 0;
|
||||
DateTime PrevDT;
|
||||
DateTime.TryParse("0000-00-00 00:00:00", out PrevDT);
|
||||
|
||||
foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
{
|
||||
@@ -444,11 +450,25 @@ namespace AutoSellerNS
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
if(iTotalBid > 0 && StartDT.DayOfYear != PrevDT.DayOfYear)
|
||||
{
|
||||
m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0}원 : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/(float)1000000));
|
||||
|
||||
iTotalProfit = 0;
|
||||
iTotalBid = 0;
|
||||
}
|
||||
|
||||
if(iTotalBid == 0)
|
||||
{
|
||||
m_tbLogView.AppendText(string.Format("{0}\n", StartDT.ToString("yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
int iStartPrice;
|
||||
int.TryParse(strStartPrice, NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out iStartPrice);
|
||||
|
||||
string strFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-JpBid-" + strCodeName + ".xlsx";
|
||||
|
||||
if(File.Exists(strFileName) == false)
|
||||
continue;
|
||||
|
||||
FileInfo newFile = new FileInfo(strFileName);
|
||||
ExcelPackage package = new ExcelPackage(newFile);
|
||||
@@ -472,14 +492,14 @@ namespace AutoSellerNS
|
||||
bool bPrevAsk = false;
|
||||
int iMaxAskPrice = 0;
|
||||
|
||||
int iCheckCount = 50;
|
||||
double dCheckCount = 5.0;
|
||||
List<int> m_PriceList = new List<int>();
|
||||
|
||||
int iPrevAskPrice = 0;
|
||||
|
||||
for(int iRow = 2; iRow<=iMaxRow; iRow++)
|
||||
{
|
||||
if(Sheet.Cells[iRow, 2].Value == "*")
|
||||
if((string)Sheet.Cells[iRow, 2].Value == "*")
|
||||
continue;
|
||||
|
||||
int iTime = (int)(double)Sheet.Cells[iRow, 1].Value;
|
||||
@@ -519,16 +539,16 @@ namespace AutoSellerNS
|
||||
if(bAverageCompare == true)
|
||||
{
|
||||
if(iPrice >= dAverage)
|
||||
iCheckCount += iFastCnt;
|
||||
else if(iCheckCount > 30)
|
||||
iCheckCount -= iFastCnt;
|
||||
dCheckCount += dFastUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dFastDownCnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iPrice >= m_PriceList[m_PriceList.Count-2])
|
||||
iCheckCount += iFastCnt;
|
||||
else if(iCheckCount > 30)
|
||||
iCheckCount -= iFastCnt;
|
||||
dCheckCount += dFastUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dFastDownCnt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -537,19 +557,19 @@ namespace AutoSellerNS
|
||||
if(bAverageCompare == true)
|
||||
{
|
||||
if(iPrice >= dAverage)
|
||||
iCheckCount += iSlowCnt;
|
||||
else if(iCheckCount > 30)
|
||||
iCheckCount -= iSlowCnt;
|
||||
dCheckCount += dSlowUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dSlowDownCnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iPrice >= m_PriceList[m_PriceList.Count-2])
|
||||
iCheckCount += iSlowCnt;
|
||||
else if(iCheckCount > 30)
|
||||
iCheckCount -= iSlowCnt;
|
||||
dCheckCount += dSlowUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dSlowUpCnt;
|
||||
}
|
||||
}
|
||||
|
||||
//dCheckCount = Math.Min(Math.Max(dCheckCount, 0), 15);
|
||||
|
||||
//// 체결가 비교
|
||||
//if(iPrice > iPrevPrice)
|
||||
@@ -623,7 +643,7 @@ namespace AutoSellerNS
|
||||
//else
|
||||
// iDealCountInSec = 1;
|
||||
|
||||
if(iAskCount >= Math.Round(iCheckCount/10.0f))
|
||||
if(iAskCount >= Math.Round(dCheckCount))
|
||||
{
|
||||
int iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
m_tbLogView.AppendText(string.Format("[{0}] 조건1 매도 (매수 : {1:n0}원, {2}, line:{3}) (매도 : {4:n0}원(매도가:{5:n0}원) {6} line:{7}) ({8}, {9:n0} : {10:n2}%) {11} \n",
|
||||
@@ -642,7 +662,7 @@ namespace AutoSellerNS
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
(iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
|
||||
iCheckCount
|
||||
dCheckCount
|
||||
));
|
||||
iTotalProfit += (iSellPrice-iStartPrice)*iStockCount;
|
||||
iTotalBid += iStartPrice*iStockCount;
|
||||
@@ -693,7 +713,7 @@ namespace AutoSellerNS
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
(iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
|
||||
iCheckCount
|
||||
dCheckCount
|
||||
|
||||
));
|
||||
|
||||
@@ -708,6 +728,8 @@ namespace AutoSellerNS
|
||||
aPrevDT.Add(RowDT);
|
||||
if(aPrevDT.Count > 15)
|
||||
aPrevDT.RemoveAt(0);
|
||||
|
||||
PrevDT = StartDT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user