AI Quant Engine

AI 量化交易
闭环执行
AI Trading,
Closed Loop

Break a Leg

将市场观察、决策生成、风控约束、执行落地与状态对账连成闭环的模块化 AI 量化运行引擎A modular AI quant engine that closes the loop from market observation and decision-making to risk control, execution, and reconciliation

$ curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash
一条命令启动,Brale 与 Freqtrade 自动对接运行 One command to start — Brale and Freqtrade connect and run automatically
Pipeline

透明可控的模块化流水线Transparent, Modular Pipeline

告别不可控的黑盒判断。Brale 严格遵循六步决策闭环,允许你在配置层对运行周期、特征指标与策略参数进行像素级自定义No more black-box decisions. Brale follows a strict six-step decision loop, with pixel-level control over cycles, indicators, and strategy params at the config layer

Observe 多维行情特征Multi-dim signals
Decide AI 策略联合研判AI + strategy analysis
Plan 构建入场与止盈损Entry, SL & TP
Execute 后端实盘下单Live order execution
Monitor 持仓风险追踪Risk monitoring
Reconcile 状态对账与同步State reconciliation
CONFIG_DRIVEN

高度自定义配置Highly Configurable

从运行周期到风控参数,一切通过配置文件驱动From trading cycles to risk parameters, everything is config-driven

  • 自定义运行周期Custom Trading Cycles支持 1m5m1h 等任意时间切片调度Schedule on any timeframe — 1m, 5m, 1h, or any interval
  • 灵活组合特征指标Flexible Feature组合接入技术指标或衍生品数据 (多空比, 资金费率)Plug in technical indicators or derivatives data (long/short ratio, funding rate)
  • 模型与风控路由Model & Risk Routing设定最大回撤与单次仓位 Risk PercentageSet max drawdown and per-position risk percentage
configs/symbols/ETHUSDT.toml
# 币种标识# Symbol identifier
symbol = "ETHUSDT"
# 自定义周期以及k线长度# Custom intervals and kline limit
intervals = ["15m", "1h", "4h"]
kline_limit = 300

[risk_management.gate]
# 建仓质量阈值# Build quality threshold
# 调参:0.20 激进 / 0.35 默认 / 0.55 保守# Tune: 0.20 aggressive / 0.35 default / 0.55 conservative
quality_threshold = 0.35

# 执行价值阈值# Execution edge threshold
# 调参:0.05 激进 / 0.10 默认 / 0.20 保守# Tune: 0.05 aggressive / 0.10 default / 0.20 conservative
edge_threshold = 0.10

[risk_management.sieve]
# 最小仓位比例下限# Minimum position size floor
min_size_factor = 0.35

Decision Engine

Gate 决定做不做,Sieve 决定做多大Gate Decides Whether, Sieve Decides How Much

Brale 的决策引擎分为两层:Gate 负责硬停与质量评估,Sieve 负责仓位缩放。两层独立运作,互不干扰Brale's decision engine has two layers: Gate handles hard stops and quality assessment, Sieve handles position scaling. They operate independently

四种情况不做Four Hard Stops

Gate 先执行四个硬停检查,任一触发直接拒绝Gate runs four hard-stop checks first — any trigger means immediate rejection

  • 方向不明Unclear Direction结构与指标无法形成一致的方向判断Structure and indicators cannot form a consistent directional signal
  • 数据缺失Missing Data配置要求的数据源无法获取Required data sources in config are unavailable
  • 结构硬失效Structure Hard Failure市场结构出现明确的反向信号Market structure shows clear counter-directional signals
  • 连锁清算Cascade Liquidation检测到连锁清算风险,市场处于极端状态Cascade liquidation risk detected, market in extreme state

满足条件才做Trade When Conditions Met

Gate 计算三个分数,通过两个阈值决定是否放行Gate calculates three scores and uses two thresholds to decide

setup_quality 建仓质量setup_quality[0, 1]

结构清晰 + 指标对齐 + 动能扩张 − 噪音Structure clarity + indicator alignment + momentum − noise

risk_penalty 执行风险risk_penalty[0, 1]

拥挤度、波动率、滑点等风险因子Crowding, volatility, slippage and other risk factors

entry_edge 执行价值entry_edge[0, 1]

