openalgo-script 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/CHANGELOG.md +1050 -0
  2. package/README.md +111 -27
  3. package/dist/adapters/charts/driving.d.ts +50 -0
  4. package/dist/adapters/charts/driving.d.ts.map +1 -0
  5. package/dist/adapters/charts/driving.js +57 -0
  6. package/dist/adapters/charts/driving.js.map +1 -0
  7. package/dist/adapters/charts/run.d.ts +20 -0
  8. package/dist/adapters/charts/run.d.ts.map +1 -1
  9. package/dist/adapters/charts/run.js +89 -16
  10. package/dist/adapters/charts/run.js.map +1 -1
  11. package/dist/adapters/charts/tables.d.ts +6 -19
  12. package/dist/adapters/charts/tables.d.ts.map +1 -1
  13. package/dist/adapters/charts/tables.js.map +1 -1
  14. package/dist/adapters/charts/undrawable.d.ts +4 -0
  15. package/dist/adapters/charts/undrawable.d.ts.map +1 -0
  16. package/dist/adapters/charts/undrawable.js +47 -0
  17. package/dist/adapters/charts/undrawable.js.map +1 -0
  18. package/dist/adapters/charts/venue.d.ts +73 -0
  19. package/dist/adapters/charts/venue.d.ts.map +1 -0
  20. package/dist/adapters/charts/venue.js +104 -0
  21. package/dist/adapters/charts/venue.js.map +1 -0
  22. package/dist/core/accounting/analysis.d.ts +111 -0
  23. package/dist/core/accounting/analysis.d.ts.map +1 -0
  24. package/dist/core/accounting/analysis.js +123 -0
  25. package/dist/core/accounting/analysis.js.map +1 -0
  26. package/dist/core/accounting/equity.d.ts +33 -0
  27. package/dist/core/accounting/equity.d.ts.map +1 -1
  28. package/dist/core/accounting/equity.js +12 -0
  29. package/dist/core/accounting/equity.js.map +1 -1
  30. package/dist/core/accounting/index.d.ts +2 -0
  31. package/dist/core/accounting/index.d.ts.map +1 -1
  32. package/dist/core/accounting/index.js +1 -0
  33. package/dist/core/accounting/index.js.map +1 -1
  34. package/dist/core/accounting/report.d.ts +3 -0
  35. package/dist/core/accounting/report.d.ts.map +1 -1
  36. package/dist/core/accounting/report.js +2 -0
  37. package/dist/core/accounting/report.js.map +1 -1
  38. package/dist/core/accounting/statistics.d.ts +12 -0
  39. package/dist/core/accounting/statistics.d.ts.map +1 -1
  40. package/dist/core/accounting/statistics.js +23 -1
  41. package/dist/core/accounting/statistics.js.map +1 -1
  42. package/dist/core/backtest/case.d.ts +60 -0
  43. package/dist/core/backtest/case.d.ts.map +1 -0
  44. package/dist/core/backtest/case.js +319 -0
  45. package/dist/core/backtest/case.js.map +1 -0
  46. package/dist/core/backtest/compare.d.ts.map +1 -1
  47. package/dist/core/backtest/compare.js +2 -0
  48. package/dist/core/backtest/compare.js.map +1 -1
  49. package/dist/core/backtest/deliver.d.ts +93 -0
  50. package/dist/core/backtest/deliver.d.ts.map +1 -0
  51. package/dist/core/backtest/deliver.js +94 -0
  52. package/dist/core/backtest/deliver.js.map +1 -0
  53. package/dist/core/backtest/drive.d.ts +101 -8
  54. package/dist/core/backtest/drive.d.ts.map +1 -1
  55. package/dist/core/backtest/drive.js +114 -158
  56. package/dist/core/backtest/drive.js.map +1 -1
  57. package/dist/core/backtest/index.d.ts +26 -12
  58. package/dist/core/backtest/index.d.ts.map +1 -1
  59. package/dist/core/backtest/index.js +21 -10
  60. package/dist/core/backtest/index.js.map +1 -1
  61. package/dist/core/backtest/record.d.ts +63 -2
  62. package/dist/core/backtest/record.d.ts.map +1 -1
  63. package/dist/core/backtest/record.js +71 -4
  64. package/dist/core/backtest/record.js.map +1 -1
  65. package/dist/core/backtest/replay.d.ts.map +1 -1
  66. package/dist/core/backtest/replay.js +11 -1
  67. package/dist/core/backtest/replay.js.map +1 -1
  68. package/dist/core/backtest/simulate.d.ts +113 -1
  69. package/dist/core/backtest/simulate.d.ts.map +1 -1
  70. package/dist/core/backtest/simulate.js +123 -5
  71. package/dist/core/backtest/simulate.js.map +1 -1
  72. package/dist/core/backtest/walk.d.ts +39 -0
  73. package/dist/core/backtest/walk.d.ts.map +1 -0
  74. package/dist/core/backtest/walk.js +125 -0
  75. package/dist/core/backtest/walk.js.map +1 -0
  76. package/dist/core/catalogue/catalogue.generated.d.ts +179 -2
  77. package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
  78. package/dist/core/catalogue/catalogue.generated.js +19 -2
  79. package/dist/core/catalogue/catalogue.generated.js.map +1 -1
  80. package/dist/core/catalogue/types.d.ts +8 -2
  81. package/dist/core/catalogue/types.d.ts.map +1 -1
  82. package/dist/core/catalogue/values.generated.d.ts +51 -0
  83. package/dist/core/catalogue/values.generated.d.ts.map +1 -1
  84. package/dist/core/check/assigned.d.ts +19 -0
  85. package/dist/core/check/assigned.d.ts.map +1 -0
  86. package/dist/core/check/assigned.js +14 -0
  87. package/dist/core/check/assigned.js.map +1 -0
  88. package/dist/core/check/call-sites.d.ts.map +1 -1
  89. package/dist/core/check/call-sites.js +9 -4
  90. package/dist/core/check/call-sites.js.map +1 -1
  91. package/dist/core/check/calls.d.ts.map +1 -1
  92. package/dist/core/check/calls.js +12 -4
  93. package/dist/core/check/calls.js.map +1 -1
  94. package/dist/core/check/check.d.ts.map +1 -1
  95. package/dist/core/check/check.js +15 -2
  96. package/dist/core/check/check.js.map +1 -1
  97. package/dist/core/check/checker.d.ts +26 -0
  98. package/dist/core/check/checker.d.ts.map +1 -1
  99. package/dist/core/check/checker.js +38 -2
  100. package/dist/core/check/checker.js.map +1 -1
  101. package/dist/core/check/constant.d.ts +16 -0
  102. package/dist/core/check/constant.d.ts.map +1 -1
  103. package/dist/core/check/constant.js +52 -0
  104. package/dist/core/check/constant.js.map +1 -1
  105. package/dist/core/check/deleted.d.ts +3 -0
  106. package/dist/core/check/deleted.d.ts.map +1 -0
  107. package/dist/core/check/deleted.js +109 -0
  108. package/dist/core/check/deleted.js.map +1 -0
  109. package/dist/core/check/expressions.js +1 -1
  110. package/dist/core/check/expressions.js.map +1 -1
  111. package/dist/core/check/library-orders.js +2 -2
  112. package/dist/core/check/library-orders.js.map +1 -1
  113. package/dist/core/check/library-output.d.ts.map +1 -1
  114. package/dist/core/check/library-output.js +1 -0
  115. package/dist/core/check/library-output.js.map +1 -1
  116. package/dist/core/check/library-prose.generated.js +12 -12
  117. package/dist/core/check/library-prose.generated.js.map +1 -1
  118. package/dist/core/check/library.d.ts +7 -0
  119. package/dist/core/check/library.d.ts.map +1 -1
  120. package/dist/core/check/library.js +1 -0
  121. package/dist/core/check/library.js.map +1 -1
  122. package/dist/core/check/surface.d.ts +9 -0
  123. package/dist/core/check/surface.d.ts.map +1 -1
  124. package/dist/core/check/surface.js +13 -0
  125. package/dist/core/check/surface.js.map +1 -1
  126. package/dist/core/emit/canonical.d.ts +22 -8
  127. package/dist/core/emit/canonical.d.ts.map +1 -1
  128. package/dist/core/emit/canonical.js +67 -6
  129. package/dist/core/emit/canonical.js.map +1 -1
  130. package/dist/core/engine/arithmetic.d.ts +6 -25
  131. package/dist/core/engine/arithmetic.d.ts.map +1 -1
  132. package/dist/core/engine/arithmetic.js +48 -3
  133. package/dist/core/engine/arithmetic.js.map +1 -1
  134. package/dist/core/engine/bar-source.d.ts +65 -0
  135. package/dist/core/engine/bar-source.d.ts.map +1 -0
  136. package/dist/core/engine/bar-source.js +58 -0
  137. package/dist/core/engine/bar-source.js.map +1 -0
  138. package/dist/core/engine/engine.d.ts +9 -11
  139. package/dist/core/engine/engine.d.ts.map +1 -1
  140. package/dist/core/engine/engine.js +24 -24
  141. package/dist/core/engine/engine.js.map +1 -1
  142. package/dist/core/engine/guard.d.ts.map +1 -1
  143. package/dist/core/engine/guard.js +10 -0
  144. package/dist/core/engine/guard.js.map +1 -1
  145. package/dist/core/engine/host.d.ts +4 -2
  146. package/dist/core/engine/host.d.ts.map +1 -1
  147. package/dist/core/engine/host.js.map +1 -1
  148. package/dist/core/engine/index.d.ts +2 -1
  149. package/dist/core/engine/index.d.ts.map +1 -1
  150. package/dist/core/engine/index.js +1 -1
  151. package/dist/core/engine/index.js.map +1 -1
  152. package/dist/core/engine/library/arrays.d.ts.map +1 -1
  153. package/dist/core/engine/library/arrays.js +8 -2
  154. package/dist/core/engine/library/arrays.js.map +1 -1
  155. package/dist/core/engine/library/binding.d.ts +2 -0
  156. package/dist/core/engine/library/binding.d.ts.map +1 -1
  157. package/dist/core/engine/library/binding.js.map +1 -1
  158. package/dist/core/engine/library/code-points.d.ts +40 -0
  159. package/dist/core/engine/library/code-points.d.ts.map +1 -0
  160. package/dist/core/engine/library/code-points.js +74 -0
  161. package/dist/core/engine/library/code-points.js.map +1 -0
  162. package/dist/core/engine/library/index.d.ts +13 -0
  163. package/dist/core/engine/library/index.d.ts.map +1 -1
  164. package/dist/core/engine/library/index.js +15 -0
  165. package/dist/core/engine/library/index.js.map +1 -1
  166. package/dist/core/engine/library/objects.d.ts.map +1 -1
  167. package/dist/core/engine/library/objects.js +1 -1
  168. package/dist/core/engine/library/objects.js.map +1 -1
  169. package/dist/core/engine/library/text.d.ts.map +1 -1
  170. package/dist/core/engine/library/text.js +51 -34
  171. package/dist/core/engine/library/text.js.map +1 -1
  172. package/dist/core/engine/load.d.ts +20 -0
  173. package/dist/core/engine/load.d.ts.map +1 -1
  174. package/dist/core/engine/load.js +62 -0
  175. package/dist/core/engine/load.js.map +1 -1
  176. package/dist/core/engine/request-body.d.ts +3 -1
  177. package/dist/core/engine/request-body.d.ts.map +1 -1
  178. package/dist/core/engine/request-body.js +3 -1
  179. package/dist/core/engine/request-body.js.map +1 -1
  180. package/dist/core/engine/request-plan.d.ts +3 -3
  181. package/dist/core/engine/request-plan.js +3 -3
  182. package/dist/core/engine/requests.d.ts +2 -2
  183. package/dist/core/engine/requests.d.ts.map +1 -1
  184. package/dist/core/engine/requests.js +5 -4
  185. package/dist/core/engine/requests.js.map +1 -1
  186. package/dist/core/engine/series.d.ts +18 -6
  187. package/dist/core/engine/series.d.ts.map +1 -1
  188. package/dist/core/engine/series.js +24 -5
  189. package/dist/core/engine/series.js.map +1 -1
  190. package/dist/core/engine/session/record.d.ts +4 -4
  191. package/dist/core/engine/session/record.js +4 -4
  192. package/dist/core/engine/verify-tables.d.ts.map +1 -1
  193. package/dist/core/engine/verify-tables.js +41 -0
  194. package/dist/core/engine/verify-tables.js.map +1 -1
  195. package/dist/core/importer/calls.d.ts +29 -0
  196. package/dist/core/importer/calls.d.ts.map +1 -0
  197. package/dist/core/importer/calls.js +267 -0
  198. package/dist/core/importer/calls.js.map +1 -0
  199. package/dist/core/importer/context.d.ts +118 -0
  200. package/dist/core/importer/context.d.ts.map +1 -0
  201. package/dist/core/importer/context.js +120 -0
  202. package/dist/core/importer/context.js.map +1 -0
  203. package/dist/core/importer/expressions.d.ts +44 -0
  204. package/dist/core/importer/expressions.d.ts.map +1 -0
  205. package/dist/core/importer/expressions.js +223 -0
  206. package/dist/core/importer/expressions.js.map +1 -0
  207. package/dist/core/importer/importer.d.ts +13 -0
  208. package/dist/core/importer/importer.d.ts.map +1 -0
  209. package/dist/core/importer/importer.js +220 -0
  210. package/dist/core/importer/importer.js.map +1 -0
  211. package/dist/core/importer/index.d.ts +20 -0
  212. package/dist/core/importer/index.d.ts.map +1 -0
  213. package/dist/core/importer/index.js +18 -0
  214. package/dist/core/importer/index.js.map +1 -0
  215. package/dist/core/importer/lexer.d.ts +68 -0
  216. package/dist/core/importer/lexer.d.ts.map +1 -0
  217. package/dist/core/importer/lexer.js +207 -0
  218. package/dist/core/importer/lexer.js.map +1 -0
  219. package/dist/core/importer/names.d.ts +41 -0
  220. package/dist/core/importer/names.d.ts.map +1 -0
  221. package/dist/core/importer/names.js +78 -0
  222. package/dist/core/importer/names.js.map +1 -0
  223. package/dist/core/importer/orders.d.ts +8 -0
  224. package/dist/core/importer/orders.d.ts.map +1 -0
  225. package/dist/core/importer/orders.js +332 -0
  226. package/dist/core/importer/orders.js.map +1 -0
  227. package/dist/core/importer/outputs.d.ts +19 -0
  228. package/dist/core/importer/outputs.d.ts.map +1 -0
  229. package/dist/core/importer/outputs.js +266 -0
  230. package/dist/core/importer/outputs.js.map +1 -0
  231. package/dist/core/importer/parser.d.ts +5 -0
  232. package/dist/core/importer/parser.d.ts.map +1 -0
  233. package/dist/core/importer/parser.js +439 -0
  234. package/dist/core/importer/parser.js.map +1 -0
  235. package/dist/core/importer/presence.d.ts +32 -0
  236. package/dist/core/importer/presence.d.ts.map +1 -0
  237. package/dist/core/importer/presence.js +146 -0
  238. package/dist/core/importer/presence.js.map +1 -0
  239. package/dist/core/importer/settle.d.ts +23 -0
  240. package/dist/core/importer/settle.d.ts.map +1 -0
  241. package/dist/core/importer/settle.js +135 -0
  242. package/dist/core/importer/settle.js.map +1 -0
  243. package/dist/core/importer/statements.d.ts +4 -0
  244. package/dist/core/importer/statements.d.ts.map +1 -0
  245. package/dist/core/importer/statements.js +339 -0
  246. package/dist/core/importer/statements.js.map +1 -0
  247. package/dist/core/importer/syntax.d.ts +182 -0
  248. package/dist/core/importer/syntax.d.ts.map +1 -0
  249. package/dist/core/importer/syntax.js +14 -0
  250. package/dist/core/importer/syntax.js.map +1 -0
  251. package/dist/core/importer/table.d.ts +52 -0
  252. package/dist/core/importer/table.d.ts.map +1 -0
  253. package/dist/core/importer/table.js +156 -0
  254. package/dist/core/importer/table.js.map +1 -0
  255. package/dist/core/importer/values.d.ts +27 -0
  256. package/dist/core/importer/values.d.ts.map +1 -0
  257. package/dist/core/importer/values.js +236 -0
  258. package/dist/core/importer/values.js.map +1 -0
  259. package/dist/core/index.d.ts +22 -5
  260. package/dist/core/index.d.ts.map +1 -1
  261. package/dist/core/index.js +19 -3
  262. package/dist/core/index.js.map +1 -1
  263. package/dist/core/stdlib/calendar/civil.d.ts.map +1 -1
  264. package/dist/core/stdlib/calendar/civil.js +5 -2
  265. package/dist/core/stdlib/calendar/civil.js.map +1 -1
  266. package/dist/core/stdlib/index.d.ts +1 -1
  267. package/dist/core/stdlib/index.d.ts.map +1 -1
  268. package/dist/core/stdlib/index.js +1 -1
  269. package/dist/core/stdlib/index.js.map +1 -1
  270. package/dist/core/stdlib/maths/index.d.ts +1 -1
  271. package/dist/core/stdlib/maths/index.d.ts.map +1 -1
  272. package/dist/core/stdlib/maths/index.js +1 -1
  273. package/dist/core/stdlib/maths/index.js.map +1 -1
  274. package/dist/core/stdlib/maths/rounding.d.ts +5 -0
  275. package/dist/core/stdlib/maths/rounding.d.ts.map +1 -1
  276. package/dist/core/stdlib/maths/rounding.js +19 -1
  277. package/dist/core/stdlib/maths/rounding.js.map +1 -1
  278. package/dist/core/version/version.generated.d.ts +1 -1
  279. package/dist/core/version/version.generated.js +1 -1
  280. package/package.json +17 -2
  281. package/spec/README.md +2 -1
  282. package/spec/errors.json +383 -23
  283. package/src/adapters/charts/driving.ts +109 -0
  284. package/src/adapters/charts/run.ts +126 -28
  285. package/src/adapters/charts/tables.ts +6 -19
  286. package/src/adapters/charts/undrawable.ts +51 -0
  287. package/src/adapters/charts/venue.ts +132 -0
  288. package/src/core/accounting/analysis.ts +188 -0
  289. package/src/core/accounting/equity.ts +38 -0
  290. package/src/core/accounting/index.ts +2 -0
  291. package/src/core/accounting/report.ts +5 -0
  292. package/src/core/accounting/statistics.ts +38 -1
  293. package/src/core/backtest/case.ts +395 -0
  294. package/src/core/backtest/compare.ts +2 -0
  295. package/src/core/backtest/deliver.ts +161 -0
  296. package/src/core/backtest/drive.ts +233 -217
  297. package/src/core/backtest/index.ts +26 -12
  298. package/src/core/backtest/record.ts +134 -5
  299. package/src/core/backtest/replay.ts +11 -1
  300. package/src/core/backtest/simulate.ts +201 -6
  301. package/src/core/backtest/walk.ts +182 -0
  302. package/src/core/catalogue/catalogue.generated.ts +19 -2
  303. package/src/core/catalogue/types.ts +8 -2
  304. package/src/core/catalogue/values.generated.ts +16 -0
  305. package/src/core/check/assigned.ts +31 -0
  306. package/src/core/check/call-sites.ts +11 -4
  307. package/src/core/check/calls.ts +13 -4
  308. package/src/core/check/check.ts +14 -2
  309. package/src/core/check/checker.ts +39 -2
  310. package/src/core/check/constant.ts +57 -0
  311. package/src/core/check/deleted.ts +135 -0
  312. package/src/core/check/expressions.ts +1 -1
  313. package/src/core/check/library-orders.ts +2 -2
  314. package/src/core/check/library-output.ts +1 -0
  315. package/src/core/check/library-prose.generated.ts +12 -12
  316. package/src/core/check/library.ts +8 -0
  317. package/src/core/check/surface.ts +16 -0
  318. package/src/core/emit/canonical.ts +67 -9
  319. package/src/core/engine/arithmetic.ts +23 -3
  320. package/src/core/engine/bar-source.ts +113 -0
  321. package/src/core/engine/engine.ts +26 -25
  322. package/src/core/engine/guard.ts +12 -1
  323. package/src/core/engine/host.ts +4 -2
  324. package/src/core/engine/index.ts +2 -1
  325. package/src/core/engine/library/arrays.ts +8 -2
  326. package/src/core/engine/library/binding.ts +2 -0
  327. package/src/core/engine/library/code-points.ts +73 -0
  328. package/src/core/engine/library/index.ts +17 -0
  329. package/src/core/engine/library/objects.ts +1 -6
  330. package/src/core/engine/library/text.ts +53 -35
  331. package/src/core/engine/load.ts +68 -0
  332. package/src/core/engine/request-body.ts +5 -7
  333. package/src/core/engine/request-plan.ts +3 -3
  334. package/src/core/engine/requests.ts +11 -8
  335. package/src/core/engine/series.ts +30 -6
  336. package/src/core/engine/session/record.ts +4 -4
  337. package/src/core/engine/verify-tables.ts +43 -0
  338. package/src/core/importer/calls.ts +274 -0
  339. package/src/core/importer/context.ts +197 -0
  340. package/src/core/importer/expressions.ts +247 -0
  341. package/src/core/importer/importer.ts +226 -0
  342. package/src/core/importer/index.ts +19 -0
  343. package/src/core/importer/lexer.ts +285 -0
  344. package/src/core/importer/names.ts +104 -0
  345. package/src/core/importer/orders.ts +307 -0
  346. package/src/core/importer/outputs.ts +245 -0
  347. package/src/core/importer/parser.ts +436 -0
  348. package/src/core/importer/presence.ts +164 -0
  349. package/src/core/importer/settle.ts +141 -0
  350. package/src/core/importer/statements.ts +331 -0
  351. package/src/core/importer/syntax.ts +144 -0
  352. package/src/core/importer/table.ts +191 -0
  353. package/src/core/importer/values.ts +241 -0
  354. package/src/core/index.ts +29 -2
  355. package/src/core/stdlib/calendar/civil.ts +5 -2
  356. package/src/core/stdlib/index.ts +1 -0
  357. package/src/core/stdlib/maths/index.ts +1 -0
  358. package/src/core/stdlib/maths/rounding.ts +23 -1
  359. package/src/core/version/version.generated.ts +1 -1
