“该策略交易9种货币期货,基于周五至周一的回报,买入过去的输家,卖出赢家,每周重新平衡,头寸从周一开盘持有至周五收盘。”

I. 策略概要

该策略针对9种货币期货,包括澳元、英镑等,其开盘价和收盘价来自TickData。投资者选择流动性最强的合约,重点关注最接近交割的合约。通过买入过去的周五至周一开盘输家,卖出赢家,创建零投资组合。使用论文中指定的公式计算单个货币的权重。投资组合在形成期后的周一开盘至周五收盘期间进行交易,每周重新平衡,以根据最新的回报模式调整头寸。此方法旨在利用短期货币市场的低效率。

II. 策略合理性

价格反转通常是由于投资者对新闻反应过度,随后出现价格修正。市场休市,如隔夜或周末休息,通常以较低的流动性和交易活动为特征。Nagel(2012)发现,以VIX指数衡量的隔夜不确定性增加,在解释收盘至开盘(CO-OC)反转策略的利润方面起着重要作用。这种效应在期货市场比在股票市场更强。CO-OC反转模式与Hong和Wang(2000)的连续时间模型一致,该模型表明,市场休市期间的对冲需求导致这些反转,从而创造了盈利机会。

III. 来源论文

市场休市和短期反转 [点击查看论文]

<摘要>

一种买入过去隔夜回报较低的证券,卖出过去隔夜回报较高的证券的策略,在所有主要资产类别中都能产生可观的样本外日内回报和夏普比率。这种被称为隔夜-日内反转的策略,其平均回报大约是传统反转策略产生的回报的二到五倍。投资者异质性、情绪、市场不确定性和全市场流动性不足都无法解释这种隔夜-日内反转回报。我们的发现与资产类别特定的做市商流动性供给机制一致,我们发现横截面回报分散可以预测每个资产类别的策略回报。一个由市场和隔夜-日内反转因子组成的全球双因子模型,很好地解释了跨资产类别的多元化投资组合的日内回报变化。

IV. 回测表现

年化回报9.18%
波动率11.17%
β值0.01
夏普比率0.82
索提诺比率-0.472
最大回撤N/A
胜率50%

V. 完整的 Python 代码

from AlgorithmImports import *
class OvernightIntradayWeeklyReversalCurrency(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2000, 1, 1)
        self.SetCash(100000)
        
        self.symbols = [
                        "CME_AD1", # Australian Dollar Futures, Continuous Contract #1
                        "CME_BP1", # British Pound Futures, Continuous Contract #1
                        "CME_CD1", # Canadian Dollar Futures, Continuous Contract #1
                        "CME_EC1", # Euro FX Futures, Continuous Contract #1
                        "CME_JY1", # Japanese Yen Futures, Continuous Contract #1
                        "CME_MP1", # Mexican Peso Futures, Continuous Contract #1
                        "CME_NE1", # New Zealand Dollar Futures, Continuous Contract #1
                        "CME_SF1"  # Swiss Franc Futures, Continuous Contract #1
                        ]
        
        self.friday_close = {}
        self.leverage = 1
        
        for symbol in self.symbols:
            data = self.AddData(QuantpediaFutures, symbol, Resolution.Daily)
            data.SetFeeModel(CustomFeeModel())
            data.SetLeverage(5)
            self.friday_close[symbol] = 0
            
    def OnData(self, data):
        # Saturday -> Friday close available
        if self.Time.date().weekday() == 5:
            for symbol in self.symbols:
                if symbol in data and data[symbol]:
                    price = data[symbol].Value
                    if price != 0:
                        self.friday_close[symbol] = price
                    
            self.Liquidate()
        # Tuesday -> Monday close available
        elif self.Time.date().weekday() == 1:
            returns = {}
            
            for symbol in self.symbols:
                # Check if data is still coming.
                if self.securities[symbol].get_last_data() and self.time.date() > QuantpediaFutures.get_last_update_date()[symbol]:
                    self.liquidate(symbol)
                    continue
                if symbol in data and data[symbol]:
                    price = data[symbol].Value
                    if price != 0 and symbol in self.friday_close and self.friday_close[symbol] != 0:
                        returns[symbol] = price / self.friday_close[symbol] - 1
            
            self.friday_close.clear()
            if len(returns) == 0: 
                return
            
            ret_mean = np.mean([x[1] for x in returns.items()])
            
            weight = {}
            N = len(returns)
            for symbol in returns:
                weight[symbol] = -(1/N) * (returns[symbol] - ret_mean) * 100
    
            for symbol in weight:
                self.SetHoldings(symbol, self.leverage * weight[symbol])
# Quantpedia data.
# NOTE: IMPORTANT: Data order must be ascending (datewise)
class QuantpediaFutures(PythonData):
    _last_update_date:Dict[Symbol, datetime.date] = {}
    @staticmethod
    def get_last_update_date() -> Dict[Symbol, datetime.date]:
       return QuantpediaFutures._last_update_date
    def GetSource(self, config, date, isLiveMode):
        return SubscriptionDataSource("data.quantpedia.com/backtesting_data/futures/{0}.csv".format(config.Symbol.Value), SubscriptionTransportMedium.RemoteFile, FileFormat.Csv)
    def Reader(self, config, line, date, isLiveMode):
        data = QuantpediaFutures()
        data.Symbol = config.Symbol
        
        if not line[0].isdigit(): return None
        split = line.split(';')
        
        data.Time = datetime.strptime(split[0], "%d.%m.%Y") + timedelta(days=1)
        data['back_adjusted'] = float(split[1])
        data['spliced'] = float(split[2])
        data.Value = float(split[1])
        if config.Symbol.Value not in QuantpediaFutures._last_update_date:
            QuantpediaFutures._last_update_date[config.Symbol.Value] = datetime(1,1,1).date()
        if data.Time.date() > QuantpediaFutures._last_update_date[config.Symbol.Value]:
            QuantpediaFutures._last_update_date[config.Symbol.Value] = data.Time.date()
            
        return data
# Custom fee model.
class CustomFeeModel(FeeModel):
    def GetOrderFee(self, parameters):
        fee = parameters.Security.Price * parameters.Order.AbsoluteQuantity * 0.00005
        return OrderFee(CashAmount(fee, "USD"))

发表评论

了解 Quant Buffet 的更多信息

立即订阅以继续阅读并访问完整档案。

继续阅读