Skip to content

Commit

Permalink
upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhuangxinyu1 committed Jun 18, 2020
1 parent c84c354 commit b3e1323
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 16 deletions.
10 changes: 1 addition & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 2.8)

SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -Wall -ggdb -fPIC")

project(hft)

add_subdirectory(src)
add_subdirectory(src cmake_src)
2 changes: 1 addition & 1 deletion config/backtest/backtest.config
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ strategy = (
// start_date = "yesterday";
test_mode = "nexttest";
start_date = "2019-11-01";
period = 10;
period = 1;

order_file = "order_backtest.dat";
exchange_file = "exchange_backtest.dat";
Expand Down
23 changes: 17 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
aux_source_directory(ctporder CTPORDER)
SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -Wall -ggdb -fPIC -pg")

include_directories(../external/common/include)
include_directories(../external/ctp/include)
Expand All @@ -9,9 +13,16 @@ link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/common/lib)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/ctp/lib)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/zeromq/lib)

link_directories(/home/nick/hft/external/common/lib)
link_directories(/home/nick/hft/external/ctp/lib)
link_directories(/home/nick/hft/external/zeromq/lib)
macro(compile arg1)
aux_source_directory(${arg1} ${arg1}_src)
add_executable(${arg1} ${${arg1}_src})
target_link_libraries(${arg1} pthread nick zmq thosttraderapi thostmduserapi config++ z)
endmacro(compile)

add_executable(ctporder ${CTPORDER})
target_link_libraries(ctporder pthread nick zmq thosttraderapi)
compile(ctpdata)
compile(ctporder)
compile(data_proxy)
compile(order_proxy)
compile(simplearb)
compile(simplearb2)
compile(backtest)
50 changes: 50 additions & 0 deletions src/bk_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -Wall -ggdb -fPIC")

# 定义一个宏,用来简化测试工作
macro (compile arg1)
aux_source_directory(${arg1} ${arg1})
add_executable(ctporder ${arg1})
target_link_libraries(ctporder pthread nick zmq thosttraderapi thostmduserapi config++)
endmacro (compile)

aux_source_directory(ctporder CTPORDER)
aux_source_directory(ctpdata CTPDATA)
aux_source_directory(data_proxy DATA_PROXY)
aux_source_directory(order_proxy ORDER_PROXY)
aux_source_directory(simplearb SIMPLEARB)
aux_source_directory(simplearb2 SIMPLEARB2)
aux_source_directory(backtest BACKTEST)

include_directories(../external/common/include)
include_directories(../external/ctp/include)
include_directories(../external/zeromq/include)
include_directories(.)

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/common/lib)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/ctp/lib)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/zeromq/lib)

add_executable(ctporder ${CTPORDER})
target_link_libraries(ctporder pthread nick zmq thosttraderapi config++)

add_executable(ctpdata ${CTPDATA})
target_link_libraries(ctpdata pthread nick zmq thostmduserapi config++)

add_executable(data_proxy ${DATA_PROXY})
target_link_libraries(data_proxy zmq)

add_executable(order_proxy ${ORDER_PROXY})
target_link_libraries(order_proxy zmq)

add_executable(simplearb ${SIMPLEARB})
target_link_libraries(simplearb pthread nick zmq config++)

add_executable(simplearb2 ${SIMPLEARB2})
target_link_libraries(simplearb2 pthread nick zmq config++)

add_executable(backtest ${BACKTEST})
target_link_libraries(backtest pthread nick zmq config++ z)

0 comments on commit b3e1323

Please sign in to comment.