검색, 구매, 구매 확인 구현
This commit is contained in:
363
MainForm.Designer.cs
generated
363
MainForm.Designer.cs
generated
@@ -28,61 +28,322 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btSearch = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.cbSearch = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btSearch
|
||||
//
|
||||
this.btSearch.Location = new System.Drawing.Point(12, 12);
|
||||
this.btSearch.Name = "btSearch";
|
||||
this.btSearch.Size = new System.Drawing.Size(139, 88);
|
||||
this.btSearch.TabIndex = 0;
|
||||
this.btSearch.Text = "Search";
|
||||
this.btSearch.UseVisualStyleBackColor = true;
|
||||
this.btSearch.Click += new System.EventHandler(this.btSearch_Click);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(12, 120);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(807, 510);
|
||||
this.textBox1.TabIndex = 2;
|
||||
//
|
||||
// cbSearch
|
||||
//
|
||||
this.cbSearch.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.cbSearch.Location = new System.Drawing.Point(157, 12);
|
||||
this.cbSearch.Name = "cbSearch";
|
||||
this.cbSearch.Size = new System.Drawing.Size(151, 88);
|
||||
this.cbSearch.TabIndex = 3;
|
||||
this.cbSearch.Text = "Search";
|
||||
this.cbSearch.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.cbSearch.UseVisualStyleBackColor = true;
|
||||
this.cbSearch.CheckedChanged += new System.EventHandler(this.cbSearch_CheckedChanged);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(831, 642);
|
||||
this.Controls.Add(this.cbSearch);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.btSearch);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.chOrder = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chCur = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chUp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chRatio = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chVolume = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chBuy = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chBuyCnt = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lvWatch = new System.Windows.Forms.ListView();
|
||||
this.tbSearchMax = new System.Windows.Forms.TextBox();
|
||||
this.tbBidMin = new System.Windows.Forms.TextBox();
|
||||
this.tbBidAmount = new System.Windows.Forms.TextBox();
|
||||
this.tbTimeout = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.tbTrailing = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.tbLossCut = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.tbSearchMin = new System.Windows.Forms.TextBox();
|
||||
this.btApply = new System.Windows.Forms.Button();
|
||||
this.btCancel = new System.Windows.Forms.Button();
|
||||
this.tbBidMax = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(835, 413);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(392, 217);
|
||||
this.textBox1.TabIndex = 2;
|
||||
//
|
||||
// chOrder
|
||||
//
|
||||
this.chOrder.Text = "순위";
|
||||
//
|
||||
// chName
|
||||
//
|
||||
this.chName.Text = "종목명";
|
||||
//
|
||||
// chCur
|
||||
//
|
||||
this.chCur.Text = "현재가";
|
||||
//
|
||||
// chUp
|
||||
//
|
||||
this.chUp.Text = "전일대비";
|
||||
//
|
||||
// chRatio
|
||||
//
|
||||
this.chRatio.Text = "대비율";
|
||||
//
|
||||
// chVolume
|
||||
//
|
||||
this.chVolume.Text = "거래량";
|
||||
//
|
||||
// chBuy
|
||||
//
|
||||
this.chBuy.Text = "매수호가";
|
||||
//
|
||||
// chBuyCnt
|
||||
//
|
||||
this.chBuyCnt.Text = "호가잔량";
|
||||
//
|
||||
// lvWatch
|
||||
//
|
||||
this.lvWatch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lvWatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chOrder,
|
||||
this.chName,
|
||||
this.chCur,
|
||||
this.chUp,
|
||||
this.chRatio,
|
||||
this.chVolume,
|
||||
this.chBuy,
|
||||
this.chBuyCnt});
|
||||
this.lvWatch.FullRowSelect = true;
|
||||
this.lvWatch.Location = new System.Drawing.Point(12, 12);
|
||||
this.lvWatch.Name = "lvWatch";
|
||||
this.lvWatch.Size = new System.Drawing.Size(807, 618);
|
||||
this.lvWatch.TabIndex = 4;
|
||||
this.lvWatch.UseCompatibleStateImageBehavior = false;
|
||||
this.lvWatch.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// tbSearchMax
|
||||
//
|
||||
this.tbSearchMax.Location = new System.Drawing.Point(984, 60);
|
||||
this.tbSearchMax.Name = "tbSearchMax";
|
||||
this.tbSearchMax.Size = new System.Drawing.Size(37, 21);
|
||||
this.tbSearchMax.TabIndex = 6;
|
||||
this.tbSearchMax.Text = "10.5";
|
||||
this.tbSearchMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// tbBidMin
|
||||
//
|
||||
this.tbBidMin.Location = new System.Drawing.Point(921, 87);
|
||||
this.tbBidMin.Name = "tbBidMin";
|
||||
this.tbBidMin.Size = new System.Drawing.Size(37, 21);
|
||||
this.tbBidMin.TabIndex = 8;
|
||||
this.tbBidMin.Text = "9.0";
|
||||
this.tbBidMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// tbBidAmount
|
||||
//
|
||||
this.tbBidAmount.Location = new System.Drawing.Point(921, 114);
|
||||
this.tbBidAmount.Name = "tbBidAmount";
|
||||
this.tbBidAmount.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbBidAmount.TabIndex = 9;
|
||||
this.tbBidAmount.Text = "1,000,000";
|
||||
this.tbBidAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// tbTimeout
|
||||
//
|
||||
this.tbTimeout.Location = new System.Drawing.Point(921, 141);
|
||||
this.tbTimeout.Name = "tbTimeout";
|
||||
this.tbTimeout.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbTimeout.TabIndex = 10;
|
||||
this.tbTimeout.Text = "120";
|
||||
this.tbTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(862, 63);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 12);
|
||||
this.label1.TabIndex = 11;
|
||||
this.label1.Text = "검색범위";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(862, 90);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 12);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "매수범위";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(862, 117);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(41, 12);
|
||||
this.label3.TabIndex = 13;
|
||||
this.label3.Text = "매수금";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(862, 144);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(53, 12);
|
||||
this.label4.TabIndex = 13;
|
||||
this.label4.Text = "타임아웃";
|
||||
//
|
||||
// tbTrailing
|
||||
//
|
||||
this.tbTrailing.Location = new System.Drawing.Point(921, 168);
|
||||
this.tbTrailing.Name = "tbTrailing";
|
||||
this.tbTrailing.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbTrailing.TabIndex = 10;
|
||||
this.tbTrailing.Text = "1.0";
|
||||
this.tbTrailing.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(862, 171);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(53, 12);
|
||||
this.label5.TabIndex = 13;
|
||||
this.label5.Text = "트레일링";
|
||||
//
|
||||
// tbLossCut
|
||||
//
|
||||
this.tbLossCut.Location = new System.Drawing.Point(921, 195);
|
||||
this.tbLossCut.Name = "tbLossCut";
|
||||
this.tbLossCut.Size = new System.Drawing.Size(100, 21);
|
||||
this.tbLossCut.TabIndex = 10;
|
||||
this.tbLossCut.Text = "2.0";
|
||||
this.tbLossCut.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(862, 198);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(29, 12);
|
||||
this.label6.TabIndex = 13;
|
||||
this.label6.Text = "손절";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(964, 63);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(14, 12);
|
||||
this.label7.TabIndex = 11;
|
||||
this.label7.Text = "~";
|
||||
//
|
||||
// tbSearchMin
|
||||
//
|
||||
this.tbSearchMin.Location = new System.Drawing.Point(921, 60);
|
||||
this.tbSearchMin.Name = "tbSearchMin";
|
||||
this.tbSearchMin.Size = new System.Drawing.Size(37, 21);
|
||||
this.tbSearchMin.TabIndex = 14;
|
||||
this.tbSearchMin.Text = "9.0";
|
||||
this.tbSearchMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// btApply
|
||||
//
|
||||
this.btApply.Location = new System.Drawing.Point(921, 222);
|
||||
this.btApply.Name = "btApply";
|
||||
this.btApply.Size = new System.Drawing.Size(44, 23);
|
||||
this.btApply.TabIndex = 15;
|
||||
this.btApply.Text = "적용";
|
||||
this.btApply.UseVisualStyleBackColor = true;
|
||||
this.btApply.Click += new System.EventHandler(this.btApply_Click);
|
||||
//
|
||||
// btCancel
|
||||
//
|
||||
this.btCancel.Location = new System.Drawing.Point(977, 222);
|
||||
this.btCancel.Name = "btCancel";
|
||||
this.btCancel.Size = new System.Drawing.Size(44, 23);
|
||||
this.btCancel.TabIndex = 16;
|
||||
this.btCancel.Text = "취소";
|
||||
this.btCancel.UseVisualStyleBackColor = true;
|
||||
this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
|
||||
//
|
||||
// tbBidMax
|
||||
//
|
||||
this.tbBidMax.Location = new System.Drawing.Point(984, 87);
|
||||
this.tbBidMax.Name = "tbBidMax";
|
||||
this.tbBidMax.Size = new System.Drawing.Size(37, 21);
|
||||
this.tbBidMax.TabIndex = 8;
|
||||
this.tbBidMax.Text = "10.0";
|
||||
this.tbBidMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(964, 90);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(14, 12);
|
||||
this.label8.TabIndex = 11;
|
||||
this.label8.Text = "~";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1239, 642);
|
||||
this.Controls.Add(this.btCancel);
|
||||
this.Controls.Add(this.btApply);
|
||||
this.Controls.Add(this.tbSearchMin);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.tbLossCut);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.tbTrailing);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.tbTimeout);
|
||||
this.Controls.Add(this.tbBidAmount);
|
||||
this.Controls.Add(this.tbBidMax);
|
||||
this.Controls.Add(this.tbBidMin);
|
||||
this.Controls.Add(this.tbSearchMax);
|
||||
this.Controls.Add(this.lvWatch);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btSearch;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.CheckBox cbSearch;
|
||||
}
|
||||
private System.Windows.Forms.ColumnHeader chOrder;
|
||||
private System.Windows.Forms.ColumnHeader chName;
|
||||
private System.Windows.Forms.ColumnHeader chCur;
|
||||
private System.Windows.Forms.ColumnHeader chUp;
|
||||
private System.Windows.Forms.ColumnHeader chRatio;
|
||||
private System.Windows.Forms.ColumnHeader chVolume;
|
||||
private System.Windows.Forms.ColumnHeader chBuy;
|
||||
private System.Windows.Forms.ColumnHeader chBuyCnt;
|
||||
private System.Windows.Forms.ListView lvWatch;
|
||||
private System.Windows.Forms.TextBox tbSearchMax;
|
||||
private System.Windows.Forms.TextBox tbBidMin;
|
||||
private System.Windows.Forms.TextBox tbBidAmount;
|
||||
private System.Windows.Forms.TextBox tbTimeout;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox tbTrailing;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox tbLossCut;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox tbSearchMin;
|
||||
private System.Windows.Forms.Button btApply;
|
||||
private System.Windows.Forms.Button btCancel;
|
||||
private System.Windows.Forms.TextBox tbBidMax;
|
||||
private System.Windows.Forms.Label label8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
330
MainForm.cs
330
MainForm.cs
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
@@ -26,19 +27,7 @@ namespace upper_limit_crawler
|
||||
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
CPSYSDIBLib.CpSvrNew7043 m_7043 = new CPSYSDIBLib.CpSvrNew7043();
|
||||
DSCBO1Lib.StockMst2 m_StockMst2 = new DSCBO1Lib.StockMst2();
|
||||
|
||||
ArrayList m_TraceList = new ArrayList();
|
||||
|
||||
MySqlConnection m_DBCon;
|
||||
|
||||
Timer timerWatch = new Timer();
|
||||
Timer timerTrace = new Timer();
|
||||
|
||||
|
||||
|
||||
|
||||
ArrayList m_TraceList = new ArrayList();
|
||||
|
||||
Timer m_MainTimer = new Timer();
|
||||
int m_iLastTime = 0;
|
||||
@@ -47,64 +36,40 @@ namespace upper_limit_crawler
|
||||
ULMonitor m_Monitor = new ULMonitor(m_DataMgr);
|
||||
ULWatch m_Watch = new ULWatch(m_DataMgr);
|
||||
ULDealing m_Dealing = new ULDealing(m_DataMgr);
|
||||
ULOwn m_Own = new ULOwn(m_DataMgr);
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
string strConn = "Server=mjjo53.us.to;Database=upperlimit;Uid=mjjo;Pwd=whaudwls;charset=utf8;";
|
||||
m_DBCon = new MySqlConnection(strConn);
|
||||
m_DBCon.Open();
|
||||
|
||||
InitWatch();
|
||||
m_DataMgr.m_Setting.m_fSearchMin = float.Parse(tbSearchMin.Text);
|
||||
m_DataMgr.m_Setting.m_fSearchMax = float.Parse(tbSearchMax.Text);
|
||||
m_DataMgr.m_Setting.m_fBidMin = float.Parse(tbBidMin.Text);
|
||||
m_DataMgr.m_Setting.m_fBidMax = float.Parse(tbBidMax.Text);
|
||||
m_DataMgr.m_Setting.m_fBidAmount = float.Parse(tbBidAmount.Text);
|
||||
m_DataMgr.m_Setting.m_fTimeout = float.Parse(tbTimeout.Text);
|
||||
m_DataMgr.m_Setting.m_fTrailing = float.Parse(tbTrailing.Text);
|
||||
m_DataMgr.m_Setting.m_fLossCut = float.Parse(tbLossCut.Text);
|
||||
|
||||
|
||||
SetDoubleBuffered(lvWatch);
|
||||
|
||||
m_MainTimer.Interval = 10;
|
||||
m_Monitor.SetView(lvWatch);
|
||||
|
||||
m_MainTimer.Interval = 10;
|
||||
m_MainTimer.Tick += Refresh;
|
||||
m_MainTimer.Start();
|
||||
|
||||
//timerWatch.Interval = 1 * 1000;
|
||||
//timerWatch.Tick += timerWatch_Tick;
|
||||
//timerWatch.Start();
|
||||
|
||||
//timerTrace.Interval = 1 * 1000;
|
||||
//timerTrace.Tick += timerTrace_Tick;
|
||||
//timerTrace.Start();
|
||||
}
|
||||
|
||||
private void InitWatch()
|
||||
{
|
||||
m_7043.SetInputValue(0, '1');
|
||||
m_7043.SetInputValue(1, '2');
|
||||
m_7043.SetInputValue(2, '1');
|
||||
m_7043.SetInputValue(3, 41);
|
||||
m_7043.SetInputValue(4, '1');
|
||||
m_7043.SetInputValue(5, '0');
|
||||
m_7043.SetInputValue(6, '0');
|
||||
m_7043.SetInputValue(7, 0);
|
||||
m_7043.SetInputValue(8, 30);
|
||||
}
|
||||
public static void SetDoubleBuffered(Control control)
|
||||
{
|
||||
// set instance non-public property with name "DoubleBuffered" to true
|
||||
typeof(Control).InvokeMember("DoubleBuffered",
|
||||
BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
|
||||
null, control, new object[] { true });
|
||||
}
|
||||
|
||||
private void Refresh(object sender, EventArgs e)
|
||||
{
|
||||
int iCurTime = Environment.TickCount;
|
||||
int iDeltaT = iCurTime - m_iLastTime;
|
||||
|
||||
m_Monitor.Refresh(iCurTime);
|
||||
|
||||
m_iLastTime = iCurTime;
|
||||
}
|
||||
|
||||
private void AddTrace(string strCode)
|
||||
{
|
||||
if (m_TraceList.Contains(strCode) == true)
|
||||
return;
|
||||
|
||||
m_TraceList.Add(strCode);
|
||||
}
|
||||
|
||||
private bool IsOnTime()
|
||||
private bool IsOnTime()
|
||||
{
|
||||
DateTime CurTime = DateTime.Now;
|
||||
if (CurTime.DayOfWeek == DayOfWeek.Sunday || CurTime.DayOfWeek == DayOfWeek.Saturday)
|
||||
@@ -122,222 +87,59 @@ namespace upper_limit_crawler
|
||||
return true;
|
||||
}
|
||||
|
||||
private void timerWatch_Tick(object sender, EventArgs e)
|
||||
private void Refresh(object sender, EventArgs e)
|
||||
{
|
||||
if (IsOnTime() == false)
|
||||
return;
|
||||
//if(IsOnTime() == false)
|
||||
// return;
|
||||
|
||||
int iResult = m_7043.BlockRequest2(1);
|
||||
if (iResult != 0)
|
||||
{
|
||||
MessageBox.Show("요청 에러");
|
||||
return;
|
||||
}
|
||||
int iCurTime = Environment.TickCount;
|
||||
int iDeltaT = iCurTime - m_iLastTime;
|
||||
|
||||
m_Monitor.Refresh(iCurTime);
|
||||
m_Watch.Refresh(iCurTime);
|
||||
m_Dealing.Refresh(iCurTime);
|
||||
m_Own.Refresh(iCurTime);
|
||||
|
||||
|
||||
string strMsg = string.Format("종목/현재가/대비플래그/대비/대비율/거래량/시가/시가대비/시가대비율/연속일");
|
||||
Console.WriteLine(strMsg);
|
||||
textBox1.Clear();
|
||||
textBox1.AppendText(strMsg + "\n");
|
||||
|
||||
bool bContinue = true;
|
||||
while (bContinue)
|
||||
{
|
||||
int iCnt = m_7043.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
object Code = m_7043.GetDataValue(0, i);
|
||||
object Name = m_7043.GetDataValue(1, i);
|
||||
object CurPrice = m_7043.GetDataValue(2, i);
|
||||
object flag = m_7043.GetDataValue(3, i);
|
||||
object Comp = m_7043.GetDataValue(4, i);
|
||||
object CompRate = m_7043.GetDataValue(5, i);
|
||||
object DealAmount = m_7043.GetDataValue(6, i);
|
||||
object StartPrice = m_7043.GetDataValue(7, i);
|
||||
object StartPriceComp = m_7043.GetDataValue(8, i);
|
||||
object StartPriceCompRate = m_7043.GetDataValue(9, i);
|
||||
object SerialDay = m_7043.GetDataValue(10, i);
|
||||
|
||||
if ((float)StartPriceCompRate >= 9.0f && (float)StartPriceCompRate <= 10.0f)
|
||||
AddTrace((string)Code);
|
||||
|
||||
//cmd.CommandText = string.Format("insert into trace(code, name, time, curprice, askcount, bidcount, startprice, tradingvolume, rateperstart) values('{0}', '{1}', '{2}', now, {3}, {4}, {5}, {6}, {7})",
|
||||
// Code, Name, CurPrice, );
|
||||
//cmd.ExecuteNonQuery();
|
||||
|
||||
strMsg = string.Format("[{0}:{1}]/{2}/{3}/{4}/{5}/{6}/{7}/{8}/{9}/{10}",
|
||||
Name.GetType(), Code.GetType(),
|
||||
CurPrice.GetType(), flag.GetType(), Comp.GetType(), CompRate.GetType(),
|
||||
DealAmount.GetType(), StartPrice.GetType(), StartPriceComp.GetType(), StartPriceCompRate.GetType(),
|
||||
SerialDay.GetType());
|
||||
Console.WriteLine(strMsg);
|
||||
textBox1.AppendText(strMsg + "\n");
|
||||
}
|
||||
|
||||
bContinue = (m_7043.Continue == 1);
|
||||
if (bContinue == true)
|
||||
iResult = m_7043.BlockRequest2(1);
|
||||
}
|
||||
m_iLastTime = iCurTime;
|
||||
}
|
||||
|
||||
private void timerTrace_Tick(object sender, EventArgs e)
|
||||
private void AddTrace(string strCode)
|
||||
{
|
||||
//0 - (string) 종목 코드
|
||||
//1 - (string) 종목명
|
||||
//2 - (long) 시간(HHMM)
|
||||
//3 - (long) 현재가
|
||||
//4 - (long) 전일대비
|
||||
//5 - (char) 상태구분
|
||||
// 코드 내용
|
||||
// '1' 상한
|
||||
// '2' 상승
|
||||
// '3' 보합
|
||||
// '4' 하한
|
||||
// '5' 하락
|
||||
// '6' 기세상한
|
||||
// '7' 기세상승
|
||||
// '8' 기세하한
|
||||
// '9' 기세하락
|
||||
|
||||
//6 - (long) 시가
|
||||
//7 - (long) 고가
|
||||
//8 - (long) 저가
|
||||
//9 - (long) 매도호가
|
||||
//10 - (long) 매수호가
|
||||
//11 - (unsigned long) 거래량 [주의] 단위 1주
|
||||
//12 - (long) 거래대금 [주의] 단위 천원
|
||||
//13 - (long) 총매도잔량
|
||||
//14 - (long) 총매수잔량
|
||||
//15 - (long) 매도잔량
|
||||
//16 - (long) 매수잔량
|
||||
//17 - (unsigned long) 상장주식수
|
||||
//18 - (long) 외국인보유비율(%)
|
||||
//19 - (long) 전일종가
|
||||
//20 - (unsigned long) 전일거래량
|
||||
//21 - (long) 체결강도
|
||||
//22 - (unsigned long) 순간체결량
|
||||
//23 - (char) 체결가비교 Flag
|
||||
// 코드 내용
|
||||
// 'O' 매도
|
||||
// 'B' 매수
|
||||
|
||||
//24 - (char) 호가비교 Flag
|
||||
// 코드 내용
|
||||
// 'O' 매도
|
||||
// 'B' 매수
|
||||
|
||||
//25- (char) 동시호가구분
|
||||
// 코드 내용
|
||||
// '1' 동시호가
|
||||
// '2' 장중
|
||||
|
||||
//26 - (long) 예상체결가
|
||||
//27 - (long) 예상체결가 전일대비
|
||||
//28 - (long) 예상체결가 상태구분
|
||||
// 코드 내용
|
||||
// '1' 상한
|
||||
// '2' 상승
|
||||
// '3' 보합
|
||||
// '4' 하한
|
||||
// '5' 하락
|
||||
// '6' 기세상한
|
||||
// '7' 기세상승
|
||||
// '8' 기세하한
|
||||
// '9' 기세하락
|
||||
|
||||
//29- (unsigned long) 예상체결가 거래량
|
||||
|
||||
if (IsOnTime() == false)
|
||||
if (m_TraceList.Contains(strCode) == true)
|
||||
return;
|
||||
|
||||
if (m_TraceList.Count <= 0)
|
||||
return;
|
||||
|
||||
string strCodes = "";
|
||||
for (int i = 0; i < m_TraceList.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
strCodes += ",";
|
||||
strCodes += m_TraceList[i];
|
||||
}
|
||||
m_StockMst2.SetInputValue(0, strCodes);
|
||||
|
||||
|
||||
int iResult = 0;
|
||||
iResult = m_StockMst2.BlockRequest2(1);
|
||||
bool bContinue = true;
|
||||
|
||||
MySqlTransaction trans = m_DBCon.BeginTransaction();
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
cmd.Connection = m_DBCon;
|
||||
cmd.Transaction = trans;
|
||||
|
||||
DateTime CurTime = DateTime.Now;
|
||||
|
||||
while (bContinue == true)
|
||||
{
|
||||
int iCnt = m_StockMst2.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
object Code = m_StockMst2.GetDataValue(0, i);
|
||||
object Name = m_StockMst2.GetDataValue(1, i);
|
||||
object Time = m_StockMst2.GetDataValue(2, i);
|
||||
object CurPrice = m_StockMst2.GetDataValue(3, i);
|
||||
object StartPrice = m_StockMst2.GetDataValue(6, i);
|
||||
object AskPrice = m_StockMst2.GetDataValue(9, i);
|
||||
object BidPrice = m_StockMst2.GetDataValue(10, i);
|
||||
object TradingVolume = m_StockMst2.GetDataValue(11, i);
|
||||
object AskCount = m_StockMst2.GetDataValue(15, i);
|
||||
object BidCount = m_StockMst2.GetDataValue(16, i);
|
||||
float fRatePerStart = ((int)CurPrice - (int)StartPrice) * 100 / (float)(int)StartPrice;
|
||||
|
||||
string time = CurTime.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
time = time.Substring(0, 10) + " " + (int)Time / 100 + ":" + (int)Time % 100 + ":00";
|
||||
|
||||
// insert to db
|
||||
string query = string.Format("insert into trace(code, name, time, startprice, curprice, rateperstart, askprice, askcount, bidprice, bidcount, tradingvolume) values('{0}', '{1}', '{2}', {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10})",
|
||||
Code, Name, time, StartPrice, CurPrice, fRatePerStart, AskPrice, AskCount, BidPrice, BidCount, TradingVolume);
|
||||
Console.WriteLine(query);
|
||||
|
||||
cmd.CommandText = query;
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
// extract if loss
|
||||
|
||||
// extract if trailing loss
|
||||
}
|
||||
|
||||
|
||||
bContinue = (m_StockMst2.Continue == 1);
|
||||
if (bContinue == true)
|
||||
iResult = m_StockMst2.BlockRequest2(1);
|
||||
}
|
||||
|
||||
trans.Commit();
|
||||
m_TraceList.Add(strCode);
|
||||
}
|
||||
|
||||
private void btApply_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_DataMgr.m_Setting.m_fSearchMin = float.Parse(tbSearchMin.Text);
|
||||
m_DataMgr.m_Setting.m_fSearchMax = float.Parse(tbSearchMax.Text);
|
||||
m_DataMgr.m_Setting.m_fBidMin = float.Parse(tbBidMin.Text);
|
||||
m_DataMgr.m_Setting.m_fBidMax = float.Parse(tbBidMax.Text);
|
||||
m_DataMgr.m_Setting.m_fBidAmount = float.Parse(tbBidAmount.Text);
|
||||
m_DataMgr.m_Setting.m_fTimeout = float.Parse(tbTimeout.Text);
|
||||
m_DataMgr.m_Setting.m_fTrailing = float.Parse(tbTrailing.Text);
|
||||
m_DataMgr.m_Setting.m_fLossCut = float.Parse(tbLossCut.Text);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UlUtil.Trace(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void btSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void cbSearch_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cbSearch.Checked == true)
|
||||
{
|
||||
timerWatch.Start();
|
||||
timerTrace.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
timerWatch.Stop();
|
||||
timerTrace.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbSearchMin.Text = m_DataMgr.m_Setting.m_fSearchMin.ToString("0.0");
|
||||
tbSearchMax.Text = m_DataMgr.m_Setting.m_fSearchMax.ToString("0.0");
|
||||
tbBidMin.Text = m_DataMgr.m_Setting.m_fBidMin.ToString("0.0");
|
||||
tbBidMax.Text = m_DataMgr.m_Setting.m_fBidMax.ToString("0.0");
|
||||
tbBidAmount.Text = m_DataMgr.m_Setting.m_fBidAmount.ToString("###,###,###,###,###");
|
||||
tbTimeout.Text = m_DataMgr.m_Setting.m_fTimeout.ToString("0.###");
|
||||
tbTrailing.Text = m_DataMgr.m_Setting.m_fTrailing.ToString("0.0");
|
||||
tbLossCut.Text = m_DataMgr.m_Setting.m_fLossCut.ToString("0.0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
100
ULDataMgr.cs
100
ULDataMgr.cs
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,7 +8,103 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
struct SETTING
|
||||
{
|
||||
public float m_fSearchMin;
|
||||
public float m_fSearchMax;
|
||||
public float m_fBidMin;
|
||||
public float m_fBidMax;
|
||||
public float m_fBidAmount;
|
||||
public float m_fTimeout;
|
||||
public float m_fTrailing;
|
||||
public float m_fLossCut;
|
||||
}
|
||||
|
||||
struct MONITOR_ITEM
|
||||
{
|
||||
public object Code;
|
||||
public object Name;
|
||||
public object CurPrice;
|
||||
public object flag;
|
||||
public object Comp;
|
||||
public object CompRate;
|
||||
public object Volume;
|
||||
public object StartPrice;
|
||||
public object StartPriceComp;
|
||||
public object StartPriceCompRate;
|
||||
public object SerialDay;
|
||||
}
|
||||
|
||||
struct WATCH_ITEM
|
||||
{
|
||||
public string m_strCode;
|
||||
}
|
||||
|
||||
class ULDataMgr
|
||||
{
|
||||
//MySqlConnection m_DBCon;
|
||||
|
||||
public SETTING m_Setting = new SETTING();
|
||||
|
||||
ULTrader m_Trader = new ULTrader();
|
||||
|
||||
List<MONITOR_ITEM> m_MonitorList = new List<MONITOR_ITEM>();
|
||||
List<WATCH_ITEM> m_WatchList = new List<WATCH_ITEM>();
|
||||
List<string> m_BlackList = new List<string>();
|
||||
|
||||
public ULDataMgr()
|
||||
{
|
||||
InitDB();
|
||||
}
|
||||
|
||||
void InitDB()
|
||||
{
|
||||
//string strConn = "Server=mjjo53.us.to;Database=upperlimit;Uid=mjjo;Pwd=whaudwls;charset=utf8;";
|
||||
//m_DBCon = new MySqlConnection(strConn);
|
||||
//m_DBCon.Open();
|
||||
}
|
||||
|
||||
public ULTrader GetTrader()
|
||||
{
|
||||
return m_Trader;
|
||||
}
|
||||
|
||||
public void ClearMonitor()
|
||||
{
|
||||
m_MonitorList.Clear();
|
||||
}
|
||||
|
||||
public void AddMonitor(MONITOR_ITEM Item)
|
||||
{
|
||||
m_MonitorList.Add(Item);
|
||||
}
|
||||
|
||||
public void AddWatch(string strCode)
|
||||
{
|
||||
WATCH_ITEM item;
|
||||
item.m_strCode = strCode;
|
||||
|
||||
m_WatchList.Add(item);
|
||||
}
|
||||
|
||||
public void AddBlackList(string strCode)
|
||||
{
|
||||
m_BlackList.Add(strCode);
|
||||
}
|
||||
|
||||
public bool IsInBlackList(string strCode)
|
||||
{
|
||||
return m_BlackList.Contains(strCode);
|
||||
}
|
||||
|
||||
public List<MONITOR_ITEM> GetMonitor()
|
||||
{
|
||||
return m_MonitorList;
|
||||
}
|
||||
|
||||
public List<WATCH_ITEM> GetWatchList()
|
||||
{
|
||||
return m_WatchList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
132
ULMonitor.cs
132
ULMonitor.cs
@@ -3,13 +3,135 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
class ULMonitor : ULObj
|
||||
{
|
||||
public ULMonitor(ULDataMgr DataMgr) : base(DataMgr)
|
||||
const int MONITOR_DELAY = 15000;
|
||||
|
||||
CPSYSDIBLib.CpSvrNew7043 m_7043 = new CPSYSDIBLib.CpSvrNew7043();
|
||||
int m_iMonitorDelay = 0;
|
||||
ListView lvWatch;
|
||||
bool m_bRequesting = false;
|
||||
|
||||
public ULMonitor(ULDataMgr DataMgr) : base(DataMgr)
|
||||
{
|
||||
m_7043.SetInputValue(0, '0');
|
||||
m_7043.SetInputValue(1, '2');
|
||||
m_7043.SetInputValue(2, '1');
|
||||
m_7043.SetInputValue(3, 21);
|
||||
m_7043.SetInputValue(4, '1');
|
||||
m_7043.SetInputValue(5, '0');
|
||||
m_7043.SetInputValue(6, '0');
|
||||
m_7043.SetInputValue(7, (short)m_DataMgr.m_Setting.m_fSearchMin);
|
||||
m_7043.SetInputValue(8, (short)m_DataMgr.m_Setting.m_fSearchMax);
|
||||
}
|
||||
|
||||
public void SetView(ListView view)
|
||||
{
|
||||
lvWatch = view;
|
||||
}
|
||||
|
||||
void Check()
|
||||
{
|
||||
if (m_bRequesting == true || UlUtil.GetLimitRemainCountRQ() < 30)
|
||||
return;
|
||||
|
||||
m_bRequesting = true;
|
||||
m_7043.SetInputValue(7, (short)m_DataMgr.m_Setting.m_fSearchMin);
|
||||
m_7043.SetInputValue(8, (short)m_DataMgr.m_Setting.m_fSearchMax);
|
||||
int iResult = m_7043.BlockRequest2(1);
|
||||
|
||||
//string strMsg = string.Format("종목/현재가/대비플래그/대비/대비율/거래량/시가/시가대비/시가대비율/연속일");
|
||||
//UlUtil.Trace(strMsg);
|
||||
// textBox1.Clear();
|
||||
// textBox1.AppendText(strMsg + "\n");
|
||||
|
||||
m_DataMgr.ClearMonitor();
|
||||
|
||||
lvWatch.Items.Clear();
|
||||
int iIdx = 1;
|
||||
|
||||
bool bContinue = true;
|
||||
while (bContinue)
|
||||
{
|
||||
int iCnt = m_7043.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
object Code = m_7043.GetDataValue(0, i);
|
||||
object Name = m_7043.GetDataValue(1, i);
|
||||
object CurPrice = m_7043.GetDataValue(2, i);
|
||||
object flag = m_7043.GetDataValue(3, i);
|
||||
object Comp = m_7043.GetDataValue(4, i);
|
||||
object CompRate = m_7043.GetDataValue(5, i);
|
||||
object Volume = m_7043.GetDataValue(6, i);
|
||||
object StartPrice = m_7043.GetDataValue(7, i);
|
||||
object StartPriceComp = m_7043.GetDataValue(8, i);
|
||||
object StartPriceCompRate = m_7043.GetDataValue(9, i);
|
||||
object SerialDay = m_7043.GetDataValue(10, i);
|
||||
|
||||
{
|
||||
MONITOR_ITEM item;
|
||||
item.Code = Code;
|
||||
item.Name = Name;
|
||||
item.CurPrice = CurPrice;
|
||||
item.flag = flag;
|
||||
item.Comp = Comp;
|
||||
item.CompRate = CompRate;
|
||||
item.Volume = Volume;
|
||||
item.StartPrice = StartPrice;
|
||||
item.StartPriceComp = StartPriceComp;
|
||||
item.StartPriceCompRate = StartPriceCompRate;
|
||||
item.SerialDay = SerialDay;
|
||||
|
||||
m_DataMgr.AddMonitor(item);
|
||||
|
||||
|
||||
string[] row = { iIdx.ToString(), item.Name.ToString(), item.CurPrice.ToString(), item.Comp.ToString(), item.CompRate.ToString(), item.Volume.ToString(), 0.ToString(), 0.ToString() };
|
||||
var listViewItem = new ListViewItem(row);
|
||||
lvWatch.Items.Add(listViewItem);
|
||||
iIdx++;
|
||||
}
|
||||
|
||||
if ((float)StartPriceCompRate >= m_DataMgr.m_Setting.m_fBidMin &&
|
||||
(float)StartPriceCompRate <= m_DataMgr.m_Setting.m_fBidMax &&
|
||||
m_DataMgr.IsInBlackList((string)Code) == false)
|
||||
{
|
||||
// bid and add to black list
|
||||
m_DataMgr.GetTrader().Buy((string)Code, (float)(int)CurPrice, m_DataMgr.m_Setting.m_fBidAmount);
|
||||
m_DataMgr.AddBlackList((string)Code);
|
||||
}
|
||||
|
||||
//if ((float)StartPriceCompRate >= 9.0f && (float)StartPriceCompRate <= 10.0f)
|
||||
//{
|
||||
// // add to watch list
|
||||
// m_DataMgr.AddWatch((string)Code);
|
||||
//}
|
||||
|
||||
//cmd.CommandText = string.Format("insert into trace(code, name, time, curprice, askcount, bidcount, startprice, tradingvolume, rateperstart) values('{0}', '{1}', '{2}', now, {3}, {4}, {5}, {6}, {7})",
|
||||
// Code, Name, CurPrice, );
|
||||
//cmd.ExecuteNonQuery();
|
||||
|
||||
//strMsg = string.Format("[{0}:{1}]/{2}/{3}/{4}/{5}/{6}/{7}/{8}/{9}/{10}",
|
||||
// Name, Code,
|
||||
// CurPrice, flag, Comp, CompRate,
|
||||
// Volume, StartPrice, StartPriceComp, StartPriceCompRate,
|
||||
// SerialDay);
|
||||
//UlUtil.Trace(strMsg);
|
||||
// textBox1.AppendText(strMsg + "\n");
|
||||
}
|
||||
|
||||
bContinue = (m_7043.Continue == 1);
|
||||
if (bContinue == true && UlUtil.GetLimitRemainCountRQ() >= 30)
|
||||
iResult = m_7043.BlockRequest2(1);
|
||||
}
|
||||
|
||||
foreach (ColumnHeader col in lvWatch.Columns)
|
||||
col.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
|
||||
|
||||
m_bRequesting = false;
|
||||
}
|
||||
|
||||
public override void Refresh(int iCurTime)
|
||||
@@ -20,6 +142,14 @@ namespace upper_limit_crawler
|
||||
return;
|
||||
}
|
||||
|
||||
int iDeltaT = iCurTime - m_iLastTime;
|
||||
m_iMonitorDelay -= iDeltaT;
|
||||
if(m_iMonitorDelay <= 0)
|
||||
{
|
||||
Check();
|
||||
m_iMonitorDelay = MONITOR_DELAY;
|
||||
}
|
||||
|
||||
base.Refresh(iCurTime);
|
||||
}
|
||||
}
|
||||
|
||||
50
ULMonitorFrom.Designer.cs
generated
Normal file
50
ULMonitorFrom.Designer.cs
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
partial class ULMonitorFrom
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ULMonitorFrom
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(521, 360);
|
||||
this.ControlBox = false;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "ULMonitorFrom";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "ULMonitorFrom";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
20
ULMonitorFrom.cs
Normal file
20
ULMonitorFrom.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
public partial class ULMonitorFrom : Form
|
||||
{
|
||||
public ULMonitorFrom()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ULMonitorFrom.resx
Normal file
120
ULMonitorFrom.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
124
ULTrader.cs
Normal file
124
ULTrader.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
class ULTrader
|
||||
{
|
||||
CPFORETRADELib.CpForeTdUtil m_Util = new CPFORETRADELib.CpForeTdUtil();
|
||||
DSCBO1Lib.CpConclusion m_Conclusion = new DSCBO1Lib.CpConclusion();
|
||||
CPTRADELib.CpTd0311 m_Td0311 = new CPTRADELib.CpTd0311();
|
||||
|
||||
string[] m_astrAccounts = null;
|
||||
|
||||
public ULTrader()
|
||||
{
|
||||
m_Util.TradeInit();
|
||||
m_astrAccounts = m_Util.AccountNumber;
|
||||
|
||||
StartConclusion();
|
||||
}
|
||||
|
||||
void StartConclusion()
|
||||
{
|
||||
m_Conclusion.Received += Conclusion_Received;
|
||||
m_Conclusion.Subscribe();
|
||||
}
|
||||
|
||||
private void Conclusion_Received()
|
||||
{
|
||||
string strAccount = m_Conclusion.GetHeaderValue(1);
|
||||
string strCodeName = m_Conclusion.GetHeaderValue(2);
|
||||
long iCount = m_Conclusion.GetHeaderValue(3);
|
||||
long iPrice = m_Conclusion.GetHeaderValue(4);
|
||||
long iTradeNo = m_Conclusion.GetHeaderValue(5);
|
||||
long iTradeNoOrg = m_Conclusion.GetHeaderValue(6);
|
||||
string strCode = m_Conclusion.GetHeaderValue(9);
|
||||
bool bBuy = (m_Conclusion.GetHeaderValue(12) == "2");
|
||||
string strResult = m_Conclusion.GetHeaderValue(14);
|
||||
string strTradeType = m_Conclusion.GetHeaderValue(16);
|
||||
|
||||
|
||||
string strLog = string.Format("[{0}:{1}] {2:###,###,###}원 {3:###,###,###}주 (총{4:###,###,###}원) ", strCodeName, strCode, iPrice, iCount, iPrice *iCount);
|
||||
|
||||
if (strResult == "1") // 체결
|
||||
{ strLog += "체결"; }
|
||||
else if (strResult == "2") // 확인
|
||||
{ strLog += "확인"; }
|
||||
else if (strResult == "3") // 거부
|
||||
{ strLog += "거부"; }
|
||||
else if (strResult == "4") // 접수
|
||||
{ strLog += "접수"; }
|
||||
|
||||
if (strTradeType == "1") // 정상주문
|
||||
{ strLog += " (정상주문)"; }
|
||||
else if (strTradeType == "2") // 정정주문
|
||||
{ strLog += " (정정주문)"; }
|
||||
else if (strTradeType == "3") // 취소주문
|
||||
{ strLog += " (취소주문)"; }
|
||||
|
||||
UlUtil.Trace(strLog);
|
||||
}
|
||||
|
||||
public void Buy(string strCode, float fCurPrice, float fBidAmount)
|
||||
{
|
||||
//0 - (string)주문종류코드 주문구분
|
||||
// 1 매도
|
||||
// 2 매수
|
||||
//1 - (string)계좌번호
|
||||
//2 - (string)상품관리구분코드 계좌구분
|
||||
//3 - (string)종목코드
|
||||
//4 - (long)주문수량
|
||||
//5 - (long)주문단가
|
||||
//6 - (string)매매구분
|
||||
//7 - (string)주문조건구분코드 매매조건
|
||||
//0 없음
|
||||
//1 IOC
|
||||
//2 FOK
|
||||
//8 - (string)주문호가구분코드
|
||||
// 1 보통[default]
|
||||
// 2 임의
|
||||
// 3 시장가
|
||||
// 5 조건부지정가
|
||||
// 6 희망대량
|
||||
// 9 자사주
|
||||
// 12 최유리지정가
|
||||
// 13 최우선지정가
|
||||
// 10 스톡옵션자사주
|
||||
// 23 임의시장가
|
||||
// 25 임의조건부지정가
|
||||
// 51 장중대량
|
||||
// 52 장중바스켓
|
||||
// 61 개시전종가
|
||||
// 62 개시전종가대량
|
||||
// 63 개시전시간외바스켓
|
||||
// 67 개시전금전신탁자사주
|
||||
// 69 개시전대량자기
|
||||
// 71 신고대량(전장시가)
|
||||
// 72 시간외대량
|
||||
// 73 신고대량(종가)
|
||||
// 77 금전신탁종가대량
|
||||
// 11 금전신탁자사주
|
||||
// 80 시간외바스켓
|
||||
// 79 시간외대량자기
|
||||
|
||||
// 최
|
||||
|
||||
long iCnt = (long)Math.Floor(fBidAmount / fCurPrice);
|
||||
iCnt = 1;
|
||||
|
||||
m_Td0311.SetInputValue(0, "2");
|
||||
m_Td0311.SetInputValue(1, m_astrAccounts[0]);
|
||||
m_Td0311.SetInputValue(3, strCode);
|
||||
m_Td0311.SetInputValue(4, iCnt); // 수량
|
||||
m_Td0311.SetInputValue(5, (long)fCurPrice); // 단가
|
||||
m_Td0311.SetInputValue(7, "0");
|
||||
m_Td0311.SetInputValue(8, "03");
|
||||
|
||||
m_Td0311.BlockRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
143
ULWatch.cs
143
ULWatch.cs
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,10 +9,144 @@ namespace upper_limit_crawler
|
||||
{
|
||||
class ULWatch : ULObj
|
||||
{
|
||||
const int WATCH_DELAY = 3000;
|
||||
|
||||
DSCBO1Lib.StockMst2 m_StockMst2 = new DSCBO1Lib.StockMst2();
|
||||
int m_iWatchDelay = 0;
|
||||
bool m_bWatching = false;
|
||||
|
||||
public ULWatch(ULDataMgr DataMgr) : base(DataMgr)
|
||||
{
|
||||
}
|
||||
|
||||
void Check()
|
||||
{
|
||||
//0 - (string) 종목 코드
|
||||
//1 - (string) 종목명
|
||||
//2 - (long) 시간(HHMM)
|
||||
//3 - (long) 현재가
|
||||
//4 - (long) 전일대비
|
||||
//5 - (char) 상태구분
|
||||
// 코드 내용
|
||||
// '1' 상한
|
||||
// '2' 상승
|
||||
// '3' 보합
|
||||
// '4' 하한
|
||||
// '5' 하락
|
||||
// '6' 기세상한
|
||||
// '7' 기세상승
|
||||
// '8' 기세하한
|
||||
// '9' 기세하락
|
||||
|
||||
//6 - (long) 시가
|
||||
//7 - (long) 고가
|
||||
//8 - (long) 저가
|
||||
//9 - (long) 매도호가
|
||||
//10 - (long) 매수호가
|
||||
//11 - (unsigned long) 거래량 [주의] 단위 1주
|
||||
//12 - (long) 거래대금 [주의] 단위 천원
|
||||
//13 - (long) 총매도잔량
|
||||
//14 - (long) 총매수잔량
|
||||
//15 - (long) 매도잔량
|
||||
//16 - (long) 매수잔량
|
||||
//17 - (unsigned long) 상장주식수
|
||||
//18 - (long) 외국인보유비율(%)
|
||||
//19 - (long) 전일종가
|
||||
//20 - (unsigned long) 전일거래량
|
||||
//21 - (long) 체결강도
|
||||
//22 - (unsigned long) 순간체결량
|
||||
//23 - (char) 체결가비교 Flag
|
||||
// 코드 내용
|
||||
// 'O' 매도
|
||||
// 'B' 매수
|
||||
|
||||
//24 - (char) 호가비교 Flag
|
||||
// 코드 내용
|
||||
// 'O' 매도
|
||||
// 'B' 매수
|
||||
|
||||
//25- (char) 동시호가구분
|
||||
// 코드 내용
|
||||
// '1' 동시호가
|
||||
// '2' 장중
|
||||
|
||||
//26 - (long) 예상체결가
|
||||
//27 - (long) 예상체결가 전일대비
|
||||
//28 - (long) 예상체결가 상태구분
|
||||
// 코드 내용
|
||||
// '1' 상한
|
||||
// '2' 상승
|
||||
// '3' 보합
|
||||
// '4' 하한
|
||||
// '5' 하락
|
||||
// '6' 기세상한
|
||||
// '7' 기세상승
|
||||
// '8' 기세하한
|
||||
// '9' 기세하락
|
||||
|
||||
//29- (unsigned long) 예상체결가 거래량
|
||||
|
||||
if (m_bWatching == true || UlUtil.GetLimitRemainCountRQ() < 30)
|
||||
return;
|
||||
|
||||
List<WATCH_ITEM> WatchList = m_DataMgr.GetWatchList();
|
||||
if (WatchList.Count <= 0)
|
||||
return;
|
||||
|
||||
string strCodes = "";
|
||||
for (int i = 0; i < WatchList.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
strCodes += ",";
|
||||
strCodes += WatchList[i].m_strCode;
|
||||
}
|
||||
m_StockMst2.SetInputValue(0, strCodes);
|
||||
|
||||
|
||||
int iResult = 0;
|
||||
m_bWatching = true;
|
||||
iResult = m_StockMst2.BlockRequest2(1);
|
||||
bool bContinue = true;
|
||||
|
||||
while (bContinue == true)
|
||||
{
|
||||
int iCnt = m_StockMst2.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
object Code = m_StockMst2.GetDataValue(0, i);
|
||||
object Name = m_StockMst2.GetDataValue(1, i);
|
||||
object Time = m_StockMst2.GetDataValue(2, i);
|
||||
object CurPrice = m_StockMst2.GetDataValue(3, i);
|
||||
object StartPrice = m_StockMst2.GetDataValue(6, i);
|
||||
object AskPrice = m_StockMst2.GetDataValue(9, i);
|
||||
object BidPrice = m_StockMst2.GetDataValue(10, i);
|
||||
object TradingVolume = m_StockMst2.GetDataValue(11, i);
|
||||
object AskCount = m_StockMst2.GetDataValue(15, i);
|
||||
object BidCount = m_StockMst2.GetDataValue(16, i);
|
||||
float fRatePerStart = ((int)CurPrice - (int)StartPrice) * 100 / (float)(int)StartPrice;
|
||||
|
||||
//if(fRatePerStart >= 9.5 && fRatePerStart <= 10.0 &&
|
||||
// m_DataMgr.HasOwnList((string)Code) == false && m_DataMgr.HasDealingList((string)Code) == false)
|
||||
//{
|
||||
// m_DataMgr.GetTrader().Buy((string)Code);
|
||||
// m_DataMgr.AddDealingList((string)Code);
|
||||
//}
|
||||
// insert to db
|
||||
|
||||
// extract if loss
|
||||
|
||||
// extract if trailing loss
|
||||
}
|
||||
|
||||
|
||||
bContinue = (m_StockMst2.Continue == 1);
|
||||
if (bContinue == true && UlUtil.GetLimitRemainCountRQ() >= 30)
|
||||
iResult = m_StockMst2.BlockRequest2(1);
|
||||
}
|
||||
|
||||
m_bWatching = false;
|
||||
}
|
||||
|
||||
public override void Refresh(int iCurTime)
|
||||
{
|
||||
if (m_iLastTime == 0)
|
||||
@@ -20,6 +155,14 @@ namespace upper_limit_crawler
|
||||
return;
|
||||
}
|
||||
|
||||
int iDeltaT = iCurTime - m_iLastTime;
|
||||
m_iWatchDelay -= iDeltaT;
|
||||
if(m_iWatchDelay <= 0)
|
||||
{
|
||||
Check();
|
||||
m_iWatchDelay = WATCH_DELAY;
|
||||
}
|
||||
|
||||
base.Refresh(iCurTime);
|
||||
}
|
||||
}
|
||||
|
||||
117
ULWatchForm.Designer.cs
generated
Normal file
117
ULWatchForm.Designer.cs
generated
Normal file
@@ -0,0 +1,117 @@
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
partial class ULWatchForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lvWatch = new System.Windows.Forms.ListView();
|
||||
this.chOrder = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chCur = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chUp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chRatio = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chVolume = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chBuy = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chBuyCnt = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lvWatch
|
||||
//
|
||||
this.lvWatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chOrder,
|
||||
this.chName,
|
||||
this.chCur,
|
||||
this.chUp,
|
||||
this.chRatio,
|
||||
this.chVolume,
|
||||
this.chBuy,
|
||||
this.chBuyCnt});
|
||||
this.lvWatch.Location = new System.Drawing.Point(12, 12);
|
||||
this.lvWatch.Name = "lvWatch";
|
||||
this.lvWatch.Size = new System.Drawing.Size(1182, 232);
|
||||
this.lvWatch.TabIndex = 5;
|
||||
this.lvWatch.UseCompatibleStateImageBehavior = false;
|
||||
this.lvWatch.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// chOrder
|
||||
//
|
||||
this.chOrder.Text = "순위";
|
||||
//
|
||||
// chName
|
||||
//
|
||||
this.chName.Text = "종목명";
|
||||
//
|
||||
// chCur
|
||||
//
|
||||
this.chCur.Text = "현재가";
|
||||
//
|
||||
// chUp
|
||||
//
|
||||
this.chUp.Text = "전일대비";
|
||||
//
|
||||
// chRatio
|
||||
//
|
||||
this.chRatio.Text = "대비율";
|
||||
//
|
||||
// chVolume
|
||||
//
|
||||
this.chVolume.Text = "거래량";
|
||||
//
|
||||
// chBuy
|
||||
//
|
||||
this.chBuy.Text = "매수호가";
|
||||
//
|
||||
// chBuyCnt
|
||||
//
|
||||
this.chBuyCnt.Text = "호가잔량";
|
||||
//
|
||||
// ULWatchForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1206, 261);
|
||||
this.Controls.Add(this.lvWatch);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "ULWatchForm";
|
||||
this.Text = "ULWatchForm";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView lvWatch;
|
||||
private System.Windows.Forms.ColumnHeader chOrder;
|
||||
private System.Windows.Forms.ColumnHeader chName;
|
||||
private System.Windows.Forms.ColumnHeader chCur;
|
||||
private System.Windows.Forms.ColumnHeader chUp;
|
||||
private System.Windows.Forms.ColumnHeader chRatio;
|
||||
private System.Windows.Forms.ColumnHeader chVolume;
|
||||
private System.Windows.Forms.ColumnHeader chBuy;
|
||||
private System.Windows.Forms.ColumnHeader chBuyCnt;
|
||||
}
|
||||
}
|
||||
20
ULWatchForm.cs
Normal file
20
ULWatchForm.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
public partial class ULWatchForm : Form
|
||||
{
|
||||
public ULWatchForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ULWatchForm.resx
Normal file
120
ULWatchForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
41
UlUtil.cs
Normal file
41
UlUtil.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace upper_limit_crawler
|
||||
{
|
||||
public static class UlUtil
|
||||
{
|
||||
static CPUTILLib.CpCybos m_Util = new CPUTILLib.CpCybos();
|
||||
|
||||
public static string GetCurTimeString()
|
||||
{
|
||||
DateTime CurTime = DateTime.Now;
|
||||
string time = CurTime.ToString("[yyyy-MM-dd hh:mm:ss]");
|
||||
//time = time.Substring(0, 10) + " " + (int)time / 100 + ":" + (int)Time % 100 + ":00";
|
||||
return time;
|
||||
}
|
||||
|
||||
public static void Trace(string strMsg)
|
||||
{
|
||||
Console.WriteLine(GetCurTimeString() + " " + strMsg);
|
||||
}
|
||||
|
||||
public static int GetLimitRemainCountTrace()
|
||||
{
|
||||
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_TRADE_REQUEST);
|
||||
}
|
||||
|
||||
public static int GetLimitRemainCountRQ()
|
||||
{
|
||||
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_NONTRADE_REQUEST);
|
||||
}
|
||||
|
||||
public static int GetLimitRemainCountSB()
|
||||
{
|
||||
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,9 +68,23 @@
|
||||
<Compile Include="ULDealing.cs" />
|
||||
<Compile Include="ULDataMgr.cs" />
|
||||
<Compile Include="ULMonitor.cs" />
|
||||
<Compile Include="ULMonitorFrom.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ULMonitorFrom.Designer.cs">
|
||||
<DependentUpon>ULMonitorFrom.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ULObj.cs" />
|
||||
<Compile Include="ULOwn.cs" />
|
||||
<Compile Include="ULTrader.cs" />
|
||||
<Compile Include="UlUtil.cs" />
|
||||
<Compile Include="ULWatch.cs" />
|
||||
<Compile Include="ULWatchForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ULWatchForm.Designer.cs">
|
||||
<DependentUpon>ULWatchForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -83,6 +97,12 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="ULMonitorFrom.resx">
|
||||
<DependentUpon>ULMonitorFrom.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ULWatchForm.resx">
|
||||
<DependentUpon>ULWatchForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@@ -102,6 +122,33 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="CPFOREDIBLIB">
|
||||
<Guid>{ABA39D6F-5AF4-4D10-8389-031055C13A75}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="CPFORETRADELib">
|
||||
<Guid>{1E3BC2CB-4AC7-46BB-AF63-11DEA8628E3C}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="CpIndexesLib">
|
||||
<Guid>{3DC4496B-C823-4440-ABD4-A248A716F7C6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="CPSYSDIBLib">
|
||||
<Guid>{9C31B76A-7189-49A3-9781-3C6DD6ED5AD3}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
@@ -111,6 +158,15 @@
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="CPTRADELib">
|
||||
<Guid>{1F7D5E5A-05AB-4236-B6F3-3D383B09203A}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="CPUTILLib">
|
||||
<Guid>{2DA9C35C-FE59-4A32-A942-325EE8A6F659}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
|
||||
Reference in New Issue
Block a user