brue-language 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. brue_language-0.0.1/.gitignore +3 -0
  2. brue_language-0.0.1/ARCHITECTURE.md +98 -0
  3. brue_language-0.0.1/LICENSE +21 -0
  4. brue_language-0.0.1/PKG-INFO +110 -0
  5. brue_language-0.0.1/README.md +92 -0
  6. brue_language-0.0.1/SYNTAX.md +738 -0
  7. brue_language-0.0.1/brue/__init__.py +76 -0
  8. brue_language-0.0.1/brue/__main__.py +5 -0
  9. brue_language-0.0.1/brue/api.py +168 -0
  10. brue_language-0.0.1/brue/ast.py +321 -0
  11. brue_language-0.0.1/brue/auth.py +136 -0
  12. brue_language-0.0.1/brue/builtins.py +2283 -0
  13. brue_language-0.0.1/brue/cli.py +282 -0
  14. brue_language-0.0.1/brue/data.py +627 -0
  15. brue_language-0.0.1/brue/errors.py +71 -0
  16. brue_language-0.0.1/brue/indicators.py +2433 -0
  17. brue_language-0.0.1/brue/jsmath.py +551 -0
  18. brue_language-0.0.1/brue/jsnum.py +123 -0
  19. brue_language-0.0.1/brue/live.py +287 -0
  20. brue_language-0.0.1/brue/output.py +521 -0
  21. brue_language-0.0.1/brue/parser.py +1136 -0
  22. brue_language-0.0.1/brue/runtime.py +3242 -0
  23. brue_language-0.0.1/brue/session.py +233 -0
  24. brue_language-0.0.1/brue/strategy.py +760 -0
  25. brue_language-0.0.1/brue/tokenizer.py +394 -0
  26. brue_language-0.0.1/brue/value.py +283 -0
  27. brue_language-0.0.1/brueconnect/__init__.py +15 -0
  28. brue_language-0.0.1/brueconnect/__main__.py +383 -0
  29. brue_language-0.0.1/brueconnect/adapter.py +329 -0
  30. brue_language-0.0.1/brueconnect/adapters/__init__.py +0 -0
  31. brue_language-0.0.1/brueconnect/adapters/atlas/atlas_adapter.py +2297 -0
  32. brue_language-0.0.1/brueconnect/adapters/helix/helix_adapter.py +2120 -0
  33. brue_language-0.0.1/brueconnect/adapters/lse_sim/__init__.py +0 -0
  34. brue_language-0.0.1/brueconnect/adapters/lse_sim/lse_sim_adapter.py +895 -0
  35. brue_language-0.0.1/brueconnect/adapters/meridian/meridian_adapter.py +2029 -0
  36. brue_language-0.0.1/brueconnect/adapters/northgate/northgate_adapter.py +1926 -0
  37. brue_language-0.0.1/brueconnect/adapters/novafx/__init__.py +0 -0
  38. brue_language-0.0.1/brueconnect/adapters/novafx/novafx_adapter.py +164 -0
  39. brue_language-0.0.1/brueconnect/adapters/paper/__init__.py +0 -0
  40. brue_language-0.0.1/brueconnect/adapters/paper/paper_adapter.py +659 -0
  41. brue_language-0.0.1/brueconnect/adapters/pemberton/pemberton_adapter.py +1860 -0
  42. brue_language-0.0.1/brueconnect/adapters/quantex/quantex_adapter.py +1884 -0
  43. brue_language-0.0.1/brueconnect/adapters/sablepoint/sablepoint_adapter.py +2507 -0
  44. brue_language-0.0.1/brueconnect/adapters/vertex/vertex_adapter.py +2003 -0
  45. brue_language-0.0.1/brueconnect/client.py +694 -0
  46. brue_language-0.0.1/brueconnect/conformance/__init__.py +0 -0
  47. brue_language-0.0.1/brueconnect/conformance/auth_drivers/__init__.py +0 -0
  48. brue_language-0.0.1/brueconnect/conformance/auth_drivers/meridian_login.py +62 -0
  49. brue_language-0.0.1/brueconnect/conformance/run.py +873 -0
  50. brue_language-0.0.1/brueconnect/protocol.py +234 -0
  51. brue_language-0.0.1/brueconnect/registry.py +280 -0
  52. brue_language-0.0.1/brueconnect/runner/__init__.py +0 -0
  53. brue_language-0.0.1/brueconnect/runner/live_driver.py +341 -0
  54. brue_language-0.0.1/conformance/run_all_py.sh +134 -0
  55. brue_language-0.0.1/conformance/v2/cases.tsv +38 -0
  56. brue_language-0.0.1/conformance/v2/corpus/01_ema_cross.brue +11 -0
  57. brue_language-0.0.1/conformance/v2/corpus/02_mas.brue +21 -0
  58. brue_language-0.0.1/conformance/v2/corpus/03_osc1.brue +15 -0
  59. brue_language-0.0.1/conformance/v2/corpus/04_osc2.brue +15 -0
  60. brue_language-0.0.1/conformance/v2/corpus/05_osc3.brue +21 -0
  61. brue_language-0.0.1/conformance/v2/corpus/06_mathlogic.brue +32 -0
  62. brue_language-0.0.1/conformance/v2/corpus/07_volatility.brue +25 -0
  63. brue_language-0.0.1/conformance/v2/corpus/08_trend.brue +30 -0
  64. brue_language-0.0.1/conformance/v2/corpus/09_volume.brue +26 -0
  65. brue_language-0.0.1/conformance/v2/corpus/10_stats.brue +13 -0
  66. brue_language-0.0.1/conformance/v2/corpus/11_time.brue +22 -0
  67. brue_language-0.0.1/conformance/v2/corpus/12_semantics.brue +30 -0
  68. brue_language-0.0.1/conformance/v2/corpus/13_history.brue +17 -0
  69. brue_language-0.0.1/conformance/v2/corpus/14_controlflow.brue +30 -0
  70. brue_language-0.0.1/conformance/v2/corpus/15_functions.brue +17 -0
  71. brue_language-0.0.1/conformance/v2/corpus/16_arrays.brue +21 -0
  72. brue_language-0.0.1/conformance/v2/corpus/17_maps.brue +21 -0
  73. brue_language-0.0.1/conformance/v2/corpus/18_types.brue +19 -0
  74. brue_language-0.0.1/conformance/v2/corpus/19_strings.brue +24 -0
  75. brue_language-0.0.1/conformance/v2/corpus/21_inputs.brue +18 -0
  76. brue_language-0.0.1/conformance/v2/corpus/22_strategy_deep.brue +18 -0
  77. brue_language-0.0.1/conformance/v2/corpus/23_tuple_quirk.brue +13 -0
  78. brue_language-0.0.1/conformance/v2/corpus/27_numeric_edges.brue +16 -0
  79. brue_language-0.0.1/conformance/v2/corpus/28_series_promotion.brue +17 -0
  80. brue_language-0.0.1/conformance/v2/corpus/29_more.brue +17 -0
  81. brue_language-0.0.1/conformance/v2/corpus/31_use_fed.brue +37 -0
  82. brue_language-0.0.1/conformance/v2/corpus/32_econ_fed.brue +38 -0
  83. brue_language-0.0.1/conformance/v2/corpus/33_multi_fed.brue +35 -0
  84. brue_language-0.0.1/conformance/v2/corpus/e10_member_assign.brue +3 -0
  85. brue_language-0.0.1/conformance/v2/corpus/e11_kwarg_unknown.brue +3 -0
  86. brue_language-0.0.1/conformance/v2/corpus/e12_no_strategy.brue +1 -0
  87. brue_language-0.0.1/conformance/v2/corpus/e1_unknown_fn.brue +1 -0
  88. brue_language-0.0.1/conformance/v2/corpus/e2_missing_arg.brue +5 -0
  89. brue_language-0.0.1/conformance/v2/corpus/e3_perbar_source.brue +6 -0
  90. brue_language-0.0.1/conformance/v2/corpus/e5_parse_colon.brue +2 -0
  91. brue_language-0.0.1/conformance/v2/corpus/e6_tokenize.brue +1 -0
  92. brue_language-0.0.1/conformance/v2/corpus/e8_unterminated.brue +1 -0
  93. brue_language-0.0.1/conformance/v2/corpus/e9_bad_number.brue +1 -0
  94. brue_language-0.0.1/conformance/v2/fixtures/31_use_fed/BTCUSD.csv +91 -0
  95. brue_language-0.0.1/conformance/v2/fixtures/31_use_fed/SPY.csv +61 -0
  96. brue_language-0.0.1/conformance/v2/fixtures/32_econ_fed/econ.json +94 -0
  97. brue_language-0.0.1/conformance/v2/fixtures/33_multi_fed/cot.json +25 -0
  98. brue_language-0.0.1/conformance/v2/fixtures/33_multi_fed/earnings.json +40 -0
  99. brue_language-0.0.1/conformance/v2/fixtures/bars_big.csv +3001 -0
  100. brue_language-0.0.1/conformance/v2/fixtures/bars_med.csv +501 -0
  101. brue_language-0.0.1/conformance/v2/fixtures/bars_small.csv +61 -0
  102. brue_language-0.0.1/conformance/v2/golden/01_ema_cross.json +1 -0
  103. brue_language-0.0.1/conformance/v2/golden/02_mas.json +1 -0
  104. brue_language-0.0.1/conformance/v2/golden/03_osc1.json +1 -0
  105. brue_language-0.0.1/conformance/v2/golden/04_osc2.json +1 -0
  106. brue_language-0.0.1/conformance/v2/golden/05_osc3.json +1 -0
  107. brue_language-0.0.1/conformance/v2/golden/06_mathlogic.json +1 -0
  108. brue_language-0.0.1/conformance/v2/golden/07_volatility.json +1 -0
  109. brue_language-0.0.1/conformance/v2/golden/08_trend.json +1 -0
  110. brue_language-0.0.1/conformance/v2/golden/09_volume.json +1 -0
  111. brue_language-0.0.1/conformance/v2/golden/10_stats.json +1 -0
  112. brue_language-0.0.1/conformance/v2/golden/11_time.json +1 -0
  113. brue_language-0.0.1/conformance/v2/golden/12_semantics.json +1 -0
  114. brue_language-0.0.1/conformance/v2/golden/13_history.json +1 -0
  115. brue_language-0.0.1/conformance/v2/golden/14_controlflow.json +1 -0
  116. brue_language-0.0.1/conformance/v2/golden/15_functions.json +1 -0
  117. brue_language-0.0.1/conformance/v2/golden/16_arrays.json +1 -0
  118. brue_language-0.0.1/conformance/v2/golden/17_maps.json +1 -0
  119. brue_language-0.0.1/conformance/v2/golden/18_types.json +1 -0
  120. brue_language-0.0.1/conformance/v2/golden/19_strings.json +1 -0
  121. brue_language-0.0.1/conformance/v2/golden/21_inputs.json +1 -0
  122. brue_language-0.0.1/conformance/v2/golden/22_strategy_deep.json +1 -0
  123. brue_language-0.0.1/conformance/v2/golden/23_tuple_quirk.json +1 -0
  124. brue_language-0.0.1/conformance/v2/golden/27_numeric_edges.json +1 -0
  125. brue_language-0.0.1/conformance/v2/golden/28_series_promotion.json +1 -0
  126. brue_language-0.0.1/conformance/v2/golden/29_more.json +1 -0
  127. brue_language-0.0.1/conformance/v2/golden/31_use_fed.json +1 -0
  128. brue_language-0.0.1/conformance/v2/golden/32_econ_fed.json +1 -0
  129. brue_language-0.0.1/conformance/v2/golden/33_multi_fed.json +1 -0
  130. brue_language-0.0.1/pyproject.toml +57 -0
