Administrator
2024-06-03 3b2b30708614ee604bc28c7db359544688ede3f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
回撤交易
"""
# 持仓字典
from log_module import log_export
from trade.buy_strategy import BuyStrategyDataManager
 
position_dict = {}
 
 
def start_backtest(date):
    __BuyStrategyDataManager = BuyStrategyDataManager()
    # 回撤
    markets_dict = log_export.load_latest_market_info(date)
    for code in markets_dict:
        __BuyStrategyDataManager.add_market_info(markets_dict[code])
    transactions = log_export.load_transactions(date)
    for t in transactions:
        code = t["SecurityID"]
        need_buy = __BuyStrategyDataManager.add_transaction_info(t)
        if need_buy and code not in position_dict:
            # 持仓结果保存
            position_dict[code] = t