卖SPY末日期权胜率有多少?

之前发现美股的SPY期权居然有周1,周3过期的期权,这样加上周5,一周有3天过期的期权了。之前尝试卖过几次末日期权,胜率还蛮高。来去quantopian上统计下真的历史胜率有多少?

"""
This is a template algorithm on Quantopian for you to adapt and fill in.
"""
import quantopian.algorithm as algo
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.filters import QTradableStocksUS


def initialize(context):
    """
    Called once at the start of the algorithm.
    """
    context.enter_price = 0
    context.b_rise = False
    # Rebalance every day, 1 hour after market open.
    algo.schedule_function(
        rebalance,
        algo.date_rules.every_day(),
        algo.time_rules.market_open(minutes=20),
    )

    # Record tracking variables at the end of each day.
    algo.schedule_function(
        record_vars,
        algo.date_rules.every_day(),
        algo.time_rules.market_close(),
    )
def before_trading_start(context, data):
    """
    Called every day before market open.
    """
    pass


def rebalance(context, data):
    """
    Execute orders according to our schedule_function() timing.
    """
    
    weekday = get_datetime("US/Eastern").date().weekday() + 1
    if weekday == 1 or weekday == 3 or weekday == 5:
        log.info(weekday)
        history_data = data.history(symbol('SPY'), ['close','high','low','open'], 2, '1m')
        context.enter_price = history_data['close'][-1]
        history_data_day = data.history(symbol('SPY'), ['close','high','low','open'], 2, '1d')
        log.info("enter_price:" + str(context.enter_price))
        if history_data_day['close'][-1] > history_data_day['close'][0]:
            context.b_rise = True
        else:
            context.b_rise = False
    pass


def record_vars(context, data):
    """
    Plot variables at the end of each day.
    """
    weekday = get_datetime("US/Eastern").date().weekday() + 1
    if weekday == 1 or weekday == 3 or weekday == 5:
        history_data = data.history(symbol('SPY'), ['close','high','low','open'], 2, '1d')
        high_price = history_data['high'][-1]
        low_price = history_data['low'][-1]
        log.info("high_price:" + str(high_price))
        log.info("low_price:" + str(low_price))
        
        if context.b_rise:
            if low_price >= context.enter_price * 0.993:
                log.info("Success Put Ex")
            else:
                log.info("Fail Put Ex")
        else:
            if high_price <= context.enter_price * 1.006:
                log.info("Success Call Ex")
            else:
                log.info("Fail Call Ex")
    pass


def handle_data(context, data):
    """
    Called every minute.
    """
    pass

逻辑是开盘20分钟后,如果SPY是涨的,就卖执行价为当前价格 * 0.993的PUT,如果是跌的,就卖执行价为价格* 1.006的Call。如果卖的是PUT,收盘前最低价击穿执行价就止损,如果卖的是CALL,收盘前最高价击穿执行价就止损。 统计Log,发现跟无脑卖的胜率差不多,都是75%左右。
估计盈亏比是1:3.所以这个策略没法盈利。

你可能感兴趣的:(量化投资)