From 0b77aa319531b27d281450992943632bb0eeeb16 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 00:53:26 +0000 Subject: [PATCH 01/17] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0=EF=BC=9Aall=5Fday=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E4=BA=A4=E6=98=93simnow7*24=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=82=E6=95=B0=EF=BC=9Aall=5Fday=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E4=BA=A4=E6=98=93simnow724?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- bin/runtime724.ini | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bin/runtime724.ini diff --git a/bin/runtime724.ini b/bin/runtime724.ini new file mode 100644 index 0000000..9e52524 --- /dev/null +++ b/bin/runtime724.ini @@ -0,0 +1,32 @@ +[include] +section_config = ./section.csv +[actual_market] +market = ctp +front = tcp://180.168.146.187:10131 +broker = 9999 +userid = +passwd = + +[actual_trader] +trader = ctp +front = tcp://180.168.146.187:10130 +broker = 9999 +userid = +passwd = +appid = simnow_client_test +authcode = 0000000000000000 +prodict = lightning + + +[recorder] +type = csv +basic_path = ./record/runtime/ + + +[control] +localdb_name = runtime +userdata_size = 1024 +position_limit = 45 +fast_mode = false +loop_interval = 10000 +all_day = true -- Gitee From 50980c72a09bf3ca2b0e86edb5202b06211e1b28 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:00:41 +0000 Subject: [PATCH 02/17] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20LTRunner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LTRunner/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/LTRunner/.keep diff --git a/src/LTRunner/.keep b/src/LTRunner/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From 70530c7bbbafab909116298a35b4825ac716df31 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:01:10 +0000 Subject: [PATCH 03/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20sr?= =?UTF-8?q?c/LTRunner/.keep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LTRunner/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/LTRunner/.keep diff --git a/src/LTRunner/.keep b/src/LTRunner/.keep deleted file mode 100644 index e69de29..0000000 -- Gitee From e3b6aaa53b4ebd00a86f7a19ccfd2f98a8665811 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:03:42 +0000 Subject: [PATCH 04/17] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20LTRunner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LTRunner/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/LTRunner/.keep diff --git a/src/LTRunner/.keep b/src/LTRunner/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From 24974dc753f0f95d8c365473dd60a5167f11a59c Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:04:22 +0000 Subject: [PATCH 05/17] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=92=8C=E5=9B=9E=E6=B5=8B=E5=88=86=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/LTRunner/CMakeLists.txt | 24 +++++++++++++++ src/LTRunner/LTRunner.cpp | 60 +++++++++++++++++++++++++++++++++++++ src/LTRunner/LTRunner.h | 3 ++ src/LTRunner/build_debug.sh | 6 ++++ 4 files changed, 93 insertions(+) create mode 100644 src/LTRunner/CMakeLists.txt create mode 100644 src/LTRunner/LTRunner.cpp create mode 100644 src/LTRunner/LTRunner.h create mode 100644 src/LTRunner/build_debug.sh diff --git a/src/LTRunner/CMakeLists.txt b/src/LTRunner/CMakeLists.txt new file mode 100644 index 0000000..ce86cbc --- /dev/null +++ b/src/LTRunner/CMakeLists.txt @@ -0,0 +1,24 @@ +# CMakeList.txt: CMake 项目,在此处包括源代码并定义 +# 项目特定的逻辑。 +# +cmake_minimum_required (VERSION 3.8) + +IF(UNIX) + SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} + "${PROJECT_SOURCE_DIR}/../api/v6.6.9_traderapi_20220920/v6.6.9_20220914_api_linux64/" + ) +ENDIF() + +include_directories(${CMAKE_INCLUDE_PATH}) +link_directories(${CMAKE_LIBRARY_PATH}) + +add_executable(LTRunner "LTRunner.cpp" "../example/marketing_strategy.cpp") + +target_link_libraries(LTRunner "framework") + +if (CMAKE_VERSION VERSION_GREATER 3.12) + set_property(TARGET LTRunner PROPERTY CXX_STANDARD 20) +endif() + +# TODO: 如有需要,请添加测试并安装目标。 + diff --git a/src/LTRunner/LTRunner.cpp b/src/LTRunner/LTRunner.cpp new file mode 100644 index 0000000..4ebdfd0 --- /dev/null +++ b/src/LTRunner/LTRunner.cpp @@ -0,0 +1,60 @@ +// 目标的源文件。 +// + +#include "LTRunner.h" +#include +#include "runtime_engine.h" +#include "evaluate_engine.h" +#include "../example/marketing_strategy.h" + + +void start_runtime(const char* account_config, const code_t& code) +{ + lt::runtime_engine app(account_config); + + std::vector> strategys; + + strategys.emplace_back(std::make_shared(1, app, code, 1, 1)); + + app.set_trading_filter([&app](const code_t& code, offset_type offset, direction_type direction, uint32_t count, double_t price, order_flag flag)->bool { + auto now = app.get_last_time(); + auto last_order = app.last_order_time(); + + return true;//暂时先不用过滤, + + if (now - last_order < 1) + { + return false; + } + return true; + }); + + app.run_to_close(strategys); +} + + +int main(int argc,char* argv[]) +{ + //start_runtime("runtime.ini", "SHFE.ni2309"); + + if(argc ==1)//main (argc=1, argv=0x7fffffffdfb8) + { + LOG_ERROR("start atgc error"); + return -1; + } + + // if (std::strcmp("runtime", argv[1]) == 0) + // { + // } + + const char* account_file = argv[1]; + //const char* strategy_file = argv[3]; + //LOG_INFO("start runtime for %s %s\n", account_file, strategy_file); + //start_runtime(account_file, strategy_file); + + start_runtime(account_file, "SHFE.rb2310"); + + + + return 0; +} diff --git a/src/LTRunner/LTRunner.h b/src/LTRunner/LTRunner.h new file mode 100644 index 0000000..250b1d2 --- /dev/null +++ b/src/LTRunner/LTRunner.h @@ -0,0 +1,3 @@ +// example.h: 目标的头文件。 + +#pragma once diff --git a/src/LTRunner/build_debug.sh b/src/LTRunner/build_debug.sh new file mode 100644 index 0000000..acbabac --- /dev/null +++ b/src/LTRunner/build_debug.sh @@ -0,0 +1,6 @@ +if [ ! -d "../build_debug" ];then +mkdir build_debug +fi +cd build_debug +cmake -DCMAKE_BUILD_TYPE=Debug .. +make -- Gitee From 6d6857e524683879013f7ceacfc342ed75d85535 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:04:40 +0000 Subject: [PATCH 06/17] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20LTBtRunner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LTBtRunner/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/LTBtRunner/.keep diff --git a/src/LTBtRunner/.keep b/src/LTBtRunner/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From 70b9fc6abac3af6547ae45ab0617b26ae5ea4b34 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:08:28 +0000 Subject: [PATCH 07/17] =?UTF-8?q?=E5=9B=9E=E6=B5=8B=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=EF=BC=8C=E8=BF=90=E8=A1=8C=E7=A8=8B=E5=BA=8F=E5=92=8C=E5=9B=9E?= =?UTF-8?q?=E6=B5=8B=E5=88=86=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/LTBtRunner/CMakeLists.txt | 24 ++++++++++++ src/LTBtRunner/LTBtRunner.cpp | 69 +++++++++++++++++++++++++++++++++++ src/LTBtRunner/LTBtRunner.h | 3 ++ src/LTBtRunner/build_debug.sh | 6 +++ 4 files changed, 102 insertions(+) create mode 100644 src/LTBtRunner/CMakeLists.txt create mode 100644 src/LTBtRunner/LTBtRunner.cpp create mode 100644 src/LTBtRunner/LTBtRunner.h create mode 100644 src/LTBtRunner/build_debug.sh diff --git a/src/LTBtRunner/CMakeLists.txt b/src/LTBtRunner/CMakeLists.txt new file mode 100644 index 0000000..1439935 --- /dev/null +++ b/src/LTBtRunner/CMakeLists.txt @@ -0,0 +1,24 @@ +# CMakeList.txt: gallop 的 CMake 项目,在此处包括源代码并定义 +# 项目特定的逻辑。 +# +cmake_minimum_required (VERSION 3.8) + +IF(UNIX) + SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} + "${PROJECT_SOURCE_DIR}/../api/v6.6.9_traderapi_20220920/v6.6.9_20220914_api_linux64/" + ) +ENDIF() + +include_directories(${CMAKE_INCLUDE_PATH}) +link_directories(${CMAKE_LIBRARY_PATH}) + +add_executable(LTBtRunner "LTBtRunner.cpp" "../example/marketing_strategy.cpp") + +target_link_libraries(LTBtRunner "framework") + +if (CMAKE_VERSION VERSION_GREATER 3.12) + set_property(TARGET LTBtRunner PROPERTY CXX_STANDARD 20) +endif() + +# TODO: 如有需要,请添加测试并安装目标。 + diff --git a/src/LTBtRunner/LTBtRunner.cpp b/src/LTBtRunner/LTBtRunner.cpp new file mode 100644 index 0000000..6fe54f5 --- /dev/null +++ b/src/LTBtRunner/LTBtRunner.cpp @@ -0,0 +1,69 @@ +// 目标的源文件。 +// + +#include "LTBtRunner.h" +#include +#include "runtime_engine.h" +#include "evaluate_engine.h" +#include "../example/marketing_strategy.h" + + + +void start_evaluate(const char* account_config, const code_t& code, const std::vector& trading_days) +{ + lt::evaluate_engine app(account_config); + + std::vector> strategys; + + strategys.emplace_back(std::make_shared(2, app, code, 1, 1)); + + + app.set_trading_filter([&app](const code_t& code, offset_type offset, direction_type direction, uint32_t count, double_t price, order_flag flag)->bool { + auto now = app.get_last_time(); + auto last_order = app.last_order_time(); + + return true;//暂时先不过滤, + + if (now - last_order < 1) + { + return false; + } + return true; + }); + + for (auto& trading_day : trading_days) + { + app.back_test(strategys, trading_day); + } +} + + +int main(int argc,char* argv[]) +{ + //std::vector trading_days{ 20220801, 20220802, 20220803, 20220804, 20220805 }; + //start_evaluate("evaluate.ini", "SHFE.rb2210", trading_days); + + + if(argc ==1)//main (argc=1, argv=0x7fffffffdfb8) + { + LOG_ERROR("start atgc error"); + return -1; + } + // if (std::strcmp("evaluate", argv[1]) == 0) + // { + + const char* account_file = argv[1]; + //const char* strategy_file = argv[3]; + //const char* trading_day_file = argv[4]; + //LOG_INFO("start evaluate for %s %s %s\n", account_file, strategy_file, trading_day_file); + //start_evaluate(account_file, strategy_file, trading_day_file); + + std::vector trading_days{ 20220801, 20220802, 20220803, 20220804, 20220805 }; + start_evaluate(account_file, "SHFE.rb2210", trading_days); + // } + + + + + return 0; +} diff --git a/src/LTBtRunner/LTBtRunner.h b/src/LTBtRunner/LTBtRunner.h new file mode 100644 index 0000000..250b1d2 --- /dev/null +++ b/src/LTBtRunner/LTBtRunner.h @@ -0,0 +1,3 @@ +// example.h: 目标的头文件。 + +#pragma once diff --git a/src/LTBtRunner/build_debug.sh b/src/LTBtRunner/build_debug.sh new file mode 100644 index 0000000..acbabac --- /dev/null +++ b/src/LTBtRunner/build_debug.sh @@ -0,0 +1,6 @@ +if [ ! -d "../build_debug" ];then +mkdir build_debug +fi +cd build_debug +cmake -DCMAKE_BUILD_TYPE=Debug .. +make -- Gitee From c3fcf5a2942c828f8ae07ea9830fc10c7238f3cf Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:17:27 +0000 Subject: [PATCH 08/17] =?UTF-8?q?update=20src/include/time=5Futils.hpp?= =?UTF-8?q?=E7=9A=84make=5Fdatetime=E5=87=BD=E6=95=B0=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E8=A1=8C=EF=BC=9At.tm=5Fisdst=20=3D=20-1;=20?= =?UTF-8?q?t.tm=5Fisdst=20=3D=20-1;//=E6=B7=BB=E5=8A=A0=E8=BF=99=E4=B8=80?= =?UTF-8?q?=E8=A1=8C=E5=88=9D=E5=A7=8B=E5=8C=96tm=5Fisdst=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E7=84=B6mktime=E8=BF=94=E5=9B=9E=E5=80=BC=E6=81=92?= =?UTF-8?q?=E4=B8=BA-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/include/time_utils.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/include/time_utils.hpp b/src/include/time_utils.hpp index 836d5f5..fbd6dac 100644 --- a/src/include/time_utils.hpp +++ b/src/include/time_utils.hpp @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -28,6 +28,7 @@ static time_t make_datetime(int year, int month, int day, int hour=0, int minute t.tm_hour = hour; t.tm_min = minute; t.tm_sec = second; + return mktime(&t); } -- Gitee From d3d0deb288a0dfa773336c8aec5291b9b798f13a Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:18:17 +0000 Subject: [PATCH 09/17] =?UTF-8?q?update=20src/include/time=5Futils.hpp?= =?UTF-8?q?=E7=9A=84make=5Fdatetime=E5=87=BD=E6=95=B0=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E8=A1=8C=EF=BC=9At.tm=5Fisdst=20=3D=20-1;=20?= =?UTF-8?q?t.tm=5Fisdst=20=3D=20-1;//=E6=B7=BB=E5=8A=A0=E8=BF=99=E4=B8=80?= =?UTF-8?q?=E8=A1=8C=E5=88=9D=E5=A7=8B=E5=8C=96tm=5Fisdst=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E7=84=B6mktime=E8=BF=94=E5=9B=9E=E5=80=BC=E6=81=92?= =?UTF-8?q?=E4=B8=BA-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/include/time_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/time_utils.hpp b/src/include/time_utils.hpp index fbd6dac..b75954d 100644 --- a/src/include/time_utils.hpp +++ b/src/include/time_utils.hpp @@ -28,7 +28,7 @@ static time_t make_datetime(int year, int month, int day, int hour=0, int minute t.tm_hour = hour; t.tm_min = minute; t.tm_sec = second; - + t.tm_isdst = -1;//添加这一行初始化tm_isdst,不然mktime返回值恒为-1 return mktime(&t); } -- Gitee From 0bd5f776ca69cb59c1370486b63002b645f0de36 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:44:16 +0000 Subject: [PATCH 10/17] update src/market/ctp_market.cpp. Signed-off-by: zhuzhenping --- src/market/ctp_market.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/market/ctp_market.cpp b/src/market/ctp_market.cpp index 2183a7a..c3ad1fe 100644 --- a/src/market/ctp_market.cpp +++ b/src/market/ctp_market.cpp @@ -1,4 +1,4 @@ - + #include "ctp_market.h" #include #include @@ -41,7 +41,7 @@ bool ctp_market::init(const boost::property_tree::ptree& config) } catch (...) { - LOG_ERROR("ctp_trader init error "); + LOG_ERROR("ctp_market init error "); return false; } @@ -66,13 +66,13 @@ void ctp_market::OnRspError( CThostFtdcRspInfoField *pRspInfo, int nRequestID, b { if(pRspInfo) { - LOG_ERROR("Error:%d->%s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); + LOG_ERROR("OnRspError:%d->%s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); } } void ctp_market::OnFrontConnected() { - LOG_INFO("Connected : %s", _front_addr.c_str()); + LOG_INFO("OnFrontConnected : %s", _front_addr.c_str()); do_userlogin(); } @@ -80,11 +80,11 @@ void ctp_market::OnRspUserLogin( CThostFtdcRspUserLoginField *pRspUserLogin, CTh { if(pRspInfo) { - LOG_DEBUG("UserLogin : %d -> %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); + LOG_DEBUG("OnRspUserLogin : %d -> %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); } if(bIsLast) { - LOG_INFO("UserLogin : Market data server logined, {%s} {%s}", pRspUserLogin->TradingDay, pRspUserLogin->UserID); + LOG_INFO("OnRspUserLogin : Market data server logined, {%s} {%s}", pRspUserLogin->TradingDay, pRspUserLogin->UserID); //订阅行情数据 do_subscribe(); if(!_is_inited) @@ -98,13 +98,13 @@ void ctp_market::OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostF { if (pRspInfo) { - LOG_DEBUG("UserLogout : %d -> %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); + LOG_DEBUG("OnRspUserLogout : %d -> %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); } } void ctp_market::OnFrontDisconnected( int nReason ) { - LOG_INFO("FrontDisconnected : Reason -> %d", nReason); + LOG_INFO("OnFrontDisconnected : Reason -> %d", nReason); } @@ -114,7 +114,7 @@ void ctp_market::OnRtnDepthMarketData( CThostFtdcDepthMarketDataField *pDepthMar { return; } - LOG_DEBUG("MarketData = [%s] [%f]\n", pDepthMarketData->InstrumentID, pDepthMarketData->LastPrice); + LOG_DEBUG("OnRtnDepthMarketData = [%s] [%f]\n", pDepthMarketData->InstrumentID, pDepthMarketData->LastPrice); tick_info tick ; auto excg_it = _instrument_id_list.find(pDepthMarketData->InstrumentID); @@ -158,7 +158,7 @@ void ctp_market::OnRspSubMarketData( CThostFtdcSpecificInstrumentField *pSpecifi { if(pRspInfo) { - LOG_INFO("SubMarketData : code -> %d %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); + LOG_INFO("OnRspSubMarketData : code -> %d %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); } } @@ -166,7 +166,7 @@ void ctp_market::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField* pSpecif { if (pRspInfo) { - LOG_INFO("SubMarketData : code -> %d %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); + LOG_INFO("OnRspUnSubMarketData : code -> %d %s", pRspInfo->ErrorID, pRspInfo->ErrorMsg); } } -- Gitee From 97b9774601369d243503b9d4c5477b54d14d1569 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:46:56 +0000 Subject: [PATCH 11/17] update src/core/trading_section.cpp. Signed-off-by: zhuzhenping --- src/core/trading_section.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/trading_section.cpp b/src/core/trading_section.cpp index 260452f..a6c6dad 100644 --- a/src/core/trading_section.cpp +++ b/src/core/trading_section.cpp @@ -1,4 +1,4 @@ -#include "trading_section.h" +#include "trading_section.h" #include #include @@ -84,7 +84,7 @@ time_t trading_section::get_open_time() return frist_one->second; } -time_t trading_section::get_clase_time() +time_t trading_section::get_close_time() { auto last_one = _trading_section.rbegin(); if(last_one == _trading_section.rend()) -- Gitee From 88320b25ecec9c84dc680de0eb7220c0991660bb Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:47:24 +0000 Subject: [PATCH 12/17] update src/core/trading_section.h. Signed-off-by: zhuzhenping --- src/core/trading_section.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/trading_section.h b/src/core/trading_section.h index bfa2bc8..2611a47 100644 --- a/src/core/trading_section.h +++ b/src/core/trading_section.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include @@ -20,7 +20,7 @@ public: time_t get_open_time(); - time_t get_clase_time(); + time_t get_close_time(); }; -- Gitee From a3f9d812b04f8cbade232a5bc577bfdde42c2d9c Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 01:49:55 +0000 Subject: [PATCH 13/17] =?UTF-8?q?update=20src/core/context.cpp.=E6=9B=B4?= =?UTF-8?q?=E6=AD=A3=E4=B8=BAget=5Fclose=5Ftime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/core/context.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/context.cpp b/src/core/context.cpp index ccc70f8..c988c9c 100644 --- a/src/core/context.cpp +++ b/src/core/context.cpp @@ -1,4 +1,4 @@ -#include "context.h" +#include "context.h" #include #include #include @@ -439,7 +439,7 @@ time_t context::get_close_time() { return 0; } - return _section->get_clase_time(); + return _section->get_close_time(); } void context::use_custom_chain(untid_t untid,bool flag) -- Gitee From 695e21a84a258f6448ee4f8e6822d9cd1c0fbe57 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 02:00:49 +0000 Subject: [PATCH 14/17] =?UTF-8?q?update=20src/core/context.cpp.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9simnow7*24=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/core/context.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/context.cpp b/src/core/context.cpp index c988c9c..d0806d0 100644 --- a/src/core/context.cpp +++ b/src/core/context.cpp @@ -27,7 +27,8 @@ context::context(): _ready_callback(nullptr), _update_callback(nullptr), _last_tick_time(0), - realtime_event() + realtime_event(), + _all_day(false) { } @@ -69,6 +70,7 @@ void context::init(boost::property_tree::ptree& ctrl, boost::property_tree::ptre } _max_position = ctrl.get("position_limit", 10000); _fast_mode = ctrl.get("fast_mode", false); + _all_day = ctrl.get("all_day", false); _loop_interval = ctrl.get("loop_interval", 1); const auto& section_config = include_config.get("section_config", "./section.csv"); _section = std::make_shared(section_config); @@ -273,7 +275,7 @@ estid_t context::place_order(untid_t untid,offset_type offset, direction_type di LOG_DEBUG("place_order _is_trading_ready"); return INVALID_ESTID; } - if(!_section->is_in_trading(get_last_time())) + if(!_section->is_in_trading(get_last_time())&& !_all_day ) { LOG_DEBUG("place_order code not in trading %s", code.get_id()); return INVALID_ESTID; @@ -695,7 +697,7 @@ void context::handle_tick(const std::vector& param) _section->init(trading_day, last_tick.time); check_crossday(trading_day); } - if(!_section->is_in_trading(last_tick.time)) + if(!_section->is_in_trading(last_tick.time) && !_all_day) { return; } -- Gitee From 1fb038bf8a040ed19c52af8af8bbf702e1bb827f Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 02:02:49 +0000 Subject: [PATCH 15/17] =?UTF-8?q?update=20src/core/context.h.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9simnow724=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/core/context.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/context.h b/src/core/context.h index b22d917..2109a8c 100644 --- a/src/core/context.h +++ b/src/core/context.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include #include @@ -76,6 +76,8 @@ private: bool _fast_mode ; + bool _all_day ; + uint32_t _loop_interval ; std::map _previous_tick; -- Gitee From a9246481e8eb46b042d918677eb5d21555ed84d9 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 02:31:03 +0000 Subject: [PATCH 16/17] =?UTF-8?q?update=20src/CMakeLists.txt.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=8B=AC=E7=AB=8B=E7=9A=84=E5=AE=9E=E7=9B=98=E5=8F=8A?= =?UTF-8?q?=E5=9B=9E=E6=B5=8B=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce76f89..cf0b1ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置 +# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置 # 并包含子项目。 # cmake_minimum_required (VERSION 3.8) @@ -49,6 +49,10 @@ SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ) # 包含子项目。 +add_subdirectory ("LTBtRunner") + +add_subdirectory ("LTRunner") + add_subdirectory ("example") add_subdirectory("trader") -- Gitee From 190bdca47d4fadc083163a1cdfb22423ed1ba212 Mon Sep 17 00:00:00 2001 From: zhuzhenping Date: Mon, 10 Jul 2023 02:58:11 +0000 Subject: [PATCH 17/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhenping --- src/build_debug.sh | 6 ++++++ src/build_release.sh | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 src/build_debug.sh create mode 100644 src/build_release.sh diff --git a/src/build_debug.sh b/src/build_debug.sh new file mode 100644 index 0000000..acbabac --- /dev/null +++ b/src/build_debug.sh @@ -0,0 +1,6 @@ +if [ ! -d "../build_debug" ];then +mkdir build_debug +fi +cd build_debug +cmake -DCMAKE_BUILD_TYPE=Debug .. +make diff --git a/src/build_release.sh b/src/build_release.sh new file mode 100644 index 0000000..b06ce6d --- /dev/null +++ b/src/build_release.sh @@ -0,0 +1,6 @@ +if [ ! -d "../build_all" ];then +mkdir build_all +fi +cd build_all +cmake -DCMAKE_BUILD_TYPE=Release .. +make -j4 -- Gitee