- simulation 수정

This commit is contained in:
2017-02-13 14:51:58 +09:00
parent 8f6937c112
commit ada9aeb58d
3 changed files with 334 additions and 321 deletions

View File

@@ -6,19 +6,19 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoSellerNS
{
class SimulationHelper
{
CybosHelper m_CybosHelper = null;
class SIMUL_ITEM
{
}
RichTextBox m_tbLogView = null;
public SimulationHelper(CybosHelper CybosHelper)
public SimulationHelper(CybosHelper CybosHelper, RichTextBox tbLog)
{
m_CybosHelper = CybosHelper;
m_tbLogView = tbLog;
}
public void LoadTxt()
@@ -92,7 +92,7 @@ namespace AutoSellerNS
if(bContinue == true)
CPStockChart.BlockRequest2(0);
Console.WriteLine(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ()));
m_tbLogView.AppendText(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ()));
}
if(strOutLine.Length > 0)
@@ -101,10 +101,10 @@ namespace AutoSellerNS
strOutLine = "";
}
Console.WriteLine("[Load] " + strOutFileName + " End");
m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End"));
}
Console.WriteLine("[Load] All End");
m_tbLogView.AppendText(string.Format("[Load] All End"));
}
public void LoadExcel()
@@ -162,20 +162,22 @@ namespace AutoSellerNS
if(bContinue == true)
CPStockChart.BlockRequest2(0);
Console.WriteLine(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ()));
m_tbLogView.AppendText(string.Format("RequestRQ({0})\n", m_CybosHelper.GetLimitRemainCountRQ()));
}
aRows.Reverse();
Excel.AddRows(aRows.ToArray());
Console.WriteLine("[Load] " + strOutFileName + " End");
m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End\n"));
}
Console.WriteLine("[Load] All End");
m_tbLogView.AppendText(string.Format("[Load] All End\n\n"));
}
public void StartSimuation()
{
m_tbLogView.AppendText(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n", Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt()));
int iTotalProfit = 0;
int iTotalBid = 0;
@@ -243,14 +245,14 @@ namespace AutoSellerNS
if(iAskCount >= Config.GetBidCount())
{
Console.WriteLine("[{0}] 시뮬레이션 매도 {1} {2} {3} ({4} : {5:n2}%)",
m_tbLogView.AppendText(string.Format("[{0}] 시뮬레이션 매도 {1} {2} {3} ({4} : {5:n2}%)\n",
strCodeName,
RowDT.ToString("yyyy-MM-dd HH:mm:00"),
iRow,
iPrice,
iPrice-iStartPrice,
(iPrice-iStartPrice)*100/(float)iStartPrice
);
));
iTotalProfit += (iPrice-iStartPrice)*iStockCount;
iTotalBid += iStartPrice*iStockCount;
break;
@@ -264,14 +266,14 @@ namespace AutoSellerNS
if(iTrailingCount >= Config.GetTrailingCnt())
{
Console.WriteLine("[{0}] 트레일링 매도 {1} {2} {3} ({4} : {5:n2}%)",
m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} {2} {3} ({4} : {5:n2}%)\n",
strCodeName,
RowDT.ToString("yyyy-MM-dd HH:mm:00"),
iRow,
iPrice,
iPrice-iStartPrice,
(iPrice-iStartPrice)*100/(float)iStartPrice
);
));
iTotalProfit += (iPrice-iStartPrice)*iStockCount;
iTotalBid += iStartPrice*iStockCount;
break;
@@ -283,7 +285,7 @@ namespace AutoSellerNS
}
}
Console.WriteLine("[시뮬레이션 종료] 총수익 : {0} : {1:n2}%", iTotalProfit, iTotalProfit*100/iTotalBid);
m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0} : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/iTotalBid));
}
}
}