mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-02 11:58:21 +08:00
update
This commit is contained in:
parent
65ced11ad0
commit
ff0094fd5d
@ -905,9 +905,9 @@ TradeRecord TradeManager::sell(const Datetime& datetime, const Stock& stock, pri
|
||||
|
||||
// 未持仓
|
||||
position_map_type::iterator pos_iter = m_position.find(stock.id());
|
||||
HKU_WARN_IF_RETURN(pos_iter == m_position.end(), result,
|
||||
"{} {} This stock was not bought never! ({}, {:<.4f}, {}, {})", datetime,
|
||||
stock.market_code(), datetime, realPrice, number, int(from));
|
||||
HKU_TRACE_IF_RETURN(pos_iter == m_position.end(), result,
|
||||
"{} {} This stock was not bought never! ({}, {:<.4f}, {}, {})", datetime,
|
||||
stock.market_code(), datetime, realPrice, number, getSystemPartName(from));
|
||||
|
||||
// 根据权息调整当前持仓情况
|
||||
updateWithWeight(datetime);
|
||||
|
@ -76,24 +76,10 @@ void SignalBase::setTO(const KData& kdata) {
|
||||
|
||||
bool cycle = getParam<bool>("cycle");
|
||||
m_cycle_start = kdata[0].datetime;
|
||||
HKU_IF_RETURN(cycle, void());
|
||||
|
||||
const KQuery& query = kdata.getQuery();
|
||||
if (query.queryType() == KQuery::DATE) {
|
||||
m_cycle_end = query.endDatetime();
|
||||
} else {
|
||||
size_t last_pos = kdata.lastPos();
|
||||
const Stock& stk = kdata.getStock();
|
||||
if (last_pos + 1 >= stk.getCount(query.kType())) {
|
||||
m_cycle_end = Null<Datetime>();
|
||||
} else {
|
||||
KRecord krecord = stk.getKRecord(last_pos + 1, query.kType());
|
||||
m_cycle_end = krecord.datetime;
|
||||
}
|
||||
}
|
||||
|
||||
KData cycle_kdata = kdata.getKData(m_cycle_start, m_cycle_end);
|
||||
if (!cycle) {
|
||||
_calculate(cycle_kdata);
|
||||
_calculate(kdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user