選擇因子模式
公式模式
每一行都必須是一個完整表達式。公式模式支援巢狀算子和數學運算。FUTURE_RETURNS。
Python 模式
當因子需要的邏輯不適合寫成單一表達式時,請使用 Python。定義一個繼承Factor 的類別,並從 calculate(self, factors) 回傳 Series。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
使用 TQX 公式或 Python 程式碼建立、驗證及分析因子。
RANK(close / DELAY(close, 20) - 1)
FUTURE_RETURNS。
Factor 的類別,並從 calculate(self, factors) 回傳 Series。
class MomentumFactor(Factor):
def calculate(self, factors):
close = factors["close"]
return close.groupby(level="symbol").transform(lambda s: s / s.shift(20) - 1)
FUTURE_RETURNS,但 TQX 會拒絕在因子中使用它,因為它會讀取未來資料。