Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Demo/OpenQuant.API.chm
Binary file not shown.
Binary file added Demo/OpenQuant.API.chw
Binary file not shown.
Binary file not shown.
Binary file added Demo/QuantBox.OQ.Demo.CLI/Debug/AssemblyInfo.obj
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.5:PlatformToolSet=v120:EnableManagedIncrementalBuild=true:VCToolArchitecture=Native32Bit
Debug|Win32|D:\用户目录\Documents\GitHub\OpenQuant\Demo\|
Binary file not shown.
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.oq.demo.cli.pch
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\vc120.pdb
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\stdafx.obj
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.oq.demo.cli.obj
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\assemblyinfo.obj
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\.netframework,version=v4.5.assemblyattributes.obj
c:\program files (x86)\smartquant ltd\openquant\bin\quantbox.oq.demo.cli.dll
c:\program files (x86)\smartquant ltd\openquant\bin\quantbox.oq.demo.cli.pdb
c:\program files (x86)\smartquant ltd\openquant\bin\openquant.api.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.providers.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.instruments.dll
c:\program files (x86)\smartquant ltd\openquant\bin\openquant.objectmap.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.charting.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.series.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.execution.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.data.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.fix.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.quant.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.dll
c:\program files (x86)\smartquant ltd\openquant\bin\openquant.config.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.fixdata.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.file.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.services.dll
c:\program files (x86)\smartquant ltd\openquant\bin\sharpziplib.dll
c:\program files (x86)\smartquant ltd\openquant\bin\smartquant.xml.dll
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\app.res
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.oq.demo.cli.vcxprojresolveassemblyreference.cache
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\cl.command.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\cl.read.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\cl.write.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\link.command.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\link.read.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\link.write.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\metagen.read.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\metagen.write.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\quantbox.oq.demo.cli.write.1u.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\rc.command.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\rc.read.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\rc.write.1.tlog
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\rsaenh.dll.bi
d:\用户目录\documents\github\openquant\demo\quantbox.oq.demo.cli\debug\quantbox.12bb57a6.tlog\tzres.dll.bi
28 changes: 28 additions & 0 deletions Demo/QuantBox.OQ.Demo.CLI/Debug/QuantBox.OQ.Demo.CLI.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
生成启动时间为 2014/5/10 21:39:45。
1>项目“D:\用户目录\Documents\GitHub\OpenQuant\Demo\QuantBox.OQ.Demo.CLI\QuantBox.OQ.Demo.CLI.vcxproj”在节点 2 上(Rebuild 个目标)。
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(357,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1>ClCompile:
D:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\\" /AI"C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral" /AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\\" /Zi /clr /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDLL /D _UNICODE /D UNICODE /EHa /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"Debug\QuantBox.OQ.Demo.CLI.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /TP /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /FU"D:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin\OpenQuant.API.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /analyze- /errorReport:prompt /clr:nostdlib Stdafx.cpp
Stdafx.cpp
D:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\\" /AI"C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral" /AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\\" /Zi /clr /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDLL /D _UNICODE /D UNICODE /EHa /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\QuantBox.OQ.Demo.CLI.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /TP /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /FU"D:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin\OpenQuant.API.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /analyze- /errorReport:prompt /clr:nostdlib AssemblyInfo.cpp QuantBox.OQ.Demo.CLI.cpp
AssemblyInfo.cpp
1>AssemblyInfo.cpp(40): warning C4947: “RequestMinimum”: 标记为已过时
消息: “Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.”
QuantBox.OQ.Demo.CLI.cpp
正在生成代码...
D:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /Zi /clr /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDLL /D _UNICODE /D UNICODE /EHa /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc120.pdb" /TP /analyze- /errorReport:prompt "C:\Users\Administrator\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cpp"
.NETFramework,Version=v4.5.AssemblyAttributes.cpp
ResourceCompile:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe /D _UNICODE /D UNICODE /l"0x0409" /nologo /fo"Debug\app.res" app.rc
Link:
D:\Program Files\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin\QuantBox.OQ.Demo.CLI.dll" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin\QuantBox.OQ.Demo.CLI.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /DLL Debug\app.res
Debug\AssemblyInfo.obj
Debug\QuantBox.OQ.Demo.CLI.obj
Debug\Stdafx.obj
"Debug\.NETFramework,Version=v4.5.AssemblyAttributes.obj"
QuantBox.OQ.Demo.CLI.vcxproj -> C:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin\QuantBox.OQ.Demo.CLI.dll
1>已完成生成项目“D:\用户目录\Documents\GitHub\OpenQuant\Demo\QuantBox.OQ.Demo.CLI\QuantBox.OQ.Demo.CLI.vcxproj”(Rebuild 个目标)的操作。

生成成功。

已用时间 00:00:09.16
Binary file not shown.
Binary file added Demo/QuantBox.OQ.Demo.CLI/Debug/Stdafx.obj
Binary file not shown.
Binary file added Demo/QuantBox.OQ.Demo.CLI/Debug/app.res
Binary file not shown.
Binary file added Demo/QuantBox.OQ.Demo.CLI/Debug/vc120.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Demo/QuantBox.OQ.Demo.CLI/QuantBox.OQ.Demo.CLI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\..\..\..\Program Files %28x86%29\SmartQuant Ltd\OpenQuant\Bin</OutDir>
<OutDir>C:\Program Files (x86)\SmartQuant Ltd\OpenQuant\Bin</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down
Binary file added Demo/QuantBox.OQ.Demo.v12.suo
Binary file not shown.
72 changes: 36 additions & 36 deletions Demo/QuantBox.OQ.Demo/Data/DataConvert_code.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
using System;
using System.Drawing;
using OpenQuant.API;
using OpenQuant.API.Indicators;
using QuantBox.CSharp2CTP;
using QuantBox.Helper.CTP;
namespace QuantBox.OQ.Demo.Data
{
public class DataConvert_code:Strategy
{
CThostFtdcDepthMarketDataField DepthMarketData;
public override void OnTrade(Trade trade)
{
// 插件3.8.2.0 中开始可用,是将Trade数据中的深度数据取出
if (DataConvert.TryConvert(trade, ref DepthMarketData))
{
Console.WriteLine("OnTrade " + DepthMarketData.LastPrice);
Console.WriteLine("OnTrade " + DepthMarketData.UpperLimitPrice);
}
}
public override void OnQuote(Quote quote)
{
// 插件3.8.2.1 中开始可用,是将Quote数据中的深度数据取出
if (DataConvert.TryConvert(quote, ref DepthMarketData))
{
Console.WriteLine("OnQuote " + DepthMarketData.LastPrice);
Console.WriteLine("OnQuote " + DepthMarketData.UpperLimitPrice);
}
}
}
}
using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

using QuantBox.CSharp2CTP;
using QuantBox.Helper.CTP;

namespace QuantBox.OQ.Demo.Data
{
public class DataConvert_code:Strategy
{
CThostFtdcDepthMarketDataField DepthMarketData;

public override void OnTrade(Trade trade)
{
// 插件3.8.2.0 中开始可用,是将Trade数据中的深度数据取出
if (DataConvert.TryConvert(trade, ref DepthMarketData))
{
Console.WriteLine("OnTrade " + DepthMarketData.LastPrice);
Console.WriteLine("OnTrade " + DepthMarketData.UpperLimitPrice);
}
}

public override void OnQuote(Quote quote)
{
// 插件3.8.2.1 中开始可用,是将Quote数据中的深度数据取出
if (DataConvert.TryConvert(quote, ref DepthMarketData))
{
Console.WriteLine("OnQuote " + DepthMarketData.LastPrice);
Console.WriteLine("OnQuote " + DepthMarketData.UpperLimitPrice);
}
}
}
}
202 changes: 101 additions & 101 deletions Demo/QuantBox.OQ.Demo/Data/DataMaker_code.cs
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
using System;
using System.Drawing;
using OpenQuant.API;
using OpenQuant.API.Indicators;
namespace QuantBox.OQ.Demo.Data
{
/// <summary>
/// 通过策略运行的方式来生成价差序列
/// </summary>
public class DataMaker_code : Strategy
{
static Instrument Instrument1;
static Instrument Instrument2;
Instrument Instrument3 = InstrumentManager.Instruments["IF1305 - IF1306"];
long barSize;
public override void OnStrategyStart()
{
if (Instrument1 == null)
{
Instrument1 = Instrument;
}
else if (Instrument2 == null)
{
Instrument2 = Instrument;
}
barSize = long.MaxValue;
foreach (BarRequest barRequest in DataRequests.BarRequests)
{
barSize = Math.Min(barSize, barRequest.BarSize);
}
Console.WriteLine("barSize = {0}", barSize);
}
public override void OnStrategyStop()
{
Instrument1 = null;
Instrument2 = null;
}
public override void OnTrade(Trade trade)
{
// 只用第二个合约的生成,数量约为第二个合约的Trade数
// 假如第一个是IF1309,第二个是399300.SZ,这下生成的就6秒一次了
// 按自己需求调
if (Instrument == Instrument2)
{
if (Instrument1.Trade != null
&& Instrument2.Trade != null)
{
double Price = Instrument1.Trade.Price - Instrument2.Trade.Price;
int Size = Math.Min(Instrument1.Trade.Size, Instrument2.Trade.Size);
Trade t = new Trade(Clock.Now, Price, Size);
DataManager.Add(Instrument3, t);
}
}
}
public override void OnQuote(Quote quote)
{
// 只要有报价就会生成,数量约为两个合约Quote之和
//if(Instrument == Instrument2)
{
if (Instrument1.Quote != null
&& Instrument2.Quote != null)
{
double Ask = Instrument1.Quote.Ask - Instrument2.Quote.Bid;
int AskSize = Math.Min(Instrument1.Quote.AskSize, Instrument2.Quote.BidSize);
double Bid = Instrument1.Quote.Bid - Instrument2.Quote.Ask;
int BidSize = Math.Min(Instrument1.Quote.BidSize, Instrument2.Quote.AskSize);
Quote q = new Quote(Clock.Now, Bid, BidSize, Ask, AskSize);
DataManager.Add(Instrument3, q);
}
}
}
public override void OnBarSlice(long size)
{
// 为了保证采样间隔一样,用户按自己的需求改
if (size != barSize)
{
return;
}
// 如果添加了两个合约就会触发两次,只选后面一次保存
if (Instrument == Instrument2)
{
// 本想保存成Bar,细想没必要,保存了Trade,用户自己手工压缩成Bar就成
double Price = Instrument1.Bar.Close - Instrument2.Bar.Close;
Trade t = new Trade(Clock.Now, Price, 0);
// 注释了。在前面的OnTrade可以生成更细致的Trade
//DataManager.Add(Instrument3,t);
}
}
}
}
using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

namespace QuantBox.OQ.Demo.Data
{
/// <summary>
/// 通过策略运行的方式来生成价差序列
/// </summary>
public class DataMaker_code : Strategy
{
static Instrument Instrument1;
static Instrument Instrument2;
Instrument Instrument3 = InstrumentManager.Instruments["IF1305 - IF1306"];

long barSize;

public override void OnStrategyStart()
{
if (Instrument1 == null)
{
Instrument1 = Instrument;
}
else if (Instrument2 == null)
{
Instrument2 = Instrument;
}

barSize = long.MaxValue;
foreach (BarRequest barRequest in DataRequests.BarRequests)
{
barSize = Math.Min(barSize, barRequest.BarSize);
}
Console.WriteLine("barSize = {0}", barSize);
}

public override void OnStrategyStop()
{
Instrument1 = null;
Instrument2 = null;
}

public override void OnTrade(Trade trade)
{
// 只用第二个合约的生成,数量约为第二个合约的Trade数
// 假如第一个是IF1309,第二个是399300.SZ,这下生成的就6秒一次了
// 按自己需求调
if (Instrument == Instrument2)
{
if (Instrument1.Trade != null
&& Instrument2.Trade != null)
{
double Price = Instrument1.Trade.Price - Instrument2.Trade.Price;
int Size = Math.Min(Instrument1.Trade.Size, Instrument2.Trade.Size);
Trade t = new Trade(Clock.Now, Price, Size);
DataManager.Add(Instrument3, t);
}
}
}

public override void OnQuote(Quote quote)
{
// 只要有报价就会生成,数量约为两个合约Quote之和
//if(Instrument == Instrument2)
{
if (Instrument1.Quote != null
&& Instrument2.Quote != null)
{
double Ask = Instrument1.Quote.Ask - Instrument2.Quote.Bid;
int AskSize = Math.Min(Instrument1.Quote.AskSize, Instrument2.Quote.BidSize);
double Bid = Instrument1.Quote.Bid - Instrument2.Quote.Ask;
int BidSize = Math.Min(Instrument1.Quote.BidSize, Instrument2.Quote.AskSize);
Quote q = new Quote(Clock.Now, Bid, BidSize, Ask, AskSize);
DataManager.Add(Instrument3, q);
}
}
}

public override void OnBarSlice(long size)
{
// 为了保证采样间隔一样,用户按自己的需求改
if (size != barSize)
{
return;
}

// 如果添加了两个合约就会触发两次,只选后面一次保存
if (Instrument == Instrument2)
{
// 本想保存成Bar,细想没必要,保存了Trade,用户自己手工压缩成Bar就成
double Price = Instrument1.Bar.Close - Instrument2.Bar.Close;
Trade t = new Trade(Clock.Now, Price, 0);
// 注释了。在前面的OnTrade可以生成更细致的Trade
//DataManager.Add(Instrument3,t);
}
}
}

}
Loading