|方向分数| × quality × (1 − risk_penalty)|direction| × quality × (1 − risk_penalty)

阈值调参指南Threshold Tuning Guide

两个阈值决定 Gate 的放行严格程度Two thresholds determine how strict the Gate is

QT
quality_threshold 质量阈值quality_threshold
0.20
激进Aggressive
0.35
默认Default
0.55
保守Conservative
0.75
极保守Very strict
ET
edge_threshold 价值阈值edge_threshold
0.05
激进Aggressive
0.10
默认Default
0.20
保守Conservative
0.30
极保守Very strict

Sieve 仓位缩放Sieve Position Scaling

Sieve 按场景匹配决定仓位大小,不改变 Gate 的做不做决策Sieve matches scenarios to determine position size, without changing Gate's go/no-go decision

场景Scenariosize_factor含义Meaning
fuel_ready + high1.0满仓Full position
fuel_ready + low0.7七成仓70% position
neutral + high0.7七成仓70% position
neutral + low0.5半仓Half position
同向拥挤 + highSame-side crowded + high0.4四成仓(赔率差)40% (poor odds)
反向拥挤 + highOpposite crowded + high0.35三成五(风险折扣)35% (risk discount)

min_size_factor = 0.35 · 仓位不会低于 35%min_size_factor = 0.35 · position never drops below 35%

Grade 分级Grade Classification

Grade 由 setup_quality 分段决定,直接影响仓位系数Grade is determined by setup_quality segments, directly affecting position multiplier

≥ 0.75gradeFactor 1.00

HighHigh

最佳 setup,满系数Best setup, full multiplier

≥ 0.55gradeFactor 0.70

MediumMedium

中等 setup,七折系数Medium setup, 70% multiplier

≥ 0.35gradeFactor 0.40

LowLow

及格 setup,四折系数Passing setup, 40% multiplier

< 0.35gradeFactor 0

NoneNone

WAIT,不开仓WAIT, no entry

策略配置示例Strategy Config Examples

不同风险偏好的阈值配置建议Recommended threshold configurations for different risk profiles

保守策略Conservative

适合 BTC 等主流币种,低频稳健For BTC and major coins, low-frequency steady

quality_threshold0.55
edge_threshold0.15
默认DEFAULT
均衡策略Balanced

适合大多数场景的默认配置Default config for most scenarios

quality_threshold0.35
edge_threshold0.10
激进策略Aggressive

适合山寨币、高波动品种For altcoins, high-volatility pairs

quality_threshold0.25
edge_threshold0.05
Features

让 AI 接管交易闭环Let AI Run the Full Loop

相比于单点输出行情的问答模型,Brale 构建了一条包含工程护栏的自动化流水线,处理从进场决策到持仓监控的完整生命周期Unlike single-point Q&A models, Brale builds an automated pipeline with engineering guardrails — from entry decisions to position monitoring across the full lifecycle

完整的交易生命周期闭环Full Trading Lifecycle

从拉取价格和多空比,到流水线决策、下单落地,再到止盈监控与外部平台对账,全链路自动化运作。市场数据不再只用来问涨跌From fetching prices and long/short ratios, through pipeline decisions and order execution, to take-profit monitoring and exchange reconciliation — fully automated end to end

工程化的严格风险约束Engineering-Grade Risk Controls

大模型决策绝不裸奔。Native 与 LLM 两类风险路径,通过工程代码强校验入场价、止损止盈比、仓位管理与清算边界LLM decisions never run unprotected. Both native and LLM risk paths enforce entry price, stop-loss, take-profit ratios, position sizing, and liquidation boundaries through engineering code

模块化与抽象执行层Modular & Abstracted Execution

System、Symbol、Strategy 三层配置架构。原生抽象 Executor 接口,将决策逻辑与执行设施彻底解耦Three-layer config architecture: System, Symbol, Strategy. Native Executor interface fully decouples decision logic from execution infrastructure

极致的全景可观察性Full Observability

不做黑盒交易。持续运行的 RuntimeScheduler,内置 Telegram 与飞书通知,配套本地 Dashboard 与 Onboarding 面板辅助运维No black-box trading. Always-on RuntimeScheduler with built-in Telegram and Feishu notifications, plus local Dashboard and Onboarding panels for operations