跳轉到

過濾全額交割股

營收動能策略搭配成交量篩選與全額交割股過濾,避免買進流動性不足或有財務問題的標的。

營收動能選股

策略核心是找出近三個月累積營收創兩年新高的股票,代表營收正處於強勁的突破動能。同時要求 10 日均量大於 300 張,排除流動性過小的冷門股。

過濾全額交割股

全額交割股是指因財務狀況異常而被交易所列為變更交易方式的股票,買進時必須預繳全額款項。這類股票通常有較高的財務風險,策略中應予以排除。

FinLab 提供 etl:full_cash_delivery_stock_filter 資料表,每日 08:15 更新全額交割股清單。買進訊號隔日若為全額交割股,則不交易。

程式碼

營收動能條件

from finlab import data
from finlab.backtest import sim
import pandas as pd

rev = data.get("monthly_revenue:當月營收")
rev_rf = data.get("monthly_revenue:去年同月增減(%)")
vol = data.get("price:成交股數") / 1000

rev_recent_3 = rev.rolling(3).sum()
vol_avg = vol.average(10)
cond1 = rev_recent_3 == rev_recent_3.rolling(24, min_periods=12).max()

# 成交量條件,排除流動性過小
cond2 = vol_avg > 300

加入全額交割股過濾

# 過濾全額交割股
full_cash_delivery_stock_filter = data.get("etl:full_cash_delivery_stock_filter")

cond_all = cond1 & cond2 & full_cash_delivery_stock_filter
result = rev_rf * cond_all
position = result[result > 0].is_largest(10).reindex(
    rev.index_str_to_date().index, method="ffill"
)
report = sim(position=position, stop_loss=0.3, position_limit=0.1, upload=False)
report.display()

策略特色

  • 使用 reindex 搭配 index_str_to_date() 將月頻營收訊號對齊到日頻價格資料
  • is_largest(10) 取營收年增率最高的前 10 檔
  • stop_loss=0.3 設定 30% 停損,給予較大的波動容忍度
  • position_limit=0.1 限制單檔部位上限為 10%,分散風險
  • full_cash_delivery_stock_filter 是布林值 DataFrame,直接用 & 運算即可過濾