@@ -0,0 +1,125 @@
1
+ import { diagnosticIn } from './record.js';
2
+ /**
3
+ * The bars, in order, with the venue answering between them.
4
+ *
5
+ * The one ordering rule: deliver, then append, then collect what the append
6
+ * reported, then ask the venue what this bar did. A driver that asked the venue
7
+ * before appending would price a fill against a bar the strategy had not seen.
8
+ */
9
+ export function walk(engine, destination, bars, covered, keep) {
10
+ const fills = [];
11
+ const rows = [];
12
+ const log = [];
13
+ const frames = [];
14
+ const diagnostics = [];
15
+ const intents = new Map();
16
+ const refs = new Map();
17
+ const sizes = new Map();
18
+ let pending = [];
19
+ let seq = 0;
20
+ // The bars are a settled history, so the fold is handed all of them before
21
+ // bar 0 as `Engine.run` hands them. A `"lookahead"` read is the one reading
22
+ // that can tell (`compiled-program.md` 2.16.2): over history it reads the
23
+ // bucket a bar is inside in full, and a driver that fed the fold one bar at
24
+ // a time would answer the bucket so far, which is the live chart's reading.
25
+ const handed = bars.slice(0, covered.total).map(hostBarOf);
26
+ engine.history(handed);
27
+ for (let index = 0; index < covered.total; index += 1) {
28
+ const bar = bars[index];
29
+ const held = handed[index];
30
+ if (bar === undefined || held === undefined)
31
+ continue;
32
+ for (const one of pending) {
33
+ const ref = one.frame.orderRef;
34
+ if (typeof ref === 'string')
35
+ refs.set(one.frame.intentId, ref);
36
+ engine.deliver(one.frame);
37
+ frames.push(one);
38
+ }
39
+ pending = [];
40
+ const result = engine.append(held, { isConfirmed: true, isRealtime: false }, covered.total);
41
+ for (const intent of intentsIn(result))
42
+ intents.set(intent.intentId, intent);
43
+ seq = settle(result, index, bar, { intents, refs, sizes }, fills, seq);
44
+ if (result.diagnostic !== undefined) {
45
+ diagnostics.push(diagnosticIn(result.diagnostic, index));
46
+ break;
47
+ }
48
+ if (keep.rows === true)
49
+ rows.push([...result.columns]);
50
+ if (keep.log === true) {
51
+ for (const one of result.effects) {
52
+ if (one.effect === 'log')
53
+ log.push({ barIndex: index, time: bar.time, value: one.args[0] ?? null });
54
+ }
55
+ }
56
+ pending = destination.answers(index);
57
+ }
58
+ return { fills, frames, diagnostics, rows, log };
59
+ }
60
+ /** A recorded bar as the engine is handed one. */
61
+ function hostBarOf(bar) {
62
+ return {
63
+ time: bar.time, open: bar.open, high: bar.high, low: bar.low, close: bar.close,
64
+ volume: bar.volume, oi: bar.oi,
65
+ };
66
+ }
67
+ /**
68
+ * The fills one bar's fold settled.
69
+ *
70
+ * **The position sizes either side of step 6 are kept here and not read back
71
+ * from the engine**, because the engine reports a leg's net and a fill settles
72
+ * against one position reference: the two are different numbers whenever a leg
73
+ * holds more than one position, which is every flip. They are folded in the
74
+ * order the frames were folded in, from the same deltas, so they are the same
75
+ * arithmetic the position book did rather than a second reading of its result.
76
+ * When `FrameOutcome` carries them, these two lines come from the engine and
77
+ * this fold keeps only the sequence number.
78
+ *
79
+ * A refused frame settles nothing and is not a fill. Today the fold reports the
80
+ * refusal as a word rather than a code, so nothing here can write it into the
81
+ * record as a diagnostic; that is OS7018 and OS7019, and both are deferred.
82
+ */
83
+ function settle(result, index, bar, books, fills, from) {
84
+ let seq = from;
85
+ for (const outcome of result.frames) {
86
+ if (outcome.refused !== undefined)
87
+ continue;
88
+ if (outcome.delta <= 0 || outcome.price === null)
89
+ continue;
90
+ const intent = books.intents.get(outcome.intentId);
91
+ if (intent === undefined || intent.side === null)
92
+ continue;
93
+ const before = books.sizes.get(intent.positionRef) ?? 0;
94
+ const after = before + (intent.side === 'sell' ? -outcome.delta : outcome.delta);
95
+ books.sizes.set(intent.positionRef, after);
96
+ seq += 1;
97
+ fills.push({
98
+ seq,
99
+ intentId: outcome.intentId,
100
+ orderRef: books.refs.get(outcome.intentId) ?? '',
101
+ tag: intent.tag,
102
+ positionRef: intent.positionRef,
103
+ side: intent.side,
104
+ units: outcome.delta,
105
+ price: outcome.price,
106
+ // The bar the fold happened at, which is the bar the position exists
107
+ // from. Where the fill itself traded is the bar before it or this bar's
108
+ // own open, and neither is a bar the strategy could have acted on it in.
109
+ barIndex: index,
110
+ barTime: bar.time,
111
+ refSizeBefore: before,
112
+ refSizeAfter: after,
113
+ });
114
+ }
115
+ return seq;
116
+ }
117
+ /** Every intent one bar handed over, in the order the bar applied them. */
118
+ function intentsIn(result) {
119
+ const out = [];
120
+ for (const effect of result.effects)
121
+ for (const intent of effect.intents)
122
+ out.push(intent);
123
+ return out;
124
+ }
125
+ //# sourceMappingURL=walk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/core/backtest/walk.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmB3C;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAClB,MAAc,EACd,WAAwB,EACxB,IAA4B,EAC5B,OAAqB,EACrB,IAAyD;IAEzD,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAExC,IAAI,OAAO,GAAyB,EAAE,CAAC;IACvC,IAAI,GAAG,GAAG,CAAC,CAAC;IAEZ,2EAA2E;IAC3E,4EAA4E;IAC5E,0EAA0E;IAC1E,4EAA4E;IAC5E,4EAA4E;IAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3D,MAAM,CAAC,OAAO,CAAC,MAAM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AC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,SAAS,SAAS,CAAC,MAAiB;IAClC,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO;QAAE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO;YAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3F,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -9,6 +9,7 @@ export declare const STAGE_LABELS: {
9
9
  readonly check: "checker";
