Skip to content

laukkw/brale-core

Repository files navigation

⚠ Beta — This project is under active development / 项目正处于活跃开发阶段。

Brale — Break a Leg

AI-powered multi-agent quantitative trading engine. Break a leg — good luck.

brale.club

Language / 语言: English | 简体中文


English Version

What Is Brale

Brale is a quantitative trading engine. It uses multiple LLM Agents to analyze markets, then applies a deterministic Go rule engine to enforce risk controls. Models propose trading plans; code validates price levels, leverage, stop-loss, take-profit, sizing, and execution safety.

A full decision cycle runs through observe, decide, plan, execute, monitor, and reconcile. Trade execution currently uses Freqtrade. The runtime API, webhooks, MCP server, and CLI are built around that workflow.

The default setup favors safe validation: Freqtrade runs with dry_run=true. Before live trading, inspect data/freqtrade/user_data/config.json and verify your strategy, risk limits, and exchange settings.

Quick Start

Prerequisites:

  • Linux server or local development machine
  • Docker and Docker Compose v2.20+
  • 2 GB memory recommended, 4 GB+ for long-running or multi-symbol deployments
  • Network access to Binance API and your selected LLM endpoint

One-click deployment:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash

Run setup first, optionally install MCP, then continue with init and start:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --setup --setup-lang en

Skip interactive init when .env is already ready:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --no-init

The default checkout is shallow. Add --full-clone when you need full Git history:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --full-clone

For first-time deployment, proxy setup, upgrades, backups, and manual steps, see the Deployment Guide.

Main Docs

GoalDocument
Deploy, upgrade, back up, configure proxyDeployment Guide
Configure .env, system, symbols, strategiesConfiguration Guide
Use bralectlCLI Reference
Connect Claude, Codex, OpenCode, Cursor, and other MCP clientsMCP Integration
Understand decisions, risk controls, Provider anchorsTrading Logic
Runtime API, webhooks, notifications, storageRuntime API
Database, memory, notification, execution internalsSubsystem Guide
Startup, network, LLM, and scheduler issuesTroubleshooting

Configuration and Tools

Main configuration lives under configs/. Runtime data lives under data/. For a first deployment, use make init or the bootstrap init wizard to generate local configuration instead of copying production files by hand.

bralectl is the main CLI for local setup, config checks, observations, decision queries, position views, MCP service management, and E2E tests. See CLI Reference for full usage.

LLM token usage grows linearly with symbol count and decision frequency. One symbol, three timeframes, and a 1-hour cycle usually costs about 300K tokens/day. A 15-minute cycle costs about 1.1M to 1.2M tokens/day.

Branch and Release

  • master is the stable / production branch.
  • dev is the daily integration branch.
  • Feature branches use feat/xxx; bug-fix branches use fix/xxx.
  • Releases use semantic version tags such as v0.x.y.

License

GNU Affero General Public License v3.0 only (AGPL-3.0-only). See LICENSE.

Disclaimer

  • This project is for technical research and workflow validation only. It is not investment advice.
  • Digital asset trading is volatile and may result in partial or total loss of funds.
  • Users are responsible for evaluating strategies, parameters, and risk controls.
  • Historical performance, backtest results, and sample configs do not guarantee future returns.
  • Test thoroughly in an isolated environment before production use.

中文版

什么是 Brale

Brale 是一个量化交易引擎。它用多个大语言模型智能体分析行情,再用确定性的 Go 规则引擎执行风控约束。模型负责提出交易计划,代码负责校验价格、杠杆、止损、止盈、仓位和执行安全。

一个完整决策周期会经过观测、决策、规划、执行、监控和对账。交易执行目前对接 Freqtrade,运行状态、Webhook、MCP 和 CLI 工具都围绕这条主链路设计。

默认配置偏向安全验证:Freqtrade 使用模拟盘 dry_run=true 。真实上线前必须检查生成的 data/freqtrade/user_data/config.json ,并自行确认策略、风控和交易所配置。

快速开始

前置条件:

  • Linux 服务器或本地开发机
  • Docker 与 Docker Compose v2.20+
  • 建议内存 2 GB 起,长期运行或多品种建议 4 GB+
  • 需要能访问 Binance API 与所选 LLM 端点

一键部署:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash

先执行 setup,可选安装 MCP,再进入 init 向导并自动启动:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --setup --setup-lang zh

已有可用 .env 时跳过交互式 init,直接启动:

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --no-init

默认使用浅克隆;如需完整 Git 历史可加 --full-clone

curl -fsSL https://raw.githubusercontent.com/laukkw/brale-core/master/scripts/bootstrap.sh | bash -s -- --full-clone

首次部署、代理配置、升级、备份和手动部署步骤见 部署指南

常用入口

目标文档
部署、升级、备份、代理部署指南
配置 .env / 系统 / 品种 / 策略配置指南
使用 bralectlCLI 参考
接入 Claude、Codex、OpenCode、Cursor 等 MCP 客户端MCP 集成
理解交易决策、风控、Provider 锚定因子交易逻辑
Runtime API、Webhook、通知、存储运行时 API
数据库、记忆、通知、执行层等内部组件子系统指南
启动失败、网络、LLM、调度问题故障排查

配置与工具

主要配置在 configs/ 下,运行时数据在 data/ 下。首次部署建议用 make init 或一键脚本里的 init 向导生成配置,不建议直接复制生产环境配置。

bralectl 是本项目的主要命令行工具,用来完成本地初始化、配置检查、观测、决策查询、持仓查看、MCP 服务和 E2E 测试。完整命令见 CLI 参考

LLM Token 用量会随品种数和决策频率线性增长。单品种、三时间框架、1 小时周期通常约 30 万 Token / 日;15 分钟周期约 110 万到 120 万 Token / 日。

分支与发布

  • master 是稳定 / 生产分支,部署和发布默认从此分支进行。
  • dev 是日常开发集成分支。
  • 功能分支使用 feat/xxx ,修复分支使用 fix/xxx
  • 发布使用语义化版本标签 v0.x.y

许可证

GNU Affero 通用公共许可证 v3.0(AGPL-3.0-only)。详见 LICENSE

免责声明

  • 本项目仅用于技术研究与流程验证,不构成任何投资建议。
  • 数字资产交易波动剧烈,可能导致部分或全部资金损失。
  • 用户须自行评估策略、参数及风控措施,并承担全部责任。
  • 历史表现、回测结果或示例配置不代表未来收益。
  • 投入生产前,请务必在隔离环境中完成充分测试。

赞助

ETH: 0x4b4C8041A8154a5AfB87E5589Ea292123E098267

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors