- BinaryRage DB 로그 추가
This commit is contained in:
89
MainForm.cs
89
MainForm.cs
@@ -212,54 +212,6 @@ namespace upper_limit_crawler
|
||||
ULUtil.SyncServerTime();
|
||||
}
|
||||
|
||||
DSCBO1Lib.StockCur cur = new DSCBO1Lib.StockCur();
|
||||
DSCBO1Lib.StockOutCur outCur = new DSCBO1Lib.StockOutCur();
|
||||
string strCheckCode = "A004565";
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
DSCBO1Lib.StockMst mst = new DSCBO1Lib.StockMst();
|
||||
mst.SetInputValue(0, strCheckCode);
|
||||
mst.BlockRequest();
|
||||
short time = mst.GetHeaderValue(4);
|
||||
Console.WriteLine("StockMst : {0}", time);
|
||||
}
|
||||
|
||||
{
|
||||
DSCBO1Lib.StockMst2 mst2 = new DSCBO1Lib.StockMst2();
|
||||
mst2.SetInputValue(0, strCheckCode);
|
||||
mst2.BlockRequest();
|
||||
long time = mst2.GetDataValue(2, 0);
|
||||
Console.WriteLine("StockMst2 : {0}", time);
|
||||
}
|
||||
|
||||
{
|
||||
cur.SetInputValue(0, strCheckCode);
|
||||
cur.Received += Cur_Received;
|
||||
cur.SubscribeLatest();
|
||||
}
|
||||
|
||||
{
|
||||
outCur.SetInputValue(0, strCheckCode);
|
||||
outCur.Received += OutCur_Received;
|
||||
outCur.SubscribeLatest();
|
||||
}
|
||||
}
|
||||
|
||||
private void OutCur_Received()
|
||||
{
|
||||
long time = outCur.GetHeaderValue(1);
|
||||
Console.WriteLine("StockOutCur : {0}", time);
|
||||
}
|
||||
|
||||
private void Cur_Received()
|
||||
{
|
||||
long time = cur.GetHeaderValue(3);
|
||||
long time2 = cur.GetHeaderValue(18);
|
||||
Console.WriteLine("StockCur : {0} / {1}", time, time2);
|
||||
}
|
||||
|
||||
struct chart_data
|
||||
{
|
||||
public chart_data(int iTime, int iPrice)
|
||||
@@ -280,10 +232,16 @@ namespace upper_limit_crawler
|
||||
Console.WriteLine("시뮬레이션 시작");
|
||||
|
||||
|
||||
List<string> aCodeList = new List<string> { "039230", "054620", "077970", "079950", "085370", "090470", "123010", "123860", "191420", "208860" };
|
||||
//List<string> aCodeList = new List<string> { "077970" };
|
||||
string strPrevDate = "20160728";
|
||||
string strDate = "20160729";
|
||||
List<string> aCodeList = new List<string> {
|
||||
"064240",
|
||||
"090410",
|
||||
"208860",
|
||||
"044180",
|
||||
"127160",
|
||||
"123570",
|
||||
};
|
||||
string strPrevDate = "20160729";
|
||||
string strDate = "20160801";
|
||||
int iTotalProfit = 0;
|
||||
|
||||
foreach (string code in aCodeList)
|
||||
@@ -371,6 +329,8 @@ namespace upper_limit_crawler
|
||||
float fCompRate = WatchItem.m_iCurPrice / (float)WatchItem.m_iPrevClosing - 1.0f;
|
||||
if (fCompRate >= m_DataMgr.m_Setting.m_fBidMin && fCompRate <= m_DataMgr.m_Setting.m_fBidMax)
|
||||
{
|
||||
m_DataMgr.AddAvailableItem(strCode);
|
||||
|
||||
if (m_DataMgr.IsInPostponeList(iTime, strCode) == true)
|
||||
{
|
||||
//Console.WriteLine("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
@@ -382,7 +342,7 @@ namespace upper_limit_crawler
|
||||
}
|
||||
|
||||
float f5MASlope = WatchItem.GetPrev5MASlope(iTime);
|
||||
if (float.IsNaN(f5MASlope) || f5MASlope < 0.002f)
|
||||
if(f5MASlope < 0.002f)
|
||||
{
|
||||
//Console.WriteLine("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
continue;
|
||||
@@ -392,6 +352,8 @@ namespace upper_limit_crawler
|
||||
Console.WriteLine("[{0}] [{1}] 조건 매수 {2}원 ({3}) (5MA slop:{4})", iTime, WatchItem.m_strCodeName, WatchItem.m_iCurPrice, fCompRate.ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
ULUtil.TraceCSV(iTime, "[시뮬레이션] 조건 매수", WatchItem.m_strCodeName, WatchItem.m_iCurPrice, fCompRate.ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
|
||||
m_DataMgr.AddBidLog(strCode, WatchItem.m_strCodeName, iTime, WatchItem.m_iCurPrice, f5MASlope);
|
||||
|
||||
int iBidCnt = (int)m_DataMgr.m_Setting.m_fBidAmount / iCurPrice;
|
||||
|
||||
iTotalBidPrice += iCurPrice* iBidCnt;
|
||||
@@ -412,8 +374,12 @@ namespace upper_limit_crawler
|
||||
{
|
||||
m_DataMgr.AddLosscutItem(strCode);
|
||||
|
||||
Console.WriteLine("[{0}] [{1}] 손절 {2}원 ({3}:{4})", iTime, OwnItem.m_strCodeName, iCurPrice, iCurPrice - OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"));
|
||||
ULUtil.TraceCSV(iTime, "[시뮬레이션] 손절", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"));
|
||||
int iProfit = iCurPrice - (int)OwnItem.m_iUnitBEP;
|
||||
float fProfitRate = (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f);
|
||||
|
||||
Console.WriteLine("[{0}] [{1}] 손절 {2}원 ({3}:{4})", iTime, OwnItem.m_strCodeName, iCurPrice, iProfit, fProfitRate.ToString("0.00%"));
|
||||
ULUtil.TraceCSV(iTime, "[시뮬레이션] 손절", OwnItem.m_strCodeName, iCurPrice, fProfitRate.ToString("0.00%"));
|
||||
m_DataMgr.AddAskLog(strCode, WatchItem.m_strCodeName, iTime, iCurPrice, float.NaN, true, iProfit, fProfitRate);
|
||||
|
||||
iTotalAskPrice += iCurPrice * OwnItem.m_iConclusionBalanceCnt;
|
||||
OwnItem.m_iUnitBEP = 0;
|
||||
@@ -437,8 +403,12 @@ namespace upper_limit_crawler
|
||||
continue;
|
||||
}
|
||||
|
||||
Console.WriteLine("[{0}] [{1}] 트레일링 매도 {2}원 ({3}:{4}) (5MA slop:{5})", iTime, OwnItem.m_strCodeName, iCurPrice, iCurPrice - OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
ULUtil.TraceCSV(iTime, "[시뮬레이션] 트레일링 매도", OwnItem.m_strCodeName, iCurPrice, iCurPrice - OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
int iProfit = iCurPrice - (int)OwnItem.m_iUnitBEP;
|
||||
float fProfitRate = (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f);
|
||||
|
||||
Console.WriteLine("[{0}] [{1}] 트레일링 매도 {2}원 ({3}:{4}) (5MA slop:{5})", iTime, OwnItem.m_strCodeName, iCurPrice, iProfit, fProfitRate.ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
ULUtil.TraceCSV(iTime, "[시뮬레이션] 트레일링 매도", OwnItem.m_strCodeName, iCurPrice, iProfit, fProfitRate.ToString("0.00%"), f5MASlope.ToString("0.00%"));
|
||||
m_DataMgr.AddAskLog(strCode, WatchItem.m_strCodeName, iTime, iCurPrice, f5MASlope, false, iProfit, fProfitRate);
|
||||
|
||||
iTotalAskPrice += iCurPrice * OwnItem.m_iConclusionBalanceCnt;
|
||||
OwnItem.m_iUnitBEP = 0;
|
||||
@@ -489,5 +459,10 @@ namespace upper_limit_crawler
|
||||
Console.WriteLine("시뮬레이션 끝");
|
||||
|
||||
}
|
||||
|
||||
private void btLogDump_Click(object sender, EventArgs e)
|
||||
{
|
||||
m_DataMgr.DumpLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user