10
10
  readonly runtime: "engine";
11
11
  readonly host: "host";
12
+ readonly import: "importer";
12
13
  };
13
14
  export declare const ENTRIES: {
14
15
  readonly OS1001: {
@@ -814,6 +815,28 @@ export declare const ENTRIES: {
814
815
  readonly fix: "Give the title something to say: input(2, \"Precision\").";
815
816
  readonly placeholders: readonly [];
816
817
  };
818
+ readonly OS3025: {
819
+ readonly code: "OS3025";
820
+ readonly title: "A setting is part of a larger expression here";
821
+ readonly severity: "error";
822
+ readonly stage: "check";
823
+ readonly since: 1;
824
+ readonly autofix: false;
825
+ readonly message: "{option} is fixed before the first bar and holds an input() only as the whole of its value, so it cannot hold an expression over one.";
826
+ readonly fix: "Declare the setting as the value itself, with an input() written as the whole of {option}, or write the value out as a literal.";
827
+ readonly placeholders: readonly ["option"];
828
+ };
829
+ readonly OS3026: {
830
+ readonly code: "OS3026";
831
+ readonly title: "This option cannot be a setting";
832
+ readonly severity: "error";
833
+ readonly stage: "check";
834
+ readonly since: 1;
835
+ readonly autofix: false;
836
+ readonly message: "{option} is written into the compiled program as a plain value, so a setting cannot choose it in this format version.";
837
+ readonly fix: "Write the option out as a string literal and drop the input(): style = \"step\", for instance, is one of the values OS3008 names.";
838
+ readonly placeholders: readonly ["option"];
839
+ };
817
840
  readonly OS4001: {
818
841
  readonly code: "OS4001";
819
842
  readonly title: "History index is not usable";
@@ -1196,7 +1219,7 @@ export declare const ENTRIES: {
1196
1219
  readonly since: 1;
1197
1220
  readonly autofix: false;
1198
1221
  readonly message: "The host did not supply {fact} for {symbol}.";
1199
- readonly fix: "Supply {fact} in the host's instrument record, or stop depending on it: round with a number the script chooses rather than chart.tickSize.";
1222
+ readonly fix: "Supply {fact} in the host's instrument record for {symbol}, or leave the session out of the record, which makes every session read absent rather than wrong.";
1200
1223
  readonly placeholders: readonly ["fact", "symbol"];
1201
1224
  };
1202
1225
  readonly OS6013: {
@@ -1295,7 +1318,7 @@ export declare const ENTRIES: {
1295
1318
  readonly since: 1;
1296
1319
  readonly autofix: false;
1297
1320
  readonly message: "{setting} cannot be applied: {problem}.";
1298
- readonly fix: "State the setting so it can be carried out: declare a charge line after every line it is levied on, supply the tick size a slippage in ticks is measured in, or write down the reason a tolerance needs a bound. Nothing has been computed at the point this is refused, so correcting the setting and running again costs one run.";
1321
+ readonly fix: "State the setting so it can be carried out: declare a charge line after every line it is levied on, supply the tick size a slippage in ticks is measured in, write down the reason a tolerance needs a bound, or bring a bound past the cap back inside it. Nothing has been computed at the point this is refused, so correcting the setting and running again costs one run.";
1299
1322
  readonly placeholders: readonly ["setting", "problem"];
1300
1323
  };
1301
1324
  readonly OS6022: {
@@ -1320,6 +1343,28 @@ export declare const ENTRIES: {
1320
1343
  readonly fix: "Supply the schedule and leave the declaration's commission at its default of zero, or state the commission in the declaration and supply no schedule. A schedule is the one of the two that can carry a floor, a cap, a charge levied on a charge, and a cost that falls on one side of the trade only.";
1321
1344
  readonly placeholders: readonly ["commission", "commissionType"];
1322
1345
  };
1346
+ readonly OS6024: {
1347
+ readonly code: "OS6024";
1348
+ readonly title: "The host cannot draw something this study declares";
1349
+ readonly severity: "error";
1350
+ readonly stage: "host";
1351
+ readonly since: 1;
1352
+ readonly autofix: false;
1353
+ readonly message: "This host cannot draw {what}: {limit}.";
1354
+ readonly fix: "Declare what this host draws, or run the study on a host that draws {what}.";
1355
+ readonly placeholders: readonly ["what", "limit"];
1356
+ };
1357
+ readonly OS6025: {
1358
+ readonly code: "OS6025";
1359
+ readonly title: "A bar has no time";
1360
+ readonly severity: "error";
1361
+ readonly stage: "host";
1362
+ readonly since: 1;
1363
+ readonly autofix: false;
1364
+ readonly message: "Bar {index} was handed over with no time.";
1365
+ readonly fix: "State the bar's open instant in whole milliseconds since the Unix epoch, UTC, and leave out a bar the host cannot date rather than handing it over without a time.";
1366
+ readonly placeholders: readonly ["index"];
1367
+ };
1323
1368
  readonly OS7001: {
1324
1369
  readonly code: "OS7001";
1325
1370
  readonly title: "Only a strategy can do that";
@@ -1738,6 +1783,138 @@ export declare const ENTRIES: {
1738
1783
  readonly fix: "Assign none to the name on the same path as the delete, and where the object came out of an array, remove the element as well as deleting the object.";
1739
1784
  readonly placeholders: readonly ["name", "kind", "line"];
1740
1785
  };
1786
+ readonly OS9001: {
1787
+ readonly code: "OS9001";
1788
+ readonly title: "Version not read by the importer";
1789
+ readonly severity: "error";
1790
+ readonly stage: "import";
1791
+ readonly since: 1;
1792
+ readonly autofix: false;
1793
+ readonly message: "The importer reads scripts written for version 5 or 6 of the source dialect, and this one {found}.";
1794
+ readonly fix: "Bring the script up to version 5 or 6 in the source dialect, or translate it by hand, and import it again.";
1795
+ readonly placeholders: readonly ["found"];
1796
+ };
1797
+ readonly OS9002: {
1798
+ readonly code: "OS9002";
1799
+ readonly title: "Construct with no equivalent";
1800
+ readonly severity: "error";
1801
+ readonly stage: "import";
1802
+ readonly since: 1;
1803
+ readonly autofix: false;
1804
+ readonly message: "The importer cannot translate {construct}, so the statement holding it was kept as a comment.";
1805
+ readonly fix: "Translate that statement by hand from the comment that holds it: the rest of the script was translated around it.";
1806
+ readonly placeholders: readonly ["construct"];
1807
+ };
1808
+ readonly OS9003: {
1809
+ readonly code: "OS9003";
1810
+ readonly title: "Built-in with no mapping";
1811
+ readonly severity: "error";
1812
+ readonly stage: "import";
1813
+ readonly since: 1;
1814
+ readonly autofix: false;
1815
+ readonly message: "{name} is not one of the built-ins the importer maps, so the statement holding it was kept as a comment.";
1816
+ readonly fix: "Find the OpenScript library call that does the same job, check how it treats its first bars and absent values, and write the statement by hand.";
1817
+ readonly placeholders: readonly ["name"];
1818
+ };
1819
+ readonly OS9004: {
1820
+ readonly code: "OS9004";
1821
+ readonly title: "Declaration the importer cannot place";
1822
+ readonly severity: "error";
1823
+ readonly stage: "import";
1824
+ readonly since: 1;
1825
+ readonly autofix: false;
1826
+ readonly message: "The importer writes the declaration from one indicator or strategy call at the top level, and this script {found}.";
1827
+ readonly fix: "Give the source script exactly one indicator or strategy declaration at the top level, and import it again.";
1828
+ readonly placeholders: readonly ["found"];
1829
+ };
1830
+ readonly OS9005: {
1831
+ readonly code: "OS9005";
1832
+ readonly title: "Reads a statement that was not translated";
1833
+ readonly severity: "error";
1834
+ readonly stage: "import";
1835
+ readonly since: 1;
1836
+ readonly autofix: false;
1837
+ readonly message: "{name} is declared by the statement at line {line}, which was not translated, so this statement that reads it was kept as a comment too.";
1838
+ readonly fix: "Translate the statement at line {line} by hand first, then this one, which was kept as a comment only because it reads {name}.";
1839
+ readonly placeholders: readonly ["name", "line"];
1840
+ };
1841
+ readonly OS9006: {
1842
+ readonly code: "OS9006";
1843
+ readonly title: "Argument with no equivalent";
1844
+ readonly severity: "error";
1845
+ readonly stage: "import";
1846
+ readonly since: 1;
1847
+ readonly autofix: false;
1848
+ readonly message: "{argument} changes what {call} computes or trades, and OpenScript has no equivalent the importer can write.";
1849
+ readonly fix: "Translate the call by hand, deciding what OpenScript should do in place of {argument}, or remove {argument} from the source script if the script does not depend on it.";
1850
+ readonly placeholders: readonly ["argument", "call"];
1851
+ };
1852
+ readonly OS9007: {
1853
+ readonly code: "OS9007";
1854
+ readonly title: "Warmup and absent bars follow OpenScript";
1855
+ readonly severity: "warning";
1856
+ readonly stage: "import";
1857
+ readonly since: 1;
1858
+ readonly autofix: false;
1859
+ readonly message: "{call} became {target} here and wherever else the script calls it, and {target} follows OpenScript's own warmup, arithmetic and handling of absent values, which the original is not guaranteed to share.";
1860
+ readonly fix: "Compare the first bars of the translation with the original, and where the script depends on them, write the value as an explicit recurrence held in var, seeded the way the original seeds it.";
1861
+ readonly placeholders: readonly ["call", "target"];
1862
+ };
1863
+ readonly OS9008: {
1864
+ readonly code: "OS9008";
1865
+ readonly title: "Whole-number division in version 5";
1866
+ readonly severity: "warning";
1867
+ readonly stage: "import";
1868
+ readonly since: 1;
1869
+ readonly autofix: false;
1870
+ readonly message: "Both sides of this division are whole-number constants, which version 5 of the source dialect divides without a fractional part, and OpenScript keeps the fraction.";
1871
+ readonly fix: "If the script relied on the whole-number result, wrap the translated division in trunc(); otherwise leave it as it is.";
1872
+ readonly placeholders: readonly [];
1873
+ };
1874
+ readonly OS9009: {
1875
+ readonly code: "OS9009";
1876
+ readonly title: "Presentation argument left out";
1877
+ readonly severity: "warning";
1878
+ readonly stage: "import";
1879
+ readonly since: 1;
1880
+ readonly autofix: false;
1881
+ readonly message: "{argument} changes how {call} is displayed or what it may allocate, not what it computes, and OpenScript has no equivalent, so the translation leaves it out.";
1882
+ readonly fix: "Nothing needs to change unless the display mattered; where it did, restyle the translated call with the arguments OpenScript does have, such as its colour, width and style.";
1883
+ readonly placeholders: readonly ["argument", "call"];
1884
+ };
1885
+ readonly OS9010: {
1886
+ readonly code: "OS9010";
1887
+ readonly title: "Order placed under OpenScript's order model";
1888
+ readonly severity: "warning";
1889
+ readonly stage: "import";
1890
+ readonly since: 1;
1891
+ readonly autofix: false;
1892
+ readonly message: "{call} was translated into OpenScript's order calls here and wherever else the script uses it, and OpenScript decides when an order fills, how a reversal and a repeated entry are handled and when an exit level starts to apply by its own order model.";
1893
+ readonly fix: "Backtest the translation beside the original and compare the two trade lists before relying on it, and adjust the order calls by hand where they part.";
1894
+ readonly placeholders: readonly ["call"];
1895
+ };
1896
+ readonly OS9011: {
1897
+ readonly code: "OS9011";
1898
+ readonly title: "Equality over two absent values";
1899
+ readonly severity: "warning";
1900
+ readonly stage: "import";
1901
+ readonly since: 1;
1902
+ readonly autofix: false;
1903
+ readonly message: "Both sides of {operator} can be absent on the same bar, and OpenScript counts two absent values as equal, which the original is not guaranteed to do.";
1904
+ readonly fix: "If the original relied on two absent values never comparing equal, guard the translated comparison with isNone() on either side.";
1905
+ readonly placeholders: readonly ["operator"];
1906
+ };
1907
+ readonly OS9012: {
1908
+ readonly code: "OS9012";
1909
+ readonly title: "The translation does not compile";
1910
+ readonly severity: "error";
1911
+ readonly stage: "import";
1912
+ readonly since: 1;
1913
+ readonly autofix: false;
1914
+ readonly message: "The OpenScript compiler refused the translation of this statement with {code}, so the statement was kept as a comment.";
1915
+ readonly fix: "Look up {code} in this catalogue and translate the statement by hand in the form that code's fix describes.";
1916
+ readonly placeholders: readonly ["code"];
1917
+ };
1741
1918
  };
1742
1919
  /** Every code the compiler and the engines may emit. Nothing else is one. */
1743
1920
  export type DiagnosticCode = keyof typeof ENTRIES;
@@ -1 +1 @@
1
- {"version":3,"file":"catalogue.generated.d.ts","sourceRoot":"","sources":["../../../src/core/catalogue/catalogue.generated.ts"],"names":[],"mappings":"AAQA,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,oDAAoD;AACpD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,+FAA+F;AAC/F,eAAO,MAAM,YAAY;;;;;;CAM2B,CAAC;AAErD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8KyC,CAAC;AAE9D,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,OAAO,CAAC"}
@@ -13,6 +13,7 @@ export const STAGE_LABELS = {
13
13
  check: "checker",
14
14
  runtime: "engine",
15
15
  host: "host",
16
+ import: "importer",
16
17
  };
17
18
  export const ENTRIES = {
18
19
  OS1001: { code: "OS1001", title: "Unexpected character", severity: "error", stage: "lex", since: 1, autofix: true, message: "Unexpected character {char}. {suggestion}", fix: "Delete the character or replace it with the plain ASCII spelling the message names: a plain space for a non-breaking space, a straight quote for a typographic one, not for !, and for &&, or for ||, pow(a, b) for ^.", placeholders: ["char", "suggestion"] },
@@ -88,6 +89,8 @@ export const ENTRIES = {
88
89
  OS3022: { code: "OS3022", title: "Two inputs share a settings key", severity: "error", stage: "check", since: 1, autofix: false, message: "This input is keyed by its title {name}, which is already the name of the input at line {line}.", fix: "Give this one a title of its own, or rename the input at line {line}.", placeholders: ["name", "line"] },
89
90
  OS3023: { code: "OS3023", title: "An order names a leg this file does not declare", severity: "error", stage: "check", since: 1, autofix: false, message: "{name} was given a {argument}, and this file declares none.", fix: "Leave {argument} out. A file that declares no leg has exactly one, and every order acts on it.", placeholders: ["name", "argument"] },
90
91
  OS3024: { code: "OS3024", title: "An input written in place has an empty title", severity: "error", stage: "check", since: 1, autofix: false, message: "An input() assigned to no name is named by its title, and this one's title is empty.", fix: "Give the title something to say: input(2, \"Precision\").", placeholders: [] },
92
+ OS3025: { code: "OS3025", title: "A setting is part of a larger expression here", severity: "error", stage: "check", since: 1, autofix: false, message: "{option} is fixed before the first bar and holds an input() only as the whole of its value, so it cannot hold an expression over one.", fix: "Declare the setting as the value itself, with an input() written as the whole of {option}, or write the value out as a literal.", placeholders: ["option"] },
93
+ OS3026: { code: "OS3026", title: "This option cannot be a setting", severity: "error", stage: "check", since: 1, autofix: false, message: "{option} is written into the compiled program as a plain value, so a setting cannot choose it in this format version.", fix: "Write the option out as a string literal and drop the input(): style = \"step\", for instance, is one of the values OS3008 names.", placeholders: ["option"] },
91
94
  OS4001: { code: "OS4001", title: "History index is not usable", severity: "error", stage: "runtime", since: 1, autofix: false, message: "[{index}] is not a whole number of bars at or above zero.", fix: "Wrap the index in floor() or round(), and clamp a computed index with max(0, n).", placeholders: ["index"] },
92
95
  OS4002: { code: "OS4002", title: "History index is deeper than the retained depth", severity: "error", stage: "runtime", since: 1, autofix: false, message: "[{index}] reaches past the retained depth of {depth} bars.", fix: "Raise the depth in one place: limits(history = {suggested}).", placeholders: ["index", "depth", "suggested"] },
93
96
  OS4003: { code: "OS4003", title: "A whole number was required here", severity: "error", stage: "runtime", since: 1, autofix: false, message: "{name}'s {argument} was {found} on this bar; a whole number was required.", fix: "Round the value before passing it: floor() towards zero, round() to nearest.", placeholders: ["name", "argument", "found"] },
@@ -122,7 +125,7 @@ export const ENTRIES = {
122
125
  OS6009: { code: "OS6009", title: "The request failed", severity: "error", stage: "host", since: 1, autofix: false, message: "The host could not fetch {symbol} at {timeframe}: {reason}.", fix: "Act on {reason} in the host: it is a connection, permission or quota problem. Where the value can be derived from the chart's own bars, derive it and drop the request.", placeholders: ["symbol", "timeframe", "reason"] },
123
126
  OS6010: { code: "OS6010", title: "The engine was given no bars", severity: "error", stage: "host", since: 1, autofix: false, message: "There are no bars for {symbol} at {timeframe}, so the script cannot run.", fix: "Choose an instrument and interval that have history, or widen the chart's date range until bars exist.", placeholders: ["symbol", "timeframe"] },
124
127
  OS6011: { code: "OS6011", title: "The bars are not in order", severity: "error", stage: "host", since: 1, autofix: false, message: "Bar {index} is dated {time}, which is not after bar {previous}.", fix: "Reload the history; if the same bar repeats, the feed is sending duplicates and the host has to sort and deduplicate the bars before the engine runs.", placeholders: ["index", "time", "previous"] },
125
- OS6012: { code: "OS6012", title: "An instrument fact is not known", severity: "error", stage: "host", since: 1, autofix: false, message: "The host did not supply {fact} for {symbol}.", fix: "Supply {fact} in the host's instrument record, or stop depending on it: round with a number the script chooses rather than chart.tickSize.", placeholders: ["fact", "symbol"] },
128
+ OS6012: { code: "OS6012", title: "An instrument fact is not known", severity: "error", stage: "host", since: 1, autofix: false, message: "The host did not supply {fact} for {symbol}.", fix: "Supply {fact} in the host's instrument record for {symbol}, or leave the session out of the record, which makes every session read absent rather than wrong.", placeholders: ["fact", "symbol"] },
126
129
  OS6013: { code: "OS6013", title: "The request changed after the first bar", severity: "error", stage: "runtime", since: 1, autofix: false, message: "This request asked for {first} on bar 0 and for {found} on bar {bar}.", fix: "Compute the symbol and the timeframe from literals or inputs, not from bar data.", placeholders: ["first", "found", "bar"] },
127
130
  OS6014: { code: "OS6014", title: "The feed does not offer this timeframe", severity: "error", stage: "host", since: 1, autofix: false, message: "The host has no {timeframe} data for {symbol}; it offers {available}.", fix: "Request one of {available}, or derive the interval you want from a lower one the host does serve.", placeholders: ["timeframe", "symbol", "available"] },
128
131
  OS6015: { code: "OS6015", title: "The requested timeframe does not fold into the chart's", severity: "error", stage: "host", since: 1, autofix: false, message: "{requested} is not a whole multiple of {chart}.", fix: "Request a multiple of {chart}, for example {suggestion}.", placeholders: ["requested", "chart", "suggestion"] },
@@ -131,9 +134,11 @@ export const ENTRIES = {
131
134
  OS6018: { code: "OS6018", title: "The compiled program is malformed", severity: "error", stage: "host", since: 1, autofix: false, message: "The program failed verification at {location}: {reason}.", fix: "Recompile the script from its source; a program that fails verification came from a broken compiler or was edited after it was written, and neither is repairable by hand.", placeholders: ["location", "reason"] },
132
135
  OS6019: { code: "OS6019", title: "A host setting fails the input's validation", severity: "error", stage: "host", since: 1, autofix: false, message: "The host supplied {value} for {key}, and {validation}.", fix: "Correct the value in the settings dialog, or widen the input's own min, max or options so the value is allowed.", placeholders: ["value", "key", "validation"] },
133
136
  OS6020: { code: "OS6020", title: "The report window holds no bars", severity: "error", stage: "host", since: 1, autofix: false, message: "The window from {from} to {to} holds none of the {count} bars supplied.", fix: "Widen the window until it covers bars, or supply the bars it covers. Both bounds are inclusive and are compared against the times of the bars supplied rather than against a calendar, so a window that falls inside a gap in the data is empty however wide it looks.", placeholders: ["from", "to", "count"] },
134
- OS6021: { code: "OS6021", title: "A run setting cannot be applied as stated", severity: "error", stage: "host", since: 1, autofix: false, message: "{setting} cannot be applied: {problem}.", fix: "State the setting so it can be carried out: declare a charge line after every line it is levied on, supply the tick size a slippage in ticks is measured in, or write down the reason a tolerance needs a bound. Nothing has been computed at the point this is refused, so correcting the setting and running again costs one run.", placeholders: ["setting", "problem"] },
137
+ OS6021: { code: "OS6021", title: "A run setting cannot be applied as stated", severity: "error", stage: "host", since: 1, autofix: false, message: "{setting} cannot be applied: {problem}.", fix: "State the setting so it can be carried out: declare a charge line after every line it is levied on, supply the tick size a slippage in ticks is measured in, write down the reason a tolerance needs a bound, or bring a bound past the cap back inside it. Nothing has been computed at the point this is refused, so correcting the setting and running again costs one run.", placeholders: ["setting", "problem"] },
135
138
  OS6022: { code: "OS6022", title: "The bars are not the bars the record was made from", severity: "error", stage: "host", since: 1, autofix: false, message: "The bars supplied hash to {found}, and the record was made from {expected}.", fix: "Replay against the bars the record names. Where the revision is the point, make a second record over the revised bars and compare the two runs, rather than overwriting one run with the other under one name.", placeholders: ["found", "expected"] },
136
139
  OS6023: { code: "OS6023", title: "Two cost models are stated at once", severity: "error", stage: "host", since: 1, autofix: false, message: "A charge schedule was supplied, and the declaration states a commission of {commission} in {commissionType}.", fix: "Supply the schedule and leave the declaration's commission at its default of zero, or state the commission in the declaration and supply no schedule. A schedule is the one of the two that can carry a floor, a cap, a charge levied on a charge, and a cost that falls on one side of the trade only.", placeholders: ["commission", "commissionType"] },
140
+ OS6024: { code: "OS6024", title: "The host cannot draw something this study declares", severity: "error", stage: "host", since: 1, autofix: false, message: "This host cannot draw {what}: {limit}.", fix: "Declare what this host draws, or run the study on a host that draws {what}.", placeholders: ["what", "limit"] },
141
+ OS6025: { code: "OS6025", title: "A bar has no time", severity: "error", stage: "host", since: 1, autofix: false, message: "Bar {index} was handed over with no time.", fix: "State the bar's open instant in whole milliseconds since the Unix epoch, UTC, and leave out a bar the host cannot date rather than handing it over without a time.", placeholders: ["index"] },
137
142
  OS7001: { code: "OS7001", title: "Only a strategy can do that", severity: "error", stage: "check", since: 1, autofix: false, message: "{name} is available only in a file declared with strategy().", fix: "Change study(...) on line {line} to strategy(...), or replace {name} with signal(\"...\") to mark the bar without trading.", placeholders: ["name", "line"] },
138
143
  OS7002: { code: "OS7002", title: "An order argument is absent", severity: "error", stage: "runtime", since: 1, autofix: false, message: "{name}'s {argument} is absent on this bar.", fix: "Guard the call with isNone({argument}), or supply a fallback with orElse() where one is genuinely correct.", placeholders: ["name", "argument"] },
139
144
  OS7003: { code: "OS7003", title: "An order function inside a request expression", severity: "error", stage: "check", since: 1, autofix: false, message: "{name} inside a request expression would place an order from another instrument's bars.", fix: "Read the value with the request, and place the order at the top level from the result.", placeholders: ["name"] },
@@ -172,5 +177,17 @@ export const ENTRIES = {
172
177
  OS8017: { code: "OS8017", title: "The condition is constant", severity: "warning", stage: "check", since: 1, autofix: false, message: "This condition is {value} on every bar.", fix: "Restore the test that was meant, or delete the branch that never runs.", placeholders: ["value"] },
173
178
  OS8018: { code: "OS8018", title: "An input is never used", severity: "warning", stage: "check", since: 1, autofix: false, message: "The input {title} is declared at line {line} and never read.", fix: "Use the name the input assigns, or delete the input() and its dialog row.", placeholders: ["title", "line"] },
174
179
  OS8019: { code: "OS8019", title: "A deleted object is still held", severity: "warning", stage: "check", since: 1, autofix: false, message: "{name} still holds the {kind} deleted at line {line}.", fix: "Assign none to the name on the same path as the delete, and where the object came out of an array, remove the element as well as deleting the object.", placeholders: ["name", "kind", "line"] },
180
+ OS9001: { code: "OS9001", title: "Version not read by the importer", severity: "error", stage: "import", since: 1, autofix: false, message: "The importer reads scripts written for version 5 or 6 of the source dialect, and this one {found}.", fix: "Bring the script up to version 5 or 6 in the source dialect, or translate it by hand, and import it again.", placeholders: ["found"] },
181
+ OS9002: { code: "OS9002", title: "Construct with no equivalent", severity: "error", stage: "import", since: 1, autofix: false, message: "The importer cannot translate {construct}, so the statement holding it was kept as a comment.", fix: "Translate that statement by hand from the comment that holds it: the rest of the script was translated around it.", placeholders: ["construct"] },
182
+ OS9003: { code: "OS9003", title: "Built-in with no mapping", severity: "error", stage: "import", since: 1, autofix: false, message: "{name} is not one of the built-ins the importer maps, so the statement holding it was kept as a comment.", fix: "Find the OpenScript library call that does the same job, check how it treats its first bars and absent values, and write the statement by hand.", placeholders: ["name"] },
183
+ OS9004: { code: "OS9004", title: "Declaration the importer cannot place", severity: "error", stage: "import", since: 1, autofix: false, message: "The importer writes the declaration from one indicator or strategy call at the top level, and this script {found}.", fix: "Give the source script exactly one indicator or strategy declaration at the top level, and import it again.", placeholders: ["found"] },
184
+ OS9005: { code: "OS9005", title: "Reads a statement that was not translated", severity: "error", stage: "import", since: 1, autofix: false, message: "{name} is declared by the statement at line {line}, which was not translated, so this statement that reads it was kept as a comment too.", fix: "Translate the statement at line {line} by hand first, then this one, which was kept as a comment only because it reads {name}.", placeholders: ["name", "line"] },
185
+ OS9006: { code: "OS9006", title: "Argument with no equivalent", severity: "error", stage: "import", since: 1, autofix: false, message: "{argument} changes what {call} computes or trades, and OpenScript has no equivalent the importer can write.", fix: "Translate the call by hand, deciding what OpenScript should do in place of {argument}, or remove {argument} from the source script if the script does not depend on it.", placeholders: ["argument", "call"] },
186
+ OS9007: { code: "OS9007", title: "Warmup and absent bars follow OpenScript", severity: "warning", stage: "import", since: 1, autofix: false, message: "{call} became {target} here and wherever else the script calls it, and {target} follows OpenScript's own warmup, arithmetic and handling of absent values, which the original is not guaranteed to share.", fix: "Compare the first bars of the translation with the original, and where the script depends on them, write the value as an explicit recurrence held in var, seeded the way the original seeds it.", placeholders: ["call", "target"] },
187
+ OS9008: { code: "OS9008", title: "Whole-number division in version 5", severity: "warning", stage: "import", since: 1, autofix: false, message: "Both sides of this division are whole-number constants, which version 5 of the source dialect divides without a fractional part, and OpenScript keeps the fraction.", fix: "If the script relied on the whole-number result, wrap the translated division in trunc(); otherwise leave it as it is.", placeholders: [] },
188
+ OS9009: { code: "OS9009", title: "Presentation argument left out", severity: "warning", stage: "import", since: 1, autofix: false, message: "{argument} changes how {call} is displayed or what it may allocate, not what it computes, and OpenScript has no equivalent, so the translation leaves it out.", fix: "Nothing needs to change unless the display mattered; where it did, restyle the translated call with the arguments OpenScript does have, such as its colour, width and style.", placeholders: ["argument", "call"] },
189
+ OS9010: { code: "OS9010", title: "Order placed under OpenScript's order model", severity: "warning", stage: "import", since: 1, autofix: false, message: "{call} was translated into OpenScript's order calls here and wherever else the script uses it, and OpenScript decides when an order fills, how a reversal and a repeated entry are handled and when an exit level starts to apply by its own order model.", fix: "Backtest the translation beside the original and compare the two trade lists before relying on it, and adjust the order calls by hand where they part.", placeholders: ["call"] },
190
+ OS9011: { code: "OS9011", title: "Equality over two absent values", severity: "warning", stage: "import", since: 1, autofix: false, message: "Both sides of {operator} can be absent on the same bar, and OpenScript counts two absent values as equal, which the original is not guaranteed to do.", fix: "If the original relied on two absent values never comparing equal, guard the translated comparison with isNone() on either side.", placeholders: ["operator"] },
191
+ OS9012: { code: "OS9012", title: "The translation does not compile", severity: "error", stage: "import", since: 1, autofix: false, message: "The OpenScript compiler refused the translation of this statement with {code}, so the statement was kept as a comment.", fix: "Look up {code} in this catalogue and translate the statement by hand in the form that code's fix describes.", placeholders: ["code"] },
175
192
  };
176
193
  //# sourceMappingURL=catalogue.generated.js.map