OptoPick
正在开发

把策略代码,变成可验证的证据

预约期权策略回测工作台,通过预设 DSL 重放标的池、候选筛选与价差规则,并在历史市场环境中检验结果。

加载可复用的策略预设重放配置与价差规则跨市场环境比较候选结果
策略示例value-allocation.dsl
//@version=1strategy("value-allocation-dsl")universe_code = input.string("value_allocation", title="Universe Code")top_n = input.int(5, title="Top N", minval=1, maxval=12)target_delta = input.float(0.35, title="Target Delta", minval=0.05, maxval=0.8, step=0.01)qty = input.float(1, title="Contracts", minval=1, maxval=20, step=1)market_name = input.string("us", title="Options Market", options=["us"])max_candidates = input.int(12, title="Max Candidates", minval=1, maxval=12)symbols = universe.symbols(universe_code)plot(len(symbols), title="universe_size", precision=0)plot(spread.count(), title="open_spreads", precision=0)candidate_items = []for symbol in symbols  upper_symbol = str.upper(symbol)  excluded = upper_symbol == "SPY" or upper_symbol == "QQQ" or upper_symbol == "IBIT"  if not excluded    pe = request.fundamental("us-stocks", symbol, "pe", "filled")    pb = request.fundamental("us-stocks", symbol, "pb", "filled")    price = request.security("us-stocks", symbol, "1d", "close")    pe_percentile = ta.percentrank_valid(pe, 630, 200)    pb_percentile = ta.percentrank_valid(pb, 630, 200)    price_percentile = ta.percentrank_valid(price, 630, 200)    valuation_percentile = price_percentile    if not na(pe_percentile) and not na(pb_percentile)      valuation_percentile = math.avg(pe_percentile, pb_percentile)    else if not na(pe_percentile)      valuation_percentile = pe_percentile    else if not na(pb_percentile)      valuation_percentile = pb_percentile