openalgo-script 0.7.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +316 -379
  3. package/dist/adapters/charts/alerts.d.ts +11 -0
  4. package/dist/adapters/charts/alerts.d.ts.map +1 -1
  5. package/dist/adapters/charts/alerts.js +16 -1
  6. package/dist/adapters/charts/alerts.js.map +1 -1
  7. package/dist/adapters/charts/capabilities.d.ts +48 -0
  8. package/dist/adapters/charts/capabilities.d.ts.map +1 -0
  9. package/dist/adapters/charts/capabilities.js +82 -0
  10. package/dist/adapters/charts/capabilities.js.map +1 -0
  11. package/dist/adapters/charts/columns.d.ts +19 -2
  12. package/dist/adapters/charts/columns.d.ts.map +1 -1
  13. package/dist/adapters/charts/columns.js +15 -3
  14. package/dist/adapters/charts/columns.js.map +1 -1
  15. package/dist/adapters/charts/contract.d.ts +35 -3
  16. package/dist/adapters/charts/contract.d.ts.map +1 -1
  17. package/dist/adapters/charts/descriptor.d.ts +1 -1
  18. package/dist/adapters/charts/descriptor.d.ts.map +1 -1
  19. package/dist/adapters/charts/descriptor.js +17 -5
  20. package/dist/adapters/charts/descriptor.js.map +1 -1
  21. package/dist/adapters/charts/fills.d.ts +26 -5
  22. package/dist/adapters/charts/fills.d.ts.map +1 -1
  23. package/dist/adapters/charts/fills.js +55 -7
  24. package/dist/adapters/charts/fills.js.map +1 -1
  25. package/dist/adapters/charts/index.d.ts +9 -3
  26. package/dist/adapters/charts/index.d.ts.map +1 -1
  27. package/dist/adapters/charts/index.js +7 -1
  28. package/dist/adapters/charts/index.js.map +1 -1
  29. package/dist/adapters/charts/produced.d.ts +3 -2
  30. package/dist/adapters/charts/produced.d.ts.map +1 -1
  31. package/dist/adapters/charts/produced.js +1 -1
  32. package/dist/adapters/charts/produced.js.map +1 -1
  33. package/dist/adapters/charts/run.d.ts +23 -0
  34. package/dist/adapters/charts/run.d.ts.map +1 -1
  35. package/dist/adapters/charts/run.js +2 -1
  36. package/dist/adapters/charts/run.js.map +1 -1
  37. package/dist/adapters/charts/surfaces.d.ts +11 -0
  38. package/dist/adapters/charts/surfaces.d.ts.map +1 -1
  39. package/dist/adapters/charts/tables.d.ts +21 -11
  40. package/dist/adapters/charts/tables.d.ts.map +1 -1
  41. package/dist/adapters/charts/tables.js +17 -6
  42. package/dist/adapters/charts/tables.js.map +1 -1
  43. package/dist/adapters/charts/undrawable.d.ts +2 -1
  44. package/dist/adapters/charts/undrawable.d.ts.map +1 -1
  45. package/dist/adapters/charts/undrawable.js +24 -14
  46. package/dist/adapters/charts/undrawable.js.map +1 -1
  47. package/dist/core/check/call-sites.js +15 -5
  48. package/dist/core/check/call-sites.js.map +1 -1
  49. package/dist/core/version/version.generated.d.ts +1 -1
  50. package/dist/core/version/version.generated.js +1 -1
  51. package/package.json +1 -1
  52. package/spec/errors.json +1 -1
  53. package/src/adapters/charts/alerts.ts +28 -1
  54. package/src/adapters/charts/capabilities.ts +103 -0
  55. package/src/adapters/charts/columns.ts +29 -8
  56. package/src/adapters/charts/contract.ts +36 -2
  57. package/src/adapters/charts/descriptor.ts +21 -6
  58. package/src/adapters/charts/fills.ts +95 -11
  59. package/src/adapters/charts/index.ts +9 -1
  60. package/src/adapters/charts/produced.ts +4 -3
  61. package/src/adapters/charts/run.ts +25 -1
  62. package/src/adapters/charts/surfaces.ts +12 -0
  63. package/src/adapters/charts/tables.ts +31 -14
  64. package/src/adapters/charts/undrawable.ts +24 -14
  65. package/src/core/check/call-sites.ts +15 -5
  66. package/src/core/version/version.generated.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,107 @@ nothing, fails the build before it can become permanent.
7
7
 
8
8
  ---
9
9
 
