openalgo-script 0.1.0-alpha.1 → 0.4.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 (1210) hide show
  1. package/CHANGELOG.md +1469 -0
  2. package/README.md +85 -30
  3. package/dist/adapters/charts/alerts.d.ts +70 -0
  4. package/dist/adapters/charts/alerts.d.ts.map +1 -0
  5. package/dist/adapters/charts/alerts.js +52 -0
  6. package/dist/adapters/charts/alerts.js.map +1 -0
  7. package/dist/adapters/charts/bars.d.ts +39 -0
  8. package/dist/adapters/charts/bars.d.ts.map +1 -0
  9. package/dist/adapters/charts/bars.js +32 -0
  10. package/dist/adapters/charts/bars.js.map +1 -0
  11. package/dist/adapters/charts/candles.d.ts +40 -0
  12. package/dist/adapters/charts/candles.d.ts.map +1 -0
  13. package/dist/adapters/charts/candles.js +85 -0
  14. package/dist/adapters/charts/candles.js.map +1 -0
  15. package/dist/adapters/charts/colours.d.ts +47 -0
  16. package/dist/adapters/charts/colours.d.ts.map +1 -0
  17. package/dist/adapters/charts/colours.js +80 -0
  18. package/dist/adapters/charts/colours.js.map +1 -0
  19. package/dist/adapters/charts/columns.d.ts +37 -0
  20. package/dist/adapters/charts/columns.d.ts.map +1 -0
  21. package/dist/adapters/charts/columns.js +56 -0
  22. package/dist/adapters/charts/columns.js.map +1 -0
  23. package/dist/adapters/charts/contract.d.ts +278 -0
  24. package/dist/adapters/charts/contract.d.ts.map +1 -0
  25. package/dist/adapters/charts/contract.js +2 -0
  26. package/dist/adapters/charts/contract.js.map +1 -0
  27. package/dist/adapters/charts/descriptor.d.ts +48 -0
  28. package/dist/adapters/charts/descriptor.d.ts.map +1 -0
  29. package/dist/adapters/charts/descriptor.js +111 -0
  30. package/dist/adapters/charts/descriptor.js.map +1 -0
  31. package/dist/adapters/charts/drawings.d.ts +43 -0
  32. package/dist/adapters/charts/drawings.d.ts.map +1 -0
  33. package/dist/adapters/charts/drawings.js +172 -0
  34. package/dist/adapters/charts/drawings.js.map +1 -0
  35. package/dist/adapters/charts/errors.d.ts +28 -0
  36. package/dist/adapters/charts/errors.d.ts.map +1 -0
  37. package/dist/adapters/charts/errors.js +21 -0
  38. package/dist/adapters/charts/errors.js.map +1 -0
  39. package/dist/adapters/charts/fields.d.ts +33 -0
  40. package/dist/adapters/charts/fields.d.ts.map +1 -0
  41. package/dist/adapters/charts/fields.js +51 -0
  42. package/dist/adapters/charts/fields.js.map +1 -0
  43. package/dist/adapters/charts/fills.d.ts +23 -0
  44. package/dist/adapters/charts/fills.d.ts.map +1 -0
  45. package/dist/adapters/charts/fills.js +48 -0
  46. package/dist/adapters/charts/fills.js.map +1 -0
  47. package/dist/adapters/charts/index.d.ts +37 -0
  48. package/dist/adapters/charts/index.d.ts.map +1 -0
  49. package/dist/adapters/charts/index.js +33 -0
  50. package/dist/adapters/charts/index.js.map +1 -0
  51. package/dist/adapters/charts/levels.d.ts +39 -0
  52. package/dist/adapters/charts/levels.d.ts.map +1 -0
  53. package/dist/adapters/charts/levels.js +61 -0
  54. package/dist/adapters/charts/levels.js.map +1 -0
  55. package/dist/adapters/charts/markers.d.ts +41 -0
  56. package/dist/adapters/charts/markers.d.ts.map +1 -0
  57. package/dist/adapters/charts/markers.js +75 -0
  58. package/dist/adapters/charts/markers.js.map +1 -0
  59. package/dist/adapters/charts/paint.d.ts +61 -0
  60. package/dist/adapters/charts/paint.d.ts.map +1 -0
  61. package/dist/adapters/charts/paint.js +47 -0
  62. package/dist/adapters/charts/paint.js.map +1 -0
  63. package/dist/adapters/charts/plots.d.ts +39 -0
  64. package/dist/adapters/charts/plots.d.ts.map +1 -0
  65. package/dist/adapters/charts/plots.js +117 -0
  66. package/dist/adapters/charts/plots.js.map +1 -0
  67. package/dist/adapters/charts/produced.d.ts +57 -0
  68. package/dist/adapters/charts/produced.d.ts.map +1 -0
  69. package/dist/adapters/charts/produced.js +11 -0
  70. package/dist/adapters/charts/produced.js.map +1 -0
  71. package/dist/adapters/charts/requests.d.ts +114 -0
  72. package/dist/adapters/charts/requests.d.ts.map +1 -0
  73. package/dist/adapters/charts/requests.js +277 -0
  74. package/dist/adapters/charts/requests.js.map +1 -0
  75. package/dist/adapters/charts/run.d.ts +147 -0
  76. package/dist/adapters/charts/run.d.ts.map +1 -0
  77. package/dist/adapters/charts/run.js +148 -0
  78. package/dist/adapters/charts/run.js.map +1 -0
  79. package/dist/adapters/charts/settings.d.ts +78 -0
  80. package/dist/adapters/charts/settings.d.ts.map +1 -0
  81. package/dist/adapters/charts/settings.js +225 -0
  82. package/dist/adapters/charts/settings.js.map +1 -0
  83. package/dist/adapters/charts/surfaces.d.ts +221 -0
  84. package/dist/adapters/charts/surfaces.d.ts.map +1 -0
  85. package/dist/adapters/charts/surfaces.js +2 -0
  86. package/dist/adapters/charts/surfaces.js.map +1 -0
  87. package/dist/adapters/charts/tables.d.ts +65 -0
  88. package/dist/adapters/charts/tables.d.ts.map +1 -0
  89. package/dist/adapters/charts/tables.js +166 -0
  90. package/dist/adapters/charts/tables.js.map +1 -0
  91. package/dist/adapters/codemirror/commands.d.ts +14 -0
  92. package/dist/adapters/codemirror/commands.d.ts.map +1 -0
  93. package/dist/adapters/codemirror/commands.js +52 -0
  94. package/dist/adapters/codemirror/commands.js.map +1 -0
  95. package/dist/adapters/codemirror/completion.d.ts +15 -0
  96. package/dist/adapters/codemirror/completion.d.ts.map +1 -0
  97. package/dist/adapters/codemirror/completion.js +64 -0
  98. package/dist/adapters/codemirror/completion.js.map +1 -0
  99. package/dist/adapters/codemirror/contract.d.ts +156 -0
  100. package/dist/adapters/codemirror/contract.d.ts.map +1 -0
  101. package/dist/adapters/codemirror/contract.js +42 -0
  102. package/dist/adapters/codemirror/contract.js.map +1 -0
  103. package/dist/adapters/codemirror/index.d.ts +43 -0
  104. package/dist/adapters/codemirror/index.d.ts.map +1 -0
  105. package/dist/adapters/codemirror/index.js +8 -0
  106. package/dist/adapters/codemirror/index.js.map +1 -0
  107. package/dist/adapters/codemirror/lint.d.ts +17 -0
  108. package/dist/adapters/codemirror/lint.d.ts.map +1 -0
  109. package/dist/adapters/codemirror/lint.js +62 -0
  110. package/dist/adapters/codemirror/lint.js.map +1 -0
  111. package/dist/adapters/codemirror/positions.d.ts +16 -0
  112. package/dist/adapters/codemirror/positions.d.ts.map +1 -0
  113. package/dist/adapters/codemirror/positions.js +65 -0
  114. package/dist/adapters/codemirror/positions.js.map +1 -0
  115. package/dist/adapters/codemirror/stream.d.ts +23 -0
  116. package/dist/adapters/codemirror/stream.d.ts.map +1 -0
  117. package/dist/adapters/codemirror/stream.js +70 -0
  118. package/dist/adapters/codemirror/stream.js.map +1 -0
  119. package/dist/adapters/codemirror/tokens.d.ts +44 -0
  120. package/dist/adapters/codemirror/tokens.d.ts.map +1 -0
  121. package/dist/adapters/codemirror/tokens.js +34 -0
  122. package/dist/adapters/codemirror/tokens.js.map +1 -0
  123. package/dist/adapters/codemirror/tooltips.d.ts +35 -0
  124. package/dist/adapters/codemirror/tooltips.d.ts.map +1 -0
  125. package/dist/adapters/codemirror/tooltips.js +108 -0
  126. package/dist/adapters/codemirror/tooltips.js.map +1 -0
  127. package/dist/core/accounting/charges.d.ts +136 -0
  128. package/dist/core/accounting/charges.d.ts.map +1 -0
  129. package/dist/core/accounting/charges.js +362 -0
  130. package/dist/core/accounting/charges.js.map +1 -0
  131. package/dist/core/accounting/equity.d.ts +158 -0
  132. package/dist/core/accounting/equity.d.ts.map +1 -0
  133. package/dist/core/accounting/equity.js +155 -0
  134. package/dist/core/accounting/equity.js.map +1 -0
  135. package/dist/core/accounting/index.d.ts +44 -0
  136. package/dist/core/accounting/index.d.ts.map +1 -0
  137. package/dist/core/accounting/index.js +36 -0
  138. package/dist/core/accounting/index.js.map +1 -0
  139. package/dist/core/accounting/markers.d.ts +43 -0
  140. package/dist/core/accounting/markers.d.ts.map +1 -0
  141. package/dist/core/accounting/markers.js +64 -0
  142. package/dist/core/accounting/markers.js.map +1 -0
  143. package/dist/core/accounting/monthly.d.ts +52 -0
  144. package/dist/core/accounting/monthly.d.ts.map +1 -0
  145. package/dist/core/accounting/monthly.js +99 -0
  146. package/dist/core/accounting/monthly.js.map +1 -0
  147. package/dist/core/accounting/report.d.ts +38 -0
  148. package/dist/core/accounting/report.d.ts.map +1 -0
  149. package/dist/core/accounting/report.js +63 -0
  150. package/dist/core/accounting/report.js.map +1 -0
  151. package/dist/core/accounting/shapes.d.ts +70 -0
  152. package/dist/core/accounting/shapes.d.ts.map +1 -0
  153. package/dist/core/accounting/shapes.js +21 -0
  154. package/dist/core/accounting/shapes.js.map +1 -0
  155. package/dist/core/accounting/statistics.d.ts +75 -0
  156. package/dist/core/accounting/statistics.d.ts.map +1 -0
  157. package/dist/core/accounting/statistics.js +246 -0
  158. package/dist/core/accounting/statistics.js.map +1 -0
  159. package/dist/core/accounting/trades.d.ts +118 -0
  160. package/dist/core/accounting/trades.d.ts.map +1 -0
  161. package/dist/core/accounting/trades.js +186 -0
  162. package/dist/core/accounting/trades.js.map +1 -0
  163. package/dist/core/backtest/compare.d.ts +38 -0
  164. package/dist/core/backtest/compare.d.ts.map +1 -0
  165. package/dist/core/backtest/compare.js +189 -0
  166. package/dist/core/backtest/compare.js.map +1 -0
  167. package/dist/core/backtest/declaration.d.ts +52 -0
  168. package/dist/core/backtest/declaration.d.ts.map +1 -0
  169. package/dist/core/backtest/declaration.js +48 -0
  170. package/dist/core/backtest/declaration.js.map +1 -0
  171. package/dist/core/backtest/drive.d.ts +29 -0
  172. package/dist/core/backtest/drive.d.ts.map +1 -0
  173. package/dist/core/backtest/drive.js +262 -0
  174. package/dist/core/backtest/drive.js.map +1 -0
  175. package/dist/core/backtest/index.d.ts +46 -0
  176. package/dist/core/backtest/index.d.ts.map +1 -0
  177. package/dist/core/backtest/index.js +36 -0
  178. package/dist/core/backtest/index.js.map +1 -0
  179. package/dist/core/backtest/range.d.ts +84 -0
  180. package/dist/core/backtest/range.d.ts.map +1 -0
  181. package/dist/core/backtest/range.js +90 -0
  182. package/dist/core/backtest/range.js.map +1 -0
  183. package/dist/core/backtest/record.d.ts +238 -0
  184. package/dist/core/backtest/record.d.ts.map +1 -0
  185. package/dist/core/backtest/record.js +176 -0
  186. package/dist/core/backtest/record.js.map +1 -0
  187. package/dist/core/backtest/replay.d.ts +48 -0
  188. package/dist/core/backtest/replay.d.ts.map +1 -0
  189. package/dist/core/backtest/replay.js +127 -0
  190. package/dist/core/backtest/replay.js.map +1 -0
  191. package/dist/core/backtest/resting.d.ts +62 -0
  192. package/dist/core/backtest/resting.d.ts.map +1 -0
  193. package/dist/core/backtest/resting.js +59 -0
  194. package/dist/core/backtest/resting.js.map +1 -0
  195. package/dist/core/backtest/settings.d.ts +117 -0
  196. package/dist/core/backtest/settings.d.ts.map +1 -0
  197. package/dist/core/backtest/settings.js +207 -0
  198. package/dist/core/backtest/settings.js.map +1 -0
  199. package/dist/core/backtest/simulate.d.ts +146 -0
  200. package/dist/core/backtest/simulate.d.ts.map +1 -0
  201. package/dist/core/backtest/simulate.js +217 -0
  202. package/dist/core/backtest/simulate.js.map +1 -0
  203. package/dist/core/catalogue/catalogue.generated.d.ts +164 -10
  204. package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
  205. package/dist/core/catalogue/catalogue.generated.js +23 -9
  206. package/dist/core/catalogue/catalogue.generated.js.map +1 -1
  207. package/dist/core/catalogue/values.generated.d.ts +49 -0
  208. package/dist/core/catalogue/values.generated.d.ts.map +1 -1
  209. package/dist/core/check/arguments.d.ts +41 -0
  210. package/dist/core/check/arguments.d.ts.map +1 -0
  211. package/dist/core/check/arguments.js +84 -0
  212. package/dist/core/check/arguments.js.map +1 -0
  213. package/dist/core/check/call-sites.d.ts +22 -0
  214. package/dist/core/check/call-sites.d.ts.map +1 -0
  215. package/dist/core/check/call-sites.js +329 -0
  216. package/dist/core/check/call-sites.js.map +1 -0
  217. package/dist/core/check/call-warmup.d.ts +37 -0
  218. package/dist/core/check/call-warmup.d.ts.map +1 -0
  219. package/dist/core/check/call-warmup.js +97 -0
  220. package/dist/core/check/call-warmup.js.map +1 -0
  221. package/dist/core/check/calls.d.ts +33 -0
  222. package/dist/core/check/calls.d.ts.map +1 -0
  223. package/dist/core/check/calls.js +348 -0
  224. package/dist/core/check/calls.js.map +1 -0
  225. package/dist/core/check/check.d.ts +23 -0
  226. package/dist/core/check/check.d.ts.map +1 -0
  227. package/dist/core/check/check.js +163 -0
  228. package/dist/core/check/check.js.map +1 -0
  229. package/dist/core/check/checked.d.ts +198 -0
  230. package/dist/core/check/checked.d.ts.map +1 -0
  231. package/dist/core/check/checked.js +19 -0
  232. package/dist/core/check/checked.js.map +1 -0
  233. package/dist/core/check/checker.d.ts +182 -0
  234. package/dist/core/check/checker.d.ts.map +1 -0
  235. package/dist/core/check/checker.js +280 -0
  236. package/dist/core/check/checker.js.map +1 -0
  237. package/dist/core/check/conditional.d.ts +35 -0
  238. package/dist/core/check/conditional.d.ts.map +1 -0
  239. package/dist/core/check/conditional.js +100 -0
  240. package/dist/core/check/conditional.js.map +1 -0
  241. package/dist/core/check/constant.d.ts +47 -0
  242. package/dist/core/check/constant.d.ts.map +1 -0
  243. package/dist/core/check/constant.js +101 -0
  244. package/dist/core/check/constant.js.map +1 -0
  245. package/dist/core/check/declaration.d.ts +33 -0
  246. package/dist/core/check/declaration.d.ts.map +1 -0
  247. package/dist/core/check/declaration.js +181 -0
  248. package/dist/core/check/declaration.js.map +1 -0
  249. package/dist/core/check/expressions.d.ts +36 -0
  250. package/dist/core/check/expressions.d.ts.map +1 -0
  251. package/dist/core/check/expressions.js +398 -0
  252. package/dist/core/check/expressions.js.map +1 -0
  253. package/dist/core/check/functions.d.ts +31 -0
  254. package/dist/core/check/functions.d.ts.map +1 -0
  255. package/dist/core/check/functions.js +238 -0
  256. package/dist/core/check/functions.js.map +1 -0
  257. package/dist/core/check/handles.d.ts +48 -0
  258. package/dist/core/check/handles.d.ts.map +1 -0
  259. package/dist/core/check/handles.js +43 -0
  260. package/dist/core/check/handles.js.map +1 -0
  261. package/dist/core/check/index.d.ts +31 -0
  262. package/dist/core/check/index.d.ts.map +1 -0
  263. package/dist/core/check/index.js +26 -0
  264. package/dist/core/check/index.js.map +1 -0
  265. package/dist/core/check/library-bars.d.ts +7 -0
  266. package/dist/core/check/library-bars.d.ts.map +1 -0
  267. package/dist/core/check/library-bars.js +181 -0
  268. package/dist/core/check/library-bars.js.map +1 -0
  269. package/dist/core/check/library-orders.d.ts +5 -0
  270. package/dist/core/check/library-orders.d.ts.map +1 -0
  271. package/dist/core/check/library-orders.js +250 -0
  272. package/dist/core/check/library-orders.js.map +1 -0
  273. package/dist/core/check/library-output.d.ts +7 -0
  274. package/dist/core/check/library-output.d.ts.map +1 -0
  275. package/dist/core/check/library-output.js +195 -0
  276. package/dist/core/check/library-output.js.map +1 -0
  277. package/dist/core/check/library-prose.generated.d.ts +16 -0
  278. package/dist/core/check/library-prose.generated.d.ts.map +1 -0
  279. package/dist/core/check/library-prose.generated.js +353 -0
  280. package/dist/core/check/library-prose.generated.js.map +1 -0
  281. package/dist/core/check/library-series.d.ts +3 -0
  282. package/dist/core/check/library-series.d.ts.map +1 -0
  283. package/dist/core/check/library-series.js +415 -0
  284. package/dist/core/check/library-series.js.map +1 -0
  285. package/dist/core/check/library.d.ts +204 -0
  286. package/dist/core/check/library.d.ts.map +1 -0
  287. package/dist/core/check/library.js +198 -0
  288. package/dist/core/check/library.js.map +1 -0
  289. package/dist/core/check/literals.d.ts +19 -0
  290. package/dist/core/check/literals.d.ts.map +1 -0
  291. package/dist/core/check/literals.js +22 -0
  292. package/dist/core/check/literals.js.map +1 -0
  293. package/dist/core/check/outputs.d.ts +31 -0
  294. package/dist/core/check/outputs.d.ts.map +1 -0
  295. package/dist/core/check/outputs.js +113 -0
  296. package/dist/core/check/outputs.js.map +1 -0
  297. package/dist/core/check/statements.d.ts +25 -0
  298. package/dist/core/check/statements.d.ts.map +1 -0
  299. package/dist/core/check/statements.js +377 -0
  300. package/dist/core/check/statements.js.map +1 -0
  301. package/dist/core/check/suggest.d.ts +25 -0
  302. package/dist/core/check/suggest.d.ts.map +1 -0
  303. package/dist/core/check/suggest.js +61 -0
  304. package/dist/core/check/suggest.js.map +1 -0
  305. package/dist/core/check/surface.d.ts +62 -0
  306. package/dist/core/check/surface.d.ts.map +1 -0
  307. package/dist/core/check/surface.js +129 -0
  308. package/dist/core/check/surface.js.map +1 -0
  309. package/dist/core/check/tags.d.ts +4 -0
  310. package/dist/core/check/tags.d.ts.map +1 -0
  311. package/dist/core/check/tags.js +54 -0
  312. package/dist/core/check/tags.js.map +1 -0
  313. package/dist/core/check/types.d.ts +153 -0
  314. package/dist/core/check/types.d.ts.map +1 -0
  315. package/dist/core/check/types.js +221 -0
  316. package/dist/core/check/types.js.map +1 -0
  317. package/dist/core/check/warmup.d.ts +73 -0
  318. package/dist/core/check/warmup.d.ts.map +1 -0
  319. package/dist/core/check/warmup.js +62 -0
  320. package/dist/core/check/warmup.js.map +1 -0
  321. package/dist/core/diagnostics/collector.d.ts +12 -0
  322. package/dist/core/diagnostics/collector.d.ts.map +1 -1
  323. package/dist/core/diagnostics/collector.js +27 -1
  324. package/dist/core/diagnostics/collector.js.map +1 -1
  325. package/dist/core/emit/calls.d.ts +38 -0
  326. package/dist/core/emit/calls.d.ts.map +1 -0
  327. package/dist/core/emit/calls.js +347 -0
  328. package/dist/core/emit/calls.js.map +1 -0
  329. package/dist/core/emit/canonical.d.ts +39 -0
  330. package/dist/core/emit/canonical.d.ts.map +1 -0
  331. package/dist/core/emit/canonical.js +71 -0
  332. package/dist/core/emit/canonical.js.map +1 -0
  333. package/dist/core/emit/channels.d.ts +28 -0
  334. package/dist/core/emit/channels.d.ts.map +1 -0
  335. package/dist/core/emit/channels.js +110 -0
  336. package/dist/core/emit/channels.js.map +1 -0
  337. package/dist/core/emit/code.d.ts +75 -0
  338. package/dist/core/emit/code.d.ts.map +1 -0
  339. package/dist/core/emit/code.js +104 -0
  340. package/dist/core/emit/code.js.map +1 -0
  341. package/dist/core/emit/colours.d.ts +35 -0
  342. package/dist/core/emit/colours.d.ts.map +1 -0
  343. package/dist/core/emit/colours.js +50 -0
  344. package/dist/core/emit/colours.js.map +1 -0
  345. package/dist/core/emit/context.d.ts +271 -0
  346. package/dist/core/emit/context.d.ts.map +1 -0
  347. package/dist/core/emit/context.js +358 -0
  348. package/dist/core/emit/context.js.map +1 -0
  349. package/dist/core/emit/defaults.d.ts +64 -0
  350. package/dist/core/emit/defaults.d.ts.map +1 -0
  351. package/dist/core/emit/defaults.js +182 -0
  352. package/dist/core/emit/defaults.js.map +1 -0
  353. package/dist/core/emit/emit.d.ts +13 -0
  354. package/dist/core/emit/emit.d.ts.map +1 -0
  355. package/dist/core/emit/emit.js +281 -0
  356. package/dist/core/emit/emit.js.map +1 -0
  357. package/dist/core/emit/events.d.ts +21 -0
  358. package/dist/core/emit/events.d.ts.map +1 -0
  359. package/dist/core/emit/events.js +112 -0
  360. package/dist/core/emit/events.js.map +1 -0
  361. package/dist/core/emit/expressions.d.ts +23 -0
  362. package/dist/core/emit/expressions.d.ts.map +1 -0
  363. package/dist/core/emit/expressions.js +253 -0
  364. package/dist/core/emit/expressions.js.map +1 -0
  365. package/dist/core/emit/functions.d.ts +30 -0
  366. package/dist/core/emit/functions.d.ts.map +1 -0
  367. package/dist/core/emit/functions.js +171 -0
  368. package/dist/core/emit/functions.js.map +1 -0
  369. package/dist/core/emit/gaps.d.ts +34 -0
  370. package/dist/core/emit/gaps.d.ts.map +1 -0
  371. package/dist/core/emit/gaps.js +16 -0
  372. package/dist/core/emit/gaps.js.map +1 -0
  373. package/dist/core/emit/index.d.ts +31 -0
  374. package/dist/core/emit/index.d.ts.map +1 -0
  375. package/dist/core/emit/index.js +25 -0
  376. package/dist/core/emit/index.js.map +1 -0
  377. package/dist/core/emit/inputs.d.ts +47 -0
  378. package/dist/core/emit/inputs.d.ts.map +1 -0
  379. package/dist/core/emit/inputs.js +150 -0
  380. package/dist/core/emit/inputs.js.map +1 -0
  381. package/dist/core/emit/layout.d.ts +73 -0
  382. package/dist/core/emit/layout.d.ts.map +1 -0
  383. package/dist/core/emit/layout.js +126 -0
  384. package/dist/core/emit/layout.js.map +1 -0
  385. package/dist/core/emit/meta.d.ts +14 -0
  386. package/dist/core/emit/meta.d.ts.map +1 -0
  387. package/dist/core/emit/meta.js +68 -0
  388. package/dist/core/emit/meta.js.map +1 -0
  389. package/dist/core/emit/opcodes.d.ts +28 -0
  390. package/dist/core/emit/opcodes.d.ts.map +1 -0
  391. package/dist/core/emit/opcodes.js +137 -0
  392. package/dist/core/emit/opcodes.js.map +1 -0
  393. package/dist/core/emit/outputs.d.ts +67 -0
  394. package/dist/core/emit/outputs.d.ts.map +1 -0
  395. package/dist/core/emit/outputs.js +293 -0
  396. package/dist/core/emit/outputs.js.map +1 -0
  397. package/dist/core/emit/pool.d.ts +33 -0
  398. package/dist/core/emit/pool.d.ts.map +1 -0
  399. package/dist/core/emit/pool.js +79 -0
  400. package/dist/core/emit/pool.js.map +1 -0
  401. package/dist/core/emit/program.d.ts +333 -0
  402. package/dist/core/emit/program.d.ts.map +1 -0
  403. package/dist/core/emit/program.js +15 -0
  404. package/dist/core/emit/program.js.map +1 -0
  405. package/dist/core/emit/registers.d.ts +35 -0
  406. package/dist/core/emit/registers.d.ts.map +1 -0
  407. package/dist/core/emit/registers.js +170 -0
  408. package/dist/core/emit/registers.js.map +1 -0
  409. package/dist/core/emit/request-scope.d.ts +36 -0
  410. package/dist/core/emit/request-scope.d.ts.map +1 -0
  411. package/dist/core/emit/request-scope.js +41 -0
  412. package/dist/core/emit/request-scope.js.map +1 -0
  413. package/dist/core/emit/requests.d.ts +69 -0
  414. package/dist/core/emit/requests.d.ts.map +1 -0
  415. package/dist/core/emit/requests.js +230 -0
  416. package/dist/core/emit/requests.js.map +1 -0
  417. package/dist/core/emit/requires.d.ts +4 -0
  418. package/dist/core/emit/requires.d.ts.map +1 -0
  419. package/dist/core/emit/requires.js +71 -0
  420. package/dist/core/emit/requires.js.map +1 -0
  421. package/dist/core/emit/sha256.d.ts +24 -0
  422. package/dist/core/emit/sha256.d.ts.map +1 -0
  423. package/dist/core/emit/sha256.js +109 -0
  424. package/dist/core/emit/sha256.js.map +1 -0
  425. package/dist/core/emit/statements.d.ts +20 -0
  426. package/dist/core/emit/statements.d.ts.map +1 -0
  427. package/dist/core/emit/statements.js +393 -0
  428. package/dist/core/emit/statements.js.map +1 -0
  429. package/dist/core/emit/values.d.ts +80 -0
  430. package/dist/core/emit/values.d.ts.map +1 -0
  431. package/dist/core/emit/values.js +242 -0
  432. package/dist/core/emit/values.js.map +1 -0
  433. package/dist/core/engine/alerts.d.ts +66 -0
  434. package/dist/core/engine/alerts.d.ts.map +1 -0
  435. package/dist/core/engine/alerts.js +119 -0
  436. package/dist/core/engine/alerts.js.map +1 -0
  437. package/dist/core/engine/arithmetic.d.ts +82 -0
  438. package/dist/core/engine/arithmetic.d.ts.map +1 -0
  439. package/dist/core/engine/arithmetic.js +141 -0
  440. package/dist/core/engine/arithmetic.js.map +1 -0
  441. package/dist/core/engine/bars.d.ts +95 -0
  442. package/dist/core/engine/bars.d.ts.map +1 -0
  443. package/dist/core/engine/bars.js +133 -0
  444. package/dist/core/engine/bars.js.map +1 -0
  445. package/dist/core/engine/budget.d.ts +162 -0
  446. package/dist/core/engine/budget.d.ts.map +1 -0
  447. package/dist/core/engine/budget.js +188 -0
  448. package/dist/core/engine/budget.js.map +1 -0
  449. package/dist/core/engine/channels.d.ts +106 -0
  450. package/dist/core/engine/channels.d.ts.map +1 -0
  451. package/dist/core/engine/channels.js +99 -0
  452. package/dist/core/engine/channels.js.map +1 -0
  453. package/dist/core/engine/drawings.d.ts +64 -0
  454. package/dist/core/engine/drawings.d.ts.map +1 -0
  455. package/dist/core/engine/drawings.js +67 -0
  456. package/dist/core/engine/drawings.js.map +1 -0
  457. package/dist/core/engine/engine.d.ts +140 -0
  458. package/dist/core/engine/engine.d.ts.map +1 -0
  459. package/dist/core/engine/engine.js +405 -0
  460. package/dist/core/engine/engine.js.map +1 -0
  461. package/dist/core/engine/errors.d.ts +64 -0
  462. package/dist/core/engine/errors.d.ts.map +1 -0
  463. package/dist/core/engine/errors.js +63 -0
  464. package/dist/core/engine/errors.js.map +1 -0
  465. package/dist/core/engine/frames.d.ts +48 -0
  466. package/dist/core/engine/frames.d.ts.map +1 -0
  467. package/dist/core/engine/frames.js +41 -0
  468. package/dist/core/engine/frames.js.map +1 -0
  469. package/dist/core/engine/grids.d.ts +25 -0
  470. package/dist/core/engine/grids.d.ts.map +1 -0
  471. package/dist/core/engine/grids.js +77 -0
  472. package/dist/core/engine/grids.js.map +1 -0
  473. package/dist/core/engine/guard.d.ts +4 -0
  474. package/dist/core/engine/guard.d.ts.map +1 -0
  475. package/dist/core/engine/guard.js +46 -0
  476. package/dist/core/engine/guard.js.map +1 -0
  477. package/dist/core/engine/host.d.ts +219 -0
  478. package/dist/core/engine/host.d.ts.map +1 -0
  479. package/dist/core/engine/host.js +38 -0
  480. package/dist/core/engine/host.js.map +1 -0
  481. package/dist/core/engine/index.d.ts +49 -0
  482. package/dist/core/engine/index.d.ts.map +1 -0
  483. package/dist/core/engine/index.js +33 -0
  484. package/dist/core/engine/index.js.map +1 -0
  485. package/dist/core/engine/inputs.d.ts +77 -0
  486. package/dist/core/engine/inputs.d.ts.map +1 -0
  487. package/dist/core/engine/inputs.js +205 -0
  488. package/dist/core/engine/inputs.js.map +1 -0
  489. package/dist/core/engine/ledger/call.d.ts +63 -0
  490. package/dist/core/engine/ledger/call.d.ts.map +1 -0
  491. package/dist/core/engine/ledger/call.js +136 -0
  492. package/dist/core/engine/ledger/call.js.map +1 -0
  493. package/dist/core/engine/ledger/closable.d.ts +155 -0
  494. package/dist/core/engine/ledger/closable.d.ts.map +1 -0
  495. package/dist/core/engine/ledger/closable.js +173 -0
  496. package/dist/core/engine/ledger/closable.js.map +1 -0
  497. package/dist/core/engine/ledger/holdings.d.ts +194 -0
  498. package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
  499. package/dist/core/engine/ledger/holdings.js +237 -0
  500. package/dist/core/engine/ledger/holdings.js.map +1 -0
  501. package/dist/core/engine/ledger/index.d.ts +19 -0
  502. package/dist/core/engine/ledger/index.d.ts.map +1 -0
  503. package/dist/core/engine/ledger/index.js +2 -0
  504. package/dist/core/engine/ledger/index.js.map +1 -0
  505. package/dist/core/engine/ledger/intent.d.ts +106 -0
  506. package/dist/core/engine/ledger/intent.d.ts.map +1 -0
  507. package/dist/core/engine/ledger/intent.js +21 -0
  508. package/dist/core/engine/ledger/intent.js.map +1 -0
  509. package/dist/core/engine/ledger/ledger.d.ts +143 -0
  510. package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
  511. package/dist/core/engine/ledger/ledger.js +237 -0
  512. package/dist/core/engine/ledger/ledger.js.map +1 -0
  513. package/dist/core/engine/ledger/place.d.ts +75 -0
  514. package/dist/core/engine/ledger/place.d.ts.map +1 -0
  515. package/dist/core/engine/ledger/place.js +174 -0
  516. package/dist/core/engine/ledger/place.js.map +1 -0
  517. package/dist/core/engine/ledger/positions.d.ts +68 -0
  518. package/dist/core/engine/ledger/positions.d.ts.map +1 -0
  519. package/dist/core/engine/ledger/positions.js +114 -0
  520. package/dist/core/engine/ledger/positions.js.map +1 -0
  521. package/dist/core/engine/ledger/refuse.d.ts +43 -0
  522. package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
  523. package/dist/core/engine/ledger/refuse.js +329 -0
  524. package/dist/core/engine/ledger/refuse.js.map +1 -0
  525. package/dist/core/engine/ledger/row.d.ts +176 -0
  526. package/dist/core/engine/ledger/row.d.ts.map +1 -0
  527. package/dist/core/engine/ledger/row.js +169 -0
  528. package/dist/core/engine/ledger/row.js.map +1 -0
  529. package/dist/core/engine/ledger/sizing.d.ts +142 -0
  530. package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
  531. package/dist/core/engine/ledger/sizing.js +223 -0
  532. package/dist/core/engine/ledger/sizing.js.map +1 -0
  533. package/dist/core/engine/library/arrays.d.ts +14 -0
  534. package/dist/core/engine/library/arrays.d.ts.map +1 -0
  535. package/dist/core/engine/library/arrays.js +285 -0
  536. package/dist/core/engine/library/arrays.js.map +1 -0
  537. package/dist/core/engine/library/averages.d.ts +9 -0
  538. package/dist/core/engine/library/averages.d.ts.map +1 -0
  539. package/dist/core/engine/library/averages.js +41 -0
  540. package/dist/core/engine/library/averages.js.map +1 -0
  541. package/dist/core/engine/library/binding.d.ts +230 -0
  542. package/dist/core/engine/library/binding.d.ts.map +1 -0
  543. package/dist/core/engine/library/binding.js +109 -0
  544. package/dist/core/engine/library/binding.js.map +1 -0
  545. package/dist/core/engine/library/chart.d.ts +3 -0
  546. package/dist/core/engine/library/chart.d.ts.map +1 -0
  547. package/dist/core/engine/library/chart.js +83 -0
  548. package/dist/core/engine/library/chart.js.map +1 -0
  549. package/dist/core/engine/library/colours.d.ts +26 -0
  550. package/dist/core/engine/library/colours.d.ts.map +1 -0
  551. package/dist/core/engine/library/colours.js +81 -0
  552. package/dist/core/engine/library/colours.js.map +1 -0
  553. package/dist/core/engine/library/dates.d.ts +3 -0
  554. package/dist/core/engine/library/dates.d.ts.map +1 -0
  555. package/dist/core/engine/library/dates.js +75 -0
  556. package/dist/core/engine/library/dates.js.map +1 -0
  557. package/dist/core/engine/library/index.d.ts +13 -0
  558. package/dist/core/engine/library/index.d.ts.map +1 -0
  559. package/dist/core/engine/library/index.js +86 -0
  560. package/dist/core/engine/library/index.js.map +1 -0
  561. package/dist/core/engine/library/maths.d.ts +3 -0
  562. package/dist/core/engine/library/maths.d.ts.map +1 -0
  563. package/dist/core/engine/library/maths.js +89 -0
  564. package/dist/core/engine/library/maths.js.map +1 -0
  565. package/dist/core/engine/library/objects.d.ts +3 -0
  566. package/dist/core/engine/library/objects.d.ts.map +1 -0
  567. package/dist/core/engine/library/objects.js +199 -0
  568. package/dist/core/engine/library/objects.js.map +1 -0
  569. package/dist/core/engine/library/oscillators.d.ts +3 -0
  570. package/dist/core/engine/library/oscillators.d.ts.map +1 -0
  571. package/dist/core/engine/library/oscillators.js +29 -0
  572. package/dist/core/engine/library/oscillators.js.map +1 -0
  573. package/dist/core/engine/library/ranges.d.ts +3 -0
  574. package/dist/core/engine/library/ranges.d.ts.map +1 -0
  575. package/dist/core/engine/library/ranges.js +23 -0
  576. package/dist/core/engine/library/ranges.js.map +1 -0
  577. package/dist/core/engine/library/series.d.ts +3 -0
  578. package/dist/core/engine/library/series.d.ts.map +1 -0
  579. package/dist/core/engine/library/series.js +46 -0
  580. package/dist/core/engine/library/series.js.map +1 -0
  581. package/dist/core/engine/library/state.d.ts +35 -0
  582. package/dist/core/engine/library/state.d.ts.map +1 -0
  583. package/dist/core/engine/library/state.js +19 -0
  584. package/dist/core/engine/library/state.js.map +1 -0
  585. package/dist/core/engine/library/studies.d.ts +3 -0
  586. package/dist/core/engine/library/studies.d.ts.map +1 -0
  587. package/dist/core/engine/library/studies.js +35 -0
  588. package/dist/core/engine/library/studies.js.map +1 -0
  589. package/dist/core/engine/library/text.d.ts +6 -0
  590. package/dist/core/engine/library/text.d.ts.map +1 -0
  591. package/dist/core/engine/library/text.js +280 -0
  592. package/dist/core/engine/library/text.js.map +1 -0
  593. package/dist/core/engine/library/trend.d.ts +3 -0
  594. package/dist/core/engine/library/trend.d.ts.map +1 -0
  595. package/dist/core/engine/library/trend.js +29 -0
  596. package/dist/core/engine/library/trend.js.map +1 -0
  597. package/dist/core/engine/library/volume.d.ts +3 -0
  598. package/dist/core/engine/library/volume.d.ts.map +1 -0
  599. package/dist/core/engine/library/volume.js +51 -0
  600. package/dist/core/engine/library/volume.js.map +1 -0
  601. package/dist/core/engine/load.d.ts +59 -0
  602. package/dist/core/engine/load.d.ts.map +1 -0
  603. package/dist/core/engine/load.js +61 -0
  604. package/dist/core/engine/load.js.map +1 -0
  605. package/dist/core/engine/machine.d.ts +107 -0
  606. package/dist/core/engine/machine.d.ts.map +1 -0
  607. package/dist/core/engine/machine.js +337 -0
  608. package/dist/core/engine/machine.js.map +1 -0
  609. package/dist/core/engine/memory.d.ts +60 -0
  610. package/dist/core/engine/memory.d.ts.map +1 -0
  611. package/dist/core/engine/memory.js +92 -0
  612. package/dist/core/engine/memory.js.map +1 -0
  613. package/dist/core/engine/operations.d.ts +62 -0
  614. package/dist/core/engine/operations.d.ts.map +1 -0
  615. package/dist/core/engine/operations.js +149 -0
  616. package/dist/core/engine/operations.js.map +1 -0
  617. package/dist/core/engine/orders.d.ts +56 -0
  618. package/dist/core/engine/orders.d.ts.map +1 -0
  619. package/dist/core/engine/orders.js +83 -0
  620. package/dist/core/engine/orders.js.map +1 -0
  621. package/dist/core/engine/registers.d.ts +50 -0
  622. package/dist/core/engine/registers.d.ts.map +1 -0
  623. package/dist/core/engine/registers.js +85 -0
  624. package/dist/core/engine/registers.js.map +1 -0
  625. package/dist/core/engine/request-body.d.ts +138 -0
  626. package/dist/core/engine/request-body.d.ts.map +1 -0
  627. package/dist/core/engine/request-body.js +227 -0
  628. package/dist/core/engine/request-body.js.map +1 -0
  629. package/dist/core/engine/request-plan.d.ts +79 -0
  630. package/dist/core/engine/request-plan.d.ts.map +1 -0
  631. package/dist/core/engine/request-plan.js +228 -0
  632. package/dist/core/engine/request-plan.js.map +1 -0
  633. package/dist/core/engine/requests.d.ts +105 -0
  634. package/dist/core/engine/requests.d.ts.map +1 -0
  635. package/dist/core/engine/requests.js +260 -0
  636. package/dist/core/engine/requests.js.map +1 -0
  637. package/dist/core/engine/results.d.ts +40 -0
  638. package/dist/core/engine/results.d.ts.map +1 -0
  639. package/dist/core/engine/results.js +2 -0
  640. package/dist/core/engine/results.js.map +1 -0
  641. package/dist/core/engine/series.d.ts +61 -0
  642. package/dist/core/engine/series.d.ts.map +1 -0
  643. package/dist/core/engine/series.js +41 -0
  644. package/dist/core/engine/series.js.map +1 -0
  645. package/dist/core/engine/session/hours.d.ts +49 -0
  646. package/dist/core/engine/session/hours.d.ts.map +1 -0
  647. package/dist/core/engine/session/hours.js +31 -0
  648. package/dist/core/engine/session/hours.js.map +1 -0
  649. package/dist/core/engine/session/index.d.ts +17 -0
  650. package/dist/core/engine/session/index.d.ts.map +1 -0
  651. package/dist/core/engine/session/index.js +3 -0
  652. package/dist/core/engine/session/index.js.map +1 -0
  653. package/dist/core/engine/session/record.d.ts +56 -0
  654. package/dist/core/engine/session/record.d.ts.map +1 -0
  655. package/dist/core/engine/session/record.js +165 -0
  656. package/dist/core/engine/session/record.js.map +1 -0
  657. package/dist/core/engine/session/spec.d.ts +19 -0
  658. package/dist/core/engine/session/spec.d.ts.map +1 -0
  659. package/dist/core/engine/session/spec.js +31 -0
  660. package/dist/core/engine/session/spec.js.map +1 -0
  661. package/dist/core/engine/timeframe.d.ts +59 -0
  662. package/dist/core/engine/timeframe.d.ts.map +1 -0
  663. package/dist/core/engine/timeframe.js +140 -0
  664. package/dist/core/engine/timeframe.js.map +1 -0
  665. package/dist/core/engine/types.d.ts +15 -0
  666. package/dist/core/engine/types.d.ts.map +1 -0
  667. package/dist/core/engine/types.js +2 -0
  668. package/dist/core/engine/types.js.map +1 -0
  669. package/dist/core/engine/values/heap.d.ts +134 -0
  670. package/dist/core/engine/values/heap.d.ts.map +1 -0
  671. package/dist/core/engine/values/heap.js +230 -0
  672. package/dist/core/engine/values/heap.js.map +1 -0
  673. package/dist/core/engine/values/index.d.ts +13 -0
  674. package/dist/core/engine/values/index.d.ts.map +1 -0
  675. package/dist/core/engine/values/index.js +3 -0
  676. package/dist/core/engine/values/index.js.map +1 -0
  677. package/dist/core/engine/values/value.d.ts +82 -0
  678. package/dist/core/engine/values/value.d.ts.map +1 -0
  679. package/dist/core/engine/values/value.js +134 -0
  680. package/dist/core/engine/values/value.js.map +1 -0
  681. package/dist/core/engine/verify-budgets.d.ts +35 -0
  682. package/dist/core/engine/verify-budgets.d.ts.map +1 -0
  683. package/dist/core/engine/verify-budgets.js +172 -0
  684. package/dist/core/engine/verify-budgets.js.map +1 -0
  685. package/dist/core/engine/verify-code.d.ts +32 -0
  686. package/dist/core/engine/verify-code.d.ts.map +1 -0
  687. package/dist/core/engine/verify-code.js +278 -0
  688. package/dist/core/engine/verify-code.js.map +1 -0
  689. package/dist/core/engine/verify-requests.d.ts +44 -0
  690. package/dist/core/engine/verify-requests.d.ts.map +1 -0
  691. package/dist/core/engine/verify-requests.js +220 -0
  692. package/dist/core/engine/verify-requests.js.map +1 -0
  693. package/dist/core/engine/verify-shape.d.ts +46 -0
  694. package/dist/core/engine/verify-shape.d.ts.map +1 -0
  695. package/dist/core/engine/verify-shape.js +147 -0
  696. package/dist/core/engine/verify-shape.js.map +1 -0
  697. package/dist/core/engine/verify-tables.d.ts +19 -0
  698. package/dist/core/engine/verify-tables.d.ts.map +1 -0
  699. package/dist/core/engine/verify-tables.js +171 -0
  700. package/dist/core/engine/verify-tables.js.map +1 -0
  701. package/dist/core/engine/verify.d.ts +19 -0
  702. package/dist/core/engine/verify.d.ts.map +1 -0
  703. package/dist/core/engine/verify.js +309 -0
  704. package/dist/core/engine/verify.js.map +1 -0
  705. package/dist/core/index.d.ts +95 -6
  706. package/dist/core/index.d.ts.map +1 -1
  707. package/dist/core/index.js +64 -6
  708. package/dist/core/index.js.map +1 -1
  709. package/dist/core/parse/expressions.js +1 -1
  710. package/dist/core/parse/expressions.js.map +1 -1
  711. package/dist/core/parse/names.d.ts +7 -1
  712. package/dist/core/parse/names.d.ts.map +1 -1
  713. package/dist/core/parse/names.js +28 -2
  714. package/dist/core/parse/names.js.map +1 -1
  715. package/dist/core/stdlib/averages/exponential.d.ts +51 -0
  716. package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
  717. package/dist/core/stdlib/averages/exponential.js +72 -0
  718. package/dist/core/stdlib/averages/exponential.js.map +1 -0
  719. package/dist/core/stdlib/averages/index.d.ts +7 -0
  720. package/dist/core/stdlib/averages/index.d.ts.map +1 -0
  721. package/dist/core/stdlib/averages/index.js +5 -0
  722. package/dist/core/stdlib/averages/index.js.map +1 -0
  723. package/dist/core/stdlib/averages/select.d.ts +35 -0
  724. package/dist/core/stdlib/averages/select.d.ts.map +1 -0
  725. package/dist/core/stdlib/averages/select.js +43 -0
  726. package/dist/core/stdlib/averages/select.js.map +1 -0
  727. package/dist/core/stdlib/averages/shaped.d.ts +61 -0
  728. package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
  729. package/dist/core/stdlib/averages/shaped.js +126 -0
  730. package/dist/core/stdlib/averages/shaped.js.map +1 -0
  731. package/dist/core/stdlib/averages/simple.d.ts +58 -0
  732. package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
  733. package/dist/core/stdlib/averages/simple.js +92 -0
  734. package/dist/core/stdlib/averages/simple.js.map +1 -0
  735. package/dist/core/stdlib/calendar/civil.d.ts +56 -0
  736. package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
  737. package/dist/core/stdlib/calendar/civil.js +70 -0
  738. package/dist/core/stdlib/calendar/civil.js.map +1 -0
  739. package/dist/core/stdlib/calendar/fields.d.ts +36 -0
  740. package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
  741. package/dist/core/stdlib/calendar/fields.js +93 -0
  742. package/dist/core/stdlib/calendar/fields.js.map +1 -0
  743. package/dist/core/stdlib/calendar/format.d.ts +19 -0
  744. package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
  745. package/dist/core/stdlib/calendar/format.js +51 -0
  746. package/dist/core/stdlib/calendar/format.js.map +1 -0
  747. package/dist/core/stdlib/calendar/index.d.ts +7 -0
  748. package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
  749. package/dist/core/stdlib/calendar/index.js +5 -0
  750. package/dist/core/stdlib/calendar/index.js.map +1 -0
  751. package/dist/core/stdlib/calendar/zone.d.ts +53 -0
  752. package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
  753. package/dist/core/stdlib/calendar/zone.js +138 -0
  754. package/dist/core/stdlib/calendar/zone.js.map +1 -0
  755. package/dist/core/stdlib/index.d.ts +57 -0
  756. package/dist/core/stdlib/index.d.ts.map +1 -0
  757. package/dist/core/stdlib/index.js +51 -0
  758. package/dist/core/stdlib/index.js.map +1 -0
  759. package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
  760. package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
  761. package/dist/core/stdlib/maths/arithmetic.js +66 -0
  762. package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
  763. package/dist/core/stdlib/maths/elementary.d.ts +65 -0
  764. package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
  765. package/dist/core/stdlib/maths/elementary.js +93 -0
  766. package/dist/core/stdlib/maths/elementary.js.map +1 -0
  767. package/dist/core/stdlib/maths/index.d.ts +4 -0
  768. package/dist/core/stdlib/maths/index.d.ts.map +1 -0
  769. package/dist/core/stdlib/maths/index.js +4 -0
  770. package/dist/core/stdlib/maths/index.js.map +1 -0
  771. package/dist/core/stdlib/maths/rounding.d.ts +43 -0
  772. package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
  773. package/dist/core/stdlib/maths/rounding.js +62 -0
  774. package/dist/core/stdlib/maths/rounding.js.map +1 -0
  775. package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
  776. package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
  777. package/dist/core/stdlib/momentum/convergence.js +48 -0
  778. package/dist/core/stdlib/momentum/convergence.js.map +1 -0
  779. package/dist/core/stdlib/momentum/index.d.ts +6 -0
  780. package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
  781. package/dist/core/stdlib/momentum/index.js +6 -0
  782. package/dist/core/stdlib/momentum/index.js.map +1 -0
  783. package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
  784. package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
  785. package/dist/core/stdlib/momentum/pressure.js +103 -0
  786. package/dist/core/stdlib/momentum/pressure.js.map +1 -0
  787. package/dist/core/stdlib/momentum/rates.d.ts +74 -0
  788. package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
  789. package/dist/core/stdlib/momentum/rates.js +134 -0
  790. package/dist/core/stdlib/momentum/rates.js.map +1 -0
  791. package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
  792. package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
  793. package/dist/core/stdlib/momentum/rsi.js +30 -0
  794. package/dist/core/stdlib/momentum/rsi.js.map +1 -0
  795. package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
  796. package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
  797. package/dist/core/stdlib/momentum/stochastic.js +97 -0
  798. package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
  799. package/dist/core/stdlib/series/changes.d.ts +59 -0
  800. package/dist/core/stdlib/series/changes.d.ts.map +1 -0
  801. package/dist/core/stdlib/series/changes.js +129 -0
  802. package/dist/core/stdlib/series/changes.js.map +1 -0
  803. package/dist/core/stdlib/series/conditions.d.ts +34 -0
  804. package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
  805. package/dist/core/stdlib/series/conditions.js +52 -0
  806. package/dist/core/stdlib/series/conditions.js.map +1 -0
  807. package/dist/core/stdlib/series/extremes.d.ts +29 -0
  808. package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
  809. package/dist/core/stdlib/series/extremes.js +62 -0
  810. package/dist/core/stdlib/series/extremes.js.map +1 -0
  811. package/dist/core/stdlib/series/index.d.ts +9 -0
  812. package/dist/core/stdlib/series/index.d.ts.map +1 -0
  813. package/dist/core/stdlib/series/index.js +7 -0
  814. package/dist/core/stdlib/series/index.js.map +1 -0
  815. package/dist/core/stdlib/series/pivots.d.ts +25 -0
  816. package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
  817. package/dist/core/stdlib/series/pivots.js +42 -0
  818. package/dist/core/stdlib/series/pivots.js.map +1 -0
  819. package/dist/core/stdlib/series/statistics.d.ts +64 -0
  820. package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
  821. package/dist/core/stdlib/series/statistics.js +148 -0
  822. package/dist/core/stdlib/series/statistics.js.map +1 -0
  823. package/dist/core/stdlib/series/totals.d.ts +68 -0
  824. package/dist/core/stdlib/series/totals.d.ts.map +1 -0
  825. package/dist/core/stdlib/series/totals.js +115 -0
  826. package/dist/core/stdlib/series/totals.js.map +1 -0
  827. package/dist/core/stdlib/trend/directional.d.ts +69 -0
  828. package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
  829. package/dist/core/stdlib/trend/directional.js +151 -0
  830. package/dist/core/stdlib/trend/directional.js.map +1 -0
  831. package/dist/core/stdlib/trend/index.d.ts +4 -0
  832. package/dist/core/stdlib/trend/index.d.ts.map +1 -0
  833. package/dist/core/stdlib/trend/index.js +4 -0
  834. package/dist/core/stdlib/trend/index.js.map +1 -0
  835. package/dist/core/stdlib/trend/psar.d.ts +33 -0
  836. package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
  837. package/dist/core/stdlib/trend/psar.js +86 -0
  838. package/dist/core/stdlib/trend/psar.js.map +1 -0
  839. package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
  840. package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
  841. package/dist/core/stdlib/trend/supertrend.js +65 -0
  842. package/dist/core/stdlib/trend/supertrend.js.map +1 -0
  843. package/dist/core/stdlib/values/bar.d.ts +39 -0
  844. package/dist/core/stdlib/values/bar.d.ts.map +1 -0
  845. package/dist/core/stdlib/values/bar.js +33 -0
  846. package/dist/core/stdlib/values/bar.js.map +1 -0
  847. package/dist/core/stdlib/values/index.d.ts +11 -0
  848. package/dist/core/stdlib/values/index.d.ts.map +1 -0
  849. package/dist/core/stdlib/values/index.js +6 -0
  850. package/dist/core/stdlib/values/index.js.map +1 -0
  851. package/dist/core/stdlib/values/lookback.d.ts +83 -0
  852. package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
  853. package/dist/core/stdlib/values/lookback.js +134 -0
  854. package/dist/core/stdlib/values/lookback.js.map +1 -0
  855. package/dist/core/stdlib/values/region.d.ts +55 -0
  856. package/dist/core/stdlib/values/region.d.ts.map +1 -0
  857. package/dist/core/stdlib/values/region.js +73 -0
  858. package/dist/core/stdlib/values/region.js.map +1 -0
  859. package/dist/core/stdlib/values/tail.d.ts +44 -0
  860. package/dist/core/stdlib/values/tail.d.ts.map +1 -0
  861. package/dist/core/stdlib/values/tail.js +23 -0
  862. package/dist/core/stdlib/values/tail.js.map +1 -0
  863. package/dist/core/stdlib/values/value.d.ts +64 -0
  864. package/dist/core/stdlib/values/value.d.ts.map +1 -0
  865. package/dist/core/stdlib/values/value.js +61 -0
  866. package/dist/core/stdlib/values/value.js.map +1 -0
  867. package/dist/core/stdlib/volatility/bands.d.ts +50 -0
  868. package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
  869. package/dist/core/stdlib/volatility/bands.js +101 -0
  870. package/dist/core/stdlib/volatility/bands.js.map +1 -0
  871. package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
  872. package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
  873. package/dist/core/stdlib/volatility/deviation.js +75 -0
  874. package/dist/core/stdlib/volatility/deviation.js.map +1 -0
  875. package/dist/core/stdlib/volatility/index.d.ts +6 -0
  876. package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
  877. package/dist/core/stdlib/volatility/index.js +5 -0
  878. package/dist/core/stdlib/volatility/index.js.map +1 -0
  879. package/dist/core/stdlib/volatility/measures.d.ts +48 -0
  880. package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
  881. package/dist/core/stdlib/volatility/measures.js +73 -0
  882. package/dist/core/stdlib/volatility/measures.js.map +1 -0
  883. package/dist/core/stdlib/volatility/range.d.ts +69 -0
  884. package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
  885. package/dist/core/stdlib/volatility/range.js +86 -0
  886. package/dist/core/stdlib/volatility/range.js.map +1 -0
  887. package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
  888. package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
  889. package/dist/core/stdlib/volume/accumulation.js +127 -0
  890. package/dist/core/stdlib/volume/accumulation.js.map +1 -0
  891. package/dist/core/stdlib/volume/flow.d.ts +60 -0
  892. package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
  893. package/dist/core/stdlib/volume/flow.js +125 -0
  894. package/dist/core/stdlib/volume/flow.js.map +1 -0
  895. package/dist/core/stdlib/volume/index.d.ts +5 -0
  896. package/dist/core/stdlib/volume/index.d.ts.map +1 -0
  897. package/dist/core/stdlib/volume/index.js +4 -0
  898. package/dist/core/stdlib/volume/index.js.map +1 -0
  899. package/dist/core/stdlib/volume/weighted.d.ts +52 -0
  900. package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
  901. package/dist/core/stdlib/volume/weighted.js +64 -0
  902. package/dist/core/stdlib/volume/weighted.js.map +1 -0
  903. package/dist/core/version/version.generated.d.ts +2 -2
  904. package/dist/core/version/version.generated.d.ts.map +1 -1
  905. package/dist/core/version/version.generated.js +2 -2
  906. package/dist/core/version/version.generated.js.map +1 -1
  907. package/dist/editor/complete.d.ts +40 -0
  908. package/dist/editor/complete.d.ts.map +1 -0
  909. package/dist/editor/complete.js +206 -0
  910. package/dist/editor/complete.js.map +1 -0
  911. package/dist/editor/diagnose.d.ts +18 -0
  912. package/dist/editor/diagnose.d.ts.map +1 -0
  913. package/dist/editor/diagnose.js +70 -0
  914. package/dist/editor/diagnose.js.map +1 -0
  915. package/dist/editor/format.d.ts +11 -0
  916. package/dist/editor/format.d.ts.map +1 -0
  917. package/dist/editor/format.js +50 -0
  918. package/dist/editor/format.js.map +1 -0
  919. package/dist/editor/highlight.d.ts +28 -0
  920. package/dist/editor/highlight.d.ts.map +1 -0
  921. package/dist/editor/highlight.js +65 -0
  922. package/dist/editor/highlight.js.map +1 -0
  923. package/dist/editor/hover.d.ts +40 -0
  924. package/dist/editor/hover.d.ts.map +1 -0
  925. package/dist/editor/hover.js +147 -0
  926. package/dist/editor/hover.js.map +1 -0
  927. package/dist/editor/index.d.ts +60 -0
  928. package/dist/editor/index.d.ts.map +1 -0
  929. package/dist/editor/index.js +7 -0
  930. package/dist/editor/index.js.map +1 -0
  931. package/dist/editor/kinds.d.ts +27 -0
  932. package/dist/editor/kinds.d.ts.map +1 -0
  933. package/dist/editor/kinds.js +118 -0
  934. package/dist/editor/kinds.js.map +1 -0
  935. package/dist/editor/layout.d.ts +47 -0
  936. package/dist/editor/layout.d.ts.map +1 -0
  937. package/dist/editor/layout.js +135 -0
  938. package/dist/editor/layout.js.map +1 -0
  939. package/dist/editor/manifest.d.ts +47 -0
  940. package/dist/editor/manifest.d.ts.map +1 -0
  941. package/dist/editor/manifest.js +93 -0
  942. package/dist/editor/manifest.js.map +1 -0
  943. package/dist/editor/reading.d.ts +41 -0
  944. package/dist/editor/reading.d.ts.map +1 -0
  945. package/dist/editor/reading.js +51 -0
  946. package/dist/editor/reading.js.map +1 -0
  947. package/dist/editor/scan.d.ts +26 -0
  948. package/dist/editor/scan.d.ts.map +1 -0
  949. package/dist/editor/scan.js +139 -0
  950. package/dist/editor/scan.js.map +1 -0
  951. package/dist/editor/scope.d.ts +19 -0
  952. package/dist/editor/scope.d.ts.map +1 -0
  953. package/dist/editor/scope.js +99 -0
  954. package/dist/editor/scope.js.map +1 -0
  955. package/dist/editor/signature.d.ts +38 -0
  956. package/dist/editor/signature.d.ts.map +1 -0
  957. package/dist/editor/signature.js +112 -0
  958. package/dist/editor/signature.js.map +1 -0
  959. package/dist/editor/site.d.ts +46 -0
  960. package/dist/editor/site.d.ts.map +1 -0
  961. package/dist/editor/site.js +184 -0
  962. package/dist/editor/site.js.map +1 -0
  963. package/dist/editor/spacing.d.ts +29 -0
  964. package/dist/editor/spacing.d.ts.map +1 -0
  965. package/dist/editor/spacing.js +116 -0
  966. package/dist/editor/spacing.js.map +1 -0
  967. package/package.json +66 -15
  968. package/spec/errors.json +522 -183
  969. package/src/adapters/charts/alerts.ts +116 -0
  970. package/src/adapters/charts/bars.ts +63 -0
  971. package/src/adapters/charts/candles.ts +137 -0
  972. package/src/adapters/charts/colours.ts +113 -0
  973. package/src/adapters/charts/columns.ts +99 -0
  974. package/src/adapters/charts/contract.ts +320 -0
  975. package/src/adapters/charts/descriptor.ts +199 -0
  976. package/src/adapters/charts/drawings.ts +213 -0
  977. package/src/adapters/charts/errors.ts +45 -0
  978. package/src/adapters/charts/fields.ts +74 -0
  979. package/src/adapters/charts/fills.ts +71 -0
  980. package/src/adapters/charts/index.ts +78 -0
  981. package/src/adapters/charts/levels.ts +92 -0
  982. package/src/adapters/charts/markers.ts +119 -0
  983. package/src/adapters/charts/paint.ts +101 -0
  984. package/src/adapters/charts/plots.ts +185 -0
  985. package/src/adapters/charts/produced.ts +68 -0
  986. package/src/adapters/charts/requests.ts +357 -0
  987. package/src/adapters/charts/run.ts +327 -0
  988. package/src/adapters/charts/settings.ts +273 -0
  989. package/src/adapters/charts/surfaces.ts +255 -0
  990. package/src/adapters/charts/tables.ts +243 -0
  991. package/src/adapters/codemirror/commands.ts +53 -0
  992. package/src/adapters/codemirror/completion.ts +74 -0
  993. package/src/adapters/codemirror/contract.ts +156 -0
  994. package/src/adapters/codemirror/index.ts +66 -0
  995. package/src/adapters/codemirror/lint.ts +66 -0
  996. package/src/adapters/codemirror/positions.ts +79 -0
  997. package/src/adapters/codemirror/stream.ts +87 -0
  998. package/src/adapters/codemirror/tokens.ts +64 -0
  999. package/src/adapters/codemirror/tooltips.ts +113 -0
  1000. package/src/core/accounting/charges.ts +452 -0
  1001. package/src/core/accounting/equity.ts +276 -0
  1002. package/src/core/accounting/index.ts +49 -0
  1003. package/src/core/accounting/markers.ts +95 -0
  1004. package/src/core/accounting/monthly.ts +137 -0
  1005. package/src/core/accounting/report.ts +89 -0
  1006. package/src/core/accounting/shapes.ts +73 -0
  1007. package/src/core/accounting/statistics.ts +350 -0
  1008. package/src/core/accounting/trades.ts +313 -0
  1009. package/src/core/backtest/compare.ts +244 -0
  1010. package/src/core/backtest/declaration.ts +97 -0
  1011. package/src/core/backtest/drive.ts +364 -0
  1012. package/src/core/backtest/index.ts +52 -0
  1013. package/src/core/backtest/range.ts +137 -0
  1014. package/src/core/backtest/record.ts +341 -0
  1015. package/src/core/backtest/replay.ts +158 -0
  1016. package/src/core/backtest/resting.ts +125 -0
  1017. package/src/core/backtest/settings.ts +280 -0
  1018. package/src/core/backtest/simulate.ts +304 -0
  1019. package/src/core/catalogue/catalogue.generated.ts +23 -9
  1020. package/src/core/catalogue/values.generated.ts +14 -0
  1021. package/src/core/check/arguments.ts +126 -0
  1022. package/src/core/check/call-sites.ts +385 -0
  1023. package/src/core/check/call-warmup.ts +121 -0
  1024. package/src/core/check/calls.ts +412 -0
  1025. package/src/core/check/check.ts +183 -0
  1026. package/src/core/check/checked.ts +228 -0
  1027. package/src/core/check/checker.ts +393 -0
  1028. package/src/core/check/conditional.ts +143 -0
  1029. package/src/core/check/constant.ts +127 -0
  1030. package/src/core/check/declaration.ts +230 -0
  1031. package/src/core/check/expressions.ts +471 -0
  1032. package/src/core/check/functions.ts +283 -0
  1033. package/src/core/check/handles.ts +75 -0
  1034. package/src/core/check/index.ts +70 -0
  1035. package/src/core/check/library-bars.ts +194 -0
  1036. package/src/core/check/library-orders.ts +290 -0
  1037. package/src/core/check/library-output.ts +241 -0
  1038. package/src/core/check/library-prose.generated.ts +367 -0
  1039. package/src/core/check/library-series.ts +457 -0
  1040. package/src/core/check/library.ts +374 -0
  1041. package/src/core/check/literals.ts +35 -0
  1042. package/src/core/check/outputs.ts +152 -0
  1043. package/src/core/check/statements.ts +465 -0
  1044. package/src/core/check/suggest.ts +63 -0
  1045. package/src/core/check/surface.ts +149 -0
  1046. package/src/core/check/tags.ts +94 -0
  1047. package/src/core/check/types.ts +260 -0
  1048. package/src/core/check/warmup.ts +100 -0
  1049. package/src/core/diagnostics/collector.ts +27 -1
  1050. package/src/core/emit/calls.ts +415 -0
  1051. package/src/core/emit/canonical.ts +81 -0
  1052. package/src/core/emit/channels.ts +144 -0
  1053. package/src/core/emit/code.ts +155 -0
  1054. package/src/core/emit/colours.ts +75 -0
  1055. package/src/core/emit/context.ts +461 -0
  1056. package/src/core/emit/defaults.ts +220 -0
  1057. package/src/core/emit/emit.ts +313 -0
  1058. package/src/core/emit/events.ts +141 -0
  1059. package/src/core/emit/expressions.ts +292 -0
  1060. package/src/core/emit/functions.ts +195 -0
  1061. package/src/core/emit/gaps.ts +44 -0
  1062. package/src/core/emit/index.ts +76 -0
  1063. package/src/core/emit/inputs.ts +179 -0
  1064. package/src/core/emit/layout.ts +165 -0
  1065. package/src/core/emit/meta.ts +104 -0
  1066. package/src/core/emit/opcodes.ts +160 -0
  1067. package/src/core/emit/outputs.ts +357 -0
  1068. package/src/core/emit/pool.ts +102 -0
  1069. package/src/core/emit/program.ts +385 -0
  1070. package/src/core/emit/registers.ts +179 -0
  1071. package/src/core/emit/request-scope.ts +52 -0
  1072. package/src/core/emit/requests.ts +258 -0
  1073. package/src/core/emit/requires.ts +91 -0
  1074. package/src/core/emit/sha256.ts +119 -0
  1075. package/src/core/emit/statements.ts +438 -0
  1076. package/src/core/emit/values.ts +284 -0
  1077. package/src/core/engine/alerts.ts +152 -0
  1078. package/src/core/engine/arithmetic.ts +165 -0
  1079. package/src/core/engine/bars.ts +224 -0
  1080. package/src/core/engine/budget.ts +284 -0
  1081. package/src/core/engine/channels.ts +171 -0
  1082. package/src/core/engine/drawings.ts +127 -0
  1083. package/src/core/engine/engine.ts +498 -0
  1084. package/src/core/engine/errors.ts +100 -0
  1085. package/src/core/engine/frames.ts +85 -0
  1086. package/src/core/engine/grids.ts +98 -0
  1087. package/src/core/engine/guard.ts +71 -0
  1088. package/src/core/engine/host.ts +251 -0
  1089. package/src/core/engine/index.ts +93 -0
  1090. package/src/core/engine/inputs.ts +263 -0
  1091. package/src/core/engine/ledger/call.ts +218 -0
  1092. package/src/core/engine/ledger/closable.ts +269 -0
  1093. package/src/core/engine/ledger/holdings.ts +354 -0
  1094. package/src/core/engine/ledger/index.ts +28 -0
  1095. package/src/core/engine/ledger/intent.ts +112 -0
  1096. package/src/core/engine/ledger/ledger.ts +314 -0
  1097. package/src/core/engine/ledger/place.ts +277 -0
  1098. package/src/core/engine/ledger/positions.ts +123 -0
  1099. package/src/core/engine/ledger/refuse.ts +378 -0
  1100. package/src/core/engine/ledger/row.ts +318 -0
  1101. package/src/core/engine/ledger/sizing.ts +292 -0
  1102. package/src/core/engine/library/arrays.ts +316 -0
  1103. package/src/core/engine/library/averages.ts +97 -0
  1104. package/src/core/engine/library/binding.ts +325 -0
  1105. package/src/core/engine/library/chart.ts +115 -0
  1106. package/src/core/engine/library/colours.ts +111 -0
  1107. package/src/core/engine/library/dates.ts +109 -0
  1108. package/src/core/engine/library/index.ts +103 -0
  1109. package/src/core/engine/library/maths.ts +134 -0
  1110. package/src/core/engine/library/objects.ts +265 -0
  1111. package/src/core/engine/library/oscillators.ts +124 -0
  1112. package/src/core/engine/library/ranges.ts +51 -0
  1113. package/src/core/engine/library/series.ts +236 -0
  1114. package/src/core/engine/library/state.ts +47 -0
  1115. package/src/core/engine/library/studies.ts +150 -0
  1116. package/src/core/engine/library/text.ts +303 -0
  1117. package/src/core/engine/library/trend.ts +79 -0
  1118. package/src/core/engine/library/volume.ts +101 -0
  1119. package/src/core/engine/load.ts +118 -0
  1120. package/src/core/engine/machine.ts +446 -0
  1121. package/src/core/engine/memory.ts +129 -0
  1122. package/src/core/engine/operations.ts +171 -0
  1123. package/src/core/engine/orders.ts +121 -0
  1124. package/src/core/engine/registers.ts +104 -0
  1125. package/src/core/engine/request-body.ts +328 -0
  1126. package/src/core/engine/request-plan.ts +270 -0
  1127. package/src/core/engine/requests.ts +382 -0
  1128. package/src/core/engine/results.ts +41 -0
  1129. package/src/core/engine/series.ts +82 -0
  1130. package/src/core/engine/session/hours.ts +86 -0
  1131. package/src/core/engine/session/index.ts +17 -0
  1132. package/src/core/engine/session/record.ts +191 -0
  1133. package/src/core/engine/session/spec.ts +45 -0
  1134. package/src/core/engine/timeframe.ts +161 -0
  1135. package/src/core/engine/types.ts +47 -0
  1136. package/src/core/engine/values/heap.ts +295 -0
  1137. package/src/core/engine/values/index.ts +34 -0
  1138. package/src/core/engine/values/value.ts +158 -0
  1139. package/src/core/engine/verify-budgets.ts +202 -0
  1140. package/src/core/engine/verify-code.ts +332 -0
  1141. package/src/core/engine/verify-requests.ts +255 -0
  1142. package/src/core/engine/verify-shape.ts +164 -0
  1143. package/src/core/engine/verify-tables.ts +176 -0
  1144. package/src/core/engine/verify.ts +341 -0
  1145. package/src/core/index.ts +212 -6
  1146. package/src/core/parse/expressions.ts +1 -1
  1147. package/src/core/parse/names.ts +29 -2
  1148. package/src/core/stdlib/averages/exponential.ts +119 -0
  1149. package/src/core/stdlib/averages/index.ts +45 -0
  1150. package/src/core/stdlib/averages/select.ts +71 -0
  1151. package/src/core/stdlib/averages/shaped.ts +161 -0
  1152. package/src/core/stdlib/averages/simple.ts +139 -0
  1153. package/src/core/stdlib/calendar/civil.ts +89 -0
  1154. package/src/core/stdlib/calendar/fields.ts +124 -0
  1155. package/src/core/stdlib/calendar/format.ts +71 -0
  1156. package/src/core/stdlib/calendar/index.ts +15 -0
  1157. package/src/core/stdlib/calendar/zone.ts +161 -0
  1158. package/src/core/stdlib/index.ts +400 -0
  1159. package/src/core/stdlib/maths/arithmetic.ts +74 -0
  1160. package/src/core/stdlib/maths/elementary.ts +124 -0
  1161. package/src/core/stdlib/maths/index.ts +43 -0
  1162. package/src/core/stdlib/maths/rounding.ts +78 -0
  1163. package/src/core/stdlib/momentum/convergence.ts +82 -0
  1164. package/src/core/stdlib/momentum/index.ts +47 -0
  1165. package/src/core/stdlib/momentum/pressure.ts +141 -0
  1166. package/src/core/stdlib/momentum/rates.ts +188 -0
  1167. package/src/core/stdlib/momentum/rsi.ts +49 -0
  1168. package/src/core/stdlib/momentum/stochastic.ts +147 -0
  1169. package/src/core/stdlib/series/changes.ts +177 -0
  1170. package/src/core/stdlib/series/conditions.ts +74 -0
  1171. package/src/core/stdlib/series/extremes.ts +92 -0
  1172. package/src/core/stdlib/series/index.ts +83 -0
  1173. package/src/core/stdlib/series/pivots.ts +63 -0
  1174. package/src/core/stdlib/series/statistics.ts +207 -0
  1175. package/src/core/stdlib/series/totals.ts +164 -0
  1176. package/src/core/stdlib/trend/directional.ts +196 -0
  1177. package/src/core/stdlib/trend/index.ts +13 -0
  1178. package/src/core/stdlib/trend/psar.ts +131 -0
  1179. package/src/core/stdlib/trend/supertrend.ts +100 -0
  1180. package/src/core/stdlib/values/bar.ts +54 -0
  1181. package/src/core/stdlib/values/index.ts +14 -0
  1182. package/src/core/stdlib/values/lookback.ts +198 -0
  1183. package/src/core/stdlib/values/region.ts +86 -0
  1184. package/src/core/stdlib/values/tail.ts +58 -0
  1185. package/src/core/stdlib/values/value.ts +82 -0
  1186. package/src/core/stdlib/volatility/bands.ts +178 -0
  1187. package/src/core/stdlib/volatility/deviation.ts +111 -0
  1188. package/src/core/stdlib/volatility/index.ts +48 -0
  1189. package/src/core/stdlib/volatility/measures.ts +96 -0
  1190. package/src/core/stdlib/volatility/range.ts +143 -0
  1191. package/src/core/stdlib/volume/accumulation.ts +152 -0
  1192. package/src/core/stdlib/volume/flow.ts +173 -0
  1193. package/src/core/stdlib/volume/index.ts +43 -0
  1194. package/src/core/stdlib/volume/weighted.ts +101 -0
  1195. package/src/core/version/version.generated.ts +2 -2
  1196. package/src/editor/complete.ts +266 -0
  1197. package/src/editor/diagnose.ts +71 -0
  1198. package/src/editor/format.ts +85 -0
  1199. package/src/editor/highlight.ts +110 -0
  1200. package/src/editor/hover.ts +199 -0
  1201. package/src/editor/index.ts +65 -0
  1202. package/src/editor/kinds.ts +157 -0
  1203. package/src/editor/layout.ts +189 -0
  1204. package/src/editor/manifest.ts +119 -0
  1205. package/src/editor/reading.ts +69 -0
  1206. package/src/editor/scan.ts +162 -0
  1207. package/src/editor/scope.ts +122 -0
  1208. package/src/editor/signature.ts +150 -0
  1209. package/src/editor/site.ts +233 -0
  1210. package/src/editor/spacing.ts +132 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,1475 @@ nothing, fails the build before it can become permanent.
