├── CTPtest.sln
├── CTPtest
├── CF705_market_data.csv
├── CTPtest.vcxproj
├── CTPtest.vcxproj.filters
├── K_line_data.csv
├── TF1706_market_data.csv
├── al1712_market_data.csv
├── cs1801_market_data.csv
├── market_data.csv
└── zn1705_market_data.csv
├── Debug
├── thostmduserapi.dll
└── thosttraderapi.dll
├── LICENSE
├── README.md
└── src
├── CTP_API
├── ThostFtdcMdApi.h
├── ThostFtdcTraderApi.h
├── ThostFtdcUserApiDataType.h
├── ThostFtdcUserApiStruct.h
├── error.dtd
├── error.xml
├── thostmduserapi.dll
├── thostmduserapi.lib
├── thosttraderapi.dll
└── thosttraderapi.lib
├── CustomMdSpi.cpp
├── CustomMdSpi.h
├── CustomTradeSpi.cpp
├── CustomTradeSpi.h
├── StrategyTrade.cpp
├── StrategyTrade.h
├── TickToKlineHelper.cpp
├── TickToKlineHelper.h
└── main.cpp
/CTPtest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTPtest", "CTPtest\CTPtest.vcxproj", "{B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}.Debug|Win32.Build.0 = Debug|Win32
16 | {B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}.Release|Win32.ActiveCfg = Release|Win32
17 | {B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/CTPtest/CF705_market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/CF705_market_data.csv
--------------------------------------------------------------------------------
/CTPtest/CTPtest.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | {B6E4CF70-7540-45BB-9DBF-C49EAA6E32E8}
28 | CTPtest
29 |
30 |
31 |
32 | Application
33 | true
34 | v120
35 | MultiByte
36 |
37 |
38 | Application
39 | false
40 | v140
41 | true
42 | MultiByte
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | ..\src\CTP_API;$(IncludePath)
56 | ..\src\CTP_API;$(LibraryPath)
57 |
58 |
59 |
60 | Level3
61 | Disabled
62 | true
63 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
64 |
65 |
66 | true
67 |
68 |
69 |
70 |
71 | Level3
72 | MaxSpeed
73 | true
74 | true
75 | true
76 |
77 |
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/CTPtest/CTPtest.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 | 源文件
26 |
27 |
28 | 源文件
29 |
30 |
31 | 源文件
32 |
33 |
34 |
35 |
36 | 头文件
37 |
38 |
39 | 头文件
40 |
41 |
42 | 头文件
43 |
44 |
45 | 头文件
46 |
47 |
48 |
--------------------------------------------------------------------------------
/CTPtest/K_line_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/K_line_data.csv
--------------------------------------------------------------------------------
/CTPtest/TF1706_market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/TF1706_market_data.csv
--------------------------------------------------------------------------------
/CTPtest/al1712_market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/al1712_market_data.csv
--------------------------------------------------------------------------------
/CTPtest/cs1801_market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/cs1801_market_data.csv
--------------------------------------------------------------------------------
/CTPtest/market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/market_data.csv
--------------------------------------------------------------------------------
/CTPtest/zn1705_market_data.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/CTPtest/zn1705_market_data.csv
--------------------------------------------------------------------------------
/Debug/thostmduserapi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/Debug/thostmduserapi.dll
--------------------------------------------------------------------------------
/Debug/thosttraderapi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/Debug/thosttraderapi.dll
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Ethan He
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CTPtest
2 | 用ctp官方接口写的一个简单demo,具备行情、交易、k线数据以及策略功能,可以连接simnow模拟交易~
3 | 编译环境是windows+vs2015,如果要用在linux上,需要用linux版的ctp api
4 | # 博客地址
5 | http://blog.csdn.net/u012234115/article/details/70195889
6 | # 截图
7 | 
8 | 
9 | 
10 | 
11 | 
12 |
--------------------------------------------------------------------------------
/src/CTP_API/ThostFtdcMdApi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/ThostFtdcMdApi.h
--------------------------------------------------------------------------------
/src/CTP_API/ThostFtdcTraderApi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/ThostFtdcTraderApi.h
--------------------------------------------------------------------------------
/src/CTP_API/ThostFtdcUserApiDataType.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/ThostFtdcUserApiDataType.h
--------------------------------------------------------------------------------
/src/CTP_API/ThostFtdcUserApiStruct.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/ThostFtdcUserApiStruct.h
--------------------------------------------------------------------------------
/src/CTP_API/error.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/src/CTP_API/error.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/error.xml
--------------------------------------------------------------------------------
/src/CTP_API/thostmduserapi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/thostmduserapi.dll
--------------------------------------------------------------------------------
/src/CTP_API/thostmduserapi.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/thostmduserapi.lib
--------------------------------------------------------------------------------
/src/CTP_API/thosttraderapi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/thosttraderapi.dll
--------------------------------------------------------------------------------
/src/CTP_API/thosttraderapi.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CTP_API/thosttraderapi.lib
--------------------------------------------------------------------------------
/src/CustomMdSpi.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CustomMdSpi.cpp
--------------------------------------------------------------------------------
/src/CustomMdSpi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CustomMdSpi.h
--------------------------------------------------------------------------------
/src/CustomTradeSpi.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CustomTradeSpi.cpp
--------------------------------------------------------------------------------
/src/CustomTradeSpi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/CustomTradeSpi.h
--------------------------------------------------------------------------------
/src/StrategyTrade.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/StrategyTrade.cpp
--------------------------------------------------------------------------------
/src/StrategyTrade.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/StrategyTrade.h
--------------------------------------------------------------------------------
/src/TickToKlineHelper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/TickToKlineHelper.cpp
--------------------------------------------------------------------------------
/src/TickToKlineHelper.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/TickToKlineHelper.h
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tashaxing/CTPtest/645daa5644fe26fafc951881891ecbbf2b77a549/src/main.cpp
--------------------------------------------------------------------------------