trace 정리
This commit is contained in:
48
MainForm.Designer.cs
generated
48
MainForm.Designer.cs
generated
@@ -51,6 +51,8 @@
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
|
||||
this.btMATest = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.btTimeSync = new System.Windows.Forms.Button();
|
||||
this.cbStart = new System.Windows.Forms.CheckBox();
|
||||
this.btCybosPlus = new System.Windows.Forms.Button();
|
||||
@@ -60,8 +62,6 @@
|
||||
this.statusBar1 = new System.Windows.Forms.StatusBar();
|
||||
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
|
||||
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.btMATest = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -169,7 +169,7 @@
|
||||
this.tbTrailing.Name = "tbTrailing";
|
||||
this.tbTrailing.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbTrailing.TabIndex = 10;
|
||||
this.tbTrailing.Text = "3.0%";
|
||||
this.tbTrailing.Text = "2.0%";
|
||||
this.tbTrailing.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label5
|
||||
@@ -187,7 +187,7 @@
|
||||
this.tbLossCut.Name = "tbLossCut";
|
||||
this.tbLossCut.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbLossCut.TabIndex = 10;
|
||||
this.tbLossCut.Text = "3.0%";
|
||||
this.tbLossCut.Text = "2.0%";
|
||||
this.tbLossCut.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label6
|
||||
@@ -334,6 +334,26 @@
|
||||
this.splitContainer3.SplitterDistance = 256;
|
||||
this.splitContainer3.TabIndex = 0;
|
||||
//
|
||||
// btMATest
|
||||
//
|
||||
this.btMATest.Location = new System.Drawing.Point(138, 430);
|
||||
this.btMATest.Name = "btMATest";
|
||||
this.btMATest.Size = new System.Drawing.Size(75, 23);
|
||||
this.btMATest.TabIndex = 24;
|
||||
this.btMATest.Text = "ma test";
|
||||
this.btMATest.UseVisualStyleBackColor = true;
|
||||
this.btMATest.Click += new System.EventHandler(this.btMATest_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(142, 371);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 23;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// btTimeSync
|
||||
//
|
||||
this.btTimeSync.Location = new System.Drawing.Point(16, 341);
|
||||
@@ -419,26 +439,6 @@
|
||||
this.statusBarPanel2.Name = "statusBarPanel2";
|
||||
this.statusBarPanel2.Width = 120;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(142, 371);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 23;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// btMATest
|
||||
//
|
||||
this.btMATest.Location = new System.Drawing.Point(138, 430);
|
||||
this.btMATest.Name = "btMATest";
|
||||
this.btMATest.Size = new System.Drawing.Size(75, 23);
|
||||
this.btMATest.TabIndex = 24;
|
||||
this.btMATest.Text = "ma test";
|
||||
this.btMATest.UseVisualStyleBackColor = true;
|
||||
this.btMATest.Click += new System.EventHandler(this.btMATest_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
|
||||
33
MainForm.cs
33
MainForm.cs
@@ -38,7 +38,7 @@ namespace upper_limit_crawler
|
||||
|
||||
SetDoubleBuffered(tbLog);
|
||||
|
||||
UlUtil.Init(tbLog);
|
||||
ULUtil.Init(tbLog);
|
||||
|
||||
btApply_Click(null, null);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace upper_limit_crawler
|
||||
m_MainTimer.Tick += Refresh;
|
||||
m_MainTimer.Start();
|
||||
|
||||
UlUtil.Trace("시작");
|
||||
ULUtil.Trace("시작");
|
||||
}
|
||||
|
||||
public static void SetDoubleBuffered(Control control)
|
||||
@@ -69,7 +69,7 @@ namespace upper_limit_crawler
|
||||
|
||||
private bool IsOnTime()
|
||||
{
|
||||
DateTime CurTime = UlUtil.GetCurTime();
|
||||
DateTime CurTime = ULUtil.GetCurTime();
|
||||
if (CurTime.DayOfWeek == DayOfWeek.Sunday || CurTime.DayOfWeek == DayOfWeek.Saturday)
|
||||
return false;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace upper_limit_crawler
|
||||
return;
|
||||
}
|
||||
|
||||
if(cbStart.Checked == true && UlUtil.IsConnected() == false)
|
||||
if(cbStart.Checked == true && ULUtil.IsConnected() == false)
|
||||
{
|
||||
cbStart.Checked = false;
|
||||
return;
|
||||
@@ -107,10 +107,10 @@ namespace upper_limit_crawler
|
||||
|
||||
m_Own.Refresh(iCurTime);
|
||||
|
||||
lbRQCnt.Text = "RQ Count : " + UlUtil.GetLimitRemainCountRQ().ToString();
|
||||
lbSBCnt.Text = "SB Count : " + UlUtil.GetLimitRemainCountSB().ToString();
|
||||
lbRQCnt.Text = "RQ Count : " + ULUtil.GetLimitRemainCountRQ().ToString();
|
||||
lbSBCnt.Text = "SB Count : " + ULUtil.GetLimitRemainCountSB().ToString();
|
||||
|
||||
statusBar1.Panels[1].Text = UlUtil.GetCurTimeString() + " ";
|
||||
statusBar1.Panels[1].Text = ULUtil.GetCurTimeString() + " ";
|
||||
|
||||
m_iLastTime = iCurTime;
|
||||
}
|
||||
@@ -133,10 +133,10 @@ namespace upper_limit_crawler
|
||||
{
|
||||
if (cbStart.Checked == true)
|
||||
{
|
||||
if (UlUtil.IsConnected() == false)
|
||||
UlUtil.Reset();
|
||||
if (ULUtil.IsConnected() == false)
|
||||
ULUtil.Reset();
|
||||
|
||||
if (UlUtil.IsConnected() == false)
|
||||
if (ULUtil.IsConnected() == false)
|
||||
{
|
||||
cbStart.Checked = false;
|
||||
MessageBox.Show("Cybos Plus를 실행해주세요");
|
||||
@@ -177,7 +177,7 @@ namespace upper_limit_crawler
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UlUtil.Trace(ex.ToString());
|
||||
ULUtil.Trace(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace upper_limit_crawler
|
||||
|
||||
private void btTimeSync_Click(object sender, EventArgs e)
|
||||
{
|
||||
UlUtil.SyncServerTime();
|
||||
ULUtil.SyncServerTime();
|
||||
}
|
||||
|
||||
DSCBO1Lib.StockCur cur = new DSCBO1Lib.StockCur();
|
||||
@@ -359,19 +359,21 @@ namespace upper_limit_crawler
|
||||
{
|
||||
if (m_DataMgr.IsInBlackList(iTime, strCode) == true)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
//Console.WriteLine("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
continue;
|
||||
}
|
||||
|
||||
float f5MASlope = item.GetPrev5MASlope(iTime);
|
||||
if (f5MASlope <= 0)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
//Console.WriteLine("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
continue;
|
||||
}
|
||||
|
||||
// bid and add to black list
|
||||
Console.WriteLine(string.Format("[{0}] [{1}] 조건 매수 {2}원 ({3}) (5MA slop:{4:0.00})", iTime, item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"), f5MASlope));
|
||||
ULUtil.TraceCSV("조건 매수", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"), f5MASlope);
|
||||
|
||||
OwnItem.m_iUnitBEP = iCurPrice;
|
||||
OwnItem.m_strCodeName = item.m_strCodeName;
|
||||
|
||||
@@ -386,6 +388,7 @@ namespace upper_limit_crawler
|
||||
if (iCurPrice <= OwnItem.m_iUnitBEP * (1.0f - m_DataMgr.m_Setting.m_fLossCut))
|
||||
{
|
||||
Console.WriteLine(string.Format("[{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("손절", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"));
|
||||
OwnItem.m_iUnitBEP = 0;
|
||||
|
||||
//m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
@@ -407,6 +410,8 @@ namespace upper_limit_crawler
|
||||
}
|
||||
|
||||
Console.WriteLine(string.Format("[{0}] [{1}] 트레일링 매도 {2}원 ({3}:{4}) (5MA slop:{5:0.00})", iTime, OwnItem.m_strCodeName, iCurPrice, iCurPrice- OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), f5MASlope));
|
||||
ULUtil.TraceCSV("트레일링 매도", OwnItem.m_strCodeName, iCurPrice, iCurPrice - OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), f5MASlope);
|
||||
|
||||
OwnItem.m_iUnitBEP = 0;
|
||||
|
||||
//m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
|
||||
7
ULBalanceDlg.Designer.cs
generated
7
ULBalanceDlg.Designer.cs
generated
@@ -41,6 +41,7 @@
|
||||
this.btRefresh = new System.Windows.Forms.Button();
|
||||
this.btSellAll = new System.Windows.Forms.Button();
|
||||
this.btSell = new System.Windows.Forms.Button();
|
||||
this.chHighestPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lvBalance
|
||||
@@ -57,6 +58,7 @@
|
||||
this.chEvaluationProfit,
|
||||
this.chBalance,
|
||||
this.chEvaluationPrice,
|
||||
this.chHighestPrice,
|
||||
this.chProfitRate});
|
||||
this.lvBalance.FullRowSelect = true;
|
||||
this.lvBalance.GridLines = true;
|
||||
@@ -147,6 +149,10 @@
|
||||
this.btSell.UseVisualStyleBackColor = true;
|
||||
this.btSell.Click += new System.EventHandler(this.btSell_Click);
|
||||
//
|
||||
// chHighestPrice
|
||||
//
|
||||
this.chHighestPrice.Text = "최고가";
|
||||
//
|
||||
// ULBalanceDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
@@ -179,5 +185,6 @@
|
||||
private System.Windows.Forms.ColumnHeader chEvaluationPrice;
|
||||
private System.Windows.Forms.Button btSellAll;
|
||||
private System.Windows.Forms.Button btSell;
|
||||
private System.Windows.Forms.ColumnHeader chHighestPrice;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace upper_limit_crawler
|
||||
ListViewItem listViewItem = new ListViewItem(new string[] { strCode, strCodeName, dConclusionUnitPrice.ToString("###,###,##0"),
|
||||
iUnitBEP.ToString("###,###,##0"), iCurPrice.ToString("###,###,##0"),
|
||||
iEvaluationProfit.ToString("###,###,##0"), iConclusionBalanceCnt.ToString("###,###,##0"),
|
||||
iEvaluationPrice.ToString("###,###,##0"), dReturn.ToString("#,##0.00")+"%" });
|
||||
iEvaluationPrice.ToString("###,###,##0"), iCurPrice.ToString("###,###,##0"), dReturn.ToString("#,##0.00")+"%" });
|
||||
listViewItem.UseItemStyleForSubItems = false;
|
||||
|
||||
if(iEvaluationProfit > 0)
|
||||
@@ -189,6 +189,7 @@ namespace upper_limit_crawler
|
||||
lvItem.SubItems[chEvaluationProfit.Index].ForeColor = Color.Blue;
|
||||
lvItem.SubItems[chEvaluationPrice.Index].Text = OwnItem.m_iEvaluationPrice.ToString("###,###,##0");
|
||||
lvItem.SubItems[chProfitRate.Index].Text = OwnItem.m_dProfitRate.ToString("#,##0.00%");
|
||||
lvItem.SubItems[chHighestPrice.Index].Text = WatchItem.m_iHighestPrice.ToString("#,##0.00%");
|
||||
if (OwnItem.m_dProfitRate > 0)
|
||||
lvItem.SubItems[chProfitRate.Index].ForeColor = Color.Red;
|
||||
else
|
||||
@@ -200,7 +201,8 @@ namespace upper_limit_crawler
|
||||
// loss cut
|
||||
if (iCurPrice <= OwnItem.m_iUnitBEP * (1.0f - m_DataMgr.m_Setting.m_fLossCut))
|
||||
{
|
||||
UlUtil.Trace(string.Format("[{0}] 손절 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/(float)OwnItem.m_iUnitBEP-1.0f).ToString("0.00%")));
|
||||
ULUtil.Trace("[{0}] 손절 {1}원 ({2}) {3}", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/(float)OwnItem.m_iUnitBEP-1.0f).ToString("0.00%"), WatchItem.m_iHighestPrice);
|
||||
ULUtil.TraceCSV("손절", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), WatchItem.m_iHighestPrice);
|
||||
m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
m_OwnList.Remove(OwnItem);
|
||||
m_DataMgr.RemoveWatch(strCode);
|
||||
@@ -212,7 +214,7 @@ namespace upper_limit_crawler
|
||||
// trailing
|
||||
else if (iCurPrice <= OwnItem.m_iMaxPrice - OwnItem.m_iUnitBEP * m_DataMgr.m_Setting.m_fTrailing)
|
||||
{
|
||||
int iTime = UlUtil.GetCurTimeInt();
|
||||
int iTime = ULUtil.GetCurTimeInt();
|
||||
float f5MASlope = WatchItem.GetPrev5MASlope(iTime);
|
||||
if (f5MASlope > 0)
|
||||
{
|
||||
@@ -220,12 +222,14 @@ namespace upper_limit_crawler
|
||||
continue;
|
||||
}
|
||||
|
||||
UlUtil.Trace(string.Format("[{0}] 트레일링 매도 {1}원 ({2}:{3}) (5MA slop:{4:0.00})",
|
||||
ULUtil.Trace("[{0}] 트레일링 매도 {1}원 ({2}:{3}) (5MA slop:{4:0.00}) {5}",
|
||||
OwnItem.m_strCodeName,
|
||||
iCurPrice,
|
||||
iCurPrice - OwnItem.m_iUnitBEP,
|
||||
(iCurPrice/(float)OwnItem.m_iUnitBEP-1.0f).ToString("0.00%"),
|
||||
f5MASlope));
|
||||
f5MASlope,
|
||||
WatchItem.m_iHighestPrice);
|
||||
ULUtil.TraceCSV("트레일링 매도", OwnItem.m_strCodeName, iCurPrice, iCurPrice - OwnItem.m_iUnitBEP, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%"), f5MASlope, WatchItem.m_iHighestPrice);
|
||||
|
||||
m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
m_OwnList.Remove(OwnItem);
|
||||
@@ -247,7 +251,7 @@ namespace upper_limit_crawler
|
||||
|
||||
int iDeltaT = iCurTime-m_iLastTime;
|
||||
m_iBalanceDelay-=iDeltaT;
|
||||
if(m_iBalanceDelay<=0 && UlUtil.GetLimitRemainCountRQ() > 20)
|
||||
if(m_iBalanceDelay<=0 && ULUtil.GetLimitRemainCountRQ() > 20)
|
||||
{
|
||||
RefreshBalance();
|
||||
m_iBalanceDelay=BALANCE_DELAY;
|
||||
@@ -267,7 +271,7 @@ namespace upper_limit_crawler
|
||||
{
|
||||
foreach(ListViewItem item in lvBalance.SelectedItems)
|
||||
{
|
||||
UlUtil.Trace(string.Format("[{0}] 수동 매도", item.SubItems[chName.Index].Text));
|
||||
ULUtil.Trace("[{0}] 수동 매도", item.SubItems[chName.Index].Text);
|
||||
|
||||
string strCode = item.SubItems[chCode.Index].Text;
|
||||
int iCnt = int.Parse(item.SubItems[chBalance.Index].Text);
|
||||
@@ -279,7 +283,7 @@ namespace upper_limit_crawler
|
||||
{
|
||||
foreach (ListViewItem item in lvBalance.Items)
|
||||
{
|
||||
UlUtil.Trace(string.Format("[{0}] 모두 청산", item.SubItems[chName.Index].Text));
|
||||
ULUtil.Trace("[{0}] 모두 청산", item.SubItems[chName.Index].Text);
|
||||
|
||||
string strCode = item.SubItems[chCode.Index].Text;
|
||||
int iCnt = int.Parse(item.SubItems[chBalance.Index].Text);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace upper_limit_crawler
|
||||
|
||||
bool RefreshMonitorItem()
|
||||
{
|
||||
if (m_bRequesting == true || UlUtil.GetLimitRemainCountRQ() < 30)
|
||||
if (m_bRequesting == true || ULUtil.GetLimitRemainCountRQ() < 30)
|
||||
return false;
|
||||
|
||||
m_bRequesting = true;
|
||||
@@ -121,7 +121,7 @@ namespace upper_limit_crawler
|
||||
}
|
||||
|
||||
bContinue = (m_7043.Continue == 1);
|
||||
if (bContinue == true && UlUtil.GetLimitRemainCountRQ() >= 30)
|
||||
if (bContinue == true && ULUtil.GetLimitRemainCountRQ() >= 30)
|
||||
iResult = m_7043.BlockRequest2(1);
|
||||
}
|
||||
|
||||
@@ -159,29 +159,32 @@ namespace upper_limit_crawler
|
||||
|
||||
if (fCompRate >= m_DataMgr.m_Setting.m_fBidMin && fCompRate <= m_DataMgr.m_Setting.m_fBidMax)
|
||||
{
|
||||
int iTime = UlUtil.GetCurTimeInt();
|
||||
int iTime = ULUtil.GetCurTimeInt();
|
||||
if (m_DataMgr.IsInBlackList(iTime, strCode) == true)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
//ULUtil.Trace("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
continue;
|
||||
}
|
||||
|
||||
float f5MASlope = item.GetPrev5MASlope(iTime);
|
||||
if (f5MASlope <= 0)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
//ULUtil.Trace("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"));
|
||||
continue;
|
||||
}
|
||||
|
||||
// bid and add to black list
|
||||
UlUtil.Trace(string.Format("[{0}] 조건 매수 {1}원 ({2}) (5MA slop:{3:0.00})",
|
||||
m_DataMgr.GetTrader().Buy(strCode, item.m_iCurPrice, (int)m_DataMgr.m_Setting.m_fBidAmount);
|
||||
m_DataMgr.AddBlackList(iTime, strCode);
|
||||
|
||||
|
||||
ULUtil.Trace("[{0}] 조건 매수 {1}원 ({2}) (5MA slop:{3:0.00})",
|
||||
item.m_strCodeName,
|
||||
item.m_iCurPrice,
|
||||
fCompRate.ToString("0.00%"),
|
||||
f5MASlope));
|
||||
f5MASlope);
|
||||
|
||||
m_DataMgr.GetTrader().Buy(strCode, item.m_iCurPrice, (int)m_DataMgr.m_Setting.m_fBidAmount);
|
||||
m_DataMgr.AddBlackList(iTime, strCode);
|
||||
ULUtil.TraceCSV("조건 매수", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%"), f5MASlope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace upper_limit_crawler
|
||||
{ strLog += "접수"; }
|
||||
|
||||
|
||||
UlUtil.Trace(strLog);
|
||||
ULUtil.Trace(strLog);
|
||||
}
|
||||
|
||||
//0 - (string)주문종류코드 주문구분
|
||||
@@ -129,7 +129,7 @@ namespace upper_limit_crawler
|
||||
{
|
||||
//lock(lockBuy)
|
||||
{
|
||||
while (UlUtil.GetLimitRemainCountRQ() <= 0) ;
|
||||
while (ULUtil.GetLimitRemainCountRQ() <= 0) ;
|
||||
|
||||
int iCnt = iBidAmount / iUnitPrice;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace upper_limit_crawler
|
||||
//long iCnt = (long)Math.Floor(fAskAmount/fCurPrice);
|
||||
//iCnt=1;
|
||||
|
||||
while (UlUtil.GetLimitRemainCountRQ() <= 0) ;
|
||||
while (ULUtil.GetLimitRemainCountRQ() <= 0) ;
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311Ask = new CPTRADELib.CpTd0311();
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace upper_limit_crawler
|
||||
//long iCnt = (long)Math.Floor(fAskAmount/fCurPrice);
|
||||
//iCnt=1;
|
||||
|
||||
while (UlUtil.GetLimitRemainCountRQ() <= 0);
|
||||
while (ULUtil.GetLimitRemainCountRQ() <= 0);
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311Ask = new CPTRADELib.CpTd0311();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace upper_limit_crawler
|
||||
|
||||
List<PriceNode> m_PriceList = new List<PriceNode>();
|
||||
|
||||
// key : time(hh:mm:ss)
|
||||
// key : time(HH:mm:ss)
|
||||
SortedList<int, CandleTick> m_1MinChart = new SortedList<int, CandleTick>();
|
||||
SortedList<int, MATick> m_5MAChart = new SortedList<int, MATick>();
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace upper_limit_crawler
|
||||
CPSYSDIBLib.StockChart stockChart = new CPSYSDIBLib.StockChart();
|
||||
stockChart.SetInputValue(0, m_strCode);
|
||||
stockChart.SetInputValue(1, '1');
|
||||
string strDate = UlUtil.GetCurTime().ToString("yyyyMMdd");
|
||||
string strDate = ULUtil.GetCurTime().ToString("yyyyMMdd");
|
||||
stockChart.SetInputValue(2, strDate);
|
||||
stockChart.SetInputValue(3, strDate);
|
||||
stockChart.SetInputValue(5, new int[] { 0, 1, 2, 3, 4, 5 });
|
||||
@@ -299,7 +299,7 @@ namespace upper_limit_crawler
|
||||
|
||||
if (lastMA.m_fMA > prevMA.m_fMA)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[Is5MAGoingUp][{0}] ma up ({1}, {2}", m_strCodeName, lastMA.m_fMA, prevMA.m_fMA));
|
||||
//ULUtil.Trace("[Is5MAGoingUp][{0}] ma up ({1}, {2}", m_strCodeName, lastMA.m_fMA, prevMA.m_fMA);
|
||||
return true;
|
||||
}
|
||||
else if(lastMA.m_fMA == 0)
|
||||
@@ -311,7 +311,7 @@ namespace upper_limit_crawler
|
||||
|
||||
if (lastTick.m_iEnd > prevTick.m_iEnd)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[Is5MAGoingUp][{0}] cur up ({1}, {2}", m_strCodeName, lastTick.m_iEnd, prevTick.m_iEnd));
|
||||
//ULUtil.Trace("[Is5MAGoingUp][{0}] cur up ({1}, {2}", m_strCodeName, lastTick.m_iEnd, prevTick.m_iEnd);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
31
UlUtil.cs
31
UlUtil.cs
@@ -10,13 +10,14 @@ using System.Windows.Forms;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
public static class UlUtil
|
||||
public static class ULUtil
|
||||
{
|
||||
//static string m_strLogServer = "http://mjjo53.us.to:8000";
|
||||
|
||||
static CPUTILLib.CpCybos m_CPUtil = new CPUTILLib.CpCybos();
|
||||
static TextBox m_tbLog = null;
|
||||
static string m_strLogFileName;
|
||||
static string m_strCSVFileName;
|
||||
static TimeSpan m_TimeDiff = TimeSpan.Zero;
|
||||
|
||||
public static void Init(TextBox tbLog)
|
||||
@@ -24,11 +25,18 @@ namespace upper_limit_crawler
|
||||
m_tbLog = tbLog;
|
||||
|
||||
if (Debugger.IsAttached == true)
|
||||
{
|
||||
m_strLogFileName = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\";
|
||||
m_strCSVFileName = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\";
|
||||
}
|
||||
|
||||
m_strLogFileName += "log\\";
|
||||
if (Directory.Exists(m_strLogFileName) == false)
|
||||
Directory.CreateDirectory(m_strLogFileName);
|
||||
m_strLogFileName += "log-" + GetCurTime().ToString("yyyy-MM-dd") + ".txt";
|
||||
|
||||
m_strCSVFileName += "log\\";
|
||||
m_strCSVFileName += "log-" + GetCurTime().ToString("yyyy-MM-dd") + ".csv";
|
||||
}
|
||||
|
||||
public static void SyncServerTime()
|
||||
@@ -64,7 +72,7 @@ namespace upper_limit_crawler
|
||||
if (ex.Status == WebExceptionStatus.ProtocolError && ex.Response != null)
|
||||
{
|
||||
var resp = (HttpWebResponse)ex.Response;
|
||||
Trace(string.Format("인터넷 시간 동기화 실패 ({0})", resp.StatusCode));
|
||||
Trace("인터넷 시간 동기화 실패 ({0})", resp.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,7 +96,7 @@ namespace upper_limit_crawler
|
||||
{
|
||||
try
|
||||
{
|
||||
UlUtil.Trace("TimeSync trying [server:{0}]", server);
|
||||
ULUtil.Trace("TimeSync trying [server:{0}]", server);
|
||||
|
||||
// Connect to the server (at port 13) and get the response
|
||||
string serverResponse = string.Empty;
|
||||
@@ -143,12 +151,12 @@ namespace upper_limit_crawler
|
||||
|
||||
public static string GetCurTimeString()
|
||||
{
|
||||
return GetCurTime().ToString("yyyy-MM-dd hh:mm:ss");
|
||||
return GetCurTime().ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
public static int GetCurTimeInt()
|
||||
{
|
||||
return int.Parse(GetCurTime().ToString("hhmmss"));
|
||||
return int.Parse(GetCurTime().ToString("HHmmss"));
|
||||
}
|
||||
|
||||
public static void WebLog(string strURL, string strMsg)
|
||||
@@ -206,9 +214,18 @@ namespace upper_limit_crawler
|
||||
//WebLog(m_strLogServer, strLog);
|
||||
}
|
||||
|
||||
public static void Trace(string strMsg, params object[] args)
|
||||
public static void Trace(string strFormat, params object[] args)
|
||||
{
|
||||
Trace(string.Format(strMsg, args));
|
||||
Trace(string.Format(strFormat, args));
|
||||
}
|
||||
|
||||
public static void TraceCSV(params object[] args)
|
||||
{
|
||||
string strLog = GetCurTimeString();
|
||||
foreach (object arg in args)
|
||||
strLog += ", " + arg;
|
||||
|
||||
System.IO.File.AppendAllText(m_strCSVFileName, strLog + Environment.NewLine, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public static int GetLimitRemainCountTrace()
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<Compile Include="ULObj.cs" />
|
||||
<Compile Include="ULOwn.cs" />
|
||||
<Compile Include="ULTrader.cs" />
|
||||
<Compile Include="UlUtil.cs" />
|
||||
<Compile Include="ULUtil.cs" />
|
||||
<EmbeddedResource Include="ULBalanceDlg.resx">
|
||||
<DependentUpon>ULBalanceDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user