From 53ee558b6ec2de25721f9fa2d45bda1aa691494a Mon Sep 17 00:00:00 2001 From: fasiondog Date: Tue, 7 May 2024 00:40:36 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20strategy=20=E5=8A=A0=E8=BD=BD=E6=9D=83?= =?UTF-8?q?=E6=81=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp | 4 ++-- .../data_driver/base_info/sqlite/SQLiteBaseInfoDriver.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp index 3fde4b3f..975513fb 100644 --- a/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp @@ -106,14 +106,14 @@ StockWeightList MySQLBaseInfoDriver::getStockWeightList(const string &market, co HKU_CHECK(con, "Failed fetch connect!"); vector table; + Datetime new_start = start.isNull() ? Datetime::min() : start; Datetime new_end = end.isNull() ? Datetime::max() : end; con->batchLoad( table, format( "stockid=(select stockid from stock where marketid=(select marketid from " "market where market='{}') and code='{}') and date>={} and date<{} order by date asc", - market, code, start.year() * 10000 + start.month() * 100 + start.day(), - new_end.year() * 10000 + new_end.month() * 100 + new_end.day())); + market, code, new_start.ymd(), new_end.ymd())); for (auto &w : table) { try { diff --git a/hikyuu_cpp/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.cpp index 06b9bf89..14e52345 100644 --- a/hikyuu_cpp/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.cpp @@ -127,14 +127,14 @@ StockWeightList SQLiteBaseInfoDriver::getStockWeightList(const string& market, c HKU_CHECK(con, "Failed fetch connect!"); vector table; + Datetime new_start = start.isNull() ? Datetime::min() : start; Datetime new_end = end.isNull() ? Datetime::max() : end; con->batchLoad( table, format( "stockid=(select stockid from stock where marketid=(select marketid from " "market where market='{}') and code='{}') and date>={} and date<{} order by date asc", - market, code, start.year() * 10000 + start.month() * 100 + start.day(), - new_end.year() * 10000 + new_end.month() * 100 + new_end.day())); + market, code, new_start.ymd(), new_end.ymd())); for (auto& w : table) { try {