@@ -0,0 +1,3 @@
1
+ __pycache__/
2
+ conformance/out/
3
+ dist/
@@ -0,0 +1,98 @@
1
+ # Brue's job: the decision layer
2
+
3
+ Brue is the trade-entry language: buy/sell/close scripts over bars that run
4
+ identically in a historical run and live against a broker through Brue
5
+ Connect. Brue is for writing trade entries and connecting them to brokers;
6
+ nothing else is Brue.
7
+
8
+ One sentence: given bars, Brue decides what a strategy does, and it makes
9
+ those decisions identically everywhere. Everything else in a trading
10
+ pipeline belongs to something else.
11
+
12
+ ```
13
+ DATA -> BRUE -> EXECUTION -> RESULTS
14
+ pandas / feeds / the strategy historical: simulated trade records,
15
+ broker bars / csv brain fills inside Brue log() lines
16
+ live: order intents -> Brue Connect
17
+ broker adapter
18
+ (user's account)
19
+ ```
20
+
21
+ ## What Brue OWNS
22
+
23
+ 1. **Indicators.** ema, rsi, atr and the rest of the 144 builtins, computed
24
+ with fixed, conformance-locked semantics. Same inputs, same bits, on
25
+ every implementation.
26
+ 2. **Strategy logic.** Entries, exits, conditions, long/short. The part a
27
+ trader actually thinks about, written in a language built for exactly
28
+ that.
29
+ 3. **Position rules.** Sizing (including risk-based sizing off stop
30
+ distance), stops, targets, trailing stops, commission.
31
+ 4. **In a historical run: the simulator.** Next-bar-open fills (an order
32
+ placed on the signal bar fills at the NEXT bar's open, never the signal
33
+ bar), bracket handling, and the trade records. This is where "same
34
+ script, same numbers" is enforced. (There is no stats block, equity
35
+ frame or research helper in the engine: Brue executes, research
36
+ happens in plain Python on the host.)
37
+ 5. **Live is the same script.** buy()/sell()/close() are the one order
38
+ vocabulary. In a historical run they drive the simulator; in a live run
39
+ the identical calls become broker order intents handed to Brue Connect.
40
+ The RUNNER decides historical vs live, never the script (no mode= flag).
41
+
42
+ ## What Brue deliberately does NOT do
43
+
44
+ - It never fetches data. Bars come in from the host (pandas frame, csv,
45
+ a feed, a broker terminal).
46
+ - It never holds broker credentials.
47
+ - It never talks to a broker directly. Executing an intent is Brue
48
+ Connect's job, through whatever adapter the user connects with their own
49
+ account; broker credentials live only on the trader's machine.
50
+ - It never touches the filesystem or network from inside a script. A
51
+ strategy is pure logic over bars, which is what makes it safe to run in
52
+ a sandbox, in a browser, or on someone else's machine.
53
+
54
+ That boundary is the product: the strategy is a portable artifact. The
55
+ same script runs in the desktop terminal, a Python session via
56
+ `brue.run_script(source, bars)`, and live against any connected broker
57
+ through Brue Connect, and every one of those produces bit-identical
58
+ decisions because they are all the same conformance-tested engine. The pipe around the strategy is swappable; the
59
+ strategy is yours.
60
+
61
+ ## How the pieces line up in Python
62
+
63
+ ```python
64
+ import brue # decisions: Brue's job; data is the host's job
65
+
66
+ bars = brue.parse_bars_csv(open("EURJPY_1h.csv").read())
67
+ out = brue.run_script(open("trend.brue").read(), bars) # historical run
68
+ out.commands # trade_entry / trade_exit records with pnl
69
+ out.to_json() # the canonical execution JSON
70
+
71
+ brue.login(api_key="lse_...") # then the same vocabulary goes live
72
+ brue.buy("EURJPY", 0.5); brue.close("EURJPY")
73
+ ```
74
+
75
+ `brue.run_script_full` adds named feeds (`ExternalData`) and run parameters
76
+ (`RunOptions`); `brue.Indicator` exposes an indicator script's plot() series
77
+ to chart hosts. See SYNTAX.md section 21.
78
+
79
+ The engine is locked by the conformance corpus: every construct's output
80
+ is byte-compared against frozen goldens (`conformance/run_all_py.sh`).
81
+
82
+ ## What the package delivers
83
+
84
+ - **Engine.** The tokenizer, parser and runtime for the language, pure
85
+ Python, stdlib only.
86
+ - **Python entry points.** `brue.run_script`, `brue.run_script_full`
87
+ (named feeds via `ExternalData`, run parameters via `RunOptions`),
88
+ `brue.parse_bars_csv`, `brue.Indicator`, and the `python -m brue` CLI.
89
+ - **Live driver.** `brue.live` (login, buy/sell/close, positions, balance,
90
+ history) plus `RunOptions.capture_intents`, which derives each closed
91
+ bar's order intents from the script's own window state so live and
92
+ historical runs share one decision path.
93
+ - **Broker adapters.** Brue Connect (`brueconnect`, installed as a
94
+ dependency): the wire standard, the paper account, and the broker
95
+ adapters behind it. Credentials stay on the trader's machine.
96
+ - **Spec and conformance suite.** `SYNTAX.md` is the rulebook;
97
+ `conformance/` holds the corpus and the frozen goldens so third-party
98
+ tooling can target the language without semantic drift.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 London Strategic Edge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.5
2
+ Name: brue-language
3
+ Version: 0.0.1
4
+ Summary: Brue: the trade-entry language. buy/sell/close scripts that run identically in a historical run and live through Brue Connect.
5
+ Project-URL: Homepage, https://londonstrategicedge.com
6
+ Author-email: London Strategic Edge <support@londonstrategicedge.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Office/Business :: Financial :: Investment
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: tzdata; sys_platform == 'win32'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Brue
20
+
21
+ Brue is the trade-entry language. A Brue script writes buy/sell/close
22
+ decisions over bars, and the same file runs identically in a historical run
23
+ and live against a broker. Brue is for two things and nothing else: writing
24
+ trade entries, and connecting them to brokers.
25
+
26
+ Two products, one install:
27
+
28
+ - **Brue, the language** (this package, `import brue`): the script engine
29
+ and the Python entry points. `.brue` scripts are pure trading logic: no
30
+ header, no credentials, no configuration block. What a script trades, at
31
+ what quantity, from which data source, at which timeframe is written where
32
+ it acts.
33
+ - **Brue Connect** (`brueconnect`, bundled inside this package): the broker
34
+ connector. One wire protocol, every broker an adapter, the built-in paper
35
+ account first. It ships with the language, so there is nothing else to
36
+ install; the language calls it.
37
+
38
+ ```
39
+ pip install brue-language
40
+ ```
41
+
42
+ (`brue-language` is the distribution; the import is `brue`. The bare `brue` name
43
+ on PyPI belongs to someone else.)
44
+
45
+ ## A script
46
+
47
+ ```brue
48
+ fast = ema(EURUSD.h1.close, 9)
49
+ slow = ema(EURUSD.h1.close, 21)
50
+ if crossover(fast, slow):
51
+ buy("EURUSD", 0.5, sl=EURUSD.h1.close * 0.995, tp=EURUSD.h1.close * 1.01)
52
+ if crossunder(fast, slow):
53
+ close("EURUSD")
54
+ ```
55
+
56
+ Over history, from the command line:
57
+
58
+ ```
59
+ python -m brue run trend.brue eurusd_h1.csv --capital 100000 --commission 0.001
60
+ ```
61
+
62
+ The same, from Python, and then live:
63
+
64
+ ```python
65
+ import brue
66
+
67
+ bars = brue.parse_bars_csv(open("eurusd_h1.csv").read())
68
+ out = brue.run_script(open("trend.brue").read(), bars) # historical run
69
+ out.commands # entries, exits, pnl
70
+
71
+ brue.login(api_key="lse_...") # the only credential that ever appears
72
+ brue.buy("EURUSD", 0.5, sl=1.05, tp=1.12) # live, via Brue Connect
73
+ brue.close("EURUSD")
74
+ ```
75
+
76
+ Historical runs simulate the fills (next-bar-open, brackets, commission,
77
+ slippage) and report what was executed: the trade records, the log() lines,
78
+ the canonical JSON. There is no stats block, no equity frame and no pandas
79
+ indicator surface in this package; research on the results happens in plain
80
+ Python on the host. Indicator scripts (`plot()` calls, no orders) are exposed
81
+ through `brue.Indicator` for chart hosts. The language reference is
82
+ `SYNTAX.md`; the boundary of what Brue owns is `ARCHITECTURE.md`.
83
+
84
+ ## Why the decisions can be trusted
85
+
86
+ The engine is conformance-locked: `conformance/run_all_py.sh` runs the
87
+ corpus (every construct of the language plus the loud-error cases) and
88
+ byte-compares the execution JSON against locked goldens. A fill or a formula
89
+ cannot silently drift, and a live run re-derives the same order intents from
90
+ the same script text.
91
+
92
+ ## Status
93
+
94
+ Version 0.0.1. Pure Python, stdlib-only engine (pandas is optional and
95
+ only used by the convenience frames in `brue.live` and
96
+ `brue.Indicator.compute`).
97
+
98
+ ## Account login
99
+
100
+ Anything account-bound (LSE data, placing orders) starts with your LSE API
101
+ key, the same key you use on the data platform:
102
+
103
+ ```python
104
+ import brue
105
+ brue.login(api_key="lse_...") # or BRUE_API_KEY / LSE_API_KEY env,
106
+ brue.account() # or ~/.config/brue/config.json
107
+ ```
108
+
109
+ Historical runs on your own bars never need a key: the engine runs fully
110
+ offline.
@@ -0,0 +1,92 @@
1
+ # Brue
2
+
3
+ Brue is the trade-entry language. A Brue script writes buy/sell/close
4
+ decisions over bars, and the same file runs identically in a historical run
5
+ and live against a broker. Brue is for two things and nothing else: writing
6
+ trade entries, and connecting them to brokers.
7
+
8
+ Two products, one install:
9
+
10
+ - **Brue, the language** (this package, `import brue`): the script engine
11
+ and the Python entry points. `.brue` scripts are pure trading logic: no
12
+ header, no credentials, no configuration block. What a script trades, at
13
+ what quantity, from which data source, at which timeframe is written where
14
+ it acts.
15
+ - **Brue Connect** (`brueconnect`, bundled inside this package): the broker
16
+ connector. One wire protocol, every broker an adapter, the built-in paper
17
+ account first. It ships with the language, so there is nothing else to
18
+ install; the language calls it.
19
+
20
+ ```
21
+ pip install brue-language
22
+ ```
23
+
24
+ (`brue-language` is the distribution; the import is `brue`. The bare `brue` name
25
+ on PyPI belongs to someone else.)
26
+
27
+ ## A script
28
+
29
+ ```brue
30
+ fast = ema(EURUSD.h1.close, 9)
31
+ slow = ema(EURUSD.h1.close, 21)
32
+ if crossover(fast, slow):
33
+ buy("EURUSD", 0.5, sl=EURUSD.h1.close * 0.995, tp=EURUSD.h1.close * 1.01)
34
+ if crossunder(fast, slow):
35
+ close("EURUSD")
36
+ ```
37
+
38
+ Over history, from the command line:
39
+
40
+ ```
41
+ python -m brue run trend.brue eurusd_h1.csv --capital 100000 --commission 0.001
42
+ ```
43
+
44
+ The same, from Python, and then live:
45
+
46
+ ```python
47
+ import brue
48
+
49
+ bars = brue.parse_bars_csv(open("eurusd_h1.csv").read())
50
+ out = brue.run_script(open("trend.brue").read(), bars) # historical run
51
+ out.commands # entries, exits, pnl
52
+
53
+ brue.login(api_key="lse_...") # the only credential that ever appears
54
+ brue.buy("EURUSD", 0.5, sl=1.05, tp=1.12) # live, via Brue Connect
55
+ brue.close("EURUSD")
56
+ ```
57
+
58
+ Historical runs simulate the fills (next-bar-open, brackets, commission,
59
+ slippage) and report what was executed: the trade records, the log() lines,
60
+ the canonical JSON. There is no stats block, no equity frame and no pandas
61
+ indicator surface in this package; research on the results happens in plain
62
+ Python on the host. Indicator scripts (`plot()` calls, no orders) are exposed
63
+ through `brue.Indicator` for chart hosts. The language reference is
64
+ `SYNTAX.md`; the boundary of what Brue owns is `ARCHITECTURE.md`.
65
+
66
+ ## Why the decisions can be trusted
67
+
68
+ The engine is conformance-locked: `conformance/run_all_py.sh` runs the
69
+ corpus (every construct of the language plus the loud-error cases) and
70
+ byte-compares the execution JSON against locked goldens. A fill or a formula
71
+ cannot silently drift, and a live run re-derives the same order intents from
72
+ the same script text.
73
+
74
+ ## Status
75
+
76
+ Version 0.0.1. Pure Python, stdlib-only engine (pandas is optional and
77
+ only used by the convenience frames in `brue.live` and
78
+ `brue.Indicator.compute`).
79
+
80
+ ## Account login
81
+
82
+ Anything account-bound (LSE data, placing orders) starts with your LSE API
83
+ key, the same key you use on the data platform:
84
+
85
+ ```python
86
+ import brue
87
+ brue.login(api_key="lse_...") # or BRUE_API_KEY / LSE_API_KEY env,
88
+ brue.account() # or ~/.config/brue/config.json
89
+ ```
90
+
91
+ Historical runs on your own bars never need a key: the engine runs fully
92
+ offline.