openalgo-script 0.5.0 → 0.6.0

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 (242) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +53 -22
  3. package/dist/adapters/charts/run.d.ts.map +1 -1
  4. package/dist/adapters/charts/run.js +6 -0
  5. package/dist/adapters/charts/run.js.map +1 -1
  6. package/dist/adapters/charts/tables.d.ts +6 -19
  7. package/dist/adapters/charts/tables.d.ts.map +1 -1
  8. package/dist/adapters/charts/tables.js.map +1 -1
  9. package/dist/adapters/charts/undrawable.d.ts +4 -0
  10. package/dist/adapters/charts/undrawable.d.ts.map +1 -0
  11. package/dist/adapters/charts/undrawable.js +47 -0
  12. package/dist/adapters/charts/undrawable.js.map +1 -0
  13. package/dist/core/backtest/drive.d.ts +36 -1
  14. package/dist/core/backtest/drive.d.ts.map +1 -1
  15. package/dist/core/backtest/drive.js +13 -107
  16. package/dist/core/backtest/drive.js.map +1 -1
  17. package/dist/core/backtest/index.d.ts +2 -0
  18. package/dist/core/backtest/index.d.ts.map +1 -1
  19. package/dist/core/backtest/index.js.map +1 -1
  20. package/dist/core/backtest/walk.d.ts +39 -0
  21. package/dist/core/backtest/walk.d.ts.map +1 -0
  22. package/dist/core/backtest/walk.js +125 -0
  23. package/dist/core/backtest/walk.js.map +1 -0
  24. package/dist/core/catalogue/catalogue.generated.d.ts +178 -1
  25. package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
  26. package/dist/core/catalogue/catalogue.generated.js +18 -1
  27. package/dist/core/catalogue/catalogue.generated.js.map +1 -1
  28. package/dist/core/catalogue/types.d.ts +8 -2
  29. package/dist/core/catalogue/types.d.ts.map +1 -1
  30. package/dist/core/catalogue/values.generated.d.ts +51 -0
  31. package/dist/core/catalogue/values.generated.d.ts.map +1 -1
  32. package/dist/core/check/assigned.d.ts +19 -0
  33. package/dist/core/check/assigned.d.ts.map +1 -0
  34. package/dist/core/check/assigned.js +14 -0
  35. package/dist/core/check/assigned.js.map +1 -0
  36. package/dist/core/check/call-sites.d.ts.map +1 -1
  37. package/dist/core/check/call-sites.js +9 -4
  38. package/dist/core/check/call-sites.js.map +1 -1
  39. package/dist/core/check/calls.d.ts.map +1 -1
  40. package/dist/core/check/calls.js +12 -4
  41. package/dist/core/check/calls.js.map +1 -1
  42. package/dist/core/check/check.d.ts.map +1 -1
  43. package/dist/core/check/check.js +15 -2
  44. package/dist/core/check/check.js.map +1 -1
  45. package/dist/core/check/checker.d.ts +26 -0
  46. package/dist/core/check/checker.d.ts.map +1 -1
  47. package/dist/core/check/checker.js +38 -2
  48. package/dist/core/check/checker.js.map +1 -1
  49. package/dist/core/check/constant.d.ts +16 -0
  50. package/dist/core/check/constant.d.ts.map +1 -1
  51. package/dist/core/check/constant.js +52 -0
  52. package/dist/core/check/constant.js.map +1 -1
  53. package/dist/core/check/deleted.d.ts +3 -0
  54. package/dist/core/check/deleted.d.ts.map +1 -0
  55. package/dist/core/check/deleted.js +109 -0
  56. package/dist/core/check/deleted.js.map +1 -0
  57. package/dist/core/check/expressions.js +1 -1
  58. package/dist/core/check/expressions.js.map +1 -1
  59. package/dist/core/check/library-output.d.ts.map +1 -1
  60. package/dist/core/check/library-output.js +1 -0
  61. package/dist/core/check/library-output.js.map +1 -1
  62. package/dist/core/check/library-prose.generated.js +10 -10
  63. package/dist/core/check/library-prose.generated.js.map +1 -1
  64. package/dist/core/check/library.d.ts +7 -0
  65. package/dist/core/check/library.d.ts.map +1 -1
  66. package/dist/core/check/library.js +1 -0
  67. package/dist/core/check/library.js.map +1 -1
  68. package/dist/core/check/surface.d.ts +9 -0
  69. package/dist/core/check/surface.d.ts.map +1 -1
  70. package/dist/core/check/surface.js +13 -0
  71. package/dist/core/check/surface.js.map +1 -1
  72. package/dist/core/engine/bar-source.d.ts +65 -0
  73. package/dist/core/engine/bar-source.d.ts.map +1 -0
  74. package/dist/core/engine/bar-source.js +58 -0
  75. package/dist/core/engine/bar-source.js.map +1 -0
  76. package/dist/core/engine/engine.d.ts +9 -11
  77. package/dist/core/engine/engine.d.ts.map +1 -1
  78. package/dist/core/engine/engine.js +24 -24
  79. package/dist/core/engine/engine.js.map +1 -1
  80. package/dist/core/engine/guard.d.ts.map +1 -1
  81. package/dist/core/engine/guard.js +10 -0
  82. package/dist/core/engine/guard.js.map +1 -1
  83. package/dist/core/engine/host.d.ts +4 -2
  84. package/dist/core/engine/host.d.ts.map +1 -1
  85. package/dist/core/engine/host.js.map +1 -1
  86. package/dist/core/engine/index.d.ts +1 -0
  87. package/dist/core/engine/index.d.ts.map +1 -1
  88. package/dist/core/engine/index.js.map +1 -1
  89. package/dist/core/engine/library/binding.d.ts +2 -0
  90. package/dist/core/engine/library/binding.d.ts.map +1 -1
  91. package/dist/core/engine/library/binding.js.map +1 -1
  92. package/dist/core/engine/library/index.d.ts +8 -0
  93. package/dist/core/engine/library/index.d.ts.map +1 -1
  94. package/dist/core/engine/library/index.js +10 -0
  95. package/dist/core/engine/library/index.js.map +1 -1
  96. package/dist/core/engine/library/objects.d.ts.map +1 -1
  97. package/dist/core/engine/library/objects.js +1 -1
  98. package/dist/core/engine/library/objects.js.map +1 -1
  99. package/dist/core/engine/request-body.d.ts +3 -1
  100. package/dist/core/engine/request-body.d.ts.map +1 -1
  101. package/dist/core/engine/request-body.js +3 -1
  102. package/dist/core/engine/request-body.js.map +1 -1
  103. package/dist/core/engine/request-plan.d.ts +3 -3
  104. package/dist/core/engine/request-plan.js +3 -3
  105. package/dist/core/engine/requests.d.ts +2 -2
  106. package/dist/core/engine/requests.d.ts.map +1 -1
  107. package/dist/core/engine/requests.js +5 -4
  108. package/dist/core/engine/requests.js.map +1 -1
  109. package/dist/core/engine/series.d.ts +18 -6
  110. package/dist/core/engine/series.d.ts.map +1 -1
  111. package/dist/core/engine/series.js +24 -5
  112. package/dist/core/engine/series.js.map +1 -1
  113. package/dist/core/engine/session/record.d.ts +4 -4
  114. package/dist/core/engine/session/record.js +4 -4
  115. package/dist/core/importer/calls.d.ts +29 -0
  116. package/dist/core/importer/calls.d.ts.map +1 -0
  117. package/dist/core/importer/calls.js +267 -0
  118. package/dist/core/importer/calls.js.map +1 -0
  119. package/dist/core/importer/context.d.ts +118 -0
  120. package/dist/core/importer/context.d.ts.map +1 -0
  121. package/dist/core/importer/context.js +120 -0
  122. package/dist/core/importer/context.js.map +1 -0
  123. package/dist/core/importer/expressions.d.ts +44 -0
  124. package/dist/core/importer/expressions.d.ts.map +1 -0
  125. package/dist/core/importer/expressions.js +223 -0
  126. package/dist/core/importer/expressions.js.map +1 -0
  127. package/dist/core/importer/importer.d.ts +13 -0
  128. package/dist/core/importer/importer.d.ts.map +1 -0
  129. package/dist/core/importer/importer.js +220 -0
  130. package/dist/core/importer/importer.js.map +1 -0
  131. package/dist/core/importer/index.d.ts +20 -0
  132. package/dist/core/importer/index.d.ts.map +1 -0
  133. package/dist/core/importer/index.js +18 -0
  134. package/dist/core/importer/index.js.map +1 -0
  135. package/dist/core/importer/lexer.d.ts +68 -0
  136. package/dist/core/importer/lexer.d.ts.map +1 -0
  137. package/dist/core/importer/lexer.js +207 -0
  138. package/dist/core/importer/lexer.js.map +1 -0
  139. package/dist/core/importer/names.d.ts +41 -0
  140. package/dist/core/importer/names.d.ts.map +1 -0
  141. package/dist/core/importer/names.js +78 -0
  142. package/dist/core/importer/names.js.map +1 -0
  143. package/dist/core/importer/orders.d.ts +8 -0
  144. package/dist/core/importer/orders.d.ts.map +1 -0
  145. package/dist/core/importer/orders.js +332 -0
  146. package/dist/core/importer/orders.js.map +1 -0
  147. package/dist/core/importer/outputs.d.ts +19 -0
  148. package/dist/core/importer/outputs.d.ts.map +1 -0
  149. package/dist/core/importer/outputs.js +266 -0
  150. package/dist/core/importer/outputs.js.map +1 -0
  151. package/dist/core/importer/parser.d.ts +5 -0
  152. package/dist/core/importer/parser.d.ts.map +1 -0
  153. package/dist/core/importer/parser.js +439 -0
  154. package/dist/core/importer/parser.js.map +1 -0
  155. package/dist/core/importer/presence.d.ts +32 -0
  156. package/dist/core/importer/presence.d.ts.map +1 -0
  157. package/dist/core/importer/presence.js +146 -0
  158. package/dist/core/importer/presence.js.map +1 -0
  159. package/dist/core/importer/settle.d.ts +23 -0
  160. package/dist/core/importer/settle.d.ts.map +1 -0
  161. package/dist/core/importer/settle.js +135 -0
  162. package/dist/core/importer/settle.js.map +1 -0
  163. package/dist/core/importer/statements.d.ts +4 -0
  164. package/dist/core/importer/statements.d.ts.map +1 -0
  165. package/dist/core/importer/statements.js +339 -0
  166. package/dist/core/importer/statements.js.map +1 -0
  167. package/dist/core/importer/syntax.d.ts +182 -0
  168. package/dist/core/importer/syntax.d.ts.map +1 -0
  169. package/dist/core/importer/syntax.js +14 -0
  170. package/dist/core/importer/syntax.js.map +1 -0
  171. package/dist/core/importer/table.d.ts +52 -0
  172. package/dist/core/importer/table.d.ts.map +1 -0
  173. package/dist/core/importer/table.js +156 -0
  174. package/dist/core/importer/table.js.map +1 -0
  175. package/dist/core/importer/values.d.ts +27 -0
  176. package/dist/core/importer/values.d.ts.map +1 -0
  177. package/dist/core/importer/values.js +236 -0
  178. package/dist/core/importer/values.js.map +1 -0
  179. package/dist/core/index.d.ts +12 -0
  180. package/dist/core/index.d.ts.map +1 -1
  181. package/dist/core/index.js +11 -0
  182. package/dist/core/index.js.map +1 -1
  183. package/dist/core/stdlib/calendar/civil.d.ts.map +1 -1
  184. package/dist/core/stdlib/calendar/civil.js +5 -2
  185. package/dist/core/stdlib/calendar/civil.js.map +1 -1
  186. package/dist/core/version/version.generated.d.ts +1 -1
  187. package/dist/core/version/version.generated.js +1 -1
  188. package/package.json +5 -2
  189. package/spec/errors.json +380 -20
  190. package/src/adapters/charts/run.ts +6 -0
  191. package/src/adapters/charts/tables.ts +6 -19
  192. package/src/adapters/charts/undrawable.ts +51 -0
  193. package/src/core/backtest/drive.ts +66 -154
  194. package/src/core/backtest/index.ts +2 -0
  195. package/src/core/backtest/walk.ts +182 -0
  196. package/src/core/catalogue/catalogue.generated.ts +18 -1
  197. package/src/core/catalogue/types.ts +8 -2
  198. package/src/core/catalogue/values.generated.ts +16 -0
  199. package/src/core/check/assigned.ts +31 -0
  200. package/src/core/check/call-sites.ts +11 -4
  201. package/src/core/check/calls.ts +13 -4
  202. package/src/core/check/check.ts +14 -2
  203. package/src/core/check/checker.ts +39 -2
  204. package/src/core/check/constant.ts +57 -0
  205. package/src/core/check/deleted.ts +135 -0
  206. package/src/core/check/expressions.ts +1 -1
  207. package/src/core/check/library-output.ts +1 -0
  208. package/src/core/check/library-prose.generated.ts +10 -10
  209. package/src/core/check/library.ts +8 -0
  210. package/src/core/check/surface.ts +16 -0
  211. package/src/core/engine/bar-source.ts +113 -0
  212. package/src/core/engine/engine.ts +26 -25
  213. package/src/core/engine/guard.ts +12 -1
  214. package/src/core/engine/host.ts +4 -2
  215. package/src/core/engine/index.ts +1 -0
  216. package/src/core/engine/library/binding.ts +2 -0
  217. package/src/core/engine/library/index.ts +11 -0
  218. package/src/core/engine/library/objects.ts +1 -6
  219. package/src/core/engine/request-body.ts +5 -7
  220. package/src/core/engine/request-plan.ts +3 -3
  221. package/src/core/engine/requests.ts +11 -8
  222. package/src/core/engine/series.ts +30 -6
  223. package/src/core/engine/session/record.ts +4 -4
  224. package/src/core/importer/calls.ts +274 -0
  225. package/src/core/importer/context.ts +197 -0
  226. package/src/core/importer/expressions.ts +247 -0
  227. package/src/core/importer/importer.ts +226 -0
  228. package/src/core/importer/index.ts +19 -0
  229. package/src/core/importer/lexer.ts +285 -0
  230. package/src/core/importer/names.ts +104 -0
  231. package/src/core/importer/orders.ts +307 -0
  232. package/src/core/importer/outputs.ts +245 -0
  233. package/src/core/importer/parser.ts +436 -0
  234. package/src/core/importer/presence.ts +164 -0
  235. package/src/core/importer/settle.ts +141 -0
  236. package/src/core/importer/statements.ts +331 -0
  237. package/src/core/importer/syntax.ts +144 -0
  238. package/src/core/importer/table.ts +191 -0
  239. package/src/core/importer/values.ts +241 -0
  240. package/src/core/index.ts +13 -0
  241. package/src/core/stdlib/calendar/civil.ts +5 -2
  242. package/src/core/version/version.generated.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,127 @@ nothing, fails the build before it can become permanent.
