openalgo-script 0.1.0-alpha.0 → 0.1.0-alpha.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 +49 -0
- package/README.md +267 -255
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/version/index.d.ts +2 -0
- package/dist/core/version/index.d.ts.map +1 -0
- package/dist/core/version/index.js +2 -0
- package/dist/core/version/index.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +10 -0
- package/dist/core/version/version.generated.d.ts.map +1 -0
- package/dist/core/version/version.generated.js +14 -0
- package/dist/core/version/version.generated.js.map +1 -0
- package/package.json +64 -52
- package/spec/errors.json +3204 -3204
- package/src/core/index.ts +1 -0
- package/src/core/parse/functions.ts +109 -109
- package/src/core/parse/switches.ts +105 -105
- package/src/core/version/index.ts +1 -0
- package/src/core/version/version.generated.ts +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
What changed in each release, written for somebody deciding whether to upgrade.
|
|
4
|
+
|
|
5
|
+
This file is checked at release: a version with no entry, or an entry that says
|
|
6
|
+
nothing, fails the build before it can become permanent.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0.1.0-alpha.1
|
|
11
|
+
|
|
12
|
+
The first release published by the automation rather than by hand.
|
|
13
|
+
|
|
14
|
+
Fixes a version skew that would have bitten anybody running the tests on a
|
|
15
|
+
different runtime than the author. Test discovery passed a glob to the runtime's
|
|
16
|
+
test runner, which expands it on a recent version and treats it as a literal path
|
|
17
|
+
on an older one, so the suite silently found no files and reported success.
|
|
18
|
+
Discovery now walks the filesystem in code, and finding zero test files is a
|
|
19
|
+
failure rather than a pass.
|
|
20
|
+
|
|
21
|
+
The supported runtime floor moves to Node 22. Node 20 reached end of life earlier
|
|
22
|
+
this year, and supporting a runtime nobody should be running was forcing a worse
|
|
23
|
+
test setup.
|
|
24
|
+
|
|
25
|
+
The build now reports two version numbers of its own: the package version, so a
|
|
26
|
+
bug report can establish which build produced a number, and the compiled program
|
|
27
|
+
format version, so an engine written by somebody else can refuse a program it does
|
|
28
|
+
not implement. Both are generated from the files that already state them rather
|
|
29
|
+
than typed into source.
|
|
30
|
+
|
|
31
|
+
## 0.1.0-alpha.0
|
|
32
|
+
|
|
33
|
+
First publication. **This version parses and does not compute anything.**
|
|
34
|
+
|
|
35
|
+
A lexer, a parser, a syntax tree, and diagnostics carrying a code, a line, a
|
|
36
|
+
column and a fix. It will tell you whether a script is well formed. It will not
|
|
37
|
+
calculate a moving average, draw anything, or place an order.
|
|
38
|
+
|
|
39
|
+
It exists to reserve the name and to prove the release path while the stakes are a
|
|
40
|
+
placeholder, on the principle that automation which has never run is not
|
|
41
|
+
automation.
|
|
42
|
+
|
|
43
|
+
What is behind it: the language specification, a 143 entry error catalogue in
|
|
44
|
+
prose and machine readable form, the compiled program format, the host interface a
|
|
45
|
+
platform implements, a conformance suite design, twelve worked example scripts and
|
|
46
|
+
72 pages of documentation. All twelve examples parse with no diagnostics, which
|
|
47
|
+
was the gate for this phase.
|
|
48
|
+
|
|
49
|
+
Published with no long lived credential. The checker and the engine are next.
|
package/README.md
CHANGED
|
@@ -1,255 +1,267 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# OpenScript
|
|
4
|
-
|
|
5
|
-
**An open trading language. Write a study or a strategy once, plot it, backtest it, trade it.**
|
|
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.
|
|
10
|
-
|
|
11
|
-
[](./LICENSE)
|
|
12
|
-
[](./ROADMAP.md)
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Status
|
|
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
|
-
if
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
A
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# OpenScript
|
|
4
|
+
|
|
5
|
+
**An open trading language. Write a study or a strategy once, plot it, backtest it, trade it.**
|
|
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.
|
|
10
|
+
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
[](./ROADMAP.md)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Status
|
|
19
|
+
|
|
20
|
+
**`0.1.0-alpha.0` parses. It does not yet compute anything.**
|
|
21
|
+
|
|
22
|
+
That is the honest description of what an install gets you today: a lexer, a
|
|
23
|
+
parser, a syntax tree, and diagnostics carrying a code, a line, a column and a
|
|
24
|
+
fix. It will tell you whether a script is well formed. It will not calculate a
|
|
25
|
+
moving average, draw anything, or place an order.
|
|
26
|
+
|
|
27
|
+
The registry shows this version under `latest` only because a package must have
|
|
28
|
+
one and this is the first release. The `-alpha.0` on the version is the part to
|
|
29
|
+
read.
|
|
30
|
+
|
|
31
|
+
The checker and the engine are Phase 2, and the roadmap says what each phase owes
|
|
32
|
+
before it is allowed to finish. The specification is written first and the
|
|
33
|
+
implementation follows it, which is why there is a great deal more specification
|
|
34
|
+
here than there is compiler.
|
|
35
|
+
|
|
36
|
+
## What it looks like
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
study("EMA cross", overlay = true)
|
|
40
|
+
|
|
41
|
+
fast = input(9, "Fast")
|
|
42
|
+
slow = input(21, "Slow")
|
|
43
|
+
|
|
44
|
+
ef = ema(close, fast)
|
|
45
|
+
es = ema(close, slow)
|
|
46
|
+
|
|
47
|
+
plot(ef, "Fast", aqua)
|
|
48
|
+
plot(es, "Slow", orange)
|
|
49
|
+
|
|
50
|
+
if crossUp(ef, es)
|
|
51
|
+
signal("BUY")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The same file becomes a strategy by adding orders:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
strategy("EMA cross", overlay = true)
|
|
58
|
+
|
|
59
|
+
if crossUp(ef, es)
|
|
60
|
+
buy(qty = 1)
|
|
61
|
+
|
|
62
|
+
if crossDown(ef, es)
|
|
63
|
+
close()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
One script. One set of numbers on the chart, in the backtest, and in the market.
|
|
67
|
+
|
|
68
|
+
## Why it exists
|
|
69
|
+
|
|
70
|
+
Chart scripting today is closed. You write in someone's editor, your script runs
|
|
71
|
+
on their servers under their limits, and the only way out is a webhook. The
|
|
72
|
+
numbers you backtest are not the numbers you trade, and you cannot check either.
|
|
73
|
+
|
|
74
|
+
OpenScript is the opposite of that:
|
|
75
|
+
|
|
76
|
+
- **Yours.** Plain text files in a folder. Version control, diffs, your own editor.
|
|
77
|
+
- **Local.** It compiles and runs on your machine. No execution quota, no loop
|
|
78
|
+
timeout, no cap on how many things you may draw.
|
|
79
|
+
- **Honest.** A higher timeframe read has to say whether it repaints. The
|
|
80
|
+
compiler warns when a script would.
|
|
81
|
+
- **Connected.** The same script places real orders through your own broker
|
|
82
|
+
connection, on paper by default.
|
|
83
|
+
- **Open.** Apache-2.0, a written specification, and a conformance suite anyone
|
|
84
|
+
can run against their own implementation.
|
|
85
|
+
|
|
86
|
+
## How it is built
|
|
87
|
+
|
|
88
|
+
The compiler does not emit JavaScript. It emits a **compiled program**: a plain
|
|
89
|
+
data structure of instructions, defined by a versioned schema.
|
|
90
|
+
|
|
91
|
+
That one decision carries the whole project:
|
|
92
|
+
|
|
93
|
+
1. It runs in a browser under a strict content security policy, with no `eval`
|
|
94
|
+
and nothing for a security team to approve.
|
|
95
|
+
2. A server-side engine is a few hundred lines that walk an instruction list,
|
|
96
|
+
not a second implementation of the language.
|
|
97
|
+
3. Anyone can write an engine in any language, and prove it correct by running
|
|
98
|
+
the conformance suite.
|
|
99
|
+
|
|
100
|
+
One compiler. One compiled format. Many small engines, all of which must agree
|
|
101
|
+
to the last decimal.
|
|
102
|
+
|
|
103
|
+
The same decision shapes the editor. This project ships the language
|
|
104
|
+
intelligence as pure functions with no DOM: highlight, complete, diagnose, hover,
|
|
105
|
+
signature, format. Highlighting comes from the real lexer, completions from the
|
|
106
|
+
standard library manifest, and the errors you see while typing are the compiler's
|
|
107
|
+
own, with their fixes taken from the error catalogue. A host supplies the text
|
|
108
|
+
component and the panel around it, and keeps its own design. The editor is not a
|
|
109
|
+
second implementation of the language to be kept in step.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
source text
|
|
113
|
+
-> tokens
|
|
114
|
+
-> tree
|
|
115
|
+
-> checked tree (errors carry a code, a line and a fix)
|
|
116
|
+
-> compiled program (plain data, versioned schema)
|
|
117
|
+
-> any engine (browser, server, yours)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## The pieces, and which way they point
|
|
121
|
+
|
|
122
|
+
A platform adopting OpenScript usually already has a chart, or an editor, or a
|
|
123
|
+
broker connection, and sometimes all three. So the pieces are separate packages
|
|
124
|
+
and the dependencies only ever point one way.
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
openalgo-script a chart library
|
|
128
|
+
(knows nobody) (knows nobody)
|
|
129
|
+
| \ /
|
|
130
|
+
| \ /
|
|
131
|
+
| .../adapters/charts <- knows both. The only place that does
|
|
132
|
+
|
|
|
133
|
+
.../editor
|
|
134
|
+
|
|
|
135
|
+
.../adapters/codemirror <- knows the editor component. Nothing else does
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The language ships as one package with an entry point per tier, so a consumer who
|
|
139
|
+
wants only the compiler never pays for an adapter. A tier is declared only once it
|
|
140
|
+
exists: an entry point that resolves to nothing fails at a consumer's run time
|
|
141
|
+
rather than honestly at install.
|
|
142
|
+
|
|
143
|
+
| Entry point | Is | Depends on |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `openalgo-script` | Compiler and engine | Nothing |
|
|
146
|
+
| `openalgo-script/editor` | Highlight, complete, diagnose, hover, signature, format. No DOM | The compiler |
|
|
147
|
+
| `openalgo-script/adapters/charts` | Turns a compiled study into a chart's indicator descriptor | The compiler and a chart |
|
|
148
|
+
| `openalgo-script/adapters/codemirror` | A drop-in editor language package | The editor half and an editor component |
|
|
149
|
+
| The Python engine, on its own index | The same compiled program, run on a server | Nothing |
|
|
150
|
+
|
|
151
|
+
An adapter is the only thing allowed to know two worlds at once, which is what
|
|
152
|
+
makes it the piece a platform replaces rather than the piece they patch. A
|
|
153
|
+
platform with its own chart writes their own chart adapter and keeps everything
|
|
154
|
+
else. A platform with its own editor does the same on that side.
|
|
155
|
+
|
|
156
|
+
This is enforced rather than promised. `scripts/check-layering.mjs` runs in
|
|
157
|
+
continuous integration and fails the build if the compiler imports a chart, if
|
|
158
|
+
anything outside an adapter imports a package, or if the compiler or the editor
|
|
159
|
+
half so much as mentions a browser global.
|
|
160
|
+
|
|
161
|
+
## Taking it, one step at a time
|
|
162
|
+
|
|
163
|
+
Each row is usable on its own. Nobody has to take the next one.
|
|
164
|
+
|
|
165
|
+
| You want | You add | Roughly |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| Scripts that produce numbers | `openalgo-script`, and the six-item host interface | An afternoon |
|
|
168
|
+
| Those studies on your chart | the charts adapter, plus a chart | Days. Free if the chart is the one this adapter already targets |
|
|
169
|
+
| Traders authoring in your app | `openalgo-script/editor`, and your own text component or the drop-in one | Days |
|
|
170
|
+
| Traders trading from it | Wire the order half of the host interface to your order API | About a week |
|
|
171
|
+
| To run it on your own stack | Implement the compiled program format in your language, then pass the conformance suite | Weeks |
|
|
172
|
+
|
|
173
|
+
The last row is the one that matters for the standard. A platform that will not
|
|
174
|
+
run our code at all reads the compiled program specification, writes its own
|
|
175
|
+
engine, passes the suite, and its traders' scripts are the same scripts as
|
|
176
|
+
everyone else's.
|
|
177
|
+
|
|
178
|
+
## What is guaranteed, and what proves it
|
|
179
|
+
|
|
180
|
+
A platform's engineering review asks two questions about a dependency: what do you
|
|
181
|
+
promise, and how would I know. This table is the answer to the second one. Where a
|
|
182
|
+
row says a check enforces something, that check runs in continuous integration and
|
|
183
|
+
fails the build.
|
|
184
|
+
|
|
185
|
+
| Guarantee | How you can tell | Today |
|
|
186
|
+
|---|---|---|
|
|
187
|
+
| No `eval`, no generated code, runs under a strict content security policy | Grep the source. There is no code construction anywhere, and the compiler emits data | Enforced |
|
|
188
|
+
| Zero runtime dependencies | `dependencies` is empty and stays empty | Enforced |
|
|
189
|
+
| 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 |
|
|
190
|
+
| Small modules with a stated surface | `scripts/check-modularity.mjs`. A module's index is its only door | Enforced |
|
|
191
|
+
| Every error is documented, with a code, a cause and a fix | `scripts/check-error-codes.mjs`, and the code type is generated from the catalogue so an invented code will not compile | Enforced |
|
|
192
|
+
| No fact is stated in two places | `scripts/check-duplication.mjs` | Enforced, with recorded debt |
|
|
193
|
+
| The compiled program is implementable without reading our code | `spec/compiled-program.md` and `spec/host-interface.md` | Written |
|
|
194
|
+
| Two engines agree to the last decimal | The conformance suite, run against both. A disagreement blocks a release | Phase 6 gate |
|
|
195
|
+
| A runaway script stops | Instruction, memory and wall clock budgets, enforced by the engine that owns the loop | Phase 2 gate |
|
|
196
|
+
| A failing script does not take anything else down | One script's failure is a diagnostic on that script | Phase 2 gate |
|
|
197
|
+
| 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 |
|
|
198
|
+
| Performance | A benchmark with a number, in continuous integration | Phase 2 gate |
|
|
199
|
+
|
|
200
|
+
The rows marked as gates are not promises we intend to keep. They are conditions a
|
|
201
|
+
phase does not finish without, and each one is written into the roadmap beside the
|
|
202
|
+
phase that owes it.
|
|
203
|
+
|
|
204
|
+
### Why a script cannot reach anything
|
|
205
|
+
|
|
206
|
+
This is the row a security review spends its time on, so it is worth stating
|
|
207
|
+
plainly rather than leaving as a property of the architecture.
|
|
208
|
+
|
|
209
|
+
A compiled program is **data**. It is a list of instructions the engine walks. A
|
|
210
|
+
script has no way to name a function the instruction set does not expose, so there
|
|
211
|
+
is no call into the host, no network, no filesystem, no access to the object graph
|
|
212
|
+
of the process it runs in. There is nothing to escape from, because nothing was
|
|
213
|
+
ever handed over.
|
|
214
|
+
|
|
215
|
+
That also makes the budgets real rather than best-effort. The engine owns the
|
|
216
|
+
loop, so an instruction count per bar, a memory ceiling and a wall clock are
|
|
217
|
+
counters in that loop rather than something to hope about. A platform running many
|
|
218
|
+
customers' scripts in one process needs exactly this, and a design that generates
|
|
219
|
+
code and runs it cannot offer it.
|
|
220
|
+
|
|
221
|
+
## The host interface
|
|
222
|
+
|
|
223
|
+
Whatever a platform takes, it supplies six things and nothing more:
|
|
224
|
+
|
|
225
|
+
1. Bars: open, high, low, close, volume, time.
|
|
226
|
+
2. Instrument facts: tick size, lot size, session, timezone.
|
|
227
|
+
3. More bars on request, for another instrument or another timeframe.
|
|
228
|
+
4. Somewhere to draw.
|
|
229
|
+
5. Somewhere to send orders, if scripts are allowed to trade.
|
|
230
|
+
6. Somewhere to save settings.
|
|
231
|
+
|
|
232
|
+
No instrument naming scheme, no exchange rules and no broker concepts appear in
|
|
233
|
+
the language. A symbol is opaque to it: a script names a contract by what the
|
|
234
|
+
contract is, and the platform resolves that to whatever its own symbology calls
|
|
235
|
+
it. A format built around one market's derivatives means nothing on a crypto
|
|
236
|
+
exchange, and portability is the entire objective.
|
|
237
|
+
|
|
238
|
+
## Errors
|
|
239
|
+
|
|
240
|
+
Every error has a stable code, a message, the cause, the fix and an example,
|
|
241
|
+
held in one machine-readable catalogue. The compiler, the editor and the
|
|
242
|
+
documentation all read that same file, so the documentation cannot drift from
|
|
243
|
+
the compiler. The build fails if an error exists without a documented entry, or
|
|
244
|
+
an entry without a test.
|
|
245
|
+
|
|
246
|
+
## Documentation
|
|
247
|
+
|
|
248
|
+
- [ROADMAP.md](./ROADMAP.md) - what is being built, in what order
|
|
249
|
+
- [docs/](./docs) - guides, once there is something to guide
|
|
250
|
+
- [spec/](./spec) - the language specification and the compiled program schema
|
|
251
|
+
- [CONTRIBUTING.md](./CONTRIBUTING.md) - how to work on this
|
|
252
|
+
- [RELEASING.md](./RELEASING.md) - how a release is published, and the one manual step that cannot be automated
|
|
253
|
+
|
|
254
|
+
## Licence
|
|
255
|
+
|
|
256
|
+
Apache-2.0. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
|
|
257
|
+
|
|
258
|
+
Apache-2.0 was chosen deliberately over a copyleft licence. A trading platform
|
|
259
|
+
that wants to embed OpenScript must be able to do so without publishing its own
|
|
260
|
+
source, or the language cannot become a shared standard.
|
|
261
|
+
|
|
262
|
+
## A note on independence
|
|
263
|
+
|
|
264
|
+
OpenScript is an independent open source language. It is not affiliated with,
|
|
265
|
+
sponsored by, or endorsed by any charting or trading platform, and it is not a
|
|
266
|
+
reimplementation of any existing product. Its specification, its documentation
|
|
267
|
+
and its error text are original work.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ export type { Argument, ArithmeticOperator, ArrayLiteral, ArrayType, Assignment,
|
|
|
25
25
|
export { ARITHMETIC_OPERATORS, ASSIGNMENT_OPERATORS, COMPARISON_OPERATORS, EQUALITY_OPERATORS, LOGICAL_OPERATORS, OBJECT_TYPE_NAMES, UNARY_OPERATORS, VALUE_TYPE_NAMES, binaryPrecedence, childrenOf, isExpression, isObjectTypeName, isStatement, isTypeAnnotation, isValueTypeName, makeNode, nodeAtOffset, pathAtOffset, typeAnnotationText, walk, withoutGrouping, } from './ast/index.js';
|
|
26
26
|
export { lex } from './lex/index.js';
|
|
27
27
|
export { parse, parseTokens } from './parse/index.js';
|
|
28
|
+
export { COMPILED_FORMAT_VERSION, VERSION } from './version/index.js';
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhF,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhE,YAAY,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA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5 @@ export { PUNCTUATORS, RESERVED_WORDS } from './tokens/index.js';
|
|
|
19
19
|
export { ARITHMETIC_OPERATORS, ASSIGNMENT_OPERATORS, COMPARISON_OPERATORS, EQUALITY_OPERATORS, LOGICAL_OPERATORS, OBJECT_TYPE_NAMES, UNARY_OPERATORS, VALUE_TYPE_NAMES, binaryPrecedence, childrenOf, isExpression, isObjectTypeName, isStatement, isTypeAnnotation, isValueTypeName, makeNode, nodeAtOffset, pathAtOffset, typeAnnotationText, walk, withoutGrouping, } from './ast/index.js';
|
|
20
20
|
export { lex } from './lex/index.js';
|
|
21
21
|
export { parse, parseTokens } from './parse/index.js';
|
|
22
|
+
export { COMPILED_FORMAT_VERSION, VERSION } from './version/index.js';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|