7
7
 
8
8
  ---
9
9
 
10
+ ## 0.4.0
11
+
12
+ **A backtest is driven, and what it produces is a document rather than a
13
+ number.** `backtest(program, bars, settings)` walks a compiled program over a
14
+ range of bars against a destination that prices fills, and hands back a
15
+ `RunRecord`: the compiled program and the hash of the source it came from, the
16
+ bars or a hash naming them, the settings the host chose, every frame the
17
+ destination answered in delivery order, every fill the engine folded in fold
18
+ order, the ledger the run ended with, the diagnostics and the report. Nothing in
19
+ it is an object reference, a function or a shape only this engine can read,
20
+ because the same document is what a second engine will be handed as a
21
+ conformance case.
22
+
23
+ **A stored run can be reported again and run again, and both are checked rather
24
+ than asserted.** `replay(record)` folds the money again from the record's own
25
+ fills with no bar executed, and has to produce the report the record carries:
26
+ that is what says the report is a function of the fills and not of anything the
27
+ engine happened to be holding. `rerun(record)` executes the record again and the
28
+ two runs are compared as bytes. Bars are revised, so a replay over bars that do
29
+ not hash to the record's is refused, OS6022, rather than reporting the original
30
+ figures over different data.
31
+
32
+ **The comparison that tells an improvement from noise.** `compareRuns` puts two
33
+ records beside each other. Two runs over different bars or different contracts
34
+ are two studies, so the pair is reported incomparable and given no separation at
35
+ all; a different program over the same bars is exactly what is comparable, and
36
+ every other difference is named, because the reason a run improved is as often a
37
+ setting somebody forgot they changed as it is the change they meant to test.
38
+ Separation is the gap between the two expectancies over the combined standard
39
+ error, analytic and with no resampling, so the same pair gives the same figure
40
+ for ever. It is null rather than infinite where neither run has the two closed
41
+ trades a spread needs.
42
+
43
+ **The phase's gate is executed rather than promised.**
44
+ `scripts/check-reproducible.mjs` runs on every `npm test`, over the shipped
45
+ strategy examples rather than over a probe written the same afternoon. Each run
46
+ is written to JSON, every other reference to it is dropped, and the record is
47
+ parsed back from that text alone; then it is reported again from its own fills to
48
+ the same report, executed again to the same bytes, refused a replay over revised
49
+ bars, compared with itself to no movement, and refused a separation against a run
50
+ over other bars. A strategy needing a capability the driver cannot supply is
51
+ named and counted, never skipped.
52
+
53
+ **The report: a trade list, an equity curve, a drawdown and a month by month
54
+ table.** A trade is one position reference from the fill that takes it off zero
55
+ to the fill that returns it, so a pyramided entry is more entry fills on one
56
+ trade, a partial close is an exit fill that does not close it, and a reversal is
57
+ two trades. Win rate is over closed trades on the net after charges, with an
58
+ exactly zero net counted as a scratch in neither half; expectancy carries its own
59
+ standard error. None of it is readable by a script: the money entries of the
60
+ `pos` namespace stay planned and go on refusing at the call, because the moment a
61
+ script can branch on its own equity every formula joins the conformance surface.
62
+
63
+ **Every bar supplied executes and only the ones inside the window are reported.**
64
+ A bar before the window is warmup: it runs, its orders are real, and a position
65
+ opened on one is carried in with its charges paid. A window holding none of the
66
+ bars supplied is refused, OS6020, rather than reported as a flat curve, which is
67
+ what a strategy that did nothing also produces.
68
+
69
+ **The costs are the destination's, where the specification puts them.** Slippage
70
+ is measured in ticks and is adverse always, worse on a buy and worse on a sell,
71
+ and it applies to a market fill and to a stop and never to a limit. A platform
72
+ that has its own rates supplies a charge schedule; a script that states a
73
+ commission gets a schedule of one line derived from it; both at once is refused,
74
+ OS6023, because two cost models charge the same money twice or charge whichever
75
+ an engine preferred.
76
+
77
+ **A quantity is converted into units by the destination, or the run is refused.**
78
+ A quantity travels in the declaration's own unit and the destination is the party
79
+ that converts it. Lots are converted through the instrument's lot size, and a lot
80
+ on an instrument stating none is refused. Cash and a percentage of equity are
81
+ refused by name: a backtest fills in units and works out no running equity to
82
+ size against, so it can convert neither, and filling the number as written is
83
+ what it used to do.
84
+
85
+ **What it does not model, said here rather than left to be discovered.** A
86
+ bracket reaches the destination as a protective instruction attached to a tag and
87
+ the engine appends no order row for one, so a stop cannot fill in a backtest yet
88
+ and a page that says otherwise is ahead of the engine. A limit fills only where
89
+ the bar traded through it and a stop that gapped fills at the open, both of which
90
+ a host can change in the fill policy; a bar is four prices and no path, and
91
+ nothing here pretends to know which extreme came first.
92
+
93
+ The equity curve marks a trade at the size it ended up entering from the bar it
94
+ first opened, so a scale-in is marked, before its second entry, on units it did
95
+ not hold at an average it had not reached: the curve reports a drawdown the
96
+ account never had, and the maximum drawdown figures are folded from it, so a
97
+ pyramiding strategy is reported as having risked more than it did. The realised
98
+ total is unaffected. Folding the curve from the fills rather than from the trades
99
+ is what fixes it, and that is a different fold rather than a correction to this
100
+ one.
101
+
102
+ The conformance case files a second engine would be handed are not written, and
103
+ cannot be from a record alone: a case has to carry the source text and a record
104
+ carries the source hash, its line count and its file name. Nothing can recompile
105
+ a stored revision for the same reason. Both belong to the next phase, and both
106
+ are now written down instead of implied.
107
+
108
+ **Four defects found by review before any of this shipped**, each a wrong number
109
+ rather than a crash:
110
+
111
+ - A quantity stated in lots, cash or a percentage of equity was filled at the
112
+ number the script wrote, so a strategy sizing in lots of sixty five traded one
113
+ sixty fifth of what it asked for and every money figure went with it.
114
+ - `checkSettings` asked about the cost model only when the host supplied one, so
115
+ on the path almost every run takes it asked nothing: a declared commission of
116
+ minus five was charged as a credit and turned a loss into a gain. A declared
117
+ slippage below zero improved both sides of every fill through the same hole.
118
+ - A month's return was divided by the equity it had already earned, so a month
119
+ that doubled an account reported fifty percent, with the money column beside it
120
+ right.
121
+ - A gross loss driven under zero by charges gave a negative profit factor, which
122
+ is a ratio nobody can act on. It is null there now, and the field says it can
123
+ go under zero instead of calling itself a positive magnitude.
124
+
125
+ A bar time outside the range a calendar can hold, which is what nanoseconds
126
+ instead of milliseconds produce, made the monthly table NaN and then threw a bare
127
+ error with no catalogue code out of core. Such a time names no month.
128
+
129
+ **`load` hands back the inputs it resolved**, beside the engine, so that a caller
130
+ outside the engine can read the declaration's capital, commission and fill rule
131
+ without resolving an input a second time under its own rules.
132
+
133
+ **`settingsFor`'s second argument no longer names a contract it ignored.** It
134
+ took a partial settings object whose contract field it discarded in favour of the
135
+ positional one, so a caller passing a contract there silently got the other. It
136
+ is now a compiler error at the call.
137
+
138
+ ## 0.3.0
139
+
140
+ **The editor half is here: six functions, text in and data out, and a drop-in
141
+ adapter for a text component.** `src/editor` is a new tier whose index is its
142
+ only door. It imports the compiler and nothing else: no package, no browser
143
+ global, no DOM type, which the layering check has enforced for it since before
144
+ the directory existed. Nothing in it is on screen, and nothing in it is hand
145
+ written: a hand written highlighter, completion list or tooltip drifts from the
146
+ language and nobody notices for a release.
147
+
148
+ **Two new entry points resolve: `openalgo-script/editor` and
149
+ `openalgo-script/adapters/codemirror`.** They are declared now that the tier they
150
+ name exists, because an entry point that resolves to half a tier fails at your
151
+ run time rather than honestly at install. A fifteenth check,
152
+ `scripts/check-entry-points.mjs`, builds a temporary install holding exactly what
153
+ the `files` list ships, with no package of any kind beside it, and imports every
154
+ door the export map declares. That is also what says both adapters' peer
155
+ dependencies are optional in fact: neither could have loaded if it imported one.
156
+
157
+ **`highlight(source)` gives every piece of a file, in order, covering every
158
+ character exactly once.** The kind of each piece comes from the language's own
159
+ tables, so a word added to the reserved list, a mark added to an operator table
160
+ and a function added to the standard library manifest are each painted the day
161
+ they are added. The covering property is the one a host cannot do without: a
162
+ highlighter that drops one character leaves everything after it on that line
163
+ drawn one column to the left, and that arrives as a bug report about the caret.
164
+ `highlightLines(source)` is the same pieces per line, which is where a host
165
+ otherwise makes the off-by-one itself.
166
+
167
+ Comments come out of `highlight` and are recovered in one place rather than by
168
+ each host. The lexer emits none, because the parser has no use for one; the two
169
+ ways a consumer ends up doing it, reading the gaps between token spans and
170
+ scanning the text for `//`, are folklore and a second lexer respectively, and the
171
+ second is wrong inside a string literal.
172
+
173
+ **`diagnose(source)` is the whole front end**, lexer through emitter, and returns
174
+ the compiler's own diagnostics with the message and the fix the error catalogue
175
+ gives them. Not a subset: there are codes the emitter raises and nothing before
176
+ it does, so an editor that stopped after the checker would show a clean file and
177
+ then have the apply refused. A source that does not parse answers usefully rather
178
+ than throwing, which is the state a file being typed into is in most of the time.
179
+
180
+ **What that costs is now a number rather than an impression.** Two measurements
181
+ join the benchmark suite, `diagnose-heavy` and `diagnose-typing`, the second on a
182
+ file with a call bracket left open half way down it, which is what a file looks
183
+ like the moment somebody types one. A third of a millisecond and about a
184
+ millisecond, against budgets of 1.5 and 4. That is the answer to whether an
185
+ editor needs a compiler of its own: at this price it does not, and the number to
186
+ beat is in the table rather than in somebody's judgement.
187
+
188
+ **`format(source)` lays a file out in the canonical layout, now stated in
189
+ `language.md` 3.13**, and formatting never changes what a script means. That is
190
+ proved twice rather than asserted: every example and every gate script in the
191
+ repository, a hundred and nineteen of them today, is laid out again, both texts are
192
+ compiled, and the compiled programs are compared field for field; and every call
193
+ lexes its own output and compares it with the tokens that went in, so a rule that
194
+ is wrong returns your source untouched rather than a changed program. A source
195
+ that does not parse comes back byte for byte, because a character the lexer
196
+ refused produces no token and a reprint from the tokens would delete it.
197
+
198
+ The three questions a reprinter usually guesses at are put to the parser instead:
199
+ which `-` is a sign, which bracket groups an expression rather than opening an
200
+ argument list, and which `:` belongs to a ternary rather than to a type. All
201
+ three are in the tree already, and the guess is where every formatter that has
202
+ turned `a - -b` into something else began.
203
+
204
+ **`complete(source, offset)` offers what may be written there**: the library's
205
+ names, the names the file has declared and still has in scope, the named
206
+ arguments of the call being written, and the members of a namespace after a dot.
207
+ The names are the standard library manifest, the same index the checker resolves
208
+ against and the same one the example check reads its globals from, so a function
209
+ added to the library is offered the day it is added. A name is offered from the
210
+ end of the statement that declares it and inside the block that declared it,
211
+ which are the compiler's own two rules rather than a second reading of them.
212
+
213
+ A call the library names and has not implemented is offered, sorted after
214
+ everything a script may write today, and carries the error catalogue's own OS2020
215
+ sentence with its name filled in. Leaving those out would send a writer to the
216
+ documentation to find out why a name is missing; offering them unmarked walks
217
+ them into a script that will not compile.
218
+
219
+ **`hover(source, offset)` says what the word under the pointer is**, and the
220
+ sentence it shows is the cell `spec/stdlib.md` prints for that call. It is read
221
+ out of the specification at build time by a new generator rather than retyped
222
+ into the source, so a description improved in the specification is improved in
223
+ the tooltip, and a test fails if the manifest and the specification ever describe
224
+ different sets of names. A name the file declared carries the type the checker
225
+ worked out and the span it was declared at; a named colour carries its channels.
226
+
227
+ Three things a hover wants and has no machine readable source for are stated
228
+ rather than invented: a reserved word has no per-word explanation anywhere, a
229
+ name with several signatures is described by the first row the specification
230
+ states for it, and a parameter has no description of its own. Those, and what the
231
+ adapter narrows, are recorded in `spec/editor-narrowings.json`.
232
+
233
+ **`signature(source, offset)` gives the call being written, which parameter the
234
+ cursor is in, and each parameter's name, type, default and whether it is
235
+ required.** The default is the one the compiler applies, which is the trap in
236
+ this function: most defaults live in the library manifest, and the eight
237
+ declaration calls keep theirs in the emitter, so a tooltip reading the manifest
238
+ alone shows nothing beside `width?` while every plot is drawn 1.5 wide. Both are
239
+ read through one answer that `scripts/check-defaults.mjs` holds to the
240
+ specification, so a number in a tooltip and a number in a compiled program cannot
241
+ differ without the build failing.
242
+
243
+ **The adapter, `src/adapters/codemirror`, is a drop-in that draws nothing.** The
244
+ text component is a peer dependency and nothing in the adapter imports it, the
245
+ same way the chart adapter treats a chart. Both tooltips take their markup as a
246
+ required parameter with no default, so no tier of this package names a browser
247
+ global at all and every file in it loads in a worker and on a server. Offsets are
248
+ translated between the document a component holds and the normalised text every
249
+ span in this package indexes, so a file with two character line endings is
250
+ underlined in the right place. Highlighting is computed a line at a time, which
251
+ is how the component asks for it, and a test compares that against the whole-file
252
+ `highlight` over every script in the repository: 4279 lines, not one piece
253
+ different.
254
+
255
+ **Two facts the core now exposes**, because a tier above it needs them and
256
+ reading them out of a module's internals would be a second copy: what a
257
+ declaration call's omitted argument resolves to, and the channels a colour name
258
+ denotes.
259
+
260
+ Eighty-eight further tests, each naming in a comment the wrong implementation it
261
+ catches, on top of the fifty-eight the first three functions came with.
262
+ Forty-five of those implementations were then written into the source one at a
263
+ time, with every file copied first and restored from the copy by hash afterwards:
264
+ forty-three were caught by a test and two by the compiler. One more was tried and
265
+ changed nothing a caller can observe, a guard in a private function, and is left
266
+ in place and untested for rather than counted as a catch.
267
+
268
+ **The first run of that harness proved nothing and said it had.** It named the
269
+ test directory, and `node --test <directory>` fails on this runtime whatever the
270
+ directory holds, so every mutation came back caught. The harness now names the
271
+ test files and runs each of its verify commands on the clean tree before it
272
+ starts, and refuses to run at all if one of them does not pass. Five mutations
273
+ then survived, every one of them a test that could not fail: a completion list
274
+ filtered by a word the assertion was about, a signature rendering compared with
275
+ the mapping it came from, a stale cache handed an empty cache to be stale with.
276
+ All five are caught now, and a control change that nothing should catch is
277
+ checked to be caught by nothing.
278
+
279
+ ## 0.2.0
280
+
281
+ **This release is the studies surface, finished.** A script compiles in a browser
282
+ tab in milliseconds and computes, bar by bar, the same numbers everywhere. One
283
+ hundred and one independently written studies compile, load and run; five of
284
+ them match arithmetic transcribed from `stdlib.md` section 20 alone, bit for
285
+ bit, warmups included. The chart adapter turns a compiled study into an
286
+ indicator descriptor, and a stored setting now reaches a declaration option
287
+ through it.
288
+
289
+ **Upgrade for studies. Do not upgrade expecting a backtest or an editor.** There
290
+ is no equity curve, no drawdown, no trade list and no reproducible run: that is
291
+ Phase 5. There are no editor functions: that is Phase 4. There is no second
292
+ engine and no conformance suite, so the portability claim is still a design
293
+ rather than a result: that is Phase 6. `README.md` says the same in the same
294
+ words, because the registry page must not overstate.
295
+
296
+ **The order surface changed a great deal and is not finished.** A strategy can
297
+ place orders through a host and the ledger refuses what the specification says
298
+ to refuse, but six rounds of adversarial work on it each found a real defect,
299
+ and the entries below are mostly that work. If you are building on orders, read
300
+ them. If you are building on studies, the short version is that nothing in the
301
+ study path changed under you.
302
+
303
+ Previously published as `0.1.0-alpha.0` and `0.1.0-alpha.1`, which parsed and
304
+ did not compute. This version takes `latest`.
305
+
306
+
307
+ **A bracket now names the position the strategy is actually holding.** `exit()`
308
+ and `order.bracket()` hand the host the position reference they protect, and
309
+ `host-interface.md` 7.1 tells a host to look that reference up only when it is
310
+ not `0`, because `0` means the leg holds nothing yet. The reference was a slot
311
+ on the position book rather than an answer worked out from it: set when a
312
+ reference was minted, cleared when that one reference returned to zero, and
313
+ never pointed at another. So a leg holding two positions, whose newer one closed
314
+ while the older one was still held, reported holding none, and the bracket went
315
+ out carrying `0` while the strategy held ten units. The same slot read the other
316
+ way named a reference nothing ever opened: a reference minted for an order the
317
+ destination then refused stayed the answer for every bracket after it, so the
318
+ intent carried a number a host reconciling against its own positions cannot find
319
+ on the other side. Neither needed an unusual destination. One entry, one
320
+ opposing entry large enough to open a second position and an ordinary partial
321
+ fill reach the first. **The reference is now derived from the leg's own book**:
322
+ the newest position its fills have settled anything on, and the position it is
323
+ opening only where nothing has settled at all, which is the order `stdlib.md`
324
+ 17.7 states the two in. Both pages now say which position is named where a leg
325
+ holds more than one.
326
+
327
+ **The arithmetic manifest now measures what it prints, and a check keeps it
328
+ that way.** `stdlib.md` section 20 is the page a second engine implements its
329
+ arithmetic from, and the way it goes wrong is always the same: a figure is
330
+ measured once, printed beside a refusal, and believed forever. Three sentences
331
+ there are corrected. `linreg` said its sums over `x` were "formed as written",
332
+ which covered a real refusal and a spelling that cannot be failed: splitting the
333
+ divisor of the sum of squares into the 2 and the 3 it is made of differs on 3716
334
+ of the whole lengths from 1 to 100000, first at 15, where it gives
335
+ 1014.9999999999999 against 1015, while the grouping of the products cannot
336
+ differ at any length a window can have. `wma` said its divisor was "computed as
337
+ written" and nothing about how it is written changes its value. And 20.2.1 said
338
+ a carried total is not bit-identical to a fresh sum on any bar, which is false:
339
+ it agrees on 236 of the 19981 windows at length 20 over a walk of twenty
340
+ thousand bars, and what is true, that it differs on the other 19745 and drifts
341
+ further as the history grows, is now the sentence. **A new check,
342
+ `scripts/check-section-20.mjs`, requires every count the section prints to be
343
+ read back out of the page by a test that measures it again**, so a figure
344
+ quoted there and measured nowhere fails the build. It found the three counts the
345
+ exponential mean prints, which a test quoted in a comment and asserted nothing
346
+ about.
347
+
348
+ **A close now flattens the part it was told to flatten, on the side that reduces
349
+ it.** `close(tag)` took its direction from the leg's net rather than from the
350
+ part the tag names, so it could send an order that **added** to that part. A leg
351
+ holding ten long under one tag and four short under another is a net six long,
352
+ and closing the short part was answered with a sell of four: that part went to
353
+ eight short, the other tag's long was cut to six, and a call named `close` had
354
+ opened position. This is the shape a hedge is written in, and `stdlib.md` 17.2
355
+ says of the reading that takes the leg's net that it would let `close` open a
356
+ position. Three things follow it and are now held: what is already working
357
+ against a part is counted on the part's own side, so a second `close(tag)` holds
358
+ back the close already on its way instead of sending the part again; a part on
359
+ the side its leg is not on is closed by the whole of itself rather than by
360
+ whatever the leg has left, because closing it moves the leg away from zero; and
361
+ a part whose position has already returned to zero sends nothing rather than
362
+ opening it again.
363
+
364
+ **A position reference no longer reads as the side it is not on.** A reference's
365
+ side was read from what had settled on it plus what a reduction claimed of the
366
+ **leg** at the moment it was sent, and those two numbers can drift apart. A
367
+ second stated close claims nothing, because the first already spoke for the
368
+ whole leg, and it still fills and still reduces what has settled: the sum went
369
+ negative, the reference read short while it was long, and an entry opposing it
370
+ was handed it as an order that **adds**. Under a declaration counting in lots,
371
+ cash or an equity percent, `buy(qty = 10)` and then two closes of one and a
372
+ `sell(qty = 9)`, with every order answered in full and nothing rejected, left
373
+ reference 1 having opened ten long and settled one short. A reference is now
374
+ measured against the orders' own sizes, which fall as a fill arrives, so the two
375
+ halves of that sum cannot drift.
376
+
377
+ **Two more, both found by the properties rather than by reading, and both the
378
+ same sentence: a close is sent against the position it is closing.** A close
379
+ whose quantity the engine cannot count in units was handed the reference an
380
+ entry was opening on the other side, where the leg's own long was entirely
381
+ inside an order the destination still had. And a bracket minted a position
382
+ reference when the leg was flat, so a script whose first order call is `exit()`
383
+ or `order.bracket()` burned reference 1 on an instruction that appends no row
384
+ and moves nothing: the entry after it opened on reference 2, and the bracket
385
+ carried a reference no order ever shared, which a host reconciling intents
386
+ against positions cannot find on the other side. **A bracket now carries the
387
+ position it protects, and `0` where the leg holds none**, which is what a
388
+ cancellation has always carried; `host-interface.md` 7.1 says so for the party
389
+ that has to read it.
390
+
391
+ **`order.reverse` is unchanged, and now says why.** Its opening half mints a
392
+ position of its own without going through the division every other entry takes.
393
+ That is correct by construction rather than an omission: a reference minted
394
+ there has nothing on it, so the order cannot cross it. Dividing it instead is a
395
+ defect, because the orders of a call are all mapped before any of them appends a
396
+ row, so the opening half would be divided against the very position the closing
397
+ half is flattening. `tests/engine/parts.test.ts` pins the reference now as well
398
+ as the quantities.
399
+
400
+ **How much of this is checked rather than promised.** Two thousand generated
401
+ scripts, ten bars each, against a destination that answers late, partially, out
402
+ of order, with rejections, with more than was asked, with a frame repeated, with
403
+ a stale quantity restated after a later one, and not at all. The oracle is
404
+ folded from what the host sent and what it answered and reads nothing the engine
405
+ kept, because an oracle folded from the ledger agrees with the engine by
406
+ construction, which is how both of these defects passed 1414 tests. Every fix
407
+ was then mutated back one at a time and the suite run against each.
408
+
409
+ **An order now knows which position it belongs to.** An order picked its position
410
+ reference by comparing its own side against the leg's net, which is folded from
411
+ settled fills, so while an entry was unanswered the leg read flat and an order
412
+ opposing that entry was not seen as opposing anything: `buy(qty = 6)` on one bar
413
+ and `sell(qty = 9)` on the next, against a destination that had said nothing, put
414
+ both orders on position reference 1, which opened six long and settled three
415
+ short. That is one position holding both signs, which is the single failure the
416
+ position reference exists to prevent, because a fill arriving late can no longer
417
+ say which position it settled. The same script with the entry acknowledged first
418
+ was already correct, which is the whole shape of the defect: **what a bar sends
419
+ must not depend on how fast the destination answers**, and now it does not.
420
+
421
+ A position is measured by what is on it, settled and what is still working
422
+ together. A position with six units still to come is a position holding six, and
423
+ an order that opposes it takes those six off it before it opens anything, because
424
+ otherwise nothing can ever bring that position back to zero. Three more shapes
425
+ went with it. A close after such an entry held nothing back for it and sent the
426
+ position again, which is last round's runaway exit with an entry in place of the
427
+ close. An order agreeing with the leg's net was attached to whichever position was
428
+ current, which during a flip is the one carrying the other sign, so a buy of
429
+ twelve took a position from nine short to three long. And a close or an
430
+ `order.reverse` sized against the whole leg and attached the result to one
431
+ position, with nothing asking whether that position could absorb it: a leg holding
432
+ seventy two short across two positions was handed one order large enough to take
433
+ either of them through zero. Each of them is now one order per position it
434
+ reduces, oldest first.
435
+
436
+ **A close is held to every order already coming off the leg, not only the ones
437
+ that were reductions when they left.** An entry the destination has not answered,
438
+ on a leg the orders after it took the other way, is a reduction now whatever it
439
+ was then. Left out of the count, `close(qty = 12)` against a leg twelve short was
440
+ accepted as true when five of the twelve were already on their way.
441
+
442
+ **Pyramiding counts the entries the leg holds in a direction**, which is what the
443
+ declaration option has always said, and which used to be the same number as the
444
+ entries on one position reference. It is not any more: an entry placed while the
445
+ whole of a position is already in an order the destination still has opens a
446
+ position of its own, because the one it would join is about to reach zero and
447
+ end. And whether an order is an entry at all is now read from the order rather
448
+ than from the leg's net, which calls every order an entry while the leg reads
449
+ flat.
450
+
451
+ **In lots, cash and an equity percent, an opposing entry is still one order, and
452
+ two things about it are now held.** It carries a position reference of its own
453
+ whether or not anything has settled, which is the defect above wearing another
454
+ unit and was not held before. And the position it leaves behind is named again: a
455
+ close works its own quantity out in units, so it is divided across the positions
456
+ holding the leg's side and reaches that one in turn, and it returns to zero as
457
+ soon as the leg's net comes back to its side. What still waits on the instrument's
458
+ lot size is the instruction itself closing it, and a leg whose net never returns
459
+ to that side carries the position for the rest of the run. OS7005's deferral says
460
+ so, and `tests/engine/ending.test.ts` asserts both halves rather than describing
461
+ them.
462
+
463
+ **What no engine answers for, recorded rather than left to be found.** A position
464
+ settles on the side it did not open on only when an order on it was never answered
465
+ in full: one still going, or one that ended rejected, cancelled or expired with
466
+ part of its quantity unfilled. An order divided against an unanswered order is
467
+ placed against units that were promised and may not arrive, and the alternative is
468
+ holding an order back until the destination answers, which is an engine that stops
469
+ trading when a destination is slow. Over six thousand generated runs against a
470
+ destination that answers late, out of order, partially, with a rejection and not
471
+ at all, every position all of whose orders were answered in full ended on the side
472
+ it opened on.
473
+
474
+ **A setting a reader stores now reaches the declaration option it was written
475
+ into.** `docs/inputs.md` teaches `study("S", precision = input(2, "Places"))` as
476
+ how a reader gets to change something the declaration decides. Through this
477
+ package's own chart adapter it did not: `descriptorFor` took no settings at all,
478
+ so `plots[0].priceFormat.precision` was 2 whatever the host had stored, and 5
479
+ when the script wrote `input(5, ...)`, which is the default and not the setting.
480
+ The engine loaded with the same stored value resolved it correctly, so the chart
481
+ formatted a pane at one precision while the column beside it was computed at
482
+ another. `ChartAdapterOptions` gains **`settings`**, and every declaration field
483
+ written as an `input()` now resolves against it: the study's name and category,
484
+ its placement, and every plot, band and alert field. A host that keeps one
485
+ descriptor per study instance passes that instance's stored settings and builds
486
+ again when a user changes one; the parts that follow a later change with no
487
+ rebuild are the calls, `levels`, `range`, the painting hooks and the calculation,
488
+ and which is which is recorded in `spec/chart-narrowings.json` and measured by
489
+ `scripts/check-chart-surface.mjs` rather than promised. One declaration option
490
+ still cannot be tuned and now says so: a plot's `style` is a plain string in the
491
+ compiled format, so an `input()` written there is folded to its default with no
492
+ diagnostic anywhere. That is issue 0018, and closing it is a format change.
493
+
494
+ **And a stored setting the engine will refuse no longer reaches the chart.** The
495
+ change above brought its own defect, in the half of it nothing had asked about:
496
+ the declared shape is built before anything is calculated, so a settings map of
497
+ `{ Places: 99 }` against `input(2, "Places", min = 0, max = 8)` put a precision
498
+ of 99 into `plots[0].priceFormat`, and `{ Places: -4 }` put -4 there. The run
499
+ refuses that map with OS6019 and nothing is drawn, but the descriptor a host was
500
+ handed first carries a number the input forbids, and a host may show it in a
501
+ legend or on a price scale before it asks for a bar. The adapter also kept a
502
+ second idea of an unusable value beside the engine's: a stored `null` or object
503
+ read as the declared default while the engine refused the same map, and a stored
504
+ `"7"` read as neither, landing on the chart's own fallback of 4.
505
+
506
+ Both are one question with one answer now, and it is the engine's own:
507
+ `checkSetting` is the function the load refuses with, and the adapter asks it
508
+ before a load exists. A stored value it will not take reads as the **declared
509
+ default** in the declared shape, and travels to the engine exactly as the host
510
+ stored it, so the run still stops with OS6019 naming the key and the bound.
511
+ Neither half is a fallback: the value is not repaired, and the shape is not
512
+ withheld, because the settings dialog a reader corrects the value in is built
513
+ from it. The incremental path compares what the engine is handed rather than what
514
+ the shape shows, because every refused value shows the same default and a
515
+ signature taken from the shape would keep a held engine across a change from a
516
+ setting that runs to one that cannot. `scripts/check-chart-surface.mjs` moves a
517
+ plot width outside its declared bounds, as text and as `null`, and reads both the
518
+ shape and the run on each.
519
+
520
+ **An input written in place whose title is empty now has a code that is true of
521
+ it: OS3024.** `input(14, "")` raised OS3021, whose message says the input "has no
522
+ title written as a string literal" and whose fix says to give it one. The reader
523
+ had. It was empty, and the sentence told them to make the edit they had already
524
+ made. OS3021 keeps the two programs it describes, an input with no title argument
525
+ and one whose title is not a literal; the empty title is OS3024, whose fix is to
526
+ give the title something to say. Beside it, a decision that had been made by
527
+ nobody is now written down: **an input assigned to a name and given an empty
528
+ title is labelled by the name**, exactly as one given no title is, because a
529
+ named input has its key already and what an empty title costs there is only a
530
+ label. `language.md` 13.4 states it, and a test pins it.
531
+
532
+ **`spec/errors.md` and `spec/errors.json` are now compared in full.** The page is
533
+ named the authority a reader is sent to, and the file is what the compiler is
534
+ generated from, and until now only the test pointer and the two example blocks
535
+ were held to each other: changing one word of a message on the page passed the
536
+ whole build, showing a reader one sentence and the user of the compiler a
537
+ different one. Every heading, first line, message, placeholder gloss, cause, fix,
538
+ deferral and unexercised sentence is now compared character for character, along
539
+ with the two tables outside part 8 that are copies of the file as well. Both of
540
+ those had already drifted: the ranges table said the argument block held 20
541
+ entries and the catalogue held 147, against 23 and 150, and the refinements table
542
+ was missing an entry added in the last release.
543
+
544
+ **The error code check reads the whole tree, not only its Markdown.** Its own
545
+ docstring said "nothing else in the repository gets to invent one" while it
546
+ walked `.md` files, and source comments cite codes heavily: changing one in a
547
+ comment to a code the catalogue does not define passed the whole build. It now
548
+ reads every file the project holds, source and tests and tooling alike, and
549
+ prints the count it read. A number outside every thousand block the catalogue
550
+ declares is not a code and is counted rather than refused, which is what lets
551
+ four checks go on attacking their own rules with a fabricated entry; those
552
+ citations and the files holding them are printed on every run.
553
+
554
+ **Three sentences in `stdlib.md` section 20 fixed nothing and have been
555
+ replaced.** Section 20 is the manifest a second engine implements from, so a
556
+ sentence there that cannot be violated costs an implementer the time the section
557
+ exists to save. `rsi` said that naming the ratio first and writing
558
+ `100 - (100 / (1 + ratio))` was "the same expression with an extra rounding in
559
+ it": there is no extra rounding, and the two spellings are bit identical on every
560
+ value at all three gate lengths. `alma` fixed the grouping of `2 * spread *
561
+ spread`, which cannot differ because one factor is a power of two; the
562
+ arrangement that does differ is the chain of divisions, and that is what it names
563
+ now. `bollinger` said a span was "formed once". 20.1 gains the general rule so
564
+ the next one is caught by reading, and two measured figures that were overstated
565
+ as "most" are now the numbers: `fade`'s refused arrangement differs at 40 of the
566
+ 101 whole percentages, and `math.toDegrees`'s at 26 in every hundred.
567
+
568
+ **A fourth one, and the rule that covers all four.** `swma` said "the two middle
569
+ terms are formed as `2 * value`, and the four terms are added left to right":
570
+ one sentence, one half of which can be failed and one of which cannot, with
571
+ nothing to tell a reader which. Writing `value * 2` or `value + value` instead is
572
+ bit identical on every finite value, measured over 25176 values covering every
573
+ binade of the double range in both signs, the subnormals included. Writing the
574
+ four additions in a different grouping is not: over twenty thousand four bar
575
+ windows of ordinary prices, pairing them differs on 5281, adding right to left on
576
+ 7230, and dividing each term by 6 as it is added on 9564. The entry now states
577
+ both, with the figures.
578
+
579
+ Four sentences of one shape in three rounds is a pattern rather than three
580
+ coincidences, so 20.1 now states the general rule rather than another list of
581
+ instances: **an arrangement is where one rounding falls relative to another**.
582
+ Only an operation that rounds can be part of one, and two operations that do not
583
+ read each other have no order between them. The three things that fixed nothing
584
+ become four, gaining the exact respelling of a step that does not round (`2 * v`,
585
+ `v * 2`, `v + v`; `v / 2`, `v * 0.5`) and the order of accumulations that do not
586
+ read each other, and the section now states the test a sentence has to pass to go
587
+ in it: name the second arrangement it refuses and count where the two differ. The
588
+ whole of section 20 was swept against that test, which found two more: `linreg`
589
+ and `covariance` fixed the pass structure of accumulations that never read each
590
+ other, `covariance`'s down to the order the three are written in. Both now fix
591
+ what is real, which is that each total runs oldest first. `tests/stdlib` reads
592
+ every figure above out of the page and measures it again, so rewording a claim or
593
+ moving a figure fails a test instead of going on being quoted.
594
+
595
+ **CLAUDE.md rule 5 now says what its check covers.** "Name nobody. No outside
596
+ product, platform, company, trademark, market index or real instrument,
597
+ anywhere" is enforced by a fixed list of eighteen products and thirteen indices.
598
+ A name on the list is caught in any file and a name that is not on it passes,
599
+ which is the only mechanizable form of the rule; the rule was written as though
600
+ the check covered all of it. It now says which half is mechanical and which is
601
+ attention, and `scripts/check-names.mjs` says the same in its passing line,
602
+ because a green build read as proof of something wider is the way this one fails.
603
+
604
+ **A close still working at the destination is no longer sent again on the next
605
+ bar.** A position moves when a fill settles and from nothing else, so an order a
606
+ strategy has sent and not had answered has moved no position figure: the leg
607
+ still reads what it held before it left. The previous release held the orders of
608
+ one bar against that, and one bar out the defect was still there. Measured, with
609
+ the entry acknowledged and the closes not acknowledged, on the plainest exit a
610
+ strategy can write:
611
+
612
+ ```
613
+ strategy("P", qty = 3)
614
+ if bar.index == 0
615
+ buy(qty = 3)
616
+ if bar.index > 0 and pos.size > 0
617
+ close()
618
+ ```
619
+
620
+ six bars sent one close per bar and netted **twelve short** under one position
621
+ reference, ten bars netted twenty four, and it grew with the run. With the closes
622
+ filling one of three at a time it sent 3, then 3, then 3 and ended three short.
623
+ Nothing was reported, on a leg that opened long three, and a destination slower
624
+ than the chart is the whole of what it takes. The script was not wrong: `pos.size`
625
+ is folded from settled fills and correctly still read three.
626
+
627
+ **What is available to reduce is now the settled position less everything already
628
+ working against it**, over the run rather than over the bar, which subsumes the
629
+ bar rule rather than sitting beside it. What is working is read from the ledger:
630
+ an order that has not ended and has not fully filled, counted by the part of it
631
+ that has not filled. A partial fill releases what settled, so three sold with one
632
+ filled leaves two working and the next close sends two. A rejection, a
633
+ cancellation or an expiry releases the rest, and the script may close again.
634
+ `cancel()` is the way out of a destination that never answers, and it now works
635
+ end to end. An unsettled entry adds nothing to what a close may reduce, because
636
+ nothing has settled. `close(qty = ...)` against a leg whose close is already
637
+ going is **OS7017** naming nothing left, where before it sent the position a
638
+ second time.
639
+
640
+ **A crossing entry carries a position reference of its own in every `qtyType`.**
641
+ Under `"lots"`, `"cash"` and `"equityPercent"`, `buy(qty = 3)` then `sell(qty = 9)`
642
+ sent one order on the outgoing position's reference: at a lot size of twenty five
643
+ the destination saw reference 1 go from seventy five units to minus one hundred
644
+ and fifty, which is the crossing the split exists to prevent. Dividing the
645
+ quantity into a closing half and an opening half needs the instrument's lot size
646
+ and still waits on it, but **minting a reference needs no arithmetic**, so it is
647
+ done in all four. What still waits is written where a reader meets it, in
648
+ `stdlib.md` 17.1 and in OS7005's deferral: the outgoing position is not closed by
649
+ an order of its own.
650
+
651
+ **`pos.avgPrice` is now averaged over the positions on the side the leg holds.**
652
+ A leg holds more than one position whenever an opposing order is outstanding.
653
+ Summed across both, the cost of a position on its way out was subtracted from the
654
+ cost of the one on its way in: three hundred bought at one hundred beside two
655
+ hundred and twenty five sold at one hundred and ten reported an entry at
656
+ **seventy**, and every level measured from the entry would have been measured
657
+ from that. It also corrects the same blend during a flip, where a leg long three
658
+ at one hundred with a new short five at one hundred and ten reported one hundred
659
+ and twenty five.
660
+
661
+ **An order that names a `leg` is now refused: OS3023.** `stdlib.md` promised that
662
+ a leg outside the declared names was refused, and nothing raised it:
663
+ `buy(qty = 3, leg = "nosuchleg")` placed the order on the only leg with no
664
+ diagnostic, and a computed name was ignored too. The sharp case is
665
+ `buy(qty = 3, leg = "a")` followed by `close(leg = "b")`, which flattened the
666
+ position: a script that named one leg and closed another traded the leg it did
667
+ not name and was told nothing. Leg declarations are planned, so no file can
668
+ declare one, so there is no name the argument could carry; it is refused whatever
669
+ it holds and whether the name was written or computed, and the fix is to take the
670
+ argument out. It is a code of its own rather than OS3008 because OS3008's fix
671
+ sentence is "use one of these values" and here there are none, and a fix a reader
672
+ cannot act on is worse than no fix.
673
+
674
+ **Two sentences of `stdlib.md` 17.1 corrected.** One claimed the engine held
675
+ every order it can read in units to "no order crosses zero" bar one named
676
+ exception; the across-bars case above was entirely in units and was not that
677
+ exception, so the engine was made true and the sentence now says what is. The
678
+ other, "a bar declared `onUnconfirmed` is one bar however many times it is
679
+ executed", is true of the reducing count and read as a general rule about the
680
+ bar: on such a bar executed four times a close sends one order and `buy(qty = 3)`
681
+ sends four, which is `language.md` 7.5 working as designed. The sentence now
682
+ carries its scope, and both halves are asserted in tests.
683
+
684
+ **A settings value now stays on the row it was stored for.** An `input()` may be
685
+ written anywhere a value belongs, and one written in a declaration option or
686
+ inside a larger expression is bound to no name, so it was keyed by its position:
687
+ `input0`, `input1`, `input2`. `host-interface.md` 8.1 promises a key that
688
+ "survives every edit that does not rename it" and a positional key survives no
689
+ edit at all. Measured end to end, on a file with three tunables in it, inserting
690
+ one in the middle and renaming nothing moved the keys down and put the value a
691
+ user had stored for Width onto Smoothing, silently, because 8.3 validates a
692
+ number against a number and both are numbers. A delete and a reorder did the
693
+ same. **An input written where a value belongs is now keyed by its title**, which
694
+ is what the user sees on the row and what changing is the rename 8.1 excepts; an
695
+ input bound to a name is keyed by the name as before, and `var len = input(...)`
696
+ is the named form, so adding or removing the word does not move a stored value.
697
+ Uniqueness is held by refusing rather than by a suffix, because a suffix is a
698
+ position again: an input with neither a name nor a title written as a string
699
+ literal is **OS3021**, a title spelling another input's name is **OS3022**, and
700
+ two inputs carrying one title were already OS3017. This changes the stored key of
701
+ every input written in place, and there were none to change: across the gate
702
+ studies, the gate scripts and `examples/`, 0 of 241 inputs carried a generated
703
+ key, because until the previous entry below closed, such an input did not compile
704
+ at all.
705
+
706
+ **An `input()` may be written inside a read's expression.** `req.timeframe("1D",
707
+ high + input(1, "K"))` produced exactly one diagnostic, OS6018, whose message
708
+ tells the reader that if nothing else was reported their correct script came from
709
+ a broken compiler. Nothing forbade the script: `language.md` 13.4 forbids an
710
+ input in a block and in a function, a read's expression argument is neither, and
711
+ `stdlib.md` 15.4 already permitted a **name** bound to an input there, for a
712
+ reason that is about the setting rather than about the name. The compiled format
713
+ already carried the mechanism as well, in the `inputs` list a read's body has had
714
+ since `compiled-program.md` 2.16: the engine resolves the key in the enclosing
715
+ program before the body runs and fills a register of the body's own table. The
716
+ call now resolves through the same scope the name does, and two reads of one
717
+ setting inside one body share one register. A `var` holding a setting is still
718
+ OS6003 there, because a later assignment may change it.
719
+
720
+ **`var len = input(14, "Length")` no longer compiles to a dead settings row.** It
721
+ was accepted with no diagnostic and read absent on every bar: the name was given
722
+ one slot, the input another, and nothing joined them, so a user got a row in the
723
+ dialog they could move that changed nothing. It is now an ordinary `var` whose
724
+ initial value is the setting, which is how a running total starts from one. A
725
+ setting cannot change mid-run, so a `var` nothing assigns to holds exactly what
726
+ the plain form holds; what the word buys is the assignment. The name is not the
727
+ setting, though: a `var` is a cell a later assignment may change, so it is
728
+ OS3003 in a declaration option and OS6003 inside a read's expression, like any
729
+ other per-bar name.
730
+
731
+ **A hole in the compiler's own copy of verification check 5.** The check is three
732
+ sentences, and only two were walked: the depth agrees on every path, and it never
733
+ goes below zero. The third, that it is zero at the terminator, is not a
734
+ restatement of the second, because a `RET` reaches nothing after it: a body one
735
+ value short is at minus one exactly at the `RET`, where the walk asked nothing,
736
+ and the walk finished clean. That is how a read's expression with an `input()` in
737
+ it came to be emitted as a body no conforming engine will load, found by an
738
+ engine rather than by the compiler that wrote it. Every `RET` and every `HALT` is
739
+ now checked, rather than the last instruction, because an early `return` is a
740
+ terminator too.
741
+
742
+
743
+ **Every worked example in the error catalogue is now compiled, and every
744
+ pointer in it resolves.** The catalogue carries a before and an after block per
745
+ entry. The after block is the fix a reader is handed at the moment they are
746
+ stuck, and they paste it; nothing had ever put one through a compiler. That is
747
+ how OS7009's fix came to call a function the language does not have, be cited in
748
+ five documents and sit there being read. Four more did not compile: OS7012's
749
+ names a planned call, OS1023's puts a `plot` inside an `if`, and OS1022's and
750
+ OS3003's were both refused by the emitter, which was a defect in the emitter and
751
+ is fixed below. OS3003's example is back to the input form its own fix sentence
752
+ names. OS1022's stays as deleting the trailing operator, on its own merits: the
753
+ statement was already complete before the stray operator, and supplying an
754
+ operand instead invents a number the reader never wrote. Five compiled and warned, which is the compiler complaining about
755
+ the reader for doing what it had just told them to do. Every after block now
756
+ compiles with no diagnostic, bar the two warnings that say a fragment stopped
757
+ rather than that it is wrong.
758
+
759
+ The before blocks were held to the code they are filed under, by compiling them
760
+ and, for a runtime code, by loading the program on a host and running it over a
761
+ fixed dataset on two venues. Seven were about a different code than the one they
762
+ were printed under. OS3001, wrong number of arguments, showed a call with one
763
+ argument missing, which is OS3012. OS3004, a literal that is not a whole number,
764
+ showed a computed value, which is OS4003 on a bar. OS4003 showed an array index,
765
+ which `compiled-program.md` assigns to OS4004. OS4002, a read past the retained
766
+ depth, declared no depth to pass. OS7010, a bracket on the wrong side of the
767
+ entry, read the entry price on the bar the entry was placed, where it is absent,
768
+ so the refusal a reader would have met is OS7002. Each of those is now the
769
+ example its own code is about. Four codes are ceilings an example cannot reach,
770
+ a million array elements among them, and each of those entries now carries an
771
+ `unexercised` sentence saying so, which expires by itself the day one is proved.
772
+ Eight entries whose example is the host's input rather than a script say that in
773
+ an example `kind`, and are held to it: a block declared not to be source that
774
+ compiles fails the build.
775
+
776
+ Every entry also used to carry `"test": "tests/errors/<CODE>"`, and that
777
+ directory has never existed in any commit. A hundred and forty-five pointers,
778
+ every one dead, printed as "Test `tests/errors/OS7009`" beside a rule promising
779
+ that every entry has a test. They now name a file under `tests/` that writes the
780
+ code, or `null`. Twenty-four codes carry the null, seventeen of them deferred and
781
+ seven taught as current behaviour and exercised by nothing, which is printed on
782
+ every run and recorded as an issue rather than papered over with a row somebody
783
+ invented. `spec/errors.md` part 8 is compared with `errors.json` character for
784
+ character for the pointer and both example blocks, because it is a copy and this
785
+ pair had drifted for every entry at once.
786
+
787
+ Two checks, `scripts/check-examples-compile.mjs` and
788
+ `scripts/check-catalogue-tests.mjs`, enforce all of it, and both say what they
789
+ cannot reach and count it: eleven host codes are the host's own answer and this
790
+ harness drives one host, so they are compiled, run, and listed by name as not
791
+ proved on every run.
792
+
793
+ **The order layer now refuses what the specification says it refuses.** Eight
794
+ codes of the orders range were written into the catalogue, taught across five
795
+ documents in the present tense, credited by a shipped example with protecting it,
796
+ and raised by nothing: an order call became an intent and was held against no
797
+ rule at all. Measured on a host built from the page, an absent quantity was
798
+ replaced with the declaration's size and filled, two opposite orders on one bar
799
+ both filled while the position read zero for the whole run, a pyramiding limit of
800
+ one let three entries through, and a typed order with no price for that type went
801
+ out unrefused. OS7002, OS7004, OS7006, OS7007, OS7008, OS7009, OS7010 and OS7013
802
+ are now raised at the call that wrote them, and each of them refuses before
803
+ anything is handed over: every order call on a bar is mapped before any of them
804
+ is routed, so a refused order reaches no destination rather than being sent and
805
+ then reported. OS7005, OS7011, OS7012, OS7014 and OS7015 stay deferred in the
806
+ catalogue, each with the sentence saying what has to exist before it is raised.
807
+ An argument the script left out and an argument it wrote that came out absent are
808
+ no longer one thing. They used to be: two of an order call's defaults are absence
809
+ itself, the compiler substituted them, and `buy()` and `buy(qty = none)` compiled
810
+ to byte identical programs, so OS7002 had nothing to fire on. The catalogue's own
811
+ worked example for that refusal, `buy(qty = 1, stop = lowest(low, 20))`, placed a
812
+ market order on every bar of the twenty bar window and then stop orders: a stop
813
+ entry silently became a market entry on every warmup bar. An order call now
814
+ carries the names of the arguments the script wrote, so `buy()` still takes the
815
+ declaration's size and `buy()` with neither price is still a market order, while
816
+ every order argument written as a value that came out absent, a quantity, a
817
+ limit, a stop, a trigger, a type, a tag, a bracket's target or its distance, is
818
+ OS7002 naming that argument and reaches no destination. The example that credited OS7013 with a
819
+ protection now says what that refusal covers and what the shape of the script
820
+ covers.
821
+
822
+ **A `close` that could never close anything is now refused, and the repository
823
+ now says one thing about what a tag argument means.** `close(tag = "entryy")`,
824
+ a tag no order in the file is placed with, sent nothing and said nothing: the
825
+ position stayed open and the script believed it had flattened. It is now OS7016,
826
+ reported at the call before any bar runs. The checker rather than the engine,
827
+ because the engine cannot tell that mistake from an ordinary bar: a tag that has
828
+ never named a ledger row is also what a working script looks like before its
829
+ entry has fired, and refusing that would stop a strategy whose exit signal simply
830
+ came first, with no guard available to write, since every call that reads the
831
+ ledger is planned. A file, unlike a run, is complete. What is not refused, and is
832
+ covered by a test of its own so that it stays that way, is a close on a tag that
833
+ holds nothing right now: closing the same tag twice sends one order and says
834
+ nothing about the second call.
835
+
836
+ Underneath it is a rule that was always in the signatures and had never been
837
+ written down: **a tag that defaults to the empty string is a label the call
838
+ carries to the destination, and a tag that is required or defaults to absence is
839
+ a reference to something that has to exist.** The catalogue disagreed with it.
840
+ OS7009's worked example was a bracket whose tag named no order, presented as a
841
+ refusal, while the engine sends that bracket without a word, as it should: a
842
+ bracket sets the leg's own level and its tag rides along as a label. The example
843
+ is now a cancellation, which does raise the code. OS7009's fix was worse than
844
+ wrong: it told the reader to test `order.working(tag)`, which is marked planned,
845
+ so the fix the catalogue handed a reader was itself a refusal. Both halves now
846
+ say something that compiles today.
847
+
848
+ **A strategy's position is folded from what it traded, and a host is no longer
849
+ asked for one.** The five position facts answered from a position row on the
850
+ engine's host type, which no specification document describes and which a host
851
+ built from the page does not supply. On such a host every one of them read
852
+ absent, so a guard written `flat = pos.size == 0` was absent rather than true,
853
+ the branch was not taken, and a strategy shipped in `examples/` placed no orders,
854
+ raised no diagnostic and drew its plots as though it were working. The run now
855
+ keeps the ledger those facts were always documented to come from: an order call
856
+ becomes the order intents the host interface specifies, each intent appends a
857
+ row, and the cumulative frames a host reports fold into those rows exactly as the
858
+ library page's fold says, including the repeated frame that must cost nothing and
859
+ the fill that arrives after a cancellation and must not be thrown away. What a
860
+ script reads is what that strategy traded, which is the point: an account
861
+ position row is shared with every other strategy and every manual trade in the
862
+ same contract, so a size computed against one is computed against somebody
863
+ else's. The position option on the chart adapter is gone with it.
864
+
865
+ **A host can now deliver an order frame.** Sending cumulative frames has been a
866
+ conformance duty since the host interface page was written, the frame was
867
+ specified in ten fields, and no engine exposed anywhere to put one: an
868
+ implementer working through the list searched for an interface that was not
869
+ there. An engine that takes orders now takes a frame at any moment between bars,
870
+ folds what arrived at the bar boundary so that every position fact is constant
871
+ for the length of one execution, and reports on that bar what each frame did,
872
+ a refused one included.
873
+
874
+ **A series the engine cannot run on is now refused instead of computed on.** Two
875
+ codes the host interface page requires, OS6010 for no bars at all and OS6011 for
876
+ a bar whose time does not follow the one before it, were in the catalogue and in
877
+ the conformance list and were raised by nothing. A host handing over an empty
878
+ dataset, a swapped pair or the same timestamp twice was accepted in silence and
879
+ the study computed on it, which is the worst failure this project has: not a
880
+ crash, a wrong number nobody is told about, entering at the boundary so that
881
+ every value downstream is confidently derived from bars that were never valid.
882
+ Both are now raised, at the hand-over, on the whole-dataset path and the bar at a
883
+ time path alike, and a refused series stops the run. The cost is one comparison
884
+ per bar handed over: about half a millisecond over fifty thousand bars, against a
885
+ full compute of the same history that the benchmark records at a hundred and
886
+ eighty five milliseconds, and it is paid where the bars arrive rather than on
887
+ every execution of them.
888
+
889
+ **A read the host refused now reports its reason when it is written inline.**
890
+ `req.error(read)` and `req.isReady(read)` answered about a read assigned to a
891
+ name and answered nothing at all about the same read written out inside the call:
892
+ the compiler resolved it to a handle and emitted no request under it, so the host
893
+ was never asked and the script was told nothing was wrong. A study that draws
894
+ nothing while its own diagnostics say nothing is wrong is the worst version of a
895
+ silent failure, because the user has already looked and been sent to look
896
+ elsewhere. A read written inline is now a read like any other: it is emitted, the
897
+ host is asked about it, and its refusal reaches the script. Two reads written in
898
+ one file are two requests and count as two against a host's ceiling, which
899
+ `spec/host-interface.md` section 5.2 now states.
900
+
901
+ **A request now carries what the host interface page says it carries.** A host
902
+ built from `spec/host-interface.md` section 5.2 alone could not implement duty 3:
903
+ the table printed six fields, three of which never arrived, and the request
904
+ carried three more the table did not print. The request is now `id`, `read`,
905
+ `instrument`, `exchange`, `timeframe`, `mode` and `warmup`, on the page and in
906
+ the engine. `symbol` is `instrument`, which is what the page calls it and what
907
+ section 9 says it is; `read`, `mode` and `warmup` are documented, because the
908
+ engine sends them and they are each worth having; and `from` and `to` are gone
909
+ from the page, because the whole set of requests is settled before bar 0 and at
910
+ that moment the engine holds no bars and has no span to state. The page now gives
911
+ the arithmetic instead: the chart's own span, extended backwards by `warmup`
912
+ requested bars, worked out by the host, which is the side that has the bars.
913
+
914
+ **A read of another instrument is now told which exchange to resolve it on.**
915
+ `req.symbol`'s `exchange` defaults to `chart.exchange` in `stdlib.md` 15.1, the
916
+ compiled format spells the omission as an absence meaning the chart's own, and
917
+ the engine passed the absence straight through. A host was therefore left to
918
+ resolve an instrument on no venue at all wherever a script did not name one,
919
+ which is a different contract wherever a ticker is listed twice. The engine now
920
+ resolves it, along with the identity of a read of the chart's own instrument,
921
+ so every request carries an identity and a venue rather than a rule to apply.
922
+
923
+ **An instrument record that contradicts itself is now refused at load.** A host
924
+ that stated a `session` and no `timezone`, a session spelled `"9:00"` rather than
925
+ `"09:00"`, or days numbered from Sunday as zero, lost `vwap` and every session
926
+ study on every bar with nothing reported anywhere, because that is exactly what
927
+ an instrument with no schedule looks like. Each of the three is OS6012 at load
928
+ naming what is missing, and so is a timezone no calendar can read. A host that
929
+ states no session at all is unchanged and still conforming: the per-bar session
930
+ facts are absent and a script tests for them.
931
+
932
+ **An alert's message now carries the bar that fired it.** A study that computed
933
+ `"crossed up at " + text(close, 2)` sent a notification reading "Crossed up", the
934
+ declared title, on every alert this adapter has ever raised. The message is a
935
+ string per bar, so it cannot travel in the table of numbers a calculation
936
+ returns, and it was left out on the ground that nothing carried it across. The
937
+ chart's own entry takes a function of the same context its condition was judged
938
+ on, and that context carries the settings object, which is how every other hook
939
+ here finds the run it is reading. So the message is read from the run at the bar
940
+ that fired, and an alert whose message was absent on that bar still falls back to
941
+ the title, which is what a chart does for an entry that states no message at all.
942
+
943
+ **A `draw` setter now takes only the objects it can move.** Eleven of the
944
+ fourteen setters declared their object argument as "whatever you give me",
945
+ because the real type is a set of kinds and there was no way to write one. So
946
+ `draw.setFrom(aLabel, t, p)` compiled, wrote an anchor a label has no field for,
947
+ drew nothing and reported nothing, and `draw.setColor(5, red)` compiled as
948
+ readily. Each setter now names the kinds that carry the property it writes, which
949
+ is the kinds whose creation call takes that argument, and a call that misses is
950
+ OS3011 at that argument with the kinds it does take in the sentence. A
951
+ declaration handle in the same place keeps OS3019. Two documentation tables
952
+ promised more than any kind carries, `setStyle` on a box and `setTooltip` on a
953
+ line, and they now say what is drawn.
954
+
955
+ **A second declared grid is still dropped, and the drop is now written down and
956
+ checked.** A chart pane has one grid and the language declares as many as it
957
+ likes, so a study with two panels draws one, and nothing said so anywhere. The
958
+ refusal that belongs there cannot be written: it needs a catalogue code for a
959
+ host that cannot draw something a study declares, the catalogue has none, and
960
+ this project reports the gap rather than inventing one. It is reported in
961
+ `issues/0011`, with the sentence the entry should carry, and the documentation
962
+ for tables now tells a reader that the first declared grid is the one drawn.
963
+
964
+ Meanwhile the class is checked instead of promised. `spec/chart-narrowings.json`
965
+ records every field and every count the chart adapter does not carry, each with
966
+ its reason, and `scripts/check-chart-surface.mjs` compiles a study that declares
967
+ two of everything, builds a descriptor from it, and fails the build on a declared
968
+ field the record does not mention, a record entry the compiled format no longer
969
+ has, a narrowing recorded with no reason, and any declaration dropped whose limit
970
+ is not recorded. It also reads the mapping back out of a run, so a field recorded
971
+ as carried cannot be a claim. The record began with eight narrowings, one of them
972
+ found by writing it: a band whose colour is computed per bar has no per-bar colour
973
+ in a chart's band and is drawn in the first plot's colour.
974
+
975
+ **Every documented default now reaches the call.** `atr()`, `rsi(close)`,
976
+ `bollinger(close)`, `macd(close)`, `stoch()`, `psar()`, `supertrend()`, `adx()`,
977
+ `keltner()`, `donchian()`, `cci()`, `williamsR()` and the rest: twenty-nine calls
978
+ out of thirty-one, written exactly as the library reference prints them,
979
+ compiled with nothing reported, loaded with nothing reported, ran to the last bar
980
+ and drew no value on any bar. The reference gives each of those arguments a
981
+ default, the surface recorded only that the argument was optional, and an
982
+ argument left out reached the engine as absence, where a lookback of an absent
983
+ length answers absence for ever. Only the calls whose length was written out drew
984
+ anything.
985
+
986
+ The hundred and sixty missing defaults are now written into the surface, taken
987
+ from the reference, and an omitted argument is filled with the value the
988
+ reference prints. `vwap()` reads `hlc3`, a calendar call reads the chart's
989
+ timezone, and a grid cell written with no alignment is aligned left, each exactly
990
+ as writing the argument out would have done. A warmup follows its default too: an
991
+ omitted length used to weaken a study's warmup to a floor, so `atr()` promised
992
+ "no earlier than" where `atr(14)` promises bar 13. Both now promise bar 13.
993
+
994
+ A check refuses the class rather than the instance. An optional parameter must
995
+ either carry the default the specification states, spelled as the specification
996
+ spells it, or be recorded in `spec/default-exceptions.json` with what the
997
+ specification says in place of a value and why that is not one. Neither is a
998
+ defect and both is a contradiction, and a default the surface invented or one
999
+ that has drifted from the specification fails the build as well. Seventeen
1000
+ parameters are recorded: the leg an order acts on and the size the `strategy()`
1001
+ declaration sets, which the library has no value for, and one row that states no
1002
+ mode where the two beside it do.
1003
+
1004
+ **The library the reference page promises now runs.** Ninety-five names compiled
1005
+ and were then refused at load with an error that named a function and gave no
1006
+ reason. Every one of them is settled: it either runs or says it is planned at the
1007
+ call, where you can see what you wrote.
1008
+
1009
+ Sixty-three names that could not run now do. The moving averages `dema`, `tema`,
1010
+ `vwma`, `swma`, `alma`, `linreg` and `ma`; the trend frames `psar`, `adx`,
1011
+ `aroon` and `ichimoku`; the oscillators `stoch`, `stochRsi`, `ppo`, `cci`,
1012
+ `williamsR`, `tsi`, `trix`, `cmo`, `dpo`, `ultimateOsc` and `awesomeOsc`;
1013
+ `keltner`, `chop` and `hv`; the whole of the volume section, `vwap` and
1014
+ `vwapAnchor` among it; `percentRank`, `correlation` and `covariance`; every
1015
+ calendar call in `date`, and `session.isIn` with them; and the six instrument
1016
+ facts `chart.timezone`, `chart.pointValue`, `chart.currency`,
1017
+ `chart.instrumentType`, `chart.hasVolume` and `chart.hasOpenInterest`.
1018
+
1019
+ The arithmetic for the studies was already written and gated against reference
1020
+ vectors; what was missing was a form an engine could drive a bar at a time, so
1021
+ each one is now a step over a state region like the rest of the library, and its
1022
+ whole-series form is that step folded. There is still one implementation of every
1023
+ formula, and the engine holds none of it.
1024
+
1025
+ The calendar is new. It reads an instant in a named zone using the runtime's own
1026
+ timezone database rather than a table copied into this package, because a copied
1027
+ table goes stale silently in exactly the way a fixed offset does. Two readings
1028
+ that have no single instant are settled in the specification rather than left to
1029
+ an engine: an hour a spring change removed resolves to where it would have been,
1030
+ and an hour an autumn change repeated resolves to the first of the two.
1031
+ `date.weekOfYear` is the ISO week, which the specification now states.
1032
+
1033
+ Fifty-nine names are now marked planned instead of failing at load. The strategy
1034
+ surface, everything in `order`, `leg` and `book` that is folded from a ledger, and
1035
+ the position facts beyond the five an engine reads from the account's own row: no
1036
+ engine holds a ledger in this release. So are the four session facts read off the
1037
+ instrument's trading hours, which the engine's host record does not yet carry.
1038
+ Nothing was removed from the specification; a marked name is refused where it is
1039
+ written, with a message saying it is planned.
1040
+
1041
+ A test now fails the build if a name the checker accepts can neither run nor says
1042
+ it is planned, so this cannot come back quietly.
1043
+
1044
+ **Three diagnostics now say what is true.** Calling or reading a name the library
1045
+ lists as planned reports OS2020, whose message says the name is planned. It used to
1046
+ report OS2001, which told a reader the name was not defined at this point in the
1047
+ file and offered them a different function as the fix. OS2004 no longer tells a
1048
+ reader to assign the value to a name at the top level in the case where it already
1049
+ is one: a declaration handle, a runtime object and a library fact that is not a
1050
+ series have no history whatever they are named, and the fix now says so. OS6016 no
1051
+ longer describes a program below the engine's format as though it were above it,
1052
+ and says that the major number decides in either direction.
1053
+
1054
+ **The integration guide described a surface the engine does not have.** The page on
1055
+ running the engine told an integrator to hand over columnar arrays, one per field.
1056
+ The engine takes one object per bar, so code written from that page did not compile
1057
+ against the library. The page now describes the surface as it is, and the memory
1058
+ case it was making, which is real and unanswered, is measured in `issues/0005`.
1059
+
1060
+ **Higher timeframe and other instrument reads run.** A file containing one used
1061
+ to compile, carry its capability tag, and be refused at load with a message
1062
+ naming the capability. The engine now evaluates a read's expression over the
1063
+ requested bars and folds the result onto the chart's, so `req.timeframe`,
1064
+ `req.symbol`, `req.isReady` and `req.error` do what the reference page says.
1065
+
1066
+ A read of the chart's own instrument at a coarser interval is folded from the
1067
+ bars the engine already holds and needs nothing from a host. A read of another
1068
+ instrument needs bars only a host can supply, so a host states a request provider
1069
+ and an engine without one still refuses exactly those files, by name, at load:
1070
+ that path is what an older engine uses to tell a newer file what it lacks, and it
1071
+ is kept and tested.
1072
+
1073
+ **The three modes produce three different numbers, and the difference is the
1074
+ whole repainting question.** A `"confirmed"` read takes the last coarse bar that
1075
+ closed and steps on the first chart bar of the next one, so it never uses a bar
1076
+ that had not happened. A `"developing"` read is the coarse bar as it stands on
1077
+ this chart bar. A `"lookahead"` read is the coarse bar in full, from its first
1078
+ chart bar, which is why it repaints. The first two stop at the bar being executed,
1079
+ so a chart given a whole dataset and a chart given one bar at a time compute the
1080
+ same numbers; the third reads past the bar, which is the mode.
1081
+
1082
+ **Read the default twice if you have written `[1]` inside a read.**
1083
+ `req.timeframe("1D", high)` is yesterday's high, because `"confirmed"` is the
1084
+ default and it takes the last day that closed. `req.timeframe("1D", high[1])` is
1085
+ the day before that. Three documentation pages had those one day apart and said
1086
+ so in words; they now say what the specification has said all along, and the
1087
+ previous-session example no longer takes the extra step back.
1088
+
1089
+ A read's warmup is counted in requested bars rather than chart bars, because the
1090
+ expression runs on the requested ones: `req.timeframe("1D", sma(close, 20))` is
1091
+ absent until twenty daily bars have closed, which on an intraday chart is about a
1092
+ month of history. A day, a week and a month are folded by the calendar, so a read
1093
+ at one of them needs the instrument's timezone and is absent without it rather
1094
+ than dated in a zone nobody chose.
1095
+
1096
+ A request that cannot be folded is refused at load with the code that names it,
1097
+ OS6002 for one finer than the chart and OS6015 for one that is not a whole
1098
+ multiple of it, and a timeframe a setting supplied that is not a timeframe is
1099
+ OS6001. A refusal from the host is not: an unknown instrument, a range with no
1100
+ bars, a source that would not answer and an interval the feed does not carry
1101
+ leave the read absent, put the host's own words in `req.error(read)`, and let the
1102
+ rest of the study keep drawing. A host's ceiling on how many reads a file may make
1103
+ is OS5006 at load, with the count named rather than reads dropped quietly.
1104
+
1105
+ The compiled format gains no field. What it gained is section 2.16.2, the fold
1106
+ itself: which requested bar each chart bar may see, written out so that a second
1107
+ engine computes the same number rather than inventing its own alignment.
1108
+
1109
+ **A read's expression is verified like the program it sits in.** The same
1110
+ interpreter walks it over another instrument's history, so its tables, its
1111
+ instruction list and the lists of the functions it calls all go through check 1
1112
+ and check 8. A body that was not verified could jump out of its own instruction
1113
+ list, and the failure would have looked like a wrong number.
1114
+
1115
+ **Every output a study can produce now reaches a chart.** Markers, bar colouring,
1116
+ the pane background, summary grids, watched conditions, drawing objects and reads
1117
+ of another instrument were all fields the compiled program carried and the chart
1118
+ adapter left empty, so a study that called `signal`, `barColor`, `background`,
1119
+ `cell`, `alert`, `draw.line` or `req.symbol` computed everything and drew none of
1120
+ it. Each of them is mapped onto the field the chart already has for it, under the
1121
+ chart's own name for that field and taking the chart's own argument.
1122
+
1123
+ A marker arrives with its text, its declared shape and position and the bar's own
1124
+ time, and only for the bars its branch was taken on. A bar colour and a background
1125
+ arrive as columns of colours beside the plot columns, so a spliced tail carries
1126
+ them. A grid arrives as the last executed bar left it, read once per calculation
1127
+ rather than once per bar, which is the difference between a constant cost and the
1128
+ length of the history, and its cells are placed into the declared size so that a
1129
+ cell nothing wrote is blank rather than missing. A watched condition arrives as a
1130
+ row a user can subscribe to, under the `id` the script gave it, whose predicate
1131
+ reads the guard chain out of a column.
1132
+
1133
+ **A study's drawing objects are handed to the chart as a set, and the set is
1134
+ replaced every time.** A line, a label, a box or a path the script created, moved,
1135
+ recoloured and deleted over many bars arrives as the shapes it currently holds,
1136
+ in the order it created them. Nothing has to tell the chart about a deletion, and
1137
+ a bar that re-executed five times leaves what one execution of it leaves, because
1138
+ the engine has already rolled the set back. An anchor crosses as a time and a
1139
+ price, converted into the seconds a chart counts exactly where a bar's time is,
1140
+ and an anchor past the newest bar stays where it was written so a projection
1141
+ reaches into the margin. An anchor missing its time or its price draws nothing,
1142
+ and a path with a hole in it becomes one shape per stretch that has none, rather
1143
+ than a line through prices the script never named.
1144
+
1145
+ **A read of another instrument fetches through the chart, and the study draws
1146
+ while it waits.** The engine settles every read before bar 0 and asks the host
1147
+ there and then; a chart answers later, and a chart computes a study once before
1148
+ it attaches the lifecycle that has the transport. So the first calculation says
1149
+ "not yet", the read is absent, `req.isReady` is false and everything that does not
1150
+ depend on the read is drawn; the answer asks for the recompute that uses it. The
1151
+ range asked for covers the chart's own span, extended back by the read's warmup
1152
+ and quantised to requested bar boundaries, so a chart that ticks does not fetch
1153
+ once per bar, and what was fetched keeps serving while a wider fetch is in flight.
1154
+ A host that refuses is carried through as its own words, in `req.error` for the
1155
+ script and in the study's data status for the user, with a retry offered.
1156
+
1157
+ **An alert fires for now and never for history.** Adding a study to a chart
1158
+ holding two years of bars fires nothing for any of them. The rule is in the
1159
+ specification rather than in a host: an alert is raised only on a bar the host
1160
+ states it is driving live and has confirmed, and `isRealtime` is a fact the host
1161
+ already states for every execution. The frequency is the engine's too: `once` is
1162
+ once for the life of the study, `oncePerBar` is once for a bar however many times
1163
+ that bar executes, and `everyUpdate` is once per execution. A host whose own
1164
+ runtime watches the declared conditions applies the same rule from its side, by
1165
+ judging only the bars that are new since it last looked.
1166
+
1167
+ **A marker no longer appears on a bar that is still moving.** The channel
1168
+ carrying it was published for every bar whatever the bar's state, so a host
1169
+ reading the column drew the marker on a tick and took it off on the next one.
1170
+ Step 9 discards a deferred channel on a bar it did not decide, and the columns a
1171
+ host reads now say so. Plot columns are unaffected and are still published on
1172
+ every execution.
1173
+
1174
+ **Which study owns the candles is a stated rule.** The instrument's bars are one
1175
+ object and two studies painting them are two answers to one question. The owner
1176
+ is the study latest in the chart's own study order that paints, which is the
1177
+ order a legend shows and a user reorders, so it does not change because one
1178
+ study recomputed before another. Every other study's bar colouring is not drawn.
1179
+
1180
+ **Five declaration options that could not be carried now say so at the line that
1181
+ wrote them.** A level's colour, a grid's two colours and an alert's `id`, `title`
1182
+ and `frequency` are written into the program before the first bar, and one
1183
+ computed from bar data used to reach the compiler with nowhere to put it: it
1184
+ reported OS6018, which says the program is malformed and asks the author to
1185
+ report a compiler defect. They are checked with OS3003 like every other fixed
1186
+ option, which names the option and says what to write instead.
1187
+
1188
+ **A colour built out of constants counts as one.** `fade(red, 50)` is the same
1189
+ four numbers on every bar, and it is what a level or a marker is normally
1190
+ coloured with. The checker accepts exactly the six colour calls the compiler
1191
+ folds, so a field that has to be fixed before bar 0 can hold one.
1192
+
1193
+ **Two alerts can no longer share one name.** A subscription is kept under the
1194
+ alert's id, so two entries under one name left the host with two conditions and
1195
+ one row and nothing to say which the user subscribed to. It is OS3017, the same
1196
+ code two plots sharing a title get, and it counts the derived name as well as
1197
+ the written one. An id taken from an `input()` is derived rather than used, for
1198
+ the reason OS8008 now gives: a name that moves when somebody opens the settings
1199
+ dialog is not a name a subscription can be kept under. A derived id is now taken
1200
+ from the call's line, which is what OS8008 said all along.
1201
+
1202
+ **The trailing stop in the volatility example drew nothing.** The band trails
1203
+ against the band as it stood, and `max` and `min` propagate absence like every
1204
+ other calculation, so the first bar after the average warmed up trailed against
1205
+ an absent band, the band went absent, and the next bar's previous band was that
1206
+ absence. The study ran, kept its legend row and plotted an empty column for the
1207
+ rest of the dataset. The example reads the previous band through `orElse` in the
1208
+ trail as well as in the comparison, and a test fails the build if that column
1209
+ stops being drawn.
1210
+
1211
+ **A cell alignment that is not one of the three is refused.** `align = "middle"`
1212
+ compiled and was silently drawn left for ever. It is OS3008, which names the
1213
+ three and suggests the nearest.
1214
+
1215
+ **Drawing objects are live.** Lines, labels, boxes and polylines are created,
1216
+ moved, extended, restyled, deleted and counted as bars arrive. Thirty-one calls,
1217
+ every one of them driven bar by bar in the tests, and the lifetime rules the
1218
+ specification states are now the ones the engine keeps.
1219
+
1220
+ Three of those rules decide what a study looks like on a live chart. An object
1221
+ created while the newest bar was moving is rolled back when that bar runs again,
1222
+ along with every change made to an object that already existed, so five updates
1223
+ and a confirm leave exactly what one pass leaves and a live chart does not gain a
1224
+ copy per tick. A setter given an object the script already deleted is OS4005 with
1225
+ the bar it went on, rather than a silent no operation that leaves a drawing that
1226
+ quietly stopped moving; a setter given `none` does nothing, which is what the
1227
+ catalogue's own fix for OS4005 asks a script to produce. An anchor is a time and
1228
+ a price and is never resolved against a bar, so an anchor past the newest bar
1229
+ reaches into the margin and an old one does not move when more history loads.
1230
+
1231
+ **A ceiling on drawing objects, reported rather than absorbed: OS5010.** An
1232
+ object lives until the script deletes it and nothing can reclaim one that is
1233
+ still drawing, so a script that creates one per bar and deletes none used to grow
1234
+ until the machine stopped it. It now stops with a diagnostic that names the
1235
+ ceiling and the count. The ceiling is the host's, as the string ceiling is; the
1236
+ language still fixes no number and nothing is ever dropped to make room, which is
1237
+ the part that would make a study wrong on the left of the chart and right on the
1238
+ right.
1239
+
1240
+ **An argument a drawing call leaves out now arrives as the default the
1241
+ specification gives it.** `draw.line(t1, p1, t2, p2)` used to reach the engine
1242
+ with an absent colour, an absent width and an absent line style, and absence on a
1243
+ drawing surface means nothing is drawn. The library surface carries these four
1244
+ calls' defaults and the compiler writes them into the program, so an engine needs
1245
+ no table of them.
1246
+
1247
+ **A polyline keeps its own path.** The two arrays are read once, at the call, and
1248
+ `draw.setPoints` is what changes a path, so pushing to an array a script kept for
1249
+ its own bookkeeping no longer silently redraws a shape. The arrays are paired by
1250
+ index, and a point missing a time or a price is a gap in the path rather than a
1251
+ point dropped.
1252
+
1253
+ **`Engine.drawings()` hands a host facts instead of heap contents.** Each live
1254
+ object arrives as its kind, its anchors in time and price, and its style, in
1255
+ creation order. A host no longer dereferences anything, which it had no way to
1256
+ do: a polyline's path was a handle into the engine's own heap.
1257
+
1258
+ **Two library calls no script could make are now callable.** The conversions to
1259
+ `bool` and to `number` were published under those names, and both are reserved
1260
+ words, so every spelling of them was refused before the checker saw one, with a
1261
+ message about naming a variable handed to somebody who had written a call. They
1262
+ are now `toBool(x)` and `toNumber(s)`. `text(x)` is unchanged: it is not a type
1263
+ name, so it never collided.
1264
+
1265
+ If you wrote either old spelling it did not compile, so nothing that ran before
1266
+ stops running. Writing one now is still OS1019, and the fix names the spelling
1267
+ that works instead of telling you to rename a variable you never declared. The
1268
+ rule behind it is in the specification: no library name is a reserved word, and a
1269
+ test fails the build if one ever is again.
1270
+
1271
+ **The no-eval check can no longer be got past.** The first rule of this project is
1272
+ that nothing here builds code out of text, and the check enforcing it knew only
1273
+ the obvious spellings. It now refuses the function builder however it is reached,
1274
+ including through `call`, `apply`, `bind`, `Reflect.construct` and a constructor
1275
+ property taken as a value; a name looked up on the global object by computed key;
1276
+ the runtime's own compiler reached through a binding rather than by naming its
1277
+ module; code assembled out of bytes; text put into a document; and a module
1278
+ specifier built out of text. It reads the git hooks and the compiled tests as
1279
+ well, which it never did. Before reading a file it puts forty-eight attack forms
1280
+ through its own rules and stops the build if one is not caught, or if an innocent
1281
+ form is.
1282
+
1283
+ **The build removes output that no source makes.** A compiled module from a
1284
+ layout two refactors old was still in `dist`, which `package.json` publishes, so
1285
+ the package carried a file no source produced, no test covered and nothing here
1286
+ explains. Every build now names and removes any such file before it compiles,
1287
+ in both outputs, reading the directories from the compiler's own configuration
1288
+ rather than from a copy of them.
1289
+
1290
+ **OS8001 now reaches a call that could be written past it.** The warning for a
1291
+ stateful call that runs on some bars and not others was decided by the pass that
1292
+ walks statements, so it saw an `if`, a `switch` arm and a loop body and nothing
1293
+ else. `v = trending ? ema(close, 20) : none` compiled with nothing reported and
1294
+ drew an average of the bars the guard let through, presented as an average. The
1295
+ warning now covers a ternary arm, both of them; the right operand of `and` and
1296
+ `or`, which is skipped whenever the left one has already decided the answer; the
1297
+ condition of an `else if`; and the values of a `case` arm after the first. Each
1298
+ of those is a place a bar can pass without evaluating the call, and the engine
1299
+ always ran them that way. What was missing was the compiler saying so.
1300
+
1301
+ A file that compiled clean before can report OS8001 now. Nothing it computes has
1302
+ changed, and the fix is the one the warning already names: take the call at the
1303
+ top level and use its result inside the guard.
1304
+
1305
+ **A tunable declaration option now compiles.** `language.md` 13.2 has always
1306
+ allowed an option value to be "a literal, arithmetic over literals, or a call to
1307
+ `input()`", 13.4 allows an `input()` anywhere at the top level of a file, and
1308
+ `decisions.md` decision 9 settled how such an option reaches a compiled program.
1309
+ The emitter carried none of it. An `input()` that was not the entire right-hand
1310
+ side of a top-level assignment had nowhere to go, so
1311
+ `study("Range", precision = input(2, "Precision"))` was refused with OS6018 and
1312
+ no program, and so were `study(input("R", "Title"))`,
1313
+ `len = input(14, "Length") + 1` and an input written inside any other expression.
1314
+ OS6018's message says a program that fails verification came from a broken
1315
+ compiler, so a correct script was told it had found our bug, and every
1316
+ declaration option in the language was a literal in practice whatever the page
1317
+ said. A platform adopting the language from those pages wrote a study that would
1318
+ not compile.
1319
+
1320
+ Two halves were missing and both are here. Folding now resolves an `input()`
1321
+ written in place to the `{ "input": "<key>" }` reference of
1322
+ `compiled-program.md` 2.3, which is the form decision 9 put in the format and
1323
+ which every field of `meta`, of `meta.strategy` and of every declaration in
1324
+ `outputs` may hold; the engine substitutes the resolved value at load, as it
1325
+ already did for an option written as a name. And an `input()` read inside an
1326
+ expression now loads the slot the engine writes at step 5 of every bar, while the
1327
+ same call written as the whole of `name = input(...)` goes on emitting nothing,
1328
+ because there the name and the input share that slot and the engine's write is
1329
+ the assignment. The two are told apart by which caller reaches the emitter, never
1330
+ by inspecting the call: the statement is the only place that can see whether the
1331
+ call is the whole of itself.
1332
+
1333
+ A colour computed from an input comes back with the rest of it.
1334
+ `plot(close, "C", fade(input(aqua, "Tint"), 50))` was refused for the same
1335
+ reason: the per-bar colour path emits the expression a script wrote, and the
1336
+ input inside it emitted nothing. It paints the colour the setting gives it on
1337
+ every bar now, which is what the checker had always accepted.
1338
+
1339
+ Nothing is now allowed that 13.2 and 13.4 did not already allow. An `input()`
1340
+ inside a block or a function is still OS3007, and the single line form of a
1341
+ function body is now held to that rule as the indented form always was:
1342
+ `fn f(x) => x + input(3, "K")` was checked as though it stood at the top level
1343
+ and declared a settings row from inside a function with nothing said.
1344
+
1345
+ **A `close` no longer crosses zero, and the ledger no longer keeps a row for an
1346
+ order nobody was sent.** On a leg holding one unit long, `close(qty = 5)` sent
1347
+ one sell of five: the leg ended the bar four short, under one position
1348
+ reference, with no diagnostic anywhere, and a call named `close` had opened a
1349
+ position. `stdlib.md` 17.1 forbids it outright, and a quantity the script
1350
+ states was the one a close sent without working it out. It is now OS7017,
1351
+ naming what was asked for and what is left to close, and the call reaches no
1352
+ destination: a bar that places a good
1353
+ order and then meets it sends nothing at all, the good order included.
1354
+
1355
+ Refused rather than quietly reduced to what is there. Sending the smaller number
1356
+ would send a quantity the script did not write and leave it believing it had
1357
+ closed the one it did, which is the wrong belief this release has now refused
1358
+ three times already; and reading the call as a reversal would let `close` open a
1359
+ position, which the order page already calls the most expensive naming mistake
1360
+ available. `close()` with no quantity is untouched and goes on working the
1361
+ number out for itself.
1362
+
1363
+ One consequence is worth knowing before you meet it.
1364
+ `close(tag = "entry", qty = 1)` on a tag that has already flattened is now
1365
+ refused, while `close(tag = "entry")` on that same tag stays silent and
1366
+ idempotent. The two look inconsistent and are not: a quantity is an argument the
1367
+ script wrote, so it is a claim about its own position and the claim can be
1368
+ false, while a call with no quantity asks the engine for the right number and has
1369
+ nothing in it to be wrong about. It is the same sentence that separates `buy()`
1370
+ from `buy(qty = none)`. The comparison with a stated quantity is made in
1371
+ full only where that quantity and the folded position count the same thing,
1372
+ which is a declaration whose `qtyType` is `"units"`; in lots, cash or equity
1373
+ percent they are different kinds of number, and the entry below says which half
1374
+ of it is made anyway.
1375
+
1376
+ The second half of that area: `engine.orders()` reported rows for orders no
1377
+ destination was ever handed. A bar that placed an order tagged `"good2"` and
1378
+ then called `cancel("nosuch")` left the destination with zero intents from that
1379
+ bar, which is right, and left the ledger reporting `good2` at `placed` with an
1380
+ empty `orderRef`. A host reconciling against that record after a stopped run saw
1381
+ an order it never received. A bar's rows and a bar's orders are now the same set:
1382
+ mapping a call still appends its row, because the calls after it on the same bar
1383
+ are measured against the rows before it, and a bar that is then refused takes
1384
+ those rows back.
1385
+
1386
+ **No order crosses zero, on the three paths that still reached it.** The
1387
+ sentence `stdlib.md` 17.1 states without qualification held on the shapes that
1388
+ had been tried. On a leg holding three long, `close()` twice on one bar sent two
1389
+ sells of three under one position reference: the destination netted three short,
1390
+ the ledger folded to minus three, and nothing was said. Five bare closes in a
1391
+ loop ended the leg twelve short, and `close(qty = 2)` twice ended it one short
1392
+ with each order inside OS7017's own ceiling. The cause was not the position
1393
+ figure, which is folded from settled fills and is right to be: an order sent a
1394
+ line ago has filled nothing, so the second close measured against the same
1395
+ position the first one did. **A reducing order is now measured against what is
1396
+ left to close on this bar**, which is what the part holds less what the bar has
1397
+ already sent against it, and the invariant is written into 17.1: the orders one
1398
+ bar sends can never sum past the position they are reducing. The second of two
1399
+ bare closes sends nothing, which is the same idempotence as closing a tag that
1400
+ holds nothing; a second stated quantity is held against what the first one left,
1401
+ so `close(qty = 2)` twice on a leg of three is one order and then OS7017 naming
1402
+ one left rather than three. The count covers a `sell` that reduces a long leg,
1403
+ the closing half of `order.reverse`, and a bar declared `onUnconfirmed` executed
1404
+ many times, which is one bar however often it runs.
1405
+
1406
+ **An entry that would cross zero is now sent as two orders, which is what the
1407
+ page already taught.** `sell(qty = abs(pos.size) + newQty)` is documented as one
1408
+ instruction the engine splits into two, because no order crosses zero, and the
1409
+ engine mapped one order at the quantity written: on a leg holding three, a sell
1410
+ of five left it two short under one position reference, where a late fill has no
1411
+ way to say which of the two positions it settled. It now sends the closing half
1412
+ at what is left of the outgoing position, under that position's own reference,
1413
+ and the opening half at the remainder under a reference minted for it, which is
1414
+ what `order.reverse` has always done. An order opposing a position the bar has
1415
+ already committed to closing in full is opening a replacement rather than
1416
+ reducing anything, so it too is minted a position of its own.
1417
+
1418
+ **A strategy declaring lots now gets the part of that rule that can be held for
1419
+ it.** OS7017 was narrowed to a declaration counting in units, so `buy(qty = 1)`
1420
+ and then `close(qty = 5)` under lots, cash or an equity percent sent one sell of
1421
+ five against a leg holding one, with no refusal on any of the three. The
1422
+ narrowing is sound where it is about two kinds of number, and it stays there:
1423
+ comparing a stated quantity with a folded position needs the instrument's lot
1424
+ size, which is the fact OS7005 has been deferred on from the beginning. But
1425
+ nothing left to close is zero in every one of those units, so **a close that
1426
+ states a quantity against a part holding nothing is now refused whatever the
1427
+ declaration counts in.** Two bare closes on one bar are held in every unit too,
1428
+ because the quantity a close works out for itself is in units by construction.
1429
+ What is still not held is one shape, named in OS7017's entry, in 17.2 and in the
1430
+ feature matrix: a quantity stated against a position that is still there, in a
1431
+ declaration counting in anything but units. An order like that is sent as
1432
+ written, and no quantity the engine works out after it adds to what it may have
1433
+ crossed, because an order the engine cannot read is counted as having closed the
1434
+ whole of what was left: a `close()` after it on the same part sends nothing. A
1435
+ second stated quantity on the same bar is another order of the same unheld
1436
+ shape, not a consequence of the first. Between a close that sends nothing and an
1437
+ order that crosses zero, 17.1 has already chosen.
1438
+
1439
+ Decision 42 records the tension this turned on, which is worth reading before
1440
+ relying on either half: sizing a bare close is the engine deciding a quantity,
1441
+ and refusing one refuses a call that wrote no claim at all. It is resolved by
1442
+ the rule the repository keeps arriving at rather than by choosing between them.
1443
+ An argument the script wrote is a claim and a false claim is refused; an
1444
+ argument it did not write is the engine's to work out, and what was always the
1445
+ engine's to work out here is what is left to close.
1446
+
1447
+ **One sentence of the arithmetic manifest could not be violated, and now can.**
1448
+ `stdlib.md` 20.3 said of the exponential mean that "the new value is multiplied
1449
+ first and the running value second, and the two products are added in that
1450
+ order". Binary64 multiplication and addition are both commutative, so that
1451
+ constrained nothing: run over the eighty bar fixture the release gate compares
1452
+ bit for bit, the swapped arrangement gives 0 differences out of 164 values. The
1453
+ arrangement that does vary is `running + (value - running) * weight`, which
1454
+ differs on 142 of them, and it is the one an implementer is most likely to reach
1455
+ for because it is one multiplication rather than two. The paragraph now names
1456
+ it, says what it measured, and says in the open what is deliberately not fixed.
1457
+ Section 20 is the manifest a second engine implements from, and a sentence that
1458
+ cannot bite sends that implementer to check the half that does not matter.
1459
+
1460
+ **The catalogue check now reads the fix sentence, not just the blocks.** The
1461
+ blocks were compiled and the sentence beside them never was, and the sentence is
1462
+ the part a reader acts on. That is how OS7009's fix came to tell a reader to
1463
+ call `order.working(tag)`, which is marked planned, and how OS3003's came to
1464
+ hand out `precision = input(2, "precision")` while its own after block had been
1465
+ edited to show something else because that form did not compile at the time. Two
1466
+ rules now, both narrow and both stated narrowly. Every call a fix names is put to
1467
+ the compiler, one at a time, and a name the language does not have or one marked
1468
+ planned fails the build, unless the entry itself carries a `deferred` sentence.
1469
+ And a fix that writes a call out with a reader's own values in it, a string
1470
+ literal or a named argument, has to show one of its calls in its own after
1471
+ block, which is the only part of an entry a compiler sees. What the rules do not
1472
+ cover is written in `scripts/lib/fix-sentence.mjs`: the fix is not compiled,
1473
+ because the code in it is a fragment of a line rather than a line; the second
1474
+ rule asks for one call rather than all of them, because eleven entries offer a
1475
+ reader two remedies and demonstrate one; an after block that writes no call at
1476
+ all is counted and named rather than skipped, and one entry is in that state;
1477
+ and neither rule can tell whether the advice is any good.
1478
+
10
1479
  ## 0.1.0-alpha.1
11
1480
 
12
1481
  The first release published by the automation rather than by hand.