工程优化,根据配置编译静态库或动态库

This commit is contained in:
fasiondog 2024-01-24 11:55:32 +08:00
parent 97b873ac2c
commit efcfbc1bd4
63 changed files with 400 additions and 416 deletions

View File

@ -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

View File

@ -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) {

View File

@ -17,7 +17,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#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 */

View File

@ -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") {

View File

@ -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") {

View File

@ -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<price_t>("transferfee") * num, precision)
: getParam<price_t>("lowest_transferfee");

View File

@ -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

View File

@ -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 */

View File

@ -7,6 +7,10 @@
#include "ZeroTradeCost.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::ZeroTradeCost)
#endif
namespace hku {
ZeroTradeCost::ZeroTradeCost() : TradeCostBase("TC_Zero") {}

View File

@ -16,7 +16,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/EqualWeightAllocateFunds.h"
BOOST_CLASS_EXPORT(hku::EqualWeightAllocateFunds)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "EqualWeightAllocateFunds.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::EqualWeightAllocateFunds)
#endif
namespace hku {
EqualWeightAllocateFunds::EqualWeightAllocateFunds() : AllocateFundsBase("AF_EqualWeight") {}

View File

@ -7,6 +7,10 @@
#include "FixedWeightAllocateFunds.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedWeightAllocateFunds)
#endif
namespace hku {
FixedWeightAllocateFunds::FixedWeightAllocateFunds() : AllocateFundsBase("AF_FixedWeight") {

View File

@ -20,7 +20,24 @@
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/set.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/OPLineCondition.h"
BOOST_CLASS_EXPORT(hku::OPLineCondition)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "BoolCondition.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::BoolCondition)
#endif
namespace hku {
BoolCondition::BoolCondition() : ConditionBase("CN_Bool") {}

View File

@ -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") {}

View File

@ -20,7 +20,24 @@
#include <boost/serialization/set.hpp>
#include "../../serialization/Datetime_serialization.h"
#include "../../serialization/KQuery_serialization.h"
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/TwoLineEnvironment.h"
BOOST_CLASS_EXPORT(hku::TwoLineEnvironment)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -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") {

View File

@ -17,7 +17,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#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 */

View File

@ -7,6 +7,10 @@
#include "FixedCapitalMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedCapitalMoneyManager)
#endif
namespace hku {
FixedCapitalMoneyManager::FixedCapitalMoneyManager() : MoneyManagerBase("MM_FixedCapital") {

View File

@ -7,6 +7,10 @@
#include "FixedCountMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedCountMoneyManager)
#endif
namespace hku {
FixedCountMoneyManager::FixedCountMoneyManager() : MoneyManagerBase("MM_FixedCount") {

View File

@ -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<double>("p", 0.02); //总资产百分比
setParam<double>("p", 0.02); // 总资产百分比
}
FixedPercentMoneyManager::~FixedPercentMoneyManager() {}

View File

@ -7,6 +7,10 @@
#include "FixedRatioMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedRatioMoneyManager)
#endif
namespace hku {
FixedRatioMoneyManager::FixedRatioMoneyManager()

View File

@ -7,6 +7,10 @@
#include "FixedRiskMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedRiskMoneyManager)
#endif
namespace hku {
FixedRiskMoneyManager::FixedRiskMoneyManager() : MoneyManagerBase("MM_FixedRisk") {

View File

@ -7,6 +7,10 @@
#include "FixedUnitsMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedUnitsMoneyManager)
#endif
namespace hku {
FixedUnitsMoneyManager::FixedUnitsMoneyManager() : MoneyManagerBase("MM_FixedUnits") {

View File

@ -7,6 +7,10 @@
#include "NotMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::NotMoneyManager)
#endif
namespace hku {
NotMoneyManager::NotMoneyManager() : MoneyManagerBase("MM_Nothing") {}

View File

@ -7,6 +7,10 @@
#include "WilliamsFixedRiskMoneyManager.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::WilliamsFixedRiskMoneyManager)
#endif
namespace hku {
WilliamsFixedRiskMoneyManager::WilliamsFixedRiskMoneyManager()

View File

@ -17,7 +17,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/NoGoalProfitGoal.h"
#include "imp/FixedPercentProfitGoal.h"
BOOST_CLASS_EXPORT(hku::NoGoalProfitGoal)
BOOST_CLASS_EXPORT(hku::FixedPercentProfitGoal)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "FixedHoldDays.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedHoldDays)
#endif
namespace hku {
FixedHoldDays::FixedHoldDays() : ProfitGoalBase("PG_FixedHoldDays") {

View File

@ -7,6 +7,10 @@
#include "FixedPercentProfitGoal.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedPercentProfitGoal)
#endif
namespace hku {
FixedPercentProfitGoal::FixedPercentProfitGoal() : ProfitGoalBase("PG_FixedPercent") {

View File

@ -7,6 +7,10 @@
#include "NoGoalProfitGoal.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::NoGoalProfitGoal)
#endif
namespace hku {
NoGoalProfitGoal::NoGoalProfitGoal() : ProfitGoalBase("PG_NoGoal") {}

View File

@ -18,7 +18,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/FixedSelector.h"
BOOST_CLASS_EXPORT(hku::FixedSelector)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "FixedSelector.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedSelector)
#endif
namespace hku {
FixedSelector::FixedSelector() : SelectorBase("SE_Fixed") {}

View File

@ -7,6 +7,10 @@
#include "SignalSelector.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::SignalSelector)
#endif
namespace hku {
SignalSelector::SignalSelector() : SelectorBase("SE_Sigal") {}

View File

@ -20,7 +20,24 @@
#include <boost/serialization/set.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#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 */

View File

@ -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") {}

View File

@ -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") {}

View File

@ -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") {}

View File

@ -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") {}

View File

@ -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") {

View File

@ -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") {

View File

@ -16,7 +16,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/FixedPercentSlippage.h"
#include "imp/FixedValueSlippage.h"
BOOST_CLASS_EXPORT(hku::FixedPercentSlippage)
BOOST_CLASS_EXPORT(hku::FixedValueSlippage)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "FixedPercentSlippage.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedPercentSlippage)
#endif
namespace hku {
FixedPercentSlippage::FixedPercentSlippage() : SlippageBase("FixedPercent") {

View File

@ -7,6 +7,10 @@
#include "FixedValueSlippage.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedValueSlippage)
#endif
namespace hku {
FixedValueSlippage::FixedValueSlippage() {

View File

@ -17,7 +17,24 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/base_object.hpp>
#endif
#if HKU_SUPPORT_XML_ARCHIVE
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#endif /* HKU_SUPPORT_SERIALIZATION */
namespace hku {

View File

@ -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 <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#endif /* HKU_SUPPORT_XML_ARCHIVE */
#if HKU_SUPPORT_TEXT_ARCHIVE
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#endif /* HKU_SUPPORT_TEXT_ARCHIVE */
#if HKU_SUPPORT_BINARY_ARCHIVE
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#endif /* HKU_SUPPORT_BINARY_ARCHIVE */
#include <boost/serialization/export.hpp>
#include "imp/FixedPercentStoploss.h"
#include "imp/IndicatorStoploss.h"
BOOST_CLASS_EXPORT(hku::FixedPercentStoploss)
BOOST_CLASS_EXPORT(hku::IndicatorStoploss)
#endif /* HKU_SUPPORT_SERIALIZATION */

View File

@ -7,6 +7,10 @@
#include "FixedPercentStoploss.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::FixedPercentStoploss)
#endif
namespace hku {
FixedPercentStoploss::FixedPercentStoploss() : StoplossBase("ST_FixedPercent") {

View File

@ -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") {

View File

@ -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")

View File

@ -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")

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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