update PF

This commit is contained in:
fasiondog 2024-04-01 23:50:02 +08:00
parent 344279be6c
commit 8d28ef9dd6
2 changed files with 0 additions and 44 deletions

View File

@ -73,7 +73,6 @@ void Portfolio::paramChanged() {
void Portfolio::reset() {
m_real_sys_list.clear();
m_running_sys_set.clear();
m_failed_sys_map.clear();
m_dlist_sys_list.clear();
m_delay_adjust_sys_list.clear();
m_tmp_selected_list.clear();
@ -267,47 +266,6 @@ void Portfolio::_runMoment(const Datetime& date, bool adjust) {
funds.cash + funds.market_value, funds.cash, funds.market_value);
}
//----------------------------------------------------------------------
// 开盘时,优先处理上一交易日强制清、减仓失败的系统
//----------------------------------------------------------------------
// for (auto iter = m_failed_sys_map.begin(); iter != m_failed_sys_map.end();) {
// const auto& sys = iter->first;
// Stock stk = sys->getStock();
// if (date > stk.lastDatetime()) {
// // 已退市
// HKU_WARN_IF(trace, "{} has been delisted!", sys->name());
// m_dlist_sys_list.emplace_back(sys);
// m_failed_sys_map.erase(iter++);
// continue;
// }
// auto tr = sys->sellForceOnOpen(date, iter->second, PART_PORTFOLIO);
// if (!tr.isNull()) {
// HKU_INFO_IF(trace, "[PF] Process pre-failed sys: {}", tr);
// m_tm->addTradeRecord(tr);
// // 卖出后,尝试将资金取出转移至影子总账户
// TMPtr sub_tm = sys->getTM();
// auto sub_cash = sub_tm->currentCash();
// if (sub_cash > 0.0 && sub_tm->checkout(date, sub_cash)) {
// m_cash_tm->checkin(date, sub_cash);
// }
// m_failed_sys_map.erase(iter++);
// continue;
// } else {
// // 如果实际已没有持仓,则将其从失败列表中移除
// PositionRecord position = sys->getTM()->getPosition(date, sys->getStock());
// if (position.number <= 0.0) {
// m_failed_sys_map.erase(iter++);
// continue;
// }
// }
// ++iter;
// }
//----------------------------------------------------------------------
// 开盘时,优先处理上一交易日遗留的延迟调仓卖出的系统
//----------------------------------------------------------------------
@ -331,7 +289,6 @@ void Portfolio::_runMoment(const Datetime& date, bool adjust) {
PositionRecord position = sys.sys->getTM()->getPosition(date, sys.sys->getStock());
if (position.number > 0.0) {
tmp_continue_adjust_sys_list.emplace_back(sys);
// m_failed_sys_map[sys.sys] = sys.weight;
}
}
}

View File

@ -117,7 +117,6 @@ protected:
// 用于中间计算的临时数据
std::unordered_set<SYSPtr> m_running_sys_set;
std::unordered_map<SYSPtr, double> m_failed_sys_map; // 强制卖出失败的系统集合
SystemList m_dlist_sys_list; // 因证券退市,无法执行买入的系统(资产全部损失)
SystemWeightList m_delay_adjust_sys_list; // 延迟调仓卖出的系统列表
SystemWeightList m_tmp_selected_list;