7
7
 
8
8
  ---
9
9
 
10
+ ## 0.6.0
11
+
12
+ **An engine that implemented nothing passed the conformance suite, and now does
13
+ not.** Every case in the tree declared the `strategy` profile, so an engine
14
+ claiming `core` was handed none of them: every case was skipped, the runner
15
+ printed "Suite passed" and exited zero. The repository's own test asserted that
16
+ outcome against an adapter written to answer no case at all. If you have been
17
+ using a passing suite run as evidence about a `core` engine, it was not one.
18
+
19
+ `core` cases now exist, twenty three at first across `lexical`, `syntax`,
20
+ `static`, `runtime` and `limits`, and fifty two by the end of this entry.
21
+ Nothing in the runner changed to make this work: its rules were already right,
22
+ and what was missing was cases for them to apply to.
23
+
24
+ **An engine reporting `engineOnly` is no longer handed compiler-diagnostic
25
+ cases.** Section 8 of `conformance.md` always said it should not be, and the
26
+ runner did not implement it, which nothing noticed while no such case existed.
27
+ Which categories need a compiler is now a column of section 7's table, read by
28
+ the runner, so a category added without an answer in that column stops the
29
+ suite rather than being handed to an engine with no compiler.
30
+
31
+ **Behaviour that changed under you, first engine.** Read these before upgrading
32
+ a deployment whose numbers you have already checked.
33
+
34
+ - **A `"lookahead"` read in a backtest now reads a higher timeframe bar's final
35
+ value from its first bar**, as `stdlib.md` 15.3 always said. The backtest
36
+ appended bars one at a time, so a lookahead read answered the bucket so far,
37
+ which is the developing reading. Confirmed and developing reads are
38
+ unchanged. A lookahead backtest now looks as smooth as the mode says it will.
39
+ - **Dates before about 1 BCE were one day early.** The day count applied the
40
+ negative era adjustment twice. No modern date moves.
41
+ - **Some input that was accepted is now refused, each with a code and a fix.**
42
+ An `input()` in a field fixed before bar 0 that is not the whole of the value
43
+ is OS3025 (arithmetic, a ternary or a colour call over a setting used to
44
+ compile and then fail inside the emitter). A plot's `style` written from an
45
+ input is OS3026 (it used to be folded silently to its default). A bar handed
46
+ over with no time is OS6025. The chart adapter refuses a second declared grid
47
+ and a band coloured per bar with OS6024 before any bar runs, where it used to
48
+ drop them in silence.
49
+ - **A cell outside its grid is OS4008**, naming the row, the column and the
50
+ grid's shape, where it was the array code OS4004 with a flattened count. A
51
+ name or an array still holding an object deleted earlier warns OS8019.
52
+ - **The editor's hover text for six drawing calls was wrong**: `draw.setFrom`
53
+ said "nothing" and `draw.delete` said "box", because the generator split
54
+ `stdlib.md`'s rows on the pipe inside `line | box`. Fixed at the generator and
55
+ in the pages.
56
+
57
+ **New.**
58
+
59
+ - **`engine.run` takes a history as columns**, one array per field, typed arrays
60
+ included, beside the record form. Over 900,000 one minute bars that held 43 MB
61
+ against 104 MB and peaked at 346 MB of heap against 877 MB.
62
+ `docs/integrating/running-the-engine.md` has the shape.
63
+ - **`importScript`**, from the main entry point, imports a script written in the
64
+ version-annotated chart dialect, versions 5 and 6. Each statement is translated
65
+ with its original meaning, translated with a warning stating the difference,
66
+ or kept as a comment with an error; the output is compiled before it is
67
+ returned. Twelve codes in a new range, OS9001 to OS9012, and a new catalogue
68
+ stage, `import`. `docs/writing/importing-a-script.md` lists what is translated
69
+ and what is refused.
70
+ - **A documentation site.** `npm run site` builds every page of `docs/` and
71
+ `spec/`, and a page per catalogue code, with every address relative.
72
+ `scripts/check-site.mjs` fails the build on a link or anchor that leads
73
+ nowhere.
74
+ - **A conformance badge.** `npm run badge` makes one from a passing result
75
+ document, and refuses anything that is not a pass of the profile it claims.
76
+ The suite revision it names is now the package version and a digest of every
77
+ case file (`conformance.md` section 11), so a result names the exact cases it
78
+ was run against.
79
+
80
+ **If you read the catalogue programmatically**: `spec/errors.json` has 173
81
+ entries, a ninth range, OS9xxx, whose severity is "error or warning", and a
82
+ sixth stage, `import`. OS4008, OS8019, OS3025, OS3026, OS6024 and OS6025 are
83
+ raised; OS6012 is now raised only where a fact cannot default, and a bare read
84
+ of an instrument fact the host did not state is absent.
85
+
86
+ **The suite now measures what it exists for.** Four channels that no engine
87
+ answered now have a definition in `conformance.md` section 4 and an answer from
88
+ both engines: `values`, one value per bar per plot; `log`; `drawings`; and
89
+ `table`. There are 106 cases, 52 `core`, 46 `chart` and 8 `strategy`, and the
90
+ `semantics`, `numerics`, `time`, `surface` and `external` categories hold real
91
+ cases for the first time, each with expected values computed independently of
92
+ both engines. A read of another instrument is served from the case's own
93
+ `bars.<SYMBOL>.csv`. `npm run suite:agree` passes 87 cases between the two
94
+ engines exactly, the other 19 being compiler-diagnostic cases an engine-only
95
+ implementation skips.
96
+
97
+ **The second engine now holds every library entry the first does**, 251 of
98
+ 251, checked on every build by `scripts/check-manifests.mjs`: arrays, `print`,
99
+ the calendar, the session calls, drawing objects, grids, and higher timeframe
100
+ and other instrument reads in all three modes. Two disagreements between the
101
+ engines were found by the new cases and settled in the specification: the
102
+ `and` and `or` tables are total (decision 71), and the drawing and grid channels
103
+ have a written shape (decision 72).
104
+
105
+ **The installed Python engine can say what it is.** `python -m openscript
106
+ --describe` read the engine's name and version from `pyproject.toml` beside the
107
+ package, and an install never carries that file, so on every installed copy,
108
+ 0.5.0 from the index included, it refused, and no host could run the conformance
109
+ suite against the engine it had actually installed. It now reads the record the
110
+ installer wrote beside the package, and still reads the file in a checkout. A
111
+ `pyproject.toml` above an installed package that names some other project is
112
+ ignored rather than reported as this one, and two installed records beside one
113
+ package, which a broken upgrade leaves, are refused rather than one picked.
114
+
115
+ **The Python engine is published by a workflow.** 0.6.0 is the first version
116
+ uploaded by `release-pypi.yml` rather than by hand. Before anything is uploaded
117
+ it builds the wheel, checks every source module is in it and nothing else is,
118
+ installs it into a fresh interpreter, and loads a program compiled by this
119
+ release's compiler and checks every value. It publishes through trusted
120
+ publishing, with no stored token, and each file on the index carries a signed
121
+ attestation of the workflow run that built it.
122
+
123
+ **What this still does not prove.** Both engines were written in this
124
+ repository, by the same hands, from the same pages. Their agreement is evidence
125
+ about this repository and not yet about the specification: that needs an engine
126
+ written by somebody who has read only the pages, which is the gate of Phase 7
127
+ and cannot be met from inside.
128
+
129
+ ---
130
+
10
131
  ## 0.5.0
