Brue
Brue is the trade-entry language. A Brue script writes buy/sell/close decisions over bars, and the same file runs identically in a historical run and live against a broker. Brue is for two things and nothing else: writing trade entries, and connecting them to brokers.
Two products, one install:
- Brue, the language (this package,
import brue): the script engine and the Python entry points..bruescripts are pure trading logic: no header, no credentials, no configuration block. What a script trades, at what quantity, from which data source, at which timeframe is written where it acts. - Brue Connect (
brueconnect, bundled inside this package): the broker connector. One wire protocol, every broker an adapter, the built-in paper account first. It ships with the language, so there is nothing else to install; the language calls it.
pip install brue-language
(brue-language is the distribution; the import is brue. The bare brue name
on PyPI belongs to someone else.)
A script
fast = ema(EURUSD.h1.close, 9)
slow = ema(EURUSD.h1.close, 21)
if crossover(fast, slow):
buy("EURUSD", 0.5, sl=EURUSD.h1.close * 0.995, tp=EURUSD.h1.close * 1.01)
if crossunder(fast, slow):
close("EURUSD")
Over history, from the command line:
python -m brue run trend.brue eurusd_h1.csv --capital 100000 --commission 0.001
The same, from Python, and then live:
import brue
bars = brue.parse_bars_csv(open("eurusd_h1.csv").read())
out = brue.run_script(open("trend.brue").read(), bars) # historical run
out.commands # entries, exits, pnl
brue.login(api_key="lse_...") # the only credential that ever appears
brue.buy("EURUSD", 0.5, sl=1.05, tp=1.12) # live, via Brue Connect
brue.close("EURUSD")
Historical runs simulate the fills (next-bar-open, brackets, commission,
slippage) and report what was executed: the trade records, the log() lines,
the canonical JSON. There is no stats block, no equity frame and no pandas
indicator surface in this package; research on the results happens in plain
Python on the host. Indicator scripts (plot() calls, no orders) are exposed
through brue.Indicator for chart hosts. The language reference is
SYNTAX.md; the boundary of what Brue owns is ARCHITECTURE.md.
Why the decisions can be trusted
The engine is conformance-locked: conformance/run_all_py.sh runs the
corpus (every construct of the language plus the loud-error cases) and
byte-compares the execution JSON against locked goldens. A fill or a formula
cannot silently drift, and a live run re-derives the same order intents from
the same script text.
Status
Version 0.0.1. Pure Python, stdlib-only engine (pandas is optional and
only used by the convenience frames in brue.live and
brue.Indicator.compute).
Account login
Anything account-bound (LSE data, placing orders) starts with your LSE API key, the same key you use on the data platform:
import brue
brue.login(api_key="lse_...") # or BRUE_API_KEY / LSE_API_KEY env,
brue.account() # or ~/.config/brue/config.json
Historical runs on your own bars never need a key: the engine runs fully offline.
Metadata
Release files for brue-language 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brue_language-0.0.1.tar.gz | 590.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brue_language-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.0 MB
Release files / brue_language-0.0.1.tar.gz
| Download URL | brue_language-0.0.1.tar.gz |
|---|---|
| Size | 590.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c132cdf2b0c7d8e08eb97d5a9bf1ccaecb07d2dd4d7d2d69cad6e767db26506b
|
|
BLAKE2b-256 checksum How to use checksums |
da143ddaa50d930ec47ec7abee4382612c58181c80d070b2677c1761ee29041d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / brue_language-0.0.1-py3-none-any.whl
| Download URL | brue_language-0.0.1-py3-none-any.whl |
|---|---|
| Size | 415.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17077b88ba11f4317dcd188109861ae69d0bbe4d26a53af244c028b2a201c275
|
|
BLAKE2b-256 checksum How to use checksums |
45f8b6965570326767c4f58510ed065bfd0e2474f0371cc2a5bcbd4c42b7a750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|