openalgo-script 0.8.0 → 0.8.1
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.
- package/CHANGELOG.md +50 -0
- package/README.md +316 -388
- package/dist/adapters/charts/alerts.d.ts +11 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -1
- package/dist/adapters/charts/alerts.js +16 -1
- package/dist/adapters/charts/alerts.js.map +1 -1
- package/dist/adapters/charts/columns.d.ts +17 -2
- package/dist/adapters/charts/columns.d.ts.map +1 -1
- package/dist/adapters/charts/columns.js +11 -3
- package/dist/adapters/charts/columns.js.map +1 -1
- package/dist/core/check/call-sites.js +15 -5
- package/dist/core/check/call-sites.js.map +1 -1
- package/dist/core/version/version.generated.d.ts +1 -1
- package/dist/core/version/version.generated.js +1 -1
- package/package.json +1 -1
- package/spec/errors.json +1 -1
- package/src/adapters/charts/alerts.ts +28 -1
- package/src/adapters/charts/columns.ts +24 -8
- package/src/core/check/call-sites.ts +15 -5
- package/src/core/version/version.generated.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,56 @@ nothing, fails the build before it can become permanent.
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## 0.8.1
|
|
11
|
+
|
|
12
|
+
Two fixes and a documentation correction. No compiled-format change: the format
|
|
13
|
+
stays 1.1, and every shipped example compiles to the same bytes as with 0.8.0.
|
|
14
|
+
|
|
15
|
+
The chart adapter now reads an alert's message at the bar the chart judged. From
|
|
16
|
+
its version 2.6.0 the chart library can run a study on a transformed chart over
|
|
17
|
+
the bars the host feeds rather than over the elements it draws, and it reads the
|
|
18
|
+
study's columns onto those elements, each at the bar the element was completed
|
|
19
|
+
on. The alert's condition is a column and was read at the right bar. Its message
|
|
20
|
+
was not: the adapter read it at the element's position in the underlying run,
|
|
21
|
+
so on a transform that is not one element per bar (Renko, range bars, line
|
|
22
|
+
break, point and figure, Kagi) a notification could carry another bar's text or
|
|
23
|
+
fall back to the alert's title. The calculation now returns one more column,
|
|
24
|
+
`openscript:bar`, holding each row's bar index in the run, and the message is
|
|
25
|
+
read at the bar that column names. The column is written only for a study that
|
|
26
|
+
declares an alert. On every other chart, including every chart library before
|
|
27
|
+
2.6.0, a study left on the chart's own bars and a transform that keeps one
|
|
28
|
+
element per bar, the column is the row's own index and nothing a study draws or
|
|
29
|
+
announces changes. A host that lists the keys of the values table sees the new
|
|
30
|
+
key beside the `openscript:alert:` ones.
|
|
31
|
+
|
|
32
|
+
`req.timeframe` and `req.symbol` now read a mode written positionally. The mode
|
|
33
|
+
is the third argument of `req.timeframe` and the fifth of `req.symbol`, and it
|
|
34
|
+
was recognised only after `mode =`. A positional mode was accepted and ignored,
|
|
35
|
+
so `req.timeframe("1D", close, "lookahead")` ran as `"confirmed"`, carried no
|
|
36
|
+
OS8005 and was not marked as repainting, and a positional `"developing"` ran
|
|
37
|
+
confirmed too. A script that wrote its mode positionally now runs in the mode it
|
|
38
|
+
wrote, so its values change, and a positional `"lookahead"` now carries OS8005
|
|
39
|
+
and the repaint mark. A positional mode that is not written out as one of the
|
|
40
|
+
three words, one taken from an input for instance, is refused with OS3003, as a
|
|
41
|
+
labelled one already was. The mode is settled by the compiler, so a program
|
|
42
|
+
compiled by 0.8.0 and stored keeps the mode it was compiled with in either
|
|
43
|
+
engine: recompile a stored program whose source writes a mode positionally. The
|
|
44
|
+
new conformance case `req/positional-mode` pins it, and both engines agree on
|
|
45
|
+
all 108 cases they run.
|
|
46
|
+
|
|
47
|
+
The documentation said a `"1D"` higher timeframe read folds by the session. It
|
|
48
|
+
folds by the civil date in the instrument's timezone, as `compiled-program.md`
|
|
49
|
+
2.16.2 specifies and both engines have always done. For a session that stays
|
|
50
|
+
inside one date the two are the same; an evening session that runs past
|
|
51
|
+
midnight is split at midnight, and its bars after midnight join the next date's
|
|
52
|
+
bucket. The pages on sessions, timeframes and higher timeframes, and the cause
|
|
53
|
+
of OS6015, now say so. No behaviour changes.
|
|
54
|
+
|
|
55
|
+
The Python engine's code is unchanged. The chart adapter ships only in the npm
|
|
56
|
+
package, and the mode fix is in the compiler. The Python package moves to 0.8.1
|
|
57
|
+
because the two packages carry one version and ship as one release. Upgrade both
|
|
58
|
+
together.
|
|
59
|
+
|
|
10
60
|
## 0.8.0
|
|
11
61
|
|
|
12
62
|
The chart adapter now draws two things it used to refuse, on a chart that can
|
package/README.md
CHANGED
|
@@ -2,423 +2,351 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenScript
|
|
4
4
|
|
|
5
|
-
**An open trading language. Write
|
|
6
|
-
|
|
7
|
-
Compiles in the browser in milliseconds with no build step and no `eval`, runs
|
|
8
|
-
the same compiled program on a server, and is specified well enough that anyone
|
|
9
|
-
can write their own engine for it.
|
|
5
|
+
**An open trading language. Write an indicator or a strategy once, then plot it,
|
|
6
|
+
backtest it and trade it.**
|
|
10
7
|
|
|
8
|
+
[](https://www.npmjs.com/package/openalgo-script)
|
|
9
|
+
[](https://pypi.org/project/openscript/)
|
|
10
|
+
[](https://github.com/marketcalls/openscript/actions/workflows/ci.yml)
|
|
11
11
|
[](./LICENSE)
|
|
12
|
-
[](./ROADMAP.md)
|
|
13
12
|
|
|
14
13
|
</div>
|
|
15
14
|
|
|
16
15
|
---
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
coverage and limitations, and [CHANGELOG.md](./CHANGELOG.md) for results that
|
|
69
|
-
can change after upgrading.
|
|
70
|
-
|
|
71
|
-
What it does **not** do yet, stated plainly because the registry page is the
|
|
72
|
-
first thing a stranger reads:
|
|
73
|
-
|
|
74
|
-
- **The backtest does not model everything, and says which.** A bracket's stop
|
|
75
|
-
cannot fill, because the engine appends no order row for a bracket. A quantity
|
|
76
|
-
stated in cash or in a percentage of equity is refused rather than filled,
|
|
77
|
-
because a backtest works out no running equity to size against. The equity
|
|
78
|
-
curve marks a trade at the size it ended up entering, so a strategy that
|
|
79
|
-
scales in is reported with a drawdown deeper than the account had. A script
|
|
80
|
-
still cannot read its own equity mid-run. [`CHANGELOG.md`](./CHANGELOG.md) is
|
|
81
|
-
the full list, release by release, and every item on it is there because
|
|
82
|
-
somebody would otherwise find it inside a report they had already believed.
|
|
83
|
-
- **No editor on screen, and that is the design.** The six headless functions are
|
|
84
|
-
here and resolve as `openalgo-script/editor`: highlight, complete, diagnose,
|
|
85
|
-
hover, signature and format, text in and data out, with no DOM at any tier. The
|
|
86
|
-
text component, the panel, the apply button, saving and the theme are yours,
|
|
87
|
-
and the drop-in adapter for one editor component wires the six into it without
|
|
88
|
-
drawing anything itself. What each function gives you, and what stays yours, is
|
|
89
|
-
in
|
|
90
|
-
[`docs/integrating/the-editor-half.md`](./docs/integrating/the-editor-half.md).
|
|
91
|
-
The language server that would put the same errors in a desktop editor is the
|
|
92
|
-
rest of Phase 4 and is not written.
|
|
93
|
-
- **No engine anybody else wrote has run the suite, so the portability claim is
|
|
94
|
-
still untested.** The second engine is here: `engine/` holds a complete engine
|
|
95
|
-
in Python, published to PyPI as `openscript`, with a test suite of its own,
|
|
96
|
-
and `npm test` runs both on every build. A run record carries its own source
|
|
97
|
-
text rather than only a hash of it (`sourceText` in
|
|
98
|
-
[`src/core/backtest/record.ts`](./src/core/backtest/record.ts)), and
|
|
99
|
-
`caseFilesFrom` in [`src/core/backtest/case.ts`](./src/core/backtest/case.ts)
|
|
100
|
-
writes the files a suite runs from straight out of a record, which is where the
|
|
101
|
-
strategy cases under [`cases/`](./cases) came from.
|
|
102
|
-
|
|
103
|
-
There are 126 cases now: 72 in the `core` profile, 46 in `chart` and 8 in
|
|
104
|
-
`strategy`. They assert eight of the channels section 4 of
|
|
105
|
-
[`spec/conformance.md`](./spec/conformance.md) defines: diagnostics, a value
|
|
106
|
-
per bar per plot, the log, drawing objects, grid cells, orders, trades and the
|
|
107
|
-
report. Markers, fills, levels, paint and alerts have no case yet, and neither
|
|
108
|
-
engine's adapter answers them. So the `semantics` and
|
|
109
|
-
`numerics` categories, which are the reason the suite exists, now hold real
|
|
110
|
-
cases, each with expected values computed independently of both engines.
|
|
111
|
-
|
|
112
|
-
`npm run suite:agree` reports 107 pass and 19 skipped of 126 between the two
|
|
113
|
-
engines, exactly, the skips being the compiler-diagnostic cases the Python
|
|
114
|
-
engine rightly has no compiler for. The two engines hold the same 251 library
|
|
115
|
-
entries, which a check asks each of them for on every build. What that run
|
|
116
|
-
does not prove is the thing the suite exists for: both engines were written
|
|
117
|
-
in this repository, from the same specification, by the same hands, so their
|
|
118
|
-
agreement is evidence about this repository rather than about the
|
|
119
|
-
specification. Until an engine written by somebody who had only the
|
|
120
|
-
specification passes these cases, portability is a design with one
|
|
121
|
-
corroborating implementation, not a result. That is why no conformance badge
|
|
122
|
-
is shown here, though `npm run badge` will make one for an engine that passes.
|
|
123
|
-
|
|
124
|
-
The version is `0.8.0` rather than `1.0` because of that list. The studies
|
|
125
|
-
surface is the part that is finished, and it is the part to build on.
|
|
126
|
-
|
|
127
|
-
`ROADMAP.md` says what each phase owes before it is allowed to finish. The
|
|
128
|
-
specification is written first and the implementation follows it, which is why
|
|
129
|
-
there is still more specification here than compiler.
|
|
130
|
-
|
|
131
|
-
## What it looks like
|
|
17
|
+
OpenScript is a small language for writing what you want to see on a chart, and
|
|
18
|
+
what you want to trade when you see it.
|
|
19
|
+
|
|
20
|
+
- A script is **one plain text file**. You own it, you can keep it in version
|
|
21
|
+
control, and you can send it to a friend.
|
|
22
|
+
- A script **runs once per bar**, oldest bar first. There is no main function to
|
|
23
|
+
write: the file itself is the loop.
|
|
24
|
+
- The same file gives **the same numbers** on the chart, in the backtest and in
|
|
25
|
+
live trading, because all three run the same compiled program.
|
|
26
|
+
- It compiles in the browser in milliseconds with no `eval`, and a server can run
|
|
27
|
+
the same compiled program in Python.
|
|
28
|
+
|
|
29
|
+
## Contents
|
|
30
|
+
|
|
31
|
+
1. [Install](#install)
|
|
32
|
+
2. [Your first indicator](#your-first-indicator)
|
|
33
|
+
3. [Two averages and a signal](#two-averages-and-a-signal)
|
|
34
|
+
4. [An indicator in its own pane](#an-indicator-in-its-own-pane)
|
|
35
|
+
5. [A built-in trend indicator](#a-built-in-trend-indicator)
|
|
36
|
+
6. [Your first strategy](#your-first-strategy)
|
|
37
|
+
7. [A strategy with a stop loss](#a-strategy-with-a-stop-loss)
|
|
38
|
+
8. [Run a script from your own code](#run-a-script-from-your-own-code)
|
|
39
|
+
9. [Words you will see](#words-you-will-see)
|
|
40
|
+
10. [Where to go next](#where-to-go-next)
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
If your trading platform already has OpenScript, there is nothing to install:
|
|
45
|
+
open its script editor, paste a script from this page and press Apply.
|
|
46
|
+
|
|
47
|
+
To use it from your own code:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
npm install openalgo-script # the compiler and the engine, for JavaScript
|
|
51
|
+
pip install openscript # the engine, for Python 3.12 or newer
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Neither package has a runtime dependency.
|
|
55
|
+
|
|
56
|
+
## Your first indicator
|
|
57
|
+
|
|
58
|
+
A 20 bar moving average drawn over price:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
version 1
|
|
62
|
+
|
|
63
|
+
study("My moving average", overlay = true)
|
|
64
|
+
|
|
65
|
+
length = input(20, "Length")
|
|
66
|
+
average = sma(close, length)
|
|
132
67
|
|
|
68
|
+
plot(average, "Average", orange, width = 2)
|
|
133
69
|
```
|
|
70
|
+
|
|
71
|
+
Line by line:
|
|
72
|
+
|
|
73
|
+
- `version 1` says which version of the language the file is written in. Every
|
|
74
|
+
script starts with it.
|
|
75
|
+
- `study(...)` names the indicator. `overlay = true` draws it on top of the
|
|
76
|
+
price. Leave it out and the indicator gets a pane of its own.
|
|
77
|
+
- `input(20, "Length")` makes a setting a trader can change without editing the
|
|
78
|
+
file. 20 is the default.
|
|
79
|
+
- `sma(close, length)` is the simple average of the last `length` closes.
|
|
80
|
+
`close`, `open`, `high`, `low` and `volume` are the current bar's prices.
|
|
81
|
+
- `plot(...)` draws one line: the value, its name in the legend, its colour and
|
|
82
|
+
its thickness.
|
|
83
|
+
|
|
84
|
+
The line starts on the 20th bar. That is correct: a 20 bar average does not exist
|
|
85
|
+
until 20 bars do.
|
|
86
|
+
|
|
87
|
+
## Two averages and a signal
|
|
88
|
+
|
|
89
|
+
A fast and a slow average, the space between them shaded, and a marker where
|
|
90
|
+
they cross:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
version 1
|
|
94
|
+
|
|
134
95
|
study("EMA cross", overlay = true)
|
|
135
96
|
|
|
136
|
-
|
|
137
|
-
|
|
97
|
+
fastLength = input(9, "Fast length")
|
|
98
|
+
slowLength = input(21, "Slow length")
|
|
138
99
|
|
|
139
|
-
|
|
140
|
-
|
|
100
|
+
fast = ema(close, fastLength)
|
|
101
|
+
slow = ema(close, slowLength)
|
|
141
102
|
|
|
142
|
-
plot(
|
|
143
|
-
plot(
|
|
103
|
+
fastPlot = plot(fast, "Fast", aqua, width = 2)
|
|
104
|
+
slowPlot = plot(slow, "Slow", orange, width = 2)
|
|
105
|
+
fill(fastPlot, slowPlot, fade(aqua, 90))
|
|
144
106
|
|
|
145
|
-
if crossUp(
|
|
146
|
-
signal("BUY")
|
|
107
|
+
if crossUp(fast, slow)
|
|
108
|
+
signal("BUY", lime, at = "below")
|
|
109
|
+
|
|
110
|
+
if crossDown(fast, slow)
|
|
111
|
+
signal("SELL", red)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- `ema` is an exponential moving average, which follows price faster than `sma`.
|
|
115
|
+
- `fill` shades between two plots. `fade(aqua, 90)` is aqua at 90 percent
|
|
116
|
+
transparency.
|
|
117
|
+
- `crossUp(fast, slow)` is true on the one bar where `fast` moves above `slow`.
|
|
118
|
+
- `signal` puts a labelled marker on that bar.
|
|
119
|
+
- Indentation marks the body of an `if`, the way it does in Python.
|
|
120
|
+
|
|
121
|
+
## An indicator in its own pane
|
|
122
|
+
|
|
123
|
+
RSI below the chart, with lines at 70 and 30, and an alert when it climbs back
|
|
124
|
+
above 30:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
version 1
|
|
128
|
+
|
|
129
|
+
study("RSI", precision = 2, range = [0, 100])
|
|
130
|
+
|
|
131
|
+
length = input(14, "Length")
|
|
132
|
+
value = rsi(close, length)
|
|
133
|
+
|
|
134
|
+
level(70, "Overbought", red)
|
|
135
|
+
level(30, "Oversold", lime)
|
|
136
|
+
|
|
137
|
+
plot(value, "RSI", purple, width = 2)
|
|
138
|
+
|
|
139
|
+
if crossUp(value, 30)
|
|
140
|
+
alert("RSI is back above 30", id = "rsiRecovered")
|
|
147
141
|
```
|
|
148
142
|
|
|
149
|
-
|
|
143
|
+
- No `overlay = true`, so the study gets its own pane. `range = [0, 100]` fixes
|
|
144
|
+
that pane's scale.
|
|
145
|
+
- `level` draws a fixed horizontal line.
|
|
146
|
+
- `alert` raises an alert on the bar where the condition is true. The `id` names
|
|
147
|
+
it, so your settings for it survive an edit to the file. Your platform decides
|
|
148
|
+
how it reaches you.
|
|
149
|
+
|
|
150
|
+
## A built-in trend indicator
|
|
151
|
+
|
|
152
|
+
Supertrend, green in an uptrend and red in a downtrend:
|
|
150
153
|
|
|
151
154
|
```
|
|
152
|
-
|
|
155
|
+
version 1
|
|
156
|
+
|
|
157
|
+
study("Supertrend", overlay = true)
|
|
158
|
+
|
|
159
|
+
factor = input(3.0, "Factor")
|
|
160
|
+
atrLength = input(10, "ATR length")
|
|
153
161
|
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
st = supertrend(factor, atrLength)
|
|
163
|
+
trendLine = st[0]
|
|
164
|
+
direction = st[1]
|
|
156
165
|
|
|
157
|
-
|
|
166
|
+
plot(direction < 0 ? trendLine : none, "Uptrend", lime, width = 2)
|
|
167
|
+
plot(direction > 0 ? trendLine : none, "Downtrend", red, width = 2)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- Some indicators give back more than one number. `supertrend` gives the line
|
|
171
|
+
and the direction, read as `st[0]` and `st[1]`. The direction is `-1` in an
|
|
172
|
+
uptrend and `1` in a downtrend.
|
|
173
|
+
- `condition ? a : b` picks `a` when the condition is true and `b` otherwise.
|
|
174
|
+
- `none` means no value. A plot given `none` draws nothing on that bar, which is
|
|
175
|
+
how one line becomes two colours.
|
|
176
|
+
|
|
177
|
+
`macd`, `bollinger`, `vwap`, `atr`, `stoch` and many more are built in. The
|
|
178
|
+
[function reference](./docs/reference/functions/ta.md) lists them all.
|
|
179
|
+
|
|
180
|
+
## Your first strategy
|
|
181
|
+
|
|
182
|
+
A strategy is a study that also places orders. This one buys when the fast
|
|
183
|
+
average crosses above the slow one, and sells when it crosses back:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
version 1
|
|
187
|
+
|
|
188
|
+
strategy("EMA cross strategy", overlay = true, qty = 1)
|
|
189
|
+
|
|
190
|
+
fastLength = input(9, "Fast length")
|
|
191
|
+
slowLength = input(21, "Slow length")
|
|
192
|
+
|
|
193
|
+
fast = ema(close, fastLength)
|
|
194
|
+
slow = ema(close, slowLength)
|
|
195
|
+
|
|
196
|
+
if crossUp(fast, slow)
|
|
197
|
+
buy()
|
|
198
|
+
|
|
199
|
+
if crossDown(fast, slow)
|
|
158
200
|
close()
|
|
201
|
+
|
|
202
|
+
plot(fast, "Fast", aqua)
|
|
203
|
+
plot(slow, "Slow", orange)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- `strategy(...)` in place of `study(...)` is what allows orders. `qty = 1` is
|
|
207
|
+
the size of each order.
|
|
208
|
+
- `buy()` opens a long position. `close()` closes it.
|
|
209
|
+
- An order placed on a bar fills at the **next bar's open**, because a bar's
|
|
210
|
+
close is not known until the bar has finished.
|
|
211
|
+
|
|
212
|
+
Run it as a backtest and you get every trade, the equity curve and a report:
|
|
213
|
+
net profit, win rate, drawdown and more.
|
|
214
|
+
|
|
215
|
+
## A strategy with a stop loss
|
|
216
|
+
|
|
217
|
+
The same entry, with a stop loss and a target measured from the entry price. Both
|
|
218
|
+
are checked on each bar's close, and the exit fills at the next bar's open:
|
|
219
|
+
|
|
159
220
|
```
|
|
221
|
+
version 1
|
|
222
|
+
|
|
223
|
+
strategy("EMA cross with stop and target", overlay = true, qty = 1)
|
|
224
|
+
|
|
225
|
+
fastLength = input(9, "Fast length")
|
|
226
|
+
slowLength = input(21, "Slow length")
|
|
227
|
+
stopPercent = input(1.0, "Stop loss, percent")
|
|
228
|
+
targetPercent = input(2.0, "Target, percent")
|
|
229
|
+
|
|
230
|
+
fast = ema(close, fastLength)
|
|
231
|
+
slow = ema(close, slowLength)
|
|
232
|
+
crossedUp = crossUp(fast, slow)
|
|
233
|
+
crossedDown = crossDown(fast, slow)
|
|
234
|
+
|
|
235
|
+
inTrade = pos.size > 0
|
|
236
|
+
stopPrice = pos.avgPrice * (1 - stopPercent / 100)
|
|
237
|
+
targetPrice = pos.avgPrice * (1 + targetPercent / 100)
|
|
238
|
+
|
|
239
|
+
if crossedUp and not inTrade
|
|
240
|
+
buy()
|
|
160
241
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Why it exists
|
|
164
|
-
|
|
165
|
-
Chart scripting today is closed. You write in someone's editor, your script runs
|
|
166
|
-
on their servers under their limits, and the only way out is a webhook. The
|
|
167
|
-
numbers you backtest are not the numbers you trade, and you cannot check either.
|
|
168
|
-
|
|
169
|
-
OpenScript is the opposite of that:
|
|
170
|
-
|
|
171
|
-
- **Yours.** Plain text files in a folder. Version control, diffs, your own editor.
|
|
172
|
-
- **Local.** It compiles and runs on your machine. No execution quota, no loop
|
|
173
|
-
timeout, and nothing you drew silently dropped to make room for the next one.
|
|
174
|
-
- **Honest.** A higher timeframe read has to say whether it repaints. The
|
|
175
|
-
compiler warns when a script would.
|
|
176
|
-
- **Connected.** Designed to route orders through your own broker connection,
|
|
177
|
-
with sandbox testing before live execution. The live runner is planned.
|
|
178
|
-
- **Open.** Apache-2.0, a written specification, and a conformance suite anyone
|
|
179
|
-
can run against their own implementation: the compiler's diagnostics, the
|
|
180
|
-
runtime errors and limits, the per-bar values, the calendar, drawing objects,
|
|
181
|
-
grids, reads of other timeframes and instruments, and strategy fills and
|
|
182
|
-
reports. [The suite's own page](./spec/conformance.md) says what a pass does
|
|
183
|
-
and does not entitle an implementation to claim.
|
|
184
|
-
|
|
185
|
-
## How it is built
|
|
186
|
-
|
|
187
|
-
The compiler does not emit JavaScript. It emits a **compiled program**: a plain
|
|
188
|
-
data structure of instructions, defined by a versioned schema.
|
|
189
|
-
|
|
190
|
-
That one decision carries the whole project:
|
|
191
|
-
|
|
192
|
-
1. It runs in a browser under a strict content security policy, with no `eval`
|
|
193
|
-
and nothing for a security team to approve.
|
|
194
|
-
2. A server-side engine is a few hundred lines that walk an instruction list,
|
|
195
|
-
not a second implementation of the language.
|
|
196
|
-
3. Anyone can write an engine in any language, and hold it to the conformance
|
|
197
|
-
suite. What the suite reaches today is written down rather than implied: an
|
|
198
|
-
engine claiming the narrowest profile is handed cases and fails if it
|
|
199
|
-
answers none of them, which it was not before the `core` cases existed.
|
|
200
|
-
|
|
201
|
-
One compiler. One compiled format. Many small engines, all of which must agree
|
|
202
|
-
to the last decimal.
|
|
203
|
-
|
|
204
|
-
The same decision shapes the editor. This project ships the language
|
|
205
|
-
intelligence as pure functions with no DOM: highlight, complete, diagnose, hover,
|
|
206
|
-
signature, format. Highlighting comes from the real lexer, completions from the
|
|
207
|
-
standard library manifest, and the errors you see while typing are the compiler's
|
|
208
|
-
own, with their fixes taken from the error catalogue. A host supplies the text
|
|
209
|
-
component and the panel around it, and keeps its own design. The editor is not a
|
|
210
|
-
second implementation of the language to be kept in step.
|
|
211
|
-
|
|
212
|
-
[](https://raw.githubusercontent.com/marketcalls/openscript/main/docs/architecture-compiler.png)
|
|
213
|
-
|
|
214
|
-
### From source to a compiled program
|
|
215
|
-
|
|
216
|
-
| Stage | What happens | Implementation |
|
|
217
|
-
|---|---|---|
|
|
218
|
-
| Lex | Turns text into tokens with source positions. Newlines, indentation and dedentation become explicit tokens, so later stages do not reinterpret whitespace. | [`src/core/lex`](./src/core/lex/index.ts) |
|
|
219
|
-
| Parse | Builds the abstract syntax tree (AST). It recovers around malformed statements so an editor can still work with a partially typed file. | [`src/core/parse`](./src/core/parse/index.ts) |
|
|
220
|
-
| Check | Resolves names, checks types and calls, determines storage and tracks when a value becomes available. `CheckedScript` keeps those answers beside the original tree. | [`src/core/check`](./src/core/check/index.ts) |
|
|
221
|
-
| Emit | Allocates registers and persistent state, lowers statements into instructions, links calls and requests, and checks stack depths and limits. | [`src/core/emit`](./src/core/emit/emit.ts) |
|
|
222
|
-
|
|
223
|
-
The result is a [`CompiledProgram`](./src/core/emit/program.ts), not executable
|
|
224
|
-
code in the host's language. Alongside its instructions it carries the constants,
|
|
225
|
-
inputs, output declarations, storage layout and source mapping the engine needs.
|
|
226
|
-
Its [canonical encoding](./src/core/emit/canonical.ts) makes the program portable
|
|
227
|
-
and gives it stable bytes for hashing. The language and compiled format have
|
|
228
|
-
separate versions, defined by the [compiled program specification](./spec/compiled-program.md).
|
|
229
|
-
|
|
230
|
-
Every compiler stage reports through the same diagnostic system. Codes, messages
|
|
231
|
-
and fixes come from the [error catalogue](./spec/errors.json); the
|
|
232
|
-
[headless editor](./src/editor/index.ts) reuses the compiler and its language
|
|
233
|
-
tables for highlighting, completion, diagnostics, hover, signatures and formatting.
|
|
234
|
-
|
|
235
|
-
### From a compiled program to results
|
|
236
|
-
|
|
237
|
-
Before the first bar, [`load`](./src/core/engine/load.ts) verifies the program's
|
|
238
|
-
format, capabilities, tables and instructions, including stack and address
|
|
239
|
-
bounds. It checks the host's limits, resolves inputs and plans requested series.
|
|
240
|
-
A rejected program returns a diagnostic before execution starts.
|
|
241
|
-
|
|
242
|
-
The [engine](./src/core/engine/engine.ts) then advances one bar at a time. Its
|
|
243
|
-
[interpreter](./src/core/engine/machine.ts) walks the instruction list using
|
|
244
|
-
registers, persistent memory and the standard library, with instruction, memory
|
|
245
|
-
and time budgets. Updating the newest bar restores its checkpoint before
|
|
246
|
-
recomputing it; explicitly live state is retained. Drawing values are published
|
|
247
|
-
on updates, while signals, alerts and orders follow the confirmation policy.
|
|
248
|
-
|
|
249
|
-
The [chart adapter](./src/adapters/charts/index.ts) maps study outputs into the
|
|
250
|
-
host's chart. A host passes the chart library's own version as `chartVersion`,
|
|
251
|
-
and the adapter draws what that version has room for: a band coloured per bar
|
|
252
|
-
and every declared grid need a newer chart, and on an older one, or when no
|
|
253
|
-
version is stated, such a study is refused with OS6024 rather than drawn in
|
|
254
|
-
part. The [backtest driver](./src/core/backtest/drive.ts) supplies a
|
|
255
|
-
simulated order destination and records frames, fills, orders and the report.
|
|
256
|
-
[Replay and rerun](./src/core/backtest/replay.ts) let a stored result be checked
|
|
257
|
-
again. The host owns data access, rendering, persistence and order routing;
|
|
258
|
-
the language core does not reach into those systems itself.
|
|
259
|
-
|
|
260
|
-
## The pieces, and which way they point
|
|
261
|
-
|
|
262
|
-
A platform adopting OpenScript usually already has a chart, or an editor, or a
|
|
263
|
-
broker connection, and sometimes all three. So the pieces are separate packages
|
|
264
|
-
and the dependencies only ever point one way.
|
|
242
|
+
if inTrade and (close < stopPrice or close > targetPrice or crossedDown)
|
|
243
|
+
close()
|
|
265
244
|
|
|
245
|
+
plot(fast, "Fast", aqua)
|
|
246
|
+
plot(slow, "Slow", orange)
|
|
247
|
+
plot(inTrade ? stopPrice : none, "Stop", red, style = "step")
|
|
248
|
+
plot(inTrade ? targetPrice : none, "Target", lime, style = "step")
|
|
266
249
|
```
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
250
|
+
|
|
251
|
+
- `pos.size` is the size of the open position, 0 when there is none, and
|
|
252
|
+
`pos.avgPrice` is its entry price.
|
|
253
|
+
- `not inTrade` stops the strategy buying again while it already holds a
|
|
254
|
+
position.
|
|
255
|
+
- The crosses are worked out once, at the top, before any `if`. A cross checked
|
|
256
|
+
only inside a condition is only tracked on the bars where that condition ran,
|
|
257
|
+
and the compiler warns you when you do it.
|
|
258
|
+
- The last two plots draw the stop and the target only while a trade is open.
|
|
259
|
+
|
|
260
|
+
A strategy can also declare its starting capital, commission and slippage, trade
|
|
261
|
+
both directions and size each trade from the risk. The
|
|
262
|
+
[first strategy guide](./docs/first-strategy.md) walks through all of it.
|
|
263
|
+
|
|
264
|
+
## Run a script from your own code
|
|
265
|
+
|
|
266
|
+
Compile a script, then run it over your bars:
|
|
267
|
+
|
|
268
|
+
```js
|
|
269
|
+
import {
|
|
270
|
+
sourceFile, DiagnosticBag, parse, check, emit, renderDiagnostics, load,
|
|
271
|
+
} from 'openalgo-script';
|
|
272
|
+
|
|
273
|
+
function compile(name, text) {
|
|
274
|
+
const file = sourceFile(name, text);
|
|
275
|
+
const errors = new DiagnosticBag();
|
|
276
|
+
const { program } = emit(file, check(file, parse(file, errors), errors), errors);
|
|
277
|
+
if (program === undefined) throw new Error(renderDiagnostics(file, errors.ordered()));
|
|
278
|
+
return program;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// One object per bar, oldest first. time is in milliseconds.
|
|
282
|
+
const bars = [
|
|
283
|
+
{ time: 1735689600000, open: 100, high: 102, low: 99, close: 101, volume: 1200, oi: null },
|
|
284
|
+
// ...
|
|
285
|
+
];
|
|
286
|
+
|
|
287
|
+
const loaded = load(compile('my-average.oscript', scriptText));
|
|
288
|
+
if (!loaded.ok) throw new Error(loaded.diagnostic.message);
|
|
289
|
+
|
|
290
|
+
const run = loaded.engine.run(bars);
|
|
291
|
+
console.log(run.bars.at(-1).columns); // the plotted values on the last bar
|
|
278
292
|
```
|
|
279
293
|
|
|
280
|
-
|
|
281
|
-
wants only the compiler never pays for an adapter. A tier is declared only once it
|
|
282
|
-
exists: an entry point that resolves to nothing fails at a consumer's run time
|
|
283
|
-
rather than honestly at install.
|
|
284
|
-
|
|
285
|
-
These four resolve today, from an install holding nothing but the manifest and the
|
|
286
|
-
built output. That is a check rather than a sentence: `scripts/check-entry-points.mjs`
|
|
287
|
-
builds exactly that install in a temporary directory, with no package of any kind
|
|
288
|
-
beside it, and imports every one of them.
|
|
289
|
-
|
|
290
|
-
| Entry point | Is | Depends on |
|
|
291
|
-
|---|---|---|
|
|
292
|
-
| `openalgo-script` | Compiler and engine | Nothing |
|
|
293
|
-
| `openalgo-script/editor` | The six headless language functions an editor needs | The compiler |
|
|
294
|
-
| `openalgo-script/adapters/charts` | Turns a compiled study into a chart's indicator descriptor | The compiler and a chart |
|
|
295
|
-
| `openalgo-script/adapters/codemirror` | Wires the six into a text component | The editor half and a text component |
|
|
296
|
-
|
|
297
|
-
The server-side engine is not among them: it is a separate package in another
|
|
298
|
-
language, and the roadmap says which phase owes it.
|
|
299
|
-
|
|
300
|
-
An adapter is the only thing allowed to know two worlds at once, which is what
|
|
301
|
-
makes it the piece a platform replaces rather than the piece they patch. A
|
|
302
|
-
platform with its own chart writes their own chart adapter and keeps everything
|
|
303
|
-
else. A platform with its own editor does the same on that side.
|
|
304
|
-
|
|
305
|
-
This is enforced rather than promised. `scripts/check-layering.mjs` runs in
|
|
306
|
-
continuous integration and fails the build if the compiler imports a chart, if
|
|
307
|
-
anything outside an adapter imports a package, or if anything under `src` so much
|
|
308
|
-
as mentions a browser global. That last one holds of the adapters too: the editor
|
|
309
|
-
adapter takes a tooltip's markup from the host rather than building an element,
|
|
310
|
-
so every file in the package loads in a worker and on a server.
|
|
311
|
-
|
|
312
|
-
## Taking it, one step at a time
|
|
313
|
-
|
|
314
|
-
Each row is usable on its own. Nobody has to take the next one.
|
|
315
|
-
|
|
316
|
-
| You want | You add | Roughly |
|
|
317
|
-
|---|---|---|
|
|
318
|
-
| Scripts that produce numbers | `openalgo-script`, and the six-item host interface | An afternoon |
|
|
319
|
-
| Those studies on your chart | the charts adapter, plus a chart | Days. Free if the chart is the one this adapter already targets |
|
|
320
|
-
| Traders authoring in your app | The editor half, and your own text component or the drop-in adapter | Days |
|
|
321
|
-
| Traders trading from it | Wire the order half of the host interface to your order API | About a week |
|
|
322
|
-
| To run it on your own stack | Implement the compiled program format in your language, then pass the conformance suite | Weeks |
|
|
323
|
-
|
|
324
|
-
The last row is the one that matters for the standard. A platform that will not
|
|
325
|
-
run our code at all reads the compiled program specification, writes its own
|
|
326
|
-
engine, passes the suite, and its traders' scripts are the same scripts as
|
|
327
|
-
everyone else's.
|
|
328
|
-
|
|
329
|
-
## What is guaranteed, and what proves it
|
|
330
|
-
|
|
331
|
-
A platform's engineering review asks two questions about a dependency: what do you
|
|
332
|
-
promise, and how would I know. This table is the answer to the second one. Where a
|
|
333
|
-
row says a check enforces something, that check runs in continuous integration and
|
|
334
|
-
fails the build.
|
|
335
|
-
|
|
336
|
-
| Guarantee | How you can tell | Today |
|
|
337
|
-
|---|---|---|
|
|
338
|
-
| The package cannot build code out of text: every door to a generator is a module, and it imports none of them | `scripts/check-layering.mjs`. Nothing under `src` may import a module from the runtime's own namespace, at either spelling, and no load may have a specifier that is not written down. So there is no virtual machine, no worker and no child process in the graph to reach. Unreachable by construction, not unmatched by a pattern | Enforced |
|
|
339
|
-
| The two names that need no import, the string evaluator and the function builder, are refused | A runtime switch you set on your own process, `--disallow-code-generation-from-strings`. Our own suite runs under it. It refuses those two names and closes no other door: see [`docs/integrating/running-the-engine.md`](./docs/integrating/running-the-engine.md) for what it does not cover and what is yours to do | Yours to turn on |
|
|
340
|
-
| No generator anywhere in this repository's own text | `scripts/check-no-eval.mjs`, over the source, both built outputs, the tooling, the hooks and the build steps, attacking itself with every form it knows before it reads a file. **It is a lint, not a proof.** It has now been got past five times, the last by a constructor reached through a key assembled at run time, and a list of spellings only ever has to be beaten once more. Treat a pass as evidence that no known form is present | **Lint** |
|
|
341
|
-
| A generator that runs is refused | The suite runs under the setting that refuses to compile text, so a builder throws the moment its path executes, however it was spelled. This caught the form the scan missed. What it cannot cover: a line no test reaches, and the module doors above, which is why the row above it matters more than this one | Enforced, for code the tests execute |
|
|
342
|
-
| Zero runtime dependencies | `dependencies` is empty and stays empty | Enforced |
|
|
343
|
-
| The pieces are separable: take the language without the chart, or the chart without the language | `scripts/check-layering.mjs`. The core may not import a package or touch a browser global | Enforced |
|
|
344
|
-
| Small modules with a stated surface | `scripts/check-modularity.mjs`. A module's index is its only door | Enforced |
|
|
345
|
-
| Every error is documented, with a code, a cause and a fix | `scripts/check-error-codes.mjs` reads every file in the tree, and the code type is generated from the catalogue so an invented code will not compile. `scripts/check-catalogue-tests.mjs` compares the catalogue a reader opens with the file the compiler is generated from, string for string, so the two cannot say different things | Enforced |
|
|
346
|
-
| No fact is stated in two places | `scripts/check-duplication.mjs` | Enforced, with recorded debt |
|
|
347
|
-
| The compiled program is implementable without reading our code | `spec/compiled-program.md` and `spec/host-interface.md`. Every engine test drives a host built from those pages rather than one we wrote | Written, and used |
|
|
348
|
-
| Two engines agree to the last decimal | The conformance suite, run against both. A disagreement blocks a release | Phase 6 gate |
|
|
349
|
-
| A runaway script stops | Instruction, memory and wall clock budgets, counters in the loop the engine owns. `tests/engine/budget.test.ts` | Enforced |
|
|
350
|
-
| A failing script does not take anything else down | One script's failure is a diagnostic on that script and reaches nothing else | Enforced |
|
|
351
|
-
| Every entry point in the export map resolves from a real install | `scripts/check-entry-points.mjs`. Each one is imported from a temporary install built from the `files` list alone, with no package beside it, which is also what says both adapters' peer dependencies are optional in fact and not only in the manifest | Enforced |
|
|
352
|
-
| A completion, a tooltip and a default come from the compiler, not from a list | The names are the standard library manifest the checker resolves against; what a call is for is the cell `spec/stdlib.md` prints, read at build time by `scripts/generate-library-prose.mjs`; a default is the one `scripts/check-defaults.mjs` holds the compiler to. `tests/editor/hover.test.ts` fails if the manifest and the specification describe different sets of names | Enforced |
|
|
353
|
-
| Laying a script out again cannot change what it computes | `tests/editor/format.test.ts`. Every example and every gate script is formatted, both texts are compiled, and the compiled programs are compared. Each call also checks itself against the lexer, so a rule that is wrong returns your source untouched rather than a changed program | Enforced |
|
|
354
|
-
| A saved script never stops working | The language version is declared per file and old front ends are retained | Phase 7, with a test per retained version |
|
|
355
|
-
| Performance | Eight benchmarks with recorded budgets, run by `npm test` and in continuous integration. A regression past a budget fails the build | Enforced |
|
|
356
|
-
|
|
357
|
-
The rows marked as gates are not promises we intend to keep. They are conditions a
|
|
358
|
-
phase does not finish without, and each one is written into the roadmap beside the
|
|
359
|
-
phase that owes it.
|
|
360
|
-
|
|
361
|
-
### Why a script cannot reach anything
|
|
362
|
-
|
|
363
|
-
This is the row a security review spends its time on, so it is worth stating
|
|
364
|
-
plainly rather than leaving as a property of the architecture.
|
|
365
|
-
|
|
366
|
-
A compiled program is **data**. It is a list of instructions the engine walks. A
|
|
367
|
-
script has no way to name a function the instruction set does not expose, so there
|
|
368
|
-
is no call into the host, no network, no filesystem, no access to the object graph
|
|
369
|
-
of the process it runs in. There is nothing to escape from, because nothing was
|
|
370
|
-
ever handed over.
|
|
371
|
-
|
|
372
|
-
That also makes the budgets real rather than best-effort. The engine owns the
|
|
373
|
-
loop, so an instruction count per bar, a memory ceiling and a wall clock are
|
|
374
|
-
counters in that loop rather than something to hope about. A platform running many
|
|
375
|
-
customers' scripts in one process needs exactly this, and a design that generates
|
|
376
|
-
code and runs it cannot offer it.
|
|
377
|
-
|
|
378
|
-
## The host interface
|
|
379
|
-
|
|
380
|
-
Whatever a platform takes, it supplies six things and nothing more:
|
|
381
|
-
|
|
382
|
-
1. Bars: open, high, low, close, volume, time.
|
|
383
|
-
2. Instrument facts: tick size, lot size, session, timezone.
|
|
384
|
-
3. More bars on request, for another instrument or another timeframe.
|
|
385
|
-
4. Somewhere to draw.
|
|
386
|
-
5. Somewhere to send orders, if scripts are allowed to trade.
|
|
387
|
-
6. Somewhere to save settings.
|
|
388
|
-
|
|
389
|
-
No instrument naming scheme, no exchange rules and no broker concepts appear in
|
|
390
|
-
the language. A symbol is opaque to it: a script names a contract by what the
|
|
391
|
-
contract is, and the platform resolves that to whatever its own symbology calls
|
|
392
|
-
it. A format built around one market's derivatives means nothing on a crypto
|
|
393
|
-
exchange, and portability is the entire objective.
|
|
394
|
-
|
|
395
|
-
## Errors
|
|
396
|
-
|
|
397
|
-
Every error has a stable code, a message, the cause, the fix and an example,
|
|
398
|
-
held in one machine-readable catalogue. The compiler, the editor and the
|
|
399
|
-
documentation all read that same file, so the documentation cannot drift from
|
|
400
|
-
the compiler. The build fails if an error exists without a documented entry, or
|
|
401
|
-
an entry without a test.
|
|
402
|
-
|
|
403
|
-
## Documentation
|
|
404
|
-
|
|
405
|
-
- [ROADMAP.md](./ROADMAP.md) - what is being built, in what order
|
|
406
|
-
- [docs/](./docs) - guides, once there is something to guide
|
|
407
|
-
- [spec/](./spec) - the language specification and the compiled program schema
|
|
408
|
-
- [CONTRIBUTING.md](./CONTRIBUTING.md) - how to work on this
|
|
409
|
-
- [RELEASING.md](./RELEASING.md) - how a release is published, and the one manual step that cannot be automated
|
|
294
|
+
Backtest a strategy over the same bars:
|
|
410
295
|
|
|
411
|
-
|
|
296
|
+
```js
|
|
297
|
+
import { backtest, settingsFor } from 'openalgo-script';
|
|
412
298
|
|
|
413
|
-
|
|
299
|
+
const result = backtest(compile('ema-cross.oscript', strategyText), bars, settingsFor({
|
|
300
|
+
symbol: 'DEMO', exchange: null, currency: 'INR',
|
|
301
|
+
tickSize: 0.05, lotSize: 1, pointValue: 1, digits: 2,
|
|
302
|
+
}));
|
|
414
303
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
304
|
+
if (result.ok) {
|
|
305
|
+
const { summary, trades } = result.record.report;
|
|
306
|
+
console.log(summary.netProfit, summary.winRate, trades.length);
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
To run the same compiled program on a server in Python, see
|
|
311
|
+
[the Python engine](./docs/integrating/the-python-engine.md). To put OpenScript
|
|
312
|
+
inside your own platform, with its chart and its editor, start at
|
|
313
|
+
[integrating OpenScript](./docs/integrating/README.md).
|
|
314
|
+
|
|
315
|
+
## Words you will see
|
|
316
|
+
|
|
317
|
+
| Word | Means |
|
|
318
|
+
|---|---|
|
|
319
|
+
| Script | One `.oscript` file |
|
|
320
|
+
| Study | A script that only draws: lines, bands, markers, alerts |
|
|
321
|
+
| Strategy | A study that also places orders |
|
|
322
|
+
| Bar | One candle: open, high, low, close, volume and a time |
|
|
323
|
+
| Series | A value with one number per bar, such as `close` or an average |
|
|
324
|
+
| Input | A setting a trader can change without editing the file |
|
|
325
|
+
| `none` | No value on this bar. It is not zero |
|
|
326
|
+
| Backtest | Running a strategy over past bars to see how it would have traded |
|
|
327
|
+
|
|
328
|
+
## Where to go next
|
|
329
|
+
|
|
330
|
+
- [Getting started](./docs/getting-started.md): what happens between pressing
|
|
331
|
+
Apply and a line appearing.
|
|
332
|
+
- [Your first study](./docs/first-study.md) and
|
|
333
|
+
[your first strategy](./docs/first-strategy.md): complete scripts built one
|
|
334
|
+
step at a time.
|
|
335
|
+
- [Examples](./examples/README.md): twelve complete scripts, from an EMA cross to
|
|
336
|
+
an opening range strategy.
|
|
337
|
+
- [The documentation](./docs/README.md): every page, grouped by what it answers.
|
|
338
|
+
- [How OpenScript is built, and what it guarantees](./docs/integrating/architecture.md):
|
|
339
|
+
the compiler, the engines, the conformance suite and what is checked on every
|
|
340
|
+
build.
|
|
341
|
+
- [CHANGELOG.md](./CHANGELOG.md): what changed in each release.
|
|
342
|
+
|
|
343
|
+
## Contributing
|
|
344
|
+
|
|
345
|
+
Questions, bug reports and pull requests are welcome. Read
|
|
346
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md) first, and the
|
|
347
|
+
[code of conduct](./CODE_OF_CONDUCT.md). Report a security issue privately, as
|
|
348
|
+
[SECURITY.md](./SECURITY.md) describes.
|
|
418
349
|
|
|
419
|
-
##
|
|
350
|
+
## Licence
|
|
420
351
|
|
|
421
|
-
|
|
422
|
-
sponsored by, or endorsed by any charting or trading platform, and it is not a
|
|
423
|
-
reimplementation of any existing product. Its specification, its documentation
|
|
424
|
-
and its error text are original work.
|
|
352
|
+
Apache-2.0. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
|
|
@@ -30,6 +30,17 @@
|
|
|
30
30
|
* reads the run's own string channel there, at the one bar it is asked about,
|
|
31
31
|
* and the alert a user receives carries the numbers the script put in it.
|
|
32
32
|
*
|
|
33
|
+
* **The bar it is asked about is the run's, found through the table.** The
|
|
34
|
+
* index the chart hands the hook is a position in the table it holds, and that
|
|
35
|
+
* is not always a position in the run: a chart that transforms its series into
|
|
36
|
+
* elements that are not one per bar can run a study on the host's bars and read
|
|
37
|
+
* the table onto its elements, so element 7 may hold bar 12's values. The
|
|
38
|
+
* condition is a column and is read across with the rest; the message channel
|
|
39
|
+
* is not, so the table also carries each row's bar index (`columns.ts`), which
|
|
40
|
+
* the chart reads across like any other column, and the message is read at the
|
|
41
|
+
* bar that names. On a chart that draws the bars it computed on, which is every
|
|
42
|
+
* chart before that option existed, the column is the index itself.
|
|
43
|
+
*
|
|
33
44
|
* A message the bar published nothing for falls back to the declared title,
|
|
34
45
|
* which is what the chart itself does for an entry that states no message. That
|
|
35
46
|
* is the honest answer for the one case that reaches it: `message` is a required
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/alerts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/alerts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvE,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAKD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CACzC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,OAAO,GACf,SAAS,aAAa,EAAE,CAK1B;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,CA2BrF"}
|
|
@@ -4,6 +4,8 @@ import { producedFor } from './produced.js';
|
|
|
4
4
|
export function alertKey(index) {
|
|
5
5
|
return `openscript:alert:${index}`;
|
|
6
6
|
}
|
|
7
|
+
/** The key each row's bar in the run travels under, for the message to be read at. */
|
|
8
|
+
const BAR_KEY = 'openscript:bar';
|
|
7
9
|
/**
|
|
8
10
|
* Each declared alert's message channel, as the run left it.
|
|
9
11
|
*
|
|
@@ -37,13 +39,26 @@ export function buildAlerts(program, lookup) {
|
|
|
37
39
|
...(declared.messageChannel === null
|
|
38
40
|
? {}
|
|
39
41
|
: {
|
|
40
|
-
message: (ctx) => messageAt(producedFor(ctx.settings).messages[index], ctx
|
|
42
|
+
message: (ctx) => messageAt(producedFor(ctx.settings).messages[index], barOf(ctx)) ?? title,
|
|
41
43
|
}),
|
|
42
44
|
when: (ctx) => ctx.values[key]?.[ctx.index] === 1,
|
|
43
45
|
});
|
|
44
46
|
}
|
|
47
|
+
// One column for every message, and none for a study with no message to read.
|
|
48
|
+
if (alerts.some((one) => one.message !== undefined))
|
|
49
|
+
columns.push({ key: BAR_KEY, part: 'bar' });
|
|
45
50
|
return { alerts, columns };
|
|
46
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The bar of the run the chart's row came from.
|
|
54
|
+
*
|
|
55
|
+
* A table without the column is one a host built itself rather than one this
|
|
56
|
+
* descriptor returned, and its rows are the run's bars as they stand.
|
|
57
|
+
*/
|
|
58
|
+
function barOf(ctx) {
|
|
59
|
+
const at = ctx.values[BAR_KEY]?.[ctx.index];
|
|
60
|
+
return typeof at === 'number' ? at : ctx.index;
|
|
61
|
+
}
|
|
47
62
|
/** The message one bar published, or nothing where it published none. */
|
|
48
63
|
function messageAt(column, index) {
|
|
49
64
|
const value = column?.[index];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/adapters/charts/alerts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/adapters/charts/alerts.ts"],"names":[],"mappings":"AA4DA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAA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AAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC"}
|
|
@@ -9,11 +9,26 @@ import type { Columns } from './run.js';
|
|
|
9
9
|
* keeps `language.md` 6.6's answer intact on the way: absent is not true.
|
|
10
10
|
*/
|
|
11
11
|
export type ColumnPart = 'value' | 'rgb' | 'alpha' | 'flag';
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* One column of the table: a part of a channel, or the bar each row came from.
|
|
14
|
+
*
|
|
15
|
+
* The second kind reads no channel. It holds the index of the bar in the run
|
|
16
|
+
* the calculation was handed, and it exists because a chart may read the table
|
|
17
|
+
* onto bars other than those: a chart that transforms its series and runs a
|
|
18
|
+
* study on the bars the host fed it reads each column at the source bar every
|
|
19
|
+
* drawn element was completed on, and then hands each hook the element's index.
|
|
20
|
+
* A hook that reads a column is right by construction. A hook that reads
|
|
21
|
+
* something the run left elsewhere, indexed by the run's own bars, finds the
|
|
22
|
+
* bar through this column, which the chart reads across like any other.
|
|
23
|
+
*/
|
|
24
|
+
export type ColumnSpec = {
|
|
13
25
|
readonly key: string;
|
|
14
26
|
readonly channel: number;
|
|
15
27
|
readonly part: ColumnPart;
|
|
16
|
-
}
|
|
28
|
+
} | {
|
|
29
|
+
readonly key: string;
|
|
30
|
+
readonly part: 'bar';
|
|
31
|
+
};
|
|
17
32
|
/** The key a level's price column travels under. */
|
|
18
33
|
export declare function levelKey(index: number): string;
|
|
19
34
|
/** The key one side of a band's computed colour travels under. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/columns.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GA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;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,WAAW,CAiBb"}
|
|
@@ -39,10 +39,18 @@ export function colourColumns(key, channel) {
|
|
|
39
39
|
export function valuesFrom(specs, columns, from, to) {
|
|
40
40
|
const out = {};
|
|
41
41
|
for (const spec of specs) {
|
|
42
|
-
const column = columns[spec.channel] ?? [];
|
|
43
42
|
const built = new Array(Math.max(0, to - from));
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (spec.part === 'bar') {
|
|
44
|
+
// The bar's own index, never its offset into the tail: the chart splices
|
|
45
|
+
// a tail by position, so a row carries the same number either way.
|
|
46
|
+
for (let bar = from; bar < to; bar += 1)
|
|
47
|
+
built[bar - from] = bar;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const column = columns[spec.channel] ?? [];
|
|
51
|
+
for (let bar = from; bar < to; bar += 1) {
|
|
52
|
+
built[bar - from] = partOf(column[bar] ?? null, spec.part);
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
out[spec.key] = built;
|
|
48
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../src/adapters/charts/columns.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../src/adapters/charts/columns.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA8BzE,oDAAoD;AACpD,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAO,oBAAoB,KAAK,EAAE,CAAC;AACrC,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,a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CAAC,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -118,7 +118,7 @@ function checkRequest(checker, call, name, placement) {
|
|
|
118
118
|
if (written !== undefined && !TIMEFRAME.test(written)) {
|
|
119
119
|
checker.report('OS6001', timeframe?.span ?? call.span, { value: written });
|
|
120
120
|
}
|
|
121
|
-
const mode = modeOf(
|
|
121
|
+
const mode = modeOf(checked);
|
|
122
122
|
if (mode === 'lookahead') {
|
|
123
123
|
checker.report('OS8005', call.span, { mode });
|
|
124
124
|
checker.repaints = true;
|
|
@@ -153,14 +153,24 @@ function timeframeArgument(call, name) {
|
|
|
153
153
|
const positional = call.args.filter((one) => one.label === undefined);
|
|
154
154
|
return positional[name === 'req.symbol' ? 1 : 0];
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
/**
|
|
157
|
+
* The mode as the signature bound it, written by its label or in its place.
|
|
158
|
+
*
|
|
159
|
+
* `language.md` 11.2 fills parameters from the left, so `mode` is the third
|
|
160
|
+
* argument of `req.timeframe` and the fifth of `req.symbol` whether or not it
|
|
161
|
+
* carries its label, and the emitter reads every other argument of a read from
|
|
162
|
+
* the same binding. Looking for the label alone read a positional
|
|
163
|
+
* `"lookahead"` as the default: the study ran confirmed, with no OS8005 and no
|
|
164
|
+
* repaint mark, while its source named the mode on the line.
|
|
165
|
+
*/
|
|
166
|
+
function modeOf(checked) {
|
|
167
|
+
const bound = argumentOf(checked, 'mode');
|
|
168
|
+
const written = bound === undefined ? undefined : stringLiteral(bound.value);
|
|
159
169
|
if (written === 'confirmed' || written === 'developing' || written === 'lookahead') {
|
|
160
170
|
return written;
|
|
161
171
|
}
|
|
162
172
|
// The default is the one mode that never repaints (stdlib.md 15.3).
|
|
163
|
-
return
|
|
173
|
+
return bound === undefined ? 'confirmed' : 'unknown';
|
|
164
174
|
}
|
|
165
175
|
function stringLiteral(expression) {
|
|
166
176
|
const inner = withoutGrouping(expression);
|
|
@@ -1 +1 @@
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C,OAAgB,EAAE,IAAU,EAAE,IAAY;IACzE,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// VERSION comes from package.json and COMPILED_FORMAT_VERSION from
|
|
4
4
|
// spec/compiled-program.md, so neither can drift from the thing it names.
|
|
5
5
|
/** This build's package version. The release refuses to publish unless the tag, the manifest and this agree. */
|
|
6
|
-
export const VERSION = "0.8.
|
|
6
|
+
export const VERSION = "0.8.1";
|
|
7
7
|
/**
|
|
8
8
|
* The compiled program format this compiler emits.
|
|
9
9
|
*
|
package/package.json
CHANGED
package/spec/errors.json
CHANGED
|
@@ -2551,7 +2551,7 @@
|
|
|
2551
2551
|
"chart": "the chart's interval",
|
|
2552
2552
|
"suggestion": "the nearest interval above the requested one that is a whole multiple of the chart's"
|
|
2553
2553
|
},
|
|
2554
|
-
"cause": "An intraday request is folded by counting chart bars, so its interval must be a whole multiple of the chart's. Day, week and month requests are folded by the calendar
|
|
2554
|
+
"cause": "An intraday request is folded by counting chart bars, so its interval must be a whole multiple of the chart's. Day, week and month requests are folded by the calendar instead, keyed by the civil date in the instrument's timezone, so they are exempt from this rule.",
|
|
2555
2555
|
"fix": "Request a multiple of {chart}, for example {suggestion}.",
|
|
2556
2556
|
"autofix": false,
|
|
2557
2557
|
"example": {
|
|
@@ -30,6 +30,17 @@
|
|
|
30
30
|
* reads the run's own string channel there, at the one bar it is asked about,
|
|
31
31
|
* and the alert a user receives carries the numbers the script put in it.
|
|
32
32
|
*
|
|
33
|
+
* **The bar it is asked about is the run's, found through the table.** The
|
|
34
|
+
* index the chart hands the hook is a position in the table it holds, and that
|
|
35
|
+
* is not always a position in the run: a chart that transforms its series into
|
|
36
|
+
* elements that are not one per bar can run a study on the host's bars and read
|
|
37
|
+
* the table onto its elements, so element 7 may hold bar 12's values. The
|
|
38
|
+
* condition is a column and is read across with the rest; the message channel
|
|
39
|
+
* is not, so the table also carries each row's bar index (`columns.ts`), which
|
|
40
|
+
* the chart reads across like any other column, and the message is read at the
|
|
41
|
+
* bar that names. On a chart that draws the bars it computed on, which is every
|
|
42
|
+
* chart before that option existed, the column is the index itself.
|
|
43
|
+
*
|
|
33
44
|
* A message the bar published nothing for falls back to the declared title,
|
|
34
45
|
* which is what the chart itself does for an entry that states no message. That
|
|
35
46
|
* is the honest answer for the one case that reaches it: `message` is a required
|
|
@@ -59,6 +70,9 @@ export function alertKey(index: number): string {
|
|
|
59
70
|
return `openscript:alert:${index}`;
|
|
60
71
|
}
|
|
61
72
|
|
|
73
|
+
/** The key each row's bar in the run travels under, for the message to be read at. */
|
|
74
|
+
const BAR_KEY = 'openscript:bar';
|
|
75
|
+
|
|
62
76
|
export interface AlertBuild {
|
|
63
77
|
readonly alerts: readonly ChartAlertSpec[];
|
|
64
78
|
readonly columns: readonly ColumnSpec[];
|
|
@@ -101,14 +115,27 @@ export function buildAlerts(program: CompiledProgram, lookup: InputLookup): Aler
|
|
|
101
115
|
? {}
|
|
102
116
|
: {
|
|
103
117
|
message: (ctx: ChartAlertContext): string =>
|
|
104
|
-
messageAt(producedFor(ctx.settings).messages[index], ctx
|
|
118
|
+
messageAt(producedFor(ctx.settings).messages[index], barOf(ctx)) ?? title,
|
|
105
119
|
}),
|
|
106
120
|
when: (ctx: ChartAlertContext): boolean => ctx.values[key]?.[ctx.index] === 1,
|
|
107
121
|
});
|
|
108
122
|
}
|
|
123
|
+
// One column for every message, and none for a study with no message to read.
|
|
124
|
+
if (alerts.some((one) => one.message !== undefined)) columns.push({ key: BAR_KEY, part: 'bar' });
|
|
109
125
|
return { alerts, columns };
|
|
110
126
|
}
|
|
111
127
|
|
|
128
|
+
/**
|
|
129
|
+
* The bar of the run the chart's row came from.
|
|
130
|
+
*
|
|
131
|
+
* A table without the column is one a host built itself rather than one this
|
|
132
|
+
* descriptor returned, and its rows are the run's bars as they stand.
|
|
133
|
+
*/
|
|
134
|
+
function barOf(ctx: ChartAlertContext): number {
|
|
135
|
+
const at = ctx.values[BAR_KEY]?.[ctx.index];
|
|
136
|
+
return typeof at === 'number' ? at : ctx.index;
|
|
137
|
+
}
|
|
138
|
+
|
|
112
139
|
/** The message one bar published, or nothing where it published none. */
|
|
113
140
|
function messageAt(column: MessageColumn | undefined, index: number): string | undefined {
|
|
114
141
|
const value = column?.[index];
|
|
@@ -31,11 +31,21 @@ import type { Columns } from './run.js';
|
|
|
31
31
|
*/
|
|
32
32
|
export type ColumnPart = 'value' | 'rgb' | 'alpha' | 'flag';
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/**
|
|
35
|
+
* One column of the table: a part of a channel, or the bar each row came from.
|
|
36
|
+
*
|
|
37
|
+
* The second kind reads no channel. It holds the index of the bar in the run
|
|
38
|
+
* the calculation was handed, and it exists because a chart may read the table
|
|
39
|
+
* onto bars other than those: a chart that transforms its series and runs a
|
|
40
|
+
* study on the bars the host fed it reads each column at the source bar every
|
|
41
|
+
* drawn element was completed on, and then hands each hook the element's index.
|
|
42
|
+
* A hook that reads a column is right by construction. A hook that reads
|
|
43
|
+
* something the run left elsewhere, indexed by the run's own bars, finds the
|
|
44
|
+
* bar through this column, which the chart reads across like any other.
|
|
45
|
+
*/
|
|
46
|
+
export type ColumnSpec =
|
|
47
|
+
| { readonly key: string; readonly channel: number; readonly part: ColumnPart }
|
|
48
|
+
| { readonly key: string; readonly part: 'bar' };
|
|
39
49
|
|
|
40
50
|
/** The key a level's price column travels under. */
|
|
41
51
|
export function levelKey(index: number): string {
|
|
@@ -86,10 +96,16 @@ export function valuesFrom(
|
|
|
86
96
|
): ChartValues {
|
|
87
97
|
const out: Record<string, readonly (number | null)[]> = {};
|
|
88
98
|
for (const spec of specs) {
|
|
89
|
-
const column = columns[spec.channel] ?? [];
|
|
90
99
|
const built = new Array<number | null>(Math.max(0, to - from));
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
if (spec.part === 'bar') {
|
|
101
|
+
// The bar's own index, never its offset into the tail: the chart splices
|
|
102
|
+
// a tail by position, so a row carries the same number either way.
|
|
103
|
+
for (let bar = from; bar < to; bar += 1) built[bar - from] = bar;
|
|
104
|
+
} else {
|
|
105
|
+
const column = columns[spec.channel] ?? [];
|
|
106
|
+
for (let bar = from; bar < to; bar += 1) {
|
|
107
|
+
built[bar - from] = partOf(column[bar] ?? null, spec.part);
|
|
108
|
+
}
|
|
93
109
|
}
|
|
94
110
|
out[spec.key] = built;
|
|
95
111
|
}
|
|
@@ -157,7 +157,7 @@ function checkRequest(
|
|
|
157
157
|
checker.report('OS6001', timeframe?.span ?? call.span, { value: written });
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const mode = modeOf(
|
|
160
|
+
const mode = modeOf(checked);
|
|
161
161
|
if (mode === 'lookahead') {
|
|
162
162
|
checker.report('OS8005', call.span, { mode });
|
|
163
163
|
checker.repaints = true;
|
|
@@ -195,14 +195,24 @@ function timeframeArgument(call: Call, name: string): Argument | undefined {
|
|
|
195
195
|
return positional[name === 'req.symbol' ? 1 : 0];
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The mode as the signature bound it, written by its label or in its place.
|
|
200
|
+
*
|
|
201
|
+
* `language.md` 11.2 fills parameters from the left, so `mode` is the third
|
|
202
|
+
* argument of `req.timeframe` and the fifth of `req.symbol` whether or not it
|
|
203
|
+
* carries its label, and the emitter reads every other argument of a read from
|
|
204
|
+
* the same binding. Looking for the label alone read a positional
|
|
205
|
+
* `"lookahead"` as the default: the study ran confirmed, with no OS8005 and no
|
|
206
|
+
* repaint mark, while its source named the mode on the line.
|
|
207
|
+
*/
|
|
208
|
+
function modeOf(checked: CheckedCall): RequestMode {
|
|
209
|
+
const bound = argumentOf(checked, 'mode');
|
|
210
|
+
const written = bound === undefined ? undefined : stringLiteral(bound.value);
|
|
201
211
|
if (written === 'confirmed' || written === 'developing' || written === 'lookahead') {
|
|
202
212
|
return written;
|
|
203
213
|
}
|
|
204
214
|
// The default is the one mode that never repaints (stdlib.md 15.3).
|
|
205
|
-
return
|
|
215
|
+
return bound === undefined ? 'confirmed' : 'unknown';
|
|
206
216
|
}
|
|
207
217
|
|
|
208
218
|
function stringLiteral(expression: Expression): string | undefined {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// spec/compiled-program.md, so neither can drift from the thing it names.
|
|
5
5
|
|
|
6
6
|
/** This build's package version. The release refuses to publish unless the tag, the manifest and this agree. */
|
|
7
|
-
export const VERSION = "0.8.
|
|
7
|
+
export const VERSION = "0.8.1";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The compiled program format this compiler emits.
|