11
132
 
12
133
  **`pow` has no library vector, and the reason is the same one.** A vector is a
package/README.md CHANGED
@@ -26,8 +26,10 @@ execution; see [Phase 6](./ROADMAP.md#phase-6-the-second-engine-and-live-running
26
26
 
27
27
  ## Status
28
28
 
29
- **`0.4.0` runs studies, backtests strategies, and ships the language
30
- intelligence an editor needs.**
29
+ **`0.6.0` runs studies, backtests strategies, draws a strategy on a chart,
30
+ imports scripts from another chart language, and ships the language
31
+ intelligence an editor needs.** The Python engine is on PyPI
32
+ as `openscript`, at the same version, and the two are released together.
31
33
 
32
34
  What an install gets you today: the compiler, the engine, the chart adapter and
33
35
  the backtest. A script compiles in milliseconds in a browser tab and computes,
@@ -43,6 +45,15 @@ examples on every run rather than asserting it in a page. Two records can be put
43
45
  beside each other, and a pair over different bars is reported incomparable
44
46
  instead of being subtracted into a table that reads like a result.
45
47
 
48
+ **New in `0.6.0`:** `importScript`
49
+ imports a script written in the version-annotated chart dialect, translating
50
+ each statement with its meaning or saying why not; `engine.run` takes a history
51
+ as columns as well as one record per bar; `npm run site` builds a documentation
52
+ site from the specification and the error catalogue; and the Python engine
53
+ holds every library entry the first one does. [`CHANGELOG.md`](./CHANGELOG.md)
54
+ says what changed under a deployment, including a `"lookahead"` read in a
55
+ backtest.
56
+
46
57
  What it does **not** do yet, stated plainly because the registry page is the
47
58
  first thing a stranger reads:
48
59
 
@@ -52,10 +63,9 @@ first thing a stranger reads:
52
63
  because a backtest works out no running equity to size against. The equity
53
64
  curve marks a trade at the size it ended up entering, so a strategy that
54
65
  scales in is reported with a drawdown deeper than the account had. A script
55
- still cannot read its own equity mid-run. The `0.4.0` entry in
56
- [`CHANGELOG.md`](./CHANGELOG.md) is the full list, and every item on it is
57
- there because somebody would otherwise find it inside a report they had
58
- already believed.
66
+ still cannot read its own equity mid-run. [`CHANGELOG.md`](./CHANGELOG.md) is
67
+ the full list, release by release, and every item on it is there because
68
+ somebody would otherwise find it inside a report they had already believed.
59
69
  - **No editor on screen, and that is the design.** The six headless functions are
60
70
  here and resolve as `openalgo-script/editor`: highlight, complete, diagnose,
61
71
  hover, signature and format, text in and data out, with no DOM at any tier. The
@@ -67,22 +77,37 @@ first thing a stranger reads:
67
77
  The language server that would put the same errors in a desktop editor is the
68
78
  rest of Phase 4 and is not written.
69
79
  - **No engine anybody else wrote has run the suite, so the portability claim is
70
- still untested.** The second engine is here: `engine/` holds a complete
71
- engine in Python with a test suite of its own, and `npm test` runs both on
72
- every build. A run record carries its own
73
- source text rather than only a hash of it (`sourceText` in
80
+ still untested.** The second engine is here: `engine/` holds a complete engine
81
+ in Python, published to PyPI as `openscript`, with a test suite of its own,
82
+ and `npm test` runs both on every build. A run record carries its own source
83
+ text rather than only a hash of it (`sourceText` in
74
84
  [`src/core/backtest/record.ts`](./src/core/backtest/record.ts)), and
75
85
  `caseFilesFrom` in [`src/core/backtest/case.ts`](./src/core/backtest/case.ts)
76
86
  writes the files a suite runs from straight out of a record, which is where the
77
- eight cases under [`cases/`](./cases) came from. `npm run suite:agree` reports
78
- 8 pass of 8 between the two engines. What that run does not prove is the thing
79
- the suite exists for: both engines were written in this repository, from the
80
- same specification, by the same hands, so their agreement is evidence about
81
- this repository rather than about the specification. Until an engine written by
82
- somebody who had only the specification passes these cases, portability is a
83
- design with one corroborating implementation, not a result.
84
-
85
- The version is `0.4.0` rather than `1.0` because of that list. The studies
87
+ strategy cases under [`cases/`](./cases) came from.
88
+
89
+ There are 106 cases now: 52 in the `core` profile, 46 in `chart` and 8 in
90
+ `strategy`. They assert eight of the channels section 4 of
91
+ [`spec/conformance.md`](./spec/conformance.md) defines: diagnostics, a value
92
+ per bar per plot, the log, drawing objects, grid cells, orders, trades and the
93
+ report. Markers, fills, levels, paint and alerts have no case yet, and neither
94
+ engine's adapter answers them. So the `semantics` and
95
+ `numerics` categories, which are the reason the suite exists, now hold real
96
+ cases, each with expected values computed independently of both engines.
97
+
98
+ `npm run suite:agree` reports 87 pass and 19 skipped of 106 between the two
99
+ engines, exactly, the skips being the compiler-diagnostic cases the Python
100
+ engine rightly has no compiler for. The two engines hold the same 251 library
101
+ entries, which a check asks each of them for on every build. What that run
102
+ does not prove is the thing the suite exists for: both engines were written
103
+ in this repository, from the same specification, by the same hands, so their
104
+ agreement is evidence about this repository rather than about the
105
+ specification. Until an engine written by somebody who had only the
106
+ specification passes these cases, portability is a design with one
107
+ corroborating implementation, not a result. That is why no conformance badge
108
+ is shown here, though `npm run badge` will make one for an engine that passes.
109
+
110
+ The version is `0.6.0` rather than `1.0` because of that list. The studies
86
111
  surface is the part that is finished, and it is the part to build on.
87
112
 
88
113
  `ROADMAP.md` says what each phase owes before it is allowed to finish. The
@@ -137,7 +162,11 @@ OpenScript is the opposite of that:
137
162
  - **Connected.** Designed to route orders through your own broker connection,
138
163
  with sandbox testing before live execution. The live runner is planned.
139
164
  - **Open.** Apache-2.0, a written specification, and a conformance suite anyone
140
- can run against their own implementation.
165
+ can run against their own implementation: the compiler's diagnostics, the
166
+ runtime errors and limits, the per-bar values, the calendar, drawing objects,
167
+ grids, reads of other timeframes and instruments, and strategy fills and
168
+ reports. [The suite's own page](./spec/conformance.md) says what a pass does
169
+ and does not entitle an implementation to claim.
141
170
 
142
171
  ## How it is built
143
172
 
@@ -150,8 +179,10 @@ That one decision carries the whole project:
150
179
  and nothing for a security team to approve.
151
180
  2. A server-side engine is a few hundred lines that walk an instruction list,
152
181
  not a second implementation of the language.
153
- 3. Anyone can write an engine in any language, and prove it correct by running
154
- the conformance suite.
182
+ 3. Anyone can write an engine in any language, and hold it to the conformance
183
+ suite. What the suite reaches today is written down rather than implied: an
184
+ engine claiming the narrowest profile is handed cases and fails if it
185
+ answers none of them, which it was not before the `core` cases existed.
155
186
 
156
187
  One compiler. One compiled format. Many small engines, all of which must agree
157
188
  to the last decimal.
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/run.ts"],"names":[],"mappings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E,SAAS,OAAO,EAAE,CAAC;CACvC;AAED,wBAAgB,OAAO,CACrB,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,gBAAgB,GAAG,SAAS,EACjC,OAAO,EAAE,mBAAmB,GAC3B,SAAS,CAmBX;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,gBAAgB,GAAG,SAAS,EAGjC,QAAQ,EAAE,mBAAmB,GAC5B,SAAS,GAAG,IAAI,CA6ClB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAG/C"}
@@ -1,6 +1,7 @@
1
1
  import { load, utcTime } from '../../core/engine/index.js';
2
2
  import { hostBar, hostNow, stateFor } from './bars.js';
3
3
  import { refused, stopped } from './errors.js';
4
+ import { undrawable } from './undrawable.js';
4
5
  import { stationIn, stationOf } from './requests.js';
5
6
  import { engineSettings, signatureOf } from './settings.js';
6
7
  import { answersFor, needsVenue, routeInto, venueFor } from './venue.js';
@@ -137,6 +138,11 @@ function start(program, settings, ctx, options, requests, bars) {
137
138
  const withRoute = simulate
138
139
  ? { ...options, orders: routeInto(holder) }
139
140
  : options;
141
+ // What this chart has no room for is refused before the engine is asked,
142
+ // because a study drawn without it is a study that looks broken.
143
+ const narrower = undrawable(program);
144
+ if (narrower !== undefined)
145
+ throw refused(narrower);
140
146
  const loaded = load(program, {
141
147
  settings: engineSettings(program, settings),
142
148
  host: hostFor(ctx, withRoute, requests),
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/adapters/charts/run.ts"],"names":[],"mappings":"AAmC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CAAC;IACpC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,CAAC,IAAY,EAAiB,EAAE;QACrC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACxC,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,0EAA0E;YAC1E,uEAAuE;YACvE,uEAAuE;YACvE,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -28,25 +28,12 @@
28
28
  * direction: a cell nothing was written into is blank, never a zero.
29
29
  *
30
30
  * **A chart pane holds one grid and the language declares as many as it likes.**
31
- * The descriptor has one `table` hook, so the first declared grid is the one
32
- * drawn and any after it are not. That is a gap in the chart's own contract
33
- * rather than a choice worth making here: there is no second hook to write to,
34
- * and merging two grids into one would put cells somewhere the script never
35
- * asked for.
36
- *
37
- * **What ought to happen is a refusal, and it cannot be written yet.** A study
38
- * whose second grid never appears is a study with no explanation, so the second
39
- * `table()` should be refused where it is written, naming the limit. Every
40
- * diagnostic in this project carries a catalogue code and the catalogue has
41
- * none for "the chart cannot draw something this study declares"; inventing one
42
- * here is the one thing that is not allowed, so the gap is reported instead, in
43
- * `issues/0011-a-second-declared-grid-is-dropped-with-nothing-said.md`, with the
44
- * sentence it should carry.
45
- *
46
- * Until it lands, the drop is at least no longer silent inside this repository:
47
- * it is recorded in `spec/chart-narrowings.json` with its reason, and
48
- * `scripts/check-chart-surface.mjs` fails the build if this adapter ever drops
49
- * anything else a compiled program declares without recording it there.
31
+ * The descriptor has one `table` hook, and merging two grids into it would put
32
+ * cells somewhere the script never asked for. So a program declaring a second
33
+ * grid never reaches this file: `undrawable.ts` refuses it before any bar runs,
34
+ * with OS6024, and this reads the one grid a program that runs can have.
35
+ * `spec/chart-narrowings.json` records the refusal and
36
+ * `scripts/check-chart-surface.mjs` proves it with a study that declares two.
50
37
  */
51
38
  import type { CompiledProgram } from '../../core/emit/index.js';
52
39
  import type { Grid } from '../../core/engine/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAGV,SAAS,EAEV,MAAM,eAAe,CAAC;AAYvB;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,SAAS,IAAI,EAAE,GACvB,SAAS,GAAG,IAAI,CAIlB"}
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAGV,SAAS,EAEV,MAAM,eAAe,CAAC;AAYvB;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,SAAS,IAAI,EAAE,GACvB,SAAS,GAAG,IAAI,CAIlB"}
@@ -1 +1 @@
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,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;QAC9D,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QACxD,KAAK;KACN,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Diagnostic } from '../../core/index.js';
2
+ import type { CompiledProgram } from '../../core/emit/index.js';
3
+ export declare function undrawable(program: CompiledProgram): Diagnostic | undefined;
4
+ //# sourceMappingURL=undrawable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undrawable.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/undrawable.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAS,MAAM,0BAA0B,CAAC;AAKvE,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU,GAAG,SAAS,CAiB3E"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * What this chart cannot draw of what a program declares, refused before a bar.
3
+ *
4
+ * `compiled-program.md` section 11: a host draws what its surface has room for,
5
+ * and refuses what it does not with OS6024 rather than drawing part of a study
6
+ * and saying nothing. Two things a version 1 program can declare have no place
7
+ * on this chart's surface, and both used to be dropped in silence.
8
+ *
9
+ * - **A second grid.** The descriptor has one `table` hook, so one grid reaches
10
+ * a pane. Merging two into it would put cells somewhere the script never
11
+ * asked for, and drawing the first alone is a study whose second panel never
12
+ * appears and whose cells look broken.
13
+ * - **A band colour computed per bar.** The chart's band takes one colour for
14
+ * the whole run and has no channel to point at, so a band whose colour the
15
+ * script computes was drawn in the first plot's colour faded, which is a
16
+ * colour the script did not choose.
17
+ *
18
+ * The compiled program carries no source position for a declaration, so the
19
+ * refusal names the declaration by its title, which is what a reader sees in
20
+ * the legend and the settings dialog, and its span is the load's own.
21
+ */
22
+ import { diagnosticFor, makeSpan } from '../../core/index.js';
23
+ /** A load refusal has no line of its own: the program is what was refused. */
24
+ const AT_LOAD = makeSpan(0, 0, 0, 0);
25
+ export function undrawable(program) {
26
+ const second = program.outputs.tables[1];
27
+ if (second !== undefined) {
28
+ return diagnosticFor('OS6024', AT_LOAD, {
29
+ what: `the table ${titled(second.title, 'after the first')}, the second grid this study declares`,
30
+ limit: 'a chart pane draws one grid',
31
+ });
32
+ }
33
+ for (const band of program.outputs.fills) {
34
+ if (band.colorUpChannel !== null || band.colorDownChannel !== null) {
35
+ return diagnosticFor('OS6024', AT_LOAD, {
36
+ what: "a band's colour that is computed per bar",
37
+ limit: "a chart's band takes one colour for the whole run",
38
+ });
39
+ }
40
+ }
41
+ return undefined;
42
+ }
43
+ /** A title as a reader sees it, or a description where it is a setting's. */
44
+ function titled(title, otherwise) {
45
+ return typeof title === 'string' ? `"${title}"` : otherwise;
46
+ }
47
+ //# sourceMappingURL=undrawable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undrawable.js","sourceRoot":"","sources":["../../../src/adapters/charts/undrawable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI9D,8EAA8E;AAC9E,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAErC,MAAM,UAAU,UAAU,CAAC,OAAwB;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE;YACtC,IAAI,EAAE,aAAa,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,uCAAuC;YACjG,KAAK,EAAE,6BAA6B;SACrC,CAAC,CAAC;IACL,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;YACnE,OAAO,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE;gBACtC,IAAI,EAAE,0CAA0C;gBAChD,KAAK,EAAE,mDAAmD;aAC3D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,6EAA6E;AAC7E,SAAS,MAAM,CAAC,KAAY,EAAE,SAAiB;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC"}
@@ -1,16 +1,25 @@
1
1
  import type { Diagnostic } from '../diagnostics/index.js';
2
2
  import type { CompiledProgram } from '../emit/index.js';
3
- import type { Instrument } from '../engine/index.js';
3
+ import type { Drawing, Grid, Instrument, RequestProvider, Value } from '../engine/index.js';
4
4
  import type { RecordedBar, RecordedFrame, RunRecord } from './record.js';
5
+ import type { LogLine } from './walk.js';
5
6
  import type { BacktestSettings } from './settings.js';
6
7
  /** What a run came to, or why it could not be carried out at all. */
7
8
  export type BacktestResult = {
8
9
  readonly ok: true;
9
10
  readonly record: RunRecord;
11
+ readonly rows?: readonly (readonly Value[])[];
12
+ readonly log?: readonly LogLine[];
13
+ readonly surface?: Surface;
10
14
  } | {
11
15
  readonly ok: false;
12
16
  readonly diagnostic: Diagnostic;
13
17
  };
18
+ /** The drawing objects and the grids the last bar left, `conformance.md` section 4. */
19
+ export interface Surface {
20
+ readonly drawings: readonly Drawing[];
21
+ readonly tables: readonly Grid[];
22
+ }
14
23
  /**
15
24
  * The facts of `host-interface.md` 4.1 that the contract does not hold.
16
25
  *
@@ -54,6 +63,32 @@ export interface DriveOptions {
54
63
  * written into a case that could never make its own expected output.
55
64
  */
56
65
  readonly sourceText?: string;
66
+ /**
67
+ * Whether to hand back every channel's value on every bar that ran, beside
68
+ * the record rather than inside it.
69
+ *
70
+ * A conformance case that asserts `values` compares one value per bar per
71
+ * plot, and the record holds none of them: it is the reproducible run, and a
72
+ * curve per plot is bytes it would carry for every run to serve the few cases
73
+ * that ask. So the rows are asked for, and a run that does not ask pays
74
+ * nothing. A bar that failed has no row, as in the second engine.
75
+ */
76
+ readonly rows?: boolean;
77
+ /** Whether to hand back every line `print` wrote, beside the record, for the same reason. */
78
+ readonly log?: boolean;
79
+ /** Whether to hand back the drawing objects and grids the last bar left, for the same reason. */
80
+ readonly surface?: boolean;
81
+ /**
82
+ * Bars for another instrument, `host-interface.md` 5, for a run whose host
83
+ * serves them.
84
+ *
85
+ * Left out, the run holds the chart's own bars and nothing else: a read of
86
+ * the chart's instrument at a coarser interval is folded from them, and a
87
+ * program that reads another instrument declares a capability this host does
88
+ * not have and is refused at load by name. Given, the host serves duty 3 and
89
+ * the engine asks it once per read, before bar 0.
90
+ */
91
+ readonly requestBars?: RequestProvider;
57
92
  }
58
93
  /**
59
94
  * One run against a simulated destination, from a compiled program to a record.
@@ -1 +1 @@
1
- {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/core/backtest/drive.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAIV,UAAU,EAIX,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,KAAK,EACV,WAAW,EAEX,a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