diff --git a/hikyuu_cpp/demo/xmake.lua b/hikyuu_cpp/demo/xmake.lua index 4e4a7f39..c02d5f96 100644 --- a/hikyuu_cpp/demo/xmake.lua +++ b/hikyuu_cpp/demo/xmake.lua @@ -10,7 +10,7 @@ target("demo") add_cxflags("-wd4251") end - if is_plat("windows") and is_mode("release") then + if is_plat("windows") and get_config("kind") == "shared" then add_defines("HKU_API=__declspec(dllimport)") add_defines("SQLITE_API=__declspec(dllimport)") end diff --git a/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.cpp b/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.cpp index a18b3cdb..97c1d0d3 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.cpp @@ -7,6 +7,10 @@ #include "TradeCostBase.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::TradeCostBase) +#endif + namespace hku { HKU_API std::ostream& operator<<(std::ostream& os, const TradeCostBase& tc) { diff --git a/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.h b/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.h index 4c3b45ec..11d109bc 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.h +++ b/hikyuu_cpp/hikyuu/trade_manage/TradeCostBase.h @@ -17,7 +17,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp b/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp index edf31dc6..b651c6a5 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp @@ -14,6 +14,10 @@ #include "../trade_sys/system/SystemPart.h" #include "../KData.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::TradeManager) +#endif + namespace hku { string TradeManager::str() const { diff --git a/hikyuu_cpp/hikyuu/trade_manage/export.cpp b/hikyuu_cpp/hikyuu/trade_manage/export.cpp deleted file mode 100644 index 2e1eeeb3..00000000 --- a/hikyuu_cpp/hikyuu/trade_manage/export.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "TradeManager.h" -#include "imp/TradeCostStub.h" -#include "imp/FixedATradeCost.h" -#include "imp/ZeroTradeCost.h" -#include "imp/FixedA2015TradeCost.h" -#include "imp/FixedA2017TradeCost.h" - -BOOST_CLASS_EXPORT(hku::TradeManager) -BOOST_CLASS_EXPORT(hku::TradeManagerBase) -BOOST_CLASS_EXPORT(hku::TradeCostStub) -BOOST_CLASS_EXPORT(hku::FixedATradeCost) -BOOST_CLASS_EXPORT(hku::ZeroTradeCost) -BOOST_CLASS_EXPORT(hku::FixedA2015TradeCost) -BOOST_CLASS_EXPORT(hku::FixedA2017TradeCost) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2015TradeCost.cpp b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2015TradeCost.cpp index 53bc7093..beed6765 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2015TradeCost.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2015TradeCost.cpp @@ -8,6 +8,10 @@ #include "../../StockTypeInfo.h" #include "FixedA2015TradeCost.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedA2015TradeCost) +#endif + namespace hku { FixedA2015TradeCost::FixedA2015TradeCost() : TradeCostBase("TC_FixedA2015") { diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2017TradeCost.cpp b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2017TradeCost.cpp index 440e5050..1222ec5f 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2017TradeCost.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedA2017TradeCost.cpp @@ -8,6 +8,10 @@ #include "../../StockTypeInfo.h" #include "FixedA2017TradeCost.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedA2017TradeCost) +#endif + namespace hku { FixedA2017TradeCost::FixedA2017TradeCost() : TradeCostBase("TC_FixedA2017") { diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedATradeCost.cpp b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedATradeCost.cpp index 73eb4e1c..d6068613 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/imp/FixedATradeCost.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/FixedATradeCost.cpp @@ -9,6 +9,10 @@ #include "../../StockTypeInfo.h" #include "../../Log.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedATradeCost) +#endif + namespace hku { FixedATradeCost::FixedATradeCost() : TradeCostBase("TC_FixedA") { @@ -42,7 +46,7 @@ CostRecord FixedATradeCost::getBuyCost(const Datetime& datetime, const Stock& st result.commission = lowestCommission; } - //上证买入时,有过户费 + // 上证买入时,有过户费 if (stock.market() == "SH") { result.transferfee = num > 1000 ? roundEx(getParam("transferfee") * num, precision) : getParam("lowest_transferfee"); diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.cpp b/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.cpp new file mode 100644 index 00000000..c58a722c --- /dev/null +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 hikyuu.org + * + * Created on: 2024-01-24 + * Author: fasiondog + */ + +#include "TradeCostStub.h" + +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::TradeCostStub) +#endif + +namespace hku { + +TradeCostStub::TradeCostStub() : TradeCostBase("TestStub") {} + +TradeCostStub::~TradeCostStub() {} + +CostRecord TradeCostStub::getBuyCost(const Datetime& datetime, const Stock& stock, price_t price, + double num) const { + return CostRecord(0, 0, 0, 10, 10); +} + +CostRecord TradeCostStub::getSellCost(const Datetime& datetime, const Stock& stock, price_t price, + double num) const { + return CostRecord(0, 0, 0, 20, 20); +} + +CostRecord TradeCostStub::getBorrowCashCost(const Datetime& datetime, price_t cash) const { + return CostRecord(0, 0, 0, 30, 30); +} + +CostRecord TradeCostStub::getReturnCashCost(const Datetime& borrow_datetime, + const Datetime& return_datetime, price_t cash) const { + return CostRecord(0, 0, 0, 40, 40); +} + +CostRecord TradeCostStub::getBorrowStockCost(const Datetime& datetime, const Stock& stock, + price_t price, double num) const { + return CostRecord(0, 0, 0, 50, 50); +} + +CostRecord TradeCostStub::getReturnStockCost(const Datetime& borrow_datetime, + const Datetime& return_datetime, const Stock& stock, + price_t price, double num) const { + return CostRecord(0, 0, 0, 60, 60); +} + +TradeCostPtr TradeCostStub::_clone() { + return TradeCostPtr(new TradeCostStub); +} + +} // namespace hku \ No newline at end of file diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.h b/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.h index 9af7efcc..e5413261 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.h +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/TradeCostStub.h @@ -17,45 +17,31 @@ class HKU_API TradeCostStub : public TradeCostBase { TRADE_COST_NO_PRIVATE_MEMBER_SERIALIZATION public: - TradeCostStub() : TradeCostBase("TestStub") {} + TradeCostStub(); - virtual ~TradeCostStub() {} + virtual ~TradeCostStub(); virtual CostRecord getBuyCost(const Datetime& datetime, const Stock& stock, price_t price, - double num) const override { - return CostRecord(0, 0, 0, 10, 10); - } + double num) const override; virtual CostRecord getSellCost(const Datetime& datetime, const Stock& stock, price_t price, - double num) const override { - return CostRecord(0, 0, 0, 20, 20); - } + double num) const override; - virtual CostRecord getBorrowCashCost(const Datetime& datetime, price_t cash) const override { - return CostRecord(0, 0, 0, 30, 30); - } + virtual CostRecord getBorrowCashCost(const Datetime& datetime, price_t cash) const override; virtual CostRecord getReturnCashCost(const Datetime& borrow_datetime, const Datetime& return_datetime, - price_t cash) const override { - return CostRecord(0, 0, 0, 40, 40); - } + price_t cash) const override; virtual CostRecord getBorrowStockCost(const Datetime& datetime, const Stock& stock, - price_t price, double num) const override { - return CostRecord(0, 0, 0, 50, 50); - } + price_t price, double num) const override; virtual CostRecord getReturnStockCost(const Datetime& borrow_datetime, const Datetime& return_datetime, const Stock& stock, - price_t price, double num) const override { - return CostRecord(0, 0, 0, 60, 60); - } + price_t price, double num) const override; /** 子类私有变量克隆接口 */ - virtual TradeCostPtr _clone() override { - return TradeCostPtr(new TradeCostStub); - } + virtual TradeCostPtr _clone() override; }; } /* namespace hku */ diff --git a/hikyuu_cpp/hikyuu/trade_manage/imp/ZeroTradeCost.cpp b/hikyuu_cpp/hikyuu/trade_manage/imp/ZeroTradeCost.cpp index 681d8ba0..4d4e5dab 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/imp/ZeroTradeCost.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/imp/ZeroTradeCost.cpp @@ -7,6 +7,10 @@ #include "ZeroTradeCost.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::ZeroTradeCost) +#endif + namespace hku { ZeroTradeCost::ZeroTradeCost() : TradeCostBase("TC_Zero") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h index e32bc50d..ddc0ed54 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h @@ -16,7 +16,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/export.cpp deleted file mode 100644 index 3c6faf8d..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/export.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/EqualWeightAllocateFunds.h" - -BOOST_CLASS_EXPORT(hku::EqualWeightAllocateFunds) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/EqualWeightAllocateFunds.cpp b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/EqualWeightAllocateFunds.cpp index 3905803c..e6bbe1cb 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/EqualWeightAllocateFunds.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/EqualWeightAllocateFunds.cpp @@ -7,6 +7,10 @@ #include "EqualWeightAllocateFunds.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::EqualWeightAllocateFunds) +#endif + namespace hku { EqualWeightAllocateFunds::EqualWeightAllocateFunds() : AllocateFundsBase("AF_EqualWeight") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/FixedWeightAllocateFunds.cpp b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/FixedWeightAllocateFunds.cpp index 1c488534..f0b01595 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/FixedWeightAllocateFunds.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/imp/FixedWeightAllocateFunds.cpp @@ -7,6 +7,10 @@ #include "FixedWeightAllocateFunds.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedWeightAllocateFunds) +#endif + namespace hku { FixedWeightAllocateFunds::FixedWeightAllocateFunds() : AllocateFundsBase("AF_FixedWeight") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/condition/ConditionBase.h b/hikyuu_cpp/hikyuu/trade_sys/condition/ConditionBase.h index 96ff8912..5a9bf5af 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/condition/ConditionBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/condition/ConditionBase.h @@ -20,7 +20,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/condition/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/condition/export.cpp deleted file mode 100644 index f80d70d9..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/condition/export.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/OPLineCondition.h" - -BOOST_CLASS_EXPORT(hku::OPLineCondition) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/condition/imp/BoolCondition.cpp b/hikyuu_cpp/hikyuu/trade_sys/condition/imp/BoolCondition.cpp index 26d8cd8b..ac743bdb 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/condition/imp/BoolCondition.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/condition/imp/BoolCondition.cpp @@ -7,6 +7,10 @@ #include "BoolCondition.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::BoolCondition) +#endif + namespace hku { BoolCondition::BoolCondition() : ConditionBase("CN_Bool") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/condition/imp/OPLineCondition.cpp b/hikyuu_cpp/hikyuu/trade_sys/condition/imp/OPLineCondition.cpp index f7f628bb..8045a43b 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/condition/imp/OPLineCondition.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/condition/imp/OPLineCondition.cpp @@ -12,6 +12,10 @@ #include "../../system/crt/SYS_Simple.h" #include "../../moneymanager/crt/MM_FixedCount.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::OPLineCondition) +#endif + namespace hku { OPLineCondition::OPLineCondition() : ConditionBase("CN_OPLine") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/environment/EnvironmentBase.h b/hikyuu_cpp/hikyuu/trade_sys/environment/EnvironmentBase.h index b1f914e1..9dd047de 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/environment/EnvironmentBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/environment/EnvironmentBase.h @@ -20,7 +20,24 @@ #include #include "../../serialization/Datetime_serialization.h" #include "../../serialization/KQuery_serialization.h" -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/environment/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/environment/export.cpp deleted file mode 100644 index 36c4bdec..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/environment/export.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/TwoLineEnvironment.h" - -BOOST_CLASS_EXPORT(hku::TwoLineEnvironment) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/environment/imp/TwoLineEnvironment.cpp b/hikyuu_cpp/hikyuu/trade_sys/environment/imp/TwoLineEnvironment.cpp index 64d4caba..45a74ade 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/environment/imp/TwoLineEnvironment.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/environment/imp/TwoLineEnvironment.cpp @@ -9,6 +9,10 @@ #include "../../../indicator/crt/KDATA.h" #include "TwoLineEnvironment.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::TwoLineEnvironment) +#endif + namespace hku { TwoLineEnvironment::TwoLineEnvironment() : EnvironmentBase("TwoLine") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h index 0635adef..1175ddbc 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h @@ -17,7 +17,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/export.cpp deleted file mode 100644 index a9cce3a4..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/export.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/FixedCountMoneyManager.h" -#include "imp/FixedPercentMoneyManager.h" -#include "imp/FixedRiskMoneyManager.h" -#include "imp/FixedCapitalMoneyManager.h" -#include "imp/FixedRatioMoneyManager.h" -#include "imp/FixedUnitsMoneyManager.h" -#include "imp/WilliamsFixedRiskMoneyManager.h" - -BOOST_CLASS_EXPORT(hku::FixedCountMoneyManager) -BOOST_CLASS_EXPORT(hku::FixedPercentMoneyManager) -BOOST_CLASS_EXPORT(hku::FixedRiskMoneyManager) -BOOST_CLASS_EXPORT(hku::FixedCapitalMoneyManager) -BOOST_CLASS_EXPORT(hku::FixedRatioMoneyManager) -BOOST_CLASS_EXPORT(hku::FixedUnitsMoneyManager) -BOOST_CLASS_EXPORT(hku::WilliamsFixedRiskMoneyManager) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCapitalMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCapitalMoneyManager.cpp index 166bb01a..9f314b5b 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCapitalMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCapitalMoneyManager.cpp @@ -7,6 +7,10 @@ #include "FixedCapitalMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedCapitalMoneyManager) +#endif + namespace hku { FixedCapitalMoneyManager::FixedCapitalMoneyManager() : MoneyManagerBase("MM_FixedCapital") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCountMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCountMoneyManager.cpp index 87cff01d..51cf58ce 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCountMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedCountMoneyManager.cpp @@ -7,6 +7,10 @@ #include "FixedCountMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedCountMoneyManager) +#endif + namespace hku { FixedCountMoneyManager::FixedCountMoneyManager() : MoneyManagerBase("MM_FixedCount") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedPercentMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedPercentMoneyManager.cpp index aabc701f..5ce5cde7 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedPercentMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedPercentMoneyManager.cpp @@ -7,10 +7,14 @@ #include "FixedPercentMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedPercentMoneyManager) +#endif + namespace hku { FixedPercentMoneyManager::FixedPercentMoneyManager() : MoneyManagerBase("MM_FixedPercent") { - setParam("p", 0.02); //总资产百分比 + setParam("p", 0.02); // 总资产百分比 } FixedPercentMoneyManager::~FixedPercentMoneyManager() {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRatioMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRatioMoneyManager.cpp index 116c1e77..06aaf8c2 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRatioMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRatioMoneyManager.cpp @@ -7,6 +7,10 @@ #include "FixedRatioMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedRatioMoneyManager) +#endif + namespace hku { FixedRatioMoneyManager::FixedRatioMoneyManager() diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRiskMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRiskMoneyManager.cpp index 40304800..a0a6f14e 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRiskMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedRiskMoneyManager.cpp @@ -7,6 +7,10 @@ #include "FixedRiskMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedRiskMoneyManager) +#endif + namespace hku { FixedRiskMoneyManager::FixedRiskMoneyManager() : MoneyManagerBase("MM_FixedRisk") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedUnitsMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedUnitsMoneyManager.cpp index a7df961a..581113b9 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedUnitsMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/FixedUnitsMoneyManager.cpp @@ -7,6 +7,10 @@ #include "FixedUnitsMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedUnitsMoneyManager) +#endif + namespace hku { FixedUnitsMoneyManager::FixedUnitsMoneyManager() : MoneyManagerBase("MM_FixedUnits") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/NotMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/NotMoneyManager.cpp index 7280c9ed..8c4e3f4a 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/NotMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/NotMoneyManager.cpp @@ -7,6 +7,10 @@ #include "NotMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::NotMoneyManager) +#endif + namespace hku { NotMoneyManager::NotMoneyManager() : MoneyManagerBase("MM_Nothing") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/WilliamsFixedRiskMoneyManager.cpp b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/WilliamsFixedRiskMoneyManager.cpp index 4fed9a14..518d97b6 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/WilliamsFixedRiskMoneyManager.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/moneymanager/imp/WilliamsFixedRiskMoneyManager.cpp @@ -7,6 +7,10 @@ #include "WilliamsFixedRiskMoneyManager.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::WilliamsFixedRiskMoneyManager) +#endif + namespace hku { WilliamsFixedRiskMoneyManager::WilliamsFixedRiskMoneyManager() diff --git a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h index af6f3c8a..d1f184f4 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h @@ -17,7 +17,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/export.cpp deleted file mode 100644 index 6314b1d9..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/export.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/NoGoalProfitGoal.h" -#include "imp/FixedPercentProfitGoal.h" - -BOOST_CLASS_EXPORT(hku::NoGoalProfitGoal) -BOOST_CLASS_EXPORT(hku::FixedPercentProfitGoal) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedHoldDays.cpp b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedHoldDays.cpp index a61b3b0f..b6383267 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedHoldDays.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedHoldDays.cpp @@ -7,6 +7,10 @@ #include "FixedHoldDays.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedHoldDays) +#endif + namespace hku { FixedHoldDays::FixedHoldDays() : ProfitGoalBase("PG_FixedHoldDays") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedPercentProfitGoal.cpp b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedPercentProfitGoal.cpp index c4010d3a..ffae7a9c 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedPercentProfitGoal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/FixedPercentProfitGoal.cpp @@ -7,6 +7,10 @@ #include "FixedPercentProfitGoal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedPercentProfitGoal) +#endif + namespace hku { FixedPercentProfitGoal::FixedPercentProfitGoal() : ProfitGoalBase("PG_FixedPercent") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/NoGoalProfitGoal.cpp b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/NoGoalProfitGoal.cpp index 2e6bf719..60e36351 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/NoGoalProfitGoal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/profitgoal/imp/NoGoalProfitGoal.cpp @@ -7,6 +7,10 @@ #include "NoGoalProfitGoal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::NoGoalProfitGoal) +#endif + namespace hku { NoGoalProfitGoal::NoGoalProfitGoal() : ProfitGoalBase("PG_NoGoal") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/selector/SelectorBase.h b/hikyuu_cpp/hikyuu/trade_sys/selector/SelectorBase.h index 1287bc52..008dae36 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/selector/SelectorBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/selector/SelectorBase.h @@ -18,7 +18,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/selector/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/selector/export.cpp deleted file mode 100644 index 89f19a9a..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/selector/export.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/FixedSelector.h" - -BOOST_CLASS_EXPORT(hku::FixedSelector) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/selector/imp/FixedSelector.cpp b/hikyuu_cpp/hikyuu/trade_sys/selector/imp/FixedSelector.cpp index a493ad6f..24d9cf73 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/selector/imp/FixedSelector.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/selector/imp/FixedSelector.cpp @@ -7,6 +7,10 @@ #include "FixedSelector.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedSelector) +#endif + namespace hku { FixedSelector::FixedSelector() : SelectorBase("SE_Fixed") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/selector/imp/SignalSelector.cpp b/hikyuu_cpp/hikyuu/trade_sys/selector/imp/SignalSelector.cpp index 12542d3b..a490a4cc 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/selector/imp/SignalSelector.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/selector/imp/SignalSelector.cpp @@ -7,6 +7,10 @@ #include "SignalSelector.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::SignalSelector) +#endif + namespace hku { SignalSelector::SignalSelector() : SelectorBase("SE_Sigal") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/SignalBase.h b/hikyuu_cpp/hikyuu/trade_sys/signal/SignalBase.h index f1c74670..ad493778 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/SignalBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/SignalBase.h @@ -20,7 +20,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/export.cpp deleted file mode 100644 index f2ae2b30..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/export.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/CrossSignal.h" -#include "imp/CrossGoldSignal.h" -#include "imp/SingleSignal.h" -#include "imp/SingleSignal2.h" -#include "imp/BoolSignal.h" - -BOOST_CLASS_EXPORT(hku::CrossSignal) -BOOST_CLASS_EXPORT(hku::CrossGoldSignal) -BOOST_CLASS_EXPORT(hku::SingleSignal) -BOOST_CLASS_EXPORT(hku::SingleSignal2) -BOOST_CLASS_EXPORT(hku::BoolSignal) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BandSignal.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BandSignal.cpp index 926f9200..1e74a1cb 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BandSignal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BandSignal.cpp @@ -7,6 +7,10 @@ #include "../../../indicator/crt/KDATA.h" #include "BandSignal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::BandSignal) +#endif + namespace hku { BandSignal::BandSignal() : SignalBase("SG_Band") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BoolSignal.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BoolSignal.cpp index 73a68358..02167273 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BoolSignal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/BoolSignal.cpp @@ -8,6 +8,10 @@ #include "../../../indicator/crt/KDATA.h" #include "BoolSignal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::BoolSignal) +#endif + namespace hku { BoolSignal::BoolSignal() : SignalBase("SG_Bool") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossGoldSignal.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossGoldSignal.cpp index 224226fc..6b62df8f 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossGoldSignal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossGoldSignal.cpp @@ -8,6 +8,10 @@ #include "../../../indicator/crt/KDATA.h" #include "CrossGoldSignal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::CrossGoldSignal) +#endif + namespace hku { CrossGoldSignal::CrossGoldSignal() : SignalBase("SG_CrossGold") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossSignal.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossSignal.cpp index f7728ff9..505bb660 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossSignal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/CrossSignal.cpp @@ -8,6 +8,10 @@ #include "../../../indicator/crt/KDATA.h" #include "CrossSignal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::CrossSignal) +#endif + namespace hku { CrossSignal::CrossSignal() : SignalBase("SG_Cross") {} diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal.cpp index ec96cfd6..561dc837 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal.cpp @@ -10,6 +10,10 @@ #include "../../../indicator/crt/STDEV.h" #include "SingleSignal.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::SingleSignal) +#endif + namespace hku { SingleSignal::SingleSignal() : SignalBase("SG_Single") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal2.cpp b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal2.cpp index 0f070c70..738aa9a4 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal2.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/signal/imp/SingleSignal2.cpp @@ -13,6 +13,10 @@ #include "../../../indicator/crt/REF.h" #include "SingleSignal2.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::SingleSignal2) +#endif + namespace hku { SingleSignal2::SingleSignal2() : SignalBase("SG_Single2") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/slippage/SlippageBase.h b/hikyuu_cpp/hikyuu/trade_sys/slippage/SlippageBase.h index 2963fb72..e40390f5 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/slippage/SlippageBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/slippage/SlippageBase.h @@ -16,7 +16,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/slippage/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/slippage/export.cpp deleted file mode 100644 index 98b0a8f8..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/slippage/export.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/FixedPercentSlippage.h" -#include "imp/FixedValueSlippage.h" - -BOOST_CLASS_EXPORT(hku::FixedPercentSlippage) -BOOST_CLASS_EXPORT(hku::FixedValueSlippage) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedPercentSlippage.cpp b/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedPercentSlippage.cpp index 1a21c4a4..fe2f8096 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedPercentSlippage.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedPercentSlippage.cpp @@ -7,6 +7,10 @@ #include "FixedPercentSlippage.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedPercentSlippage) +#endif + namespace hku { FixedPercentSlippage::FixedPercentSlippage() : SlippageBase("FixedPercent") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedValueSlippage.cpp b/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedValueSlippage.cpp index 70ac55e2..b5cedf0b 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedValueSlippage.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/slippage/imp/FixedValueSlippage.cpp @@ -7,6 +7,10 @@ #include "FixedValueSlippage.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedValueSlippage) +#endif + namespace hku { FixedValueSlippage::FixedValueSlippage() { diff --git a/hikyuu_cpp/hikyuu/trade_sys/stoploss/StoplossBase.h b/hikyuu_cpp/hikyuu/trade_sys/stoploss/StoplossBase.h index 064dd797..10970d00 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/stoploss/StoplossBase.h +++ b/hikyuu_cpp/hikyuu/trade_sys/stoploss/StoplossBase.h @@ -17,7 +17,24 @@ #include #include #include -#endif + +#if HKU_SUPPORT_XML_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_XML_ARCHIVE */ + +#if HKU_SUPPORT_TEXT_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ + +#if HKU_SUPPORT_BINARY_ARCHIVE +#include +#include +#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ + +#include +#endif /* HKU_SUPPORT_SERIALIZATION */ namespace hku { diff --git a/hikyuu_cpp/hikyuu/trade_sys/stoploss/export.cpp b/hikyuu_cpp/hikyuu/trade_sys/stoploss/export.cpp deleted file mode 100644 index b96f4647..00000000 --- a/hikyuu_cpp/hikyuu/trade_sys/stoploss/export.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * export.cpp - * - * Created on: 2013-4-29 - * Author: fasiondog - */ - -#include "../../config.h" - -#if HKU_SUPPORT_SERIALIZATION - -#if HKU_SUPPORT_XML_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_XML_ARCHIVE */ - -#if HKU_SUPPORT_TEXT_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_TEXT_ARCHIVE */ - -#if HKU_SUPPORT_BINARY_ARCHIVE -#include -#include -#endif /* HKU_SUPPORT_BINARY_ARCHIVE */ - -#include - -#include "imp/FixedPercentStoploss.h" -#include "imp/IndicatorStoploss.h" - -BOOST_CLASS_EXPORT(hku::FixedPercentStoploss) -BOOST_CLASS_EXPORT(hku::IndicatorStoploss) - -#endif /* HKU_SUPPORT_SERIALIZATION */ diff --git a/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/FixedPercentStoploss.cpp b/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/FixedPercentStoploss.cpp index 7a9bd345..c3882fcf 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/FixedPercentStoploss.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/FixedPercentStoploss.cpp @@ -7,6 +7,10 @@ #include "FixedPercentStoploss.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::FixedPercentStoploss) +#endif + namespace hku { FixedPercentStoploss::FixedPercentStoploss() : StoplossBase("ST_FixedPercent") { diff --git a/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.cpp b/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.cpp index 98e94383..f541dff1 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.cpp @@ -8,6 +8,10 @@ #include "../../../indicator/crt/KDATA.h" #include "IndicatorStoploss.h" +#if HKU_SUPPORT_SERIALIZATION +BOOST_CLASS_EXPORT(hku::IndicatorStoploss) +#endif + namespace hku { IndicatorStoploss::IndicatorStoploss() : StoplossBase("IndicatorStoploss") { diff --git a/hikyuu_cpp/hikyuu/xmake.lua b/hikyuu_cpp/hikyuu/xmake.lua index 6ef573f7..9f3cdbc3 100644 --- a/hikyuu_cpp/hikyuu/xmake.lua +++ b/hikyuu_cpp/hikyuu/xmake.lua @@ -1,10 +1,11 @@ target("hikyuu") - if is_mode("debug", "coverage", "asan", "msan", "tsan", "lsan") then - set_kind("static") - else - set_kind("shared") - end + set_kind("$(kind)") + -- if is_mode("debug", "coverage", "asan", "msan", "tsan", "lsan") then + -- set_kind("static") + -- else + -- set_kind("shared") + -- end add_options("hdf5", "mysql", "sqlite", "tdx", "feedback", "stackstrace") diff --git a/hikyuu_cpp/hikyuu_server/xmake.lua b/hikyuu_cpp/hikyuu_server/xmake.lua index ea52eea2..4c9cbb1f 100644 --- a/hikyuu_cpp/hikyuu_server/xmake.lua +++ b/hikyuu_cpp/hikyuu_server/xmake.lua @@ -22,7 +22,7 @@ target("hkuserver") end if is_plat("windows") then - if is_mode("release") then + if get_config("kind") == "shared" then add_defines("HKU_API=__declspec(dllimport)") end add_packages("mysql") diff --git a/hikyuu_cpp/unit_test/xmake.lua b/hikyuu_cpp/unit_test/xmake.lua index 177f5443..217629ea 100644 --- a/hikyuu_cpp/unit_test/xmake.lua +++ b/hikyuu_cpp/unit_test/xmake.lua @@ -79,7 +79,7 @@ target("unit-test") add_cxflags("-Wno-sign-compare") end - if is_plat("windows") and is_mode("release") then + if is_plat("windows") and get_config("kind") == "shared" then add_defines("HKU_API=__declspec(dllimport)") end @@ -99,7 +99,7 @@ target("unit-test") -- add files add_files("**.cpp") - + before_run(prepare_run) after_run(coverage_report) target_end() diff --git a/hikyuu_pywrap/xmake.lua b/hikyuu_pywrap/xmake.lua index f03cd412..e8c9cb54 100644 --- a/hikyuu_pywrap/xmake.lua +++ b/hikyuu_pywrap/xmake.lua @@ -20,7 +20,7 @@ target("core") set_filename("core.so") end - if is_plat("windows") and is_mode("release") then + if is_plat("windows") and get_config("kind") == "shared" then add_defines("HKU_API=__declspec(dllimport)") add_cxflags("-wd4566") end diff --git a/setup.py b/setup.py index ece9792d..d092a111 100644 --- a/setup.py +++ b/setup.py @@ -123,8 +123,8 @@ def start_build(verbose=False, mode='release', feedback=True, worker_num=2): if py_version != history_compile_info[ 'py_version'] or history_compile_info['mode'] != mode: clear_with_python_changed(mode) - cmd = "xmake f {} -c -y -m {} --feedback={}".format( - "-v -D" if verbose else "", mode, feedback) + cmd = "xmake f {} -c -y -m {} --feedback={} -k {}".format( + "-v -D" if verbose else "", mode, feedback, "shared" if mode == 'release' else "static") print(cmd) os.system(cmd) diff --git a/xmake.lua b/xmake.lua index c8a90cf3..7527198f 100644 --- a/xmake.lua +++ b/xmake.lua @@ -148,7 +148,9 @@ add_requires("boost " .. boost_version, { system = false, debug = is_mode("debug"), configs = { - shared = is_plat("windows") and true or false, + shared = get_config("kind") == "shared", --is_plat("windows") and true or false, + vs_runtime = 'MD', + multi = true, date_time = true, filesystem = true, serialization = true, @@ -172,7 +174,9 @@ set_objectdir("$(buildir)/$(mode)/$(plat)/$(arch)/.objs") set_targetdir("$(buildir)/$(mode)/$(plat)/$(arch)/lib") -- modifed to use boost static library, except boost.python, serialization -if is_plat("windows") then add_defines("BOOST_ALL_DYN_LINK") end +if is_plat("windows") and get_config("kind") == "shared" then + add_defines("BOOST_ALL_DYN_LINK") +end -- is release now if is_mode("release") then