12. Sector Rotation Stock Selection Strategy (Equivalent to Educational Version)
Reference source: docs/_joinquant_migration_source/Example_12_行业轮动选股.ipynb First Markdown cell.
12.1. Strategy and Ideas
Monthly comparison of industry agency index revenue over the past N days;
Choose the industry agency targets with the highest returns;
Concentrate your positions in the strongest sectors (tutorial version).
12.2. QtEasy Implementation Instructions
Strategy class:
Example12IndustryRotation;The default index proxy pool (
000300.SH,000905.SH,000852.SH) is used to demonstrate the rotation logic;If you switch to the “Industry Component Stocks + Market Value Screening” version, you can expand the two-stage stock selection on this basis.
from examples.strategies.example_strategies import Example12IndustryRotation
import qteasy as qt
stg = Example12IndustryRotation()
op = qt.Operator(stg, signal_type='PT')
op.op_type = 'stepwise'
op.set_blender('1.0*s0')
res = qt.run(
op,
mode=1,
asset_type='IDX',
asset_pool=['000300.SH', '000905.SH', '000852.SH'],
benchmark_asset='000300.SH',
invest_start='20190101',
invest_end='20211231',
invest_cash_amounts=[1000000],
trade_batch_size=0.01,
sell_batch_size=0.01,
trade_log=True,
)
12.3. Executable script
examples/strategy_example_12.py