from logging import log from typing import Any from config.network_config import network_config from jq_channel import jq_channel from strategy import trade_strategy from task.check_state_before_task import check_state_before_task strategy = trade_strategy("测试策略", 10000000, network_config(), log, jq_channel()) def initialize(context: Any) -> None: # # 初始化策略参数 strategy.init_strategy() # 策略初始化函数 # # 注册调度任务 # run_daily(check_positions_before_market_open_func, time='9:01') # 开盘前先检查持仓状态 # run_daily(check_holdings_yesterday_func, time='9:00') # run_daily(prepare_stock_list_func, time='9:05') # # run_daily(sell_stocks_func, time='10:00') # 每日检查止损条件 # # run_daily(process_pending_sells_func, time='10:15') # 处理待卖出股票 # run_weekly(buy_stocks_func, 2, time='10:30') # 周二进行调仓 # run_daily(process_pending_buys_func, time='10:20') # 处理待买入股票 # run_daily(process_pending_sells_func, time='13:05') # 午盘开盘后也处理一次卖出 # run_daily(process_pending_buys_func, time='13:15') # 午盘开盘后也处理一次买入 # run_daily(trade_afternoon_func, time='14:30') # run_daily(process_pending_sells_func, time='14:40') # 收盘前再处理一次卖出 # run_daily(process_pending_buys_func, time='14:45') # 收盘前再处理一次买入 # run_daily(close_account_func, time='14:50') # run_weekly(print_position_info_func, 5, time='15:10') # 周五收盘后打印持仓信息 # task = check_state_before_task(strategy) # task.process(context) pass # initialize(None) # 调用初始化函数,开始策略执行