Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
576c1a146e | ||
| 9a8f11a285 | |||
| 67e7e332fb |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
26
Form1.Designer.cs
generated
26
Form1.Designer.cs
generated
@@ -30,6 +30,8 @@
|
|||||||
{
|
{
|
||||||
this.btSearchCode = new System.Windows.Forms.Button();
|
this.btSearchCode = new System.Windows.Forms.Button();
|
||||||
this.lbFutCode = new System.Windows.Forms.Label();
|
this.lbFutCode = new System.Windows.Forms.Label();
|
||||||
|
this.btCrawlingFuture = new System.Windows.Forms.Button();
|
||||||
|
this.btCrawlingOption = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btSearchCode
|
// btSearchCode
|
||||||
@@ -51,11 +53,33 @@
|
|||||||
this.lbFutCode.TabIndex = 1;
|
this.lbFutCode.TabIndex = 1;
|
||||||
this.lbFutCode.Text = "unknown";
|
this.lbFutCode.Text = "unknown";
|
||||||
//
|
//
|
||||||
|
// btCrawlingFuture
|
||||||
|
//
|
||||||
|
this.btCrawlingFuture.Location = new System.Drawing.Point(12, 104);
|
||||||
|
this.btCrawlingFuture.Name = "btCrawlingFuture";
|
||||||
|
this.btCrawlingFuture.Size = new System.Drawing.Size(160, 100);
|
||||||
|
this.btCrawlingFuture.TabIndex = 2;
|
||||||
|
this.btCrawlingFuture.Text = "Future Crawling";
|
||||||
|
this.btCrawlingFuture.UseVisualStyleBackColor = true;
|
||||||
|
this.btCrawlingFuture.Click += new System.EventHandler(this.btCrawling_Click);
|
||||||
|
//
|
||||||
|
// btCrawlingOption
|
||||||
|
//
|
||||||
|
this.btCrawlingOption.Location = new System.Drawing.Point(231, 104);
|
||||||
|
this.btCrawlingOption.Name = "btCrawlingOption";
|
||||||
|
this.btCrawlingOption.Size = new System.Drawing.Size(143, 100);
|
||||||
|
this.btCrawlingOption.TabIndex = 3;
|
||||||
|
this.btCrawlingOption.Text = "Option Crawling";
|
||||||
|
this.btCrawlingOption.UseVisualStyleBackColor = true;
|
||||||
|
this.btCrawlingOption.Click += new System.EventHandler(this.btCrawlingOption_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(386, 405);
|
this.ClientSize = new System.Drawing.Size(386, 405);
|
||||||
|
this.Controls.Add(this.btCrawlingOption);
|
||||||
|
this.Controls.Add(this.btCrawlingFuture);
|
||||||
this.Controls.Add(this.lbFutCode);
|
this.Controls.Add(this.lbFutCode);
|
||||||
this.Controls.Add(this.btSearchCode);
|
this.Controls.Add(this.btSearchCode);
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
@@ -69,6 +93,8 @@
|
|||||||
|
|
||||||
private System.Windows.Forms.Button btSearchCode;
|
private System.Windows.Forms.Button btSearchCode;
|
||||||
private System.Windows.Forms.Label lbFutCode;
|
private System.Windows.Forms.Label lbFutCode;
|
||||||
|
private System.Windows.Forms.Button btCrawlingFuture;
|
||||||
|
private System.Windows.Forms.Button btCrawlingOption;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
162
Form1.cs
162
Form1.cs
@@ -7,17 +7,27 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
namespace future_crawler
|
namespace future_crawler
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
MySqlConnection m_DBCon;
|
||||||
|
|
||||||
CPUTILLib.CpFutureCode m_FutCode = new CPUTILLib.CpFutureCode();
|
CPUTILLib.CpFutureCode m_FutCode = new CPUTILLib.CpFutureCode();
|
||||||
string m_strTargetFutCode;
|
string m_strTargetFutCode = "101K9";
|
||||||
|
string m_strTargetOptCode = "201K7255";
|
||||||
|
|
||||||
|
CPSYSDIBLib.FutOptChart m_FutOpChart = new CPSYSDIBLib.FutOptChart();
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
string strConn = "Server=mjjo53.us.to;Database=futopt;Uid=mjjo;Pwd=whaudwls;";
|
||||||
|
m_DBCon = new MySqlConnection(strConn);
|
||||||
|
m_DBCon.Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btSearchCode_Click(object sender, EventArgs e)
|
private void btSearchCode_Click(object sender, EventArgs e)
|
||||||
@@ -34,5 +44,155 @@ namespace future_crawler
|
|||||||
m_strTargetFutCode = (string)m_FutCode.GetData(0, 0);
|
m_strTargetFutCode = (string)m_FutCode.GetData(0, 0);
|
||||||
lbFutCode.Text = m_strTargetFutCode;
|
lbFutCode.Text = m_strTargetFutCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btCrawling_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// 필드값
|
||||||
|
//0: 날짜(ulong)
|
||||||
|
//1:시간(ulong) - hhmm(단, 차트구분을 초('S')로 설정한 경우에는 hhmmss)
|
||||||
|
//2:시가(ulong or float)
|
||||||
|
//3:고가(ulong or float)
|
||||||
|
//4:저가(ulong or float)
|
||||||
|
//5:종가(ulong or float)
|
||||||
|
//6:전일대비(long or float)
|
||||||
|
//8:거래량(ulong or ulonglong)
|
||||||
|
//9:거래대금(ulonglong)
|
||||||
|
//10:누적체결매도수량(ulong or ulonglong) - 주) 분,틱 요청일 때만 제공
|
||||||
|
//11:누적체결매수수량(ulong or ulonglong) - 주) 분,틱 요청일 때만 제공
|
||||||
|
//12: 사용하지 않음
|
||||||
|
//13: 사용하지 않음
|
||||||
|
//14: 사용하지 않음
|
||||||
|
//15: 사용하지 않음
|
||||||
|
//16: 사용하지 않음
|
||||||
|
//17: 사용하지 않음
|
||||||
|
//18:수정주가일자(ulong) - YYYYMMDD
|
||||||
|
//19:수정주가비율(float)
|
||||||
|
//20:기관순매수(long)
|
||||||
|
//21:기관누적순매수(long)
|
||||||
|
//22: 사용하지 않음
|
||||||
|
//23: 사용하지 않음
|
||||||
|
//24: 사용하지 않음
|
||||||
|
//25: 사용하지 않음
|
||||||
|
//26: 사용하지 않음
|
||||||
|
//27: 미결제약정
|
||||||
|
//28: 선물이론가(선물 일간데이터에서만 제공)
|
||||||
|
//29: 베이시스
|
||||||
|
//30: 옵션이론가 (옵션일 때만 제공)
|
||||||
|
//31: IV
|
||||||
|
//32: Delta
|
||||||
|
//33: Gamma
|
||||||
|
//34: Theta
|
||||||
|
//35: Vaga
|
||||||
|
//36: Rho
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m_FutOpChart.SetInputValue(0, m_strTargetFutCode);
|
||||||
|
m_FutOpChart.SetInputValue(1, '1');
|
||||||
|
m_FutOpChart.SetInputValue(2, 20150618);
|
||||||
|
m_FutOpChart.SetInputValue(3, 20150618);
|
||||||
|
m_FutOpChart.SetInputValue(4, 0);
|
||||||
|
m_FutOpChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 20 });
|
||||||
|
m_FutOpChart.SetInputValue(6, 'S');
|
||||||
|
m_FutOpChart.SetInputValue(7, 1);
|
||||||
|
m_FutOpChart.SetInputValue(8, '0');
|
||||||
|
m_FutOpChart.SetInputValue(9, '0');
|
||||||
|
|
||||||
|
int iResult = m_FutOpChart.BlockRequest2(1);
|
||||||
|
if (iResult != 0)
|
||||||
|
MessageBox.Show("결과가 이상함");
|
||||||
|
|
||||||
|
|
||||||
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
|
|
||||||
|
bool bContinue = true;
|
||||||
|
while (bContinue == true)
|
||||||
|
{
|
||||||
|
MySqlTransaction trans = m_DBCon.BeginTransaction();
|
||||||
|
cmd.Connection = m_DBCon;
|
||||||
|
cmd.Transaction = trans;
|
||||||
|
|
||||||
|
int iCnt = m_FutOpChart.GetHeaderValue(3);
|
||||||
|
int iFieldCnt = m_FutOpChart.GetHeaderValue(1);
|
||||||
|
for (int i = 0; i < iCnt; i++)
|
||||||
|
{
|
||||||
|
ulong date = m_FutOpChart.GetDataValue(0, i);
|
||||||
|
ulong time = m_FutOpChart.GetDataValue(1, i);
|
||||||
|
float fp = m_FutOpChart.GetDataValue(2, i);
|
||||||
|
object deal_amount = m_FutOpChart.GetDataValue(3, i);
|
||||||
|
object deal_cash = m_FutOpChart.GetDataValue(4, i);
|
||||||
|
int comp_bid = m_FutOpChart.GetDataValue(5, i);
|
||||||
|
|
||||||
|
string strTime = string.Format("{0:d04}-{1:d02}-{2:d02} {3:d02}:{4:d02}:{5:d02}", date / 10000, (date % 10000) / 100, date % 100, time / 10000, (time % 10000) / 100, time % 100);
|
||||||
|
|
||||||
|
cmd.CommandText = string.Format("insert into future_list(code,date,fin_price,deal_amount,deal_cash,comp_bid) values('{0}','{1}',{2},{3},{4},{5})",
|
||||||
|
m_strTargetFutCode, strTime, fp, deal_amount, deal_cash, comp_bid);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine(string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", m_strTargetFutCode, date, time, fp, deal_amount, deal_cash, comp_bid));
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
|
||||||
|
bContinue = (m_FutOpChart.Continue == 1);
|
||||||
|
iResult = m_FutOpChart.BlockRequest2(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("end.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btCrawlingOption_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
m_FutOpChart.SetInputValue(0, m_strTargetOptCode);
|
||||||
|
m_FutOpChart.SetInputValue(1, '1');
|
||||||
|
m_FutOpChart.SetInputValue(2, 20150618);
|
||||||
|
m_FutOpChart.SetInputValue(3, 20150618);
|
||||||
|
m_FutOpChart.SetInputValue(4, 0);
|
||||||
|
m_FutOpChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 20 });
|
||||||
|
m_FutOpChart.SetInputValue(6, 'S');
|
||||||
|
m_FutOpChart.SetInputValue(7, 1);
|
||||||
|
m_FutOpChart.SetInputValue(8, '0');
|
||||||
|
m_FutOpChart.SetInputValue(9, '0');
|
||||||
|
|
||||||
|
int iResult = m_FutOpChart.BlockRequest2(1);
|
||||||
|
if (iResult != 0)
|
||||||
|
MessageBox.Show("결과가 이상함");
|
||||||
|
|
||||||
|
|
||||||
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
|
|
||||||
|
bool bContinue = true;
|
||||||
|
while (bContinue == true)
|
||||||
|
{
|
||||||
|
MySqlTransaction trans = m_DBCon.BeginTransaction();
|
||||||
|
cmd.Connection = m_DBCon;
|
||||||
|
cmd.Transaction = trans;
|
||||||
|
|
||||||
|
int iCnt = m_FutOpChart.GetHeaderValue(3);
|
||||||
|
int iFieldCnt = m_FutOpChart.GetHeaderValue(1);
|
||||||
|
for (int i = 0; i < iCnt; i++)
|
||||||
|
{
|
||||||
|
ulong date = m_FutOpChart.GetDataValue(0, i);
|
||||||
|
ulong time = m_FutOpChart.GetDataValue(1, i);
|
||||||
|
float fp = m_FutOpChart.GetDataValue(2, i);
|
||||||
|
object deal_amount = m_FutOpChart.GetDataValue(3, i);
|
||||||
|
object deal_cash = m_FutOpChart.GetDataValue(4, i);
|
||||||
|
int comp_bid = m_FutOpChart.GetDataValue(5, i);
|
||||||
|
|
||||||
|
string strTime = string.Format("{0:d04}-{1:d02}-{2:d02} {3:d02}:{4:d02}:{5:d02}", date / 10000, (date % 10000) / 100, date % 100, time / 10000, (time % 10000) / 100, time % 100);
|
||||||
|
|
||||||
|
cmd.CommandText = string.Format("insert into option_list(code,date,fin_price,deal_amount,deal_cash,comp_bid) values('{0}','{1}',{2},{3},{4},{5})",
|
||||||
|
m_strTargetOptCode, strTime, fp, deal_amount, deal_cash, comp_bid);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine(string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", m_strTargetOptCode, date, time, fp, deal_amount, deal_cash, comp_bid));
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
|
||||||
|
bContinue = (m_FutOpChart.Continue == 1);
|
||||||
|
iResult = m_FutOpChart.BlockRequest2(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("end.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
Properties/app.manifest
Normal file
54
Properties/app.manifest
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- UAC Manifest Options
|
||||||
|
If you want to change the Windows User Account Control level replace the
|
||||||
|
requestedExecutionLevel node with one of the following.
|
||||||
|
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||||
|
If you want to utilize File and Registry Virtualization for backward
|
||||||
|
compatibility then delete the requestedExecutionLevel node.
|
||||||
|
-->
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
<applicationRequestMinimum>
|
||||||
|
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||||
|
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
|
||||||
|
</applicationRequestMinimum>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- A list of all Windows versions that this application is designed to work with.
|
||||||
|
Windows will automatically select the most compatible environment.-->
|
||||||
|
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
|
||||||
|
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
|
||||||
|
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||||
|
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||||
|
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
|
||||||
|
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
|
||||||
|
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node-->
|
||||||
|
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>-->
|
||||||
|
</asmv1:assembly>
|
||||||
@@ -31,7 +31,17 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<GenerateManifests>false</GenerateManifests>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -64,6 +74,9 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<None Include="Properties\app.manifest">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@@ -78,6 +91,15 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<COMReference Include="CPSYSDIBLib">
|
||||||
|
<Guid>{9C31B76A-7189-49A3-9781-3C6DD6ED5AD3}</Guid>
|
||||||
|
<VersionMajor>1</VersionMajor>
|
||||||
|
<VersionMinor>0</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>tlbimp</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
<COMReference Include="CPUTILLib">
|
<COMReference Include="CPUTILLib">
|
||||||
<Guid>{2DA9C35C-FE59-4A32-A942-325EE8A6F659}</Guid>
|
<Guid>{2DA9C35C-FE59-4A32-A942-325EE8A6F659}</Guid>
|
||||||
<VersionMajor>1</VersionMajor>
|
<VersionMajor>1</VersionMajor>
|
||||||
|
|||||||
69262
result/result.htm
Normal file
69262
result/result.htm
Normal file
File diff suppressed because it is too large
Load Diff
22
sql/create.sql
Normal file
22
sql/create.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
CREATE TABLE option_list
|
||||||
|
(
|
||||||
|
seq INT NOT NULL AUTO_INCREMENT,
|
||||||
|
CODE VARCHAR(10),
|
||||||
|
DATE DATETIME,
|
||||||
|
fin_price FLOAT,
|
||||||
|
deal_amount INT,
|
||||||
|
deal_cash BIGINT,
|
||||||
|
comp_bid INT,
|
||||||
|
PRIMARY KEY(seq)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
drop table if exist futopt_list
|
||||||
|
create table futopt_list
|
||||||
|
(
|
||||||
|
seq int auto_increment,
|
||||||
|
deal_cash bigint,
|
||||||
|
date datetime,
|
||||||
|
fin_price float,
|
||||||
|
primary key(seq)
|
||||||
|
);
|
||||||
50
sql/search.sql
Normal file
50
sql/search.sql
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
SELECT * FROM option_list o WHERE future_list
|
||||||
|
SELECT o.date FROM option_list o IN (SELECT DATE FROM future_list f WHERE deal_cash >= 10000000000)
|
||||||
|
|
||||||
|
-- 특정 시간부터 30초 동안 현재가와 죄소값, 최대값
|
||||||
|
SELECT o.fin_price
|
||||||
|
FROM option_list o
|
||||||
|
WHERE o.date='2015-06-18 14:50:01'
|
||||||
|
|
||||||
|
SELECT o.fin_price, MAX(o.fin_price), MIN(o.fin_price)
|
||||||
|
FROM option_list o
|
||||||
|
WHERE o.date>='2015-06-18 14:50:01' AND o.date<=DATE_ADD('2015-06-18 14:50:01', INTERVAL 30 SECOND)
|
||||||
|
|
||||||
|
|
||||||
|
-- 100억이상의 거래량이 나온 시간의 옵션
|
||||||
|
SELECT sl.* FROM
|
||||||
|
(SELECT o.* FROM option_list o LEFT OUTER JOIN future_list f ON o.date=f.date AND f.deal_cash >= 10000000000) AS sl
|
||||||
|
|
||||||
|
|
||||||
|
-- 100억이상의 거래량이 나온 시간의 옵션과 향후 30초 동안의 옵션들
|
||||||
|
SELECT sl.deal_cash, sl.date, o2.date, o2.fin_price
|
||||||
|
FROM
|
||||||
|
(SELECT f.deal_cash, o.date FROM option_list o LEFT OUTER JOIN future_list f ON o.date=f.date AND f.deal_cash >= 10000000000) AS sl
|
||||||
|
LEFT OUTER JOIN option_list o2
|
||||||
|
ON o2.date>=sl.date AND o2.date<=DATE_ADD(sl.date, INTERVAL 30 SECOND)
|
||||||
|
|
||||||
|
|
||||||
|
-- 100억이상의 거래량이 나온 시간의 옵션과 향후 30초 동안의 옵션들 중 fin_price, min, max
|
||||||
|
SELECT sl.deal_cash, sl.date, o2.date, sl.fin_price, MIN(o2.fin_price), MAX(o2.fin_price)
|
||||||
|
FROM
|
||||||
|
(SELECT f.deal_cash, o.date, o.fin_price
|
||||||
|
FROM option_list o LEFT OUTER JOIN future_list f
|
||||||
|
ON o.date=f.date AND f.deal_cash >= 10000000000) AS sl
|
||||||
|
LEFT OUTER JOIN option_list o2
|
||||||
|
ON o2.date>=sl.date AND o2.date<=DATE_ADD(sl.date, INTERVAL 30 SECOND)
|
||||||
|
GROUP BY sl.date
|
||||||
|
|
||||||
|
|
||||||
|
-- procedure
|
||||||
|
insert into futopt_list(deal_cash, date, fin_price)
|
||||||
|
|
||||||
|
SELECT f.deal_cash as deal_cash, o.date as date, o.fin_price as fin_price
|
||||||
|
FROM future_list f LEFT OUTER JOIN option_list o
|
||||||
|
ON f.deal_cash >= 10000000000 and o.date!=null
|
||||||
|
|
||||||
|
|
||||||
|
select * from futopt_list
|
||||||
|
|
||||||
|
|
||||||
|
create procedure futopt.FindBigDeal()
|
||||||
|
BEGIN
|
||||||
Reference in New Issue
Block a user