Add AI generated cap-band strategy example
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
let refresh_rate = 15;
|
||||||
|
let stocknum = 40;
|
||||||
|
let xs = 0.008;
|
||||||
|
let base_index_level = 2000;
|
||||||
|
let lower_offset = 3;
|
||||||
|
let upper_offset = 28;
|
||||||
|
|
||||||
|
fn cap_floor(current_price, base_index_level, xs, lower_offset) {
|
||||||
|
round((current_price - base_index_level) * xs + lower_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cap_ceiling(current_price, base_index_level, xs, upper_offset) {
|
||||||
|
round((current_price - base_index_level) * xs + upper_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
strategy("ai_generated_000001_open_cap_band") {
|
||||||
|
market("CN_A")
|
||||||
|
benchmark("000852.SH")
|
||||||
|
signal("000001.SH")
|
||||||
|
|
||||||
|
rebalance.every_days(refresh_rate).at("10:18")
|
||||||
|
|
||||||
|
universe.exclude("paused", "st", "kcb", "one_yuan", "new_listing")
|
||||||
|
|
||||||
|
selection.limit(stocknum)
|
||||||
|
selection.market_cap_band(
|
||||||
|
field="market_cap",
|
||||||
|
lower=cap_floor(signal_open, base_index_level, xs, lower_offset),
|
||||||
|
upper=cap_ceiling(signal_open, base_index_level, xs, upper_offset)
|
||||||
|
)
|
||||||
|
|
||||||
|
filter.stock_expr(
|
||||||
|
stock_ma5 > stock_ma10 &&
|
||||||
|
stock_ma10 > stock_ma30 &&
|
||||||
|
rolling_mean("volume", 5) < rolling_mean("volume", 60) &&
|
||||||
|
!ends_with(symbol, ".BJ") &&
|
||||||
|
!at_upper_limit &&
|
||||||
|
!at_lower_limit
|
||||||
|
)
|
||||||
|
|
||||||
|
ordering.rank_by("market_cap", "asc")
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"strategyId": "ai_generated_000001_open_cap_band",
|
||||||
|
"version": "2",
|
||||||
|
"parser": "omniquant-engine-script-v2",
|
||||||
|
"market": "CN_A",
|
||||||
|
"signalSymbol": "000001.SH",
|
||||||
|
"benchmark": {
|
||||||
|
"instrumentId": "000852.SH",
|
||||||
|
"fallbackInstrumentId": "000852.SH"
|
||||||
|
},
|
||||||
|
"engineConfig": {
|
||||||
|
"market": "CN_A",
|
||||||
|
"signalSymbol": "000001.SH",
|
||||||
|
"benchmarkSymbol": "000852.SH",
|
||||||
|
"refreshRate": 15,
|
||||||
|
"rankLimit": 40
|
||||||
|
},
|
||||||
|
"runtimeExpressions": {
|
||||||
|
"prelude": "let refresh_rate = 15;\nlet stocknum = 40;\nlet xs = 0.008;\nlet base_index_level = 2000;\nlet lower_offset = 3;\nlet upper_offset = 28;\n\nfn cap_floor(current_price, base_index_level, xs, lower_offset) {\nround((current_price - base_index_level) * xs + lower_offset)\n}\n\nfn cap_ceiling(current_price, base_index_level, xs, upper_offset) {\nround((current_price - base_index_level) * xs + upper_offset)\n}",
|
||||||
|
"selection": {
|
||||||
|
"limitExpr": "stocknum",
|
||||||
|
"marketCapField": "market_cap",
|
||||||
|
"marketCapLowerExpr": "cap_floor(signal_open, base_index_level, xs, lower_offset)",
|
||||||
|
"marketCapUpperExpr": "cap_ceiling(signal_open, base_index_level, xs, upper_offset)",
|
||||||
|
"stockFilterExpr": "stock_ma5 > stock_ma10 && stock_ma10 > stock_ma30 && rolling_mean(\"volume\", 5) < rolling_mean(\"volume\", 60) && !ends_with(symbol, \".BJ\") && !at_upper_limit && !at_lower_limit"
|
||||||
|
},
|
||||||
|
"ordering": {
|
||||||
|
"rankBy": "market_cap",
|
||||||
|
"rankExpr": "",
|
||||||
|
"rankOrder": "asc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user