10
+ ## 0.8.1
11
+
12
+ Two fixes and a documentation correction. No compiled-format change: the format
13
+ stays 1.1, and every shipped example compiles to the same bytes as with 0.8.0.
14
+
15
+ The chart adapter now reads an alert's message at the bar the chart judged. From
16
+ its version 2.6.0 the chart library can run a study on a transformed chart over
17
+ the bars the host feeds rather than over the elements it draws, and it reads the
18
+ study's columns onto those elements, each at the bar the element was completed
19
+ on. The alert's condition is a column and was read at the right bar. Its message
20
+ was not: the adapter read it at the element's position in the underlying run,
21
+ so on a transform that is not one element per bar (Renko, range bars, line
22
+ break, point and figure, Kagi) a notification could carry another bar's text or
23
+ fall back to the alert's title. The calculation now returns one more column,
24
+ `openscript:bar`, holding each row's bar index in the run, and the message is
25
+ read at the bar that column names. The column is written only for a study that
26
+ declares an alert. On every other chart, including every chart library before
27
+ 2.6.0, a study left on the chart's own bars and a transform that keeps one
28
+ element per bar, the column is the row's own index and nothing a study draws or
29
+ announces changes. A host that lists the keys of the values table sees the new
30
+ key beside the `openscript:alert:` ones.
31
+
32
+ `req.timeframe` and `req.symbol` now read a mode written positionally. The mode
33
+ is the third argument of `req.timeframe` and the fifth of `req.symbol`, and it
34
+ was recognised only after `mode =`. A positional mode was accepted and ignored,
35
+ so `req.timeframe("1D", close, "lookahead")` ran as `"confirmed"`, carried no
36
+ OS8005 and was not marked as repainting, and a positional `"developing"` ran
37
+ confirmed too. A script that wrote its mode positionally now runs in the mode it
38
+ wrote, so its values change, and a positional `"lookahead"` now carries OS8005
39
+ and the repaint mark. A positional mode that is not written out as one of the
40
+ three words, one taken from an input for instance, is refused with OS3003, as a
41
+ labelled one already was. The mode is settled by the compiler, so a program
42
+ compiled by 0.8.0 and stored keeps the mode it was compiled with in either
43
+ engine: recompile a stored program whose source writes a mode positionally. The
44
+ new conformance case `req/positional-mode` pins it, and both engines agree on
45
+ all 108 cases they run.
46
+
47
+ The documentation said a `"1D"` higher timeframe read folds by the session. It
48
+ folds by the civil date in the instrument's timezone, as `compiled-program.md`
49
+ 2.16.2 specifies and both engines have always done. For a session that stays
50
+ inside one date the two are the same; an evening session that runs past
51
+ midnight is split at midnight, and its bars after midnight join the next date's
52
+ bucket. The pages on sessions, timeframes and higher timeframes, and the cause
53
+ of OS6015, now say so. No behaviour changes.
54
+
55
+ The Python engine's code is unchanged. The chart adapter ships only in the npm
56
+ package, and the mode fix is in the compiler. The Python package moves to 0.8.1
57
+ because the two packages carry one version and ship as one release. Upgrade both
58
+ together.
59
+
60
+ ## 0.8.0
61
+
62
+ The chart adapter now draws two things it used to refuse, on a chart that can
63
+ draw them. A band whose colour the script computes per bar is shaded bar by bar,
64
+ and a study that declares more than one grid gets every grid, each in the corner
65
+ its own `position` names. Both need hooks the chart library added in its version
66
+ 2.5.4, and a chart ignores a hook it does not know, so the adapter is told which
67
+ chart it is drawing on: a host passes the library's exported `VERSION` string as
68
+ the new `chartVersion` option, `descriptorFor(program, { chartVersion: VERSION })`.
69
+
70
+ A host that passes nothing draws exactly what it drew with 0.7.2, and such a
71
+ study is still refused before any bar runs with OS6024. So is one on a chart
72
+ older than 2.5.4, on a prerelease of 2.5.4, or on a version string that cannot
73
+ be read, and the refusal now ends by saying which version the host stated. On no
74
+ chart version is either thing drawn in part or dropped in silence.
75
+
76
+ How a computed band colour is drawn. Each bar is shaded in the colour the script
77
+ computed there for the side the band is on, and the side is decided the way the
78
+ chart decides it, the first plot at or above the second, so the colour always
79
+ belongs to the run the chart draws that bar in. An absent colour leaves the bar
80
+ unshaded, as `docs/visuals/fills.md` has always taught. A side the script did
81
+ not compute keeps the colour it declared. `opacity` dims a computed colour
82
+ exactly as it dims a constant one, and the twelve percent fade of a band with no
83
+ colour of its own does not apply to a band whose colour is computed.
84
+
85
+ How several grids are drawn. Each grid reaches the chart under its declaration's
86
+ key, which does not change between recomputes, so the chart keeps a grid rather
87
+ than building it again on every tick. The single `table` hook still carries the
88
+ first grid, for a chart without the list. Two grids pinned to the same corner are
89
+ drawn one over the other, so give each grid its own `position`.
90
+
91
+ For a host that type checks the descriptor: `ChartFill` gains an optional
92
+ `colorBy`, `ChartDescriptor` an optional `tables`, and `ChartFillContext` and
93
+ `ChartTableSpec` are new exports. The one line assignment to the chart library's
94
+ own descriptor type was compiled against that library's types at 2.5.1 and at
95
+ 2.5.5, and a study with two grids and a computed band was drawn end to end on
96
+ 2.5.5.
97
+
98
+ The Python engine is unchanged. It never had either limit: its fills channel
99
+ already publishes each band's colours bar by bar, and its table channel already
100
+ serves every declared grid in declaration order. The chart adapter ships only in
101
+ the npm package. The Python package moves to 0.8.0 because the two packages carry
102
+ one version and ship as one release, and upgrading it changes nothing.
103
+
104
+ No compiled-format change, no language change, and no computed value moves:
105
+ every shipped example builds the same descriptor and the same columns as 0.7.2
106
+ when no chart version is stated. Still not decided: a band that computes one
107
+ side's colour and names none for the other draws that side in the chart's own
108
+ default colour, as a band with one constant side always has; whether such a side
109
+ should be unshaded is recorded as open in decision 75.
110
+
10
111
  ## 0.7.2
11
112
 
12
113
  Running totals in both engines now survive one overflowing bar. `pvt` added its