Files
RustAst/examples/data_stream_print.myc
T
Brummel 9b13546609 feat: Add pipe parameter validation and fix VM call frame
Adds a check within the `PipeHook` to ensure the number of input streams
provided to a `pipe` operation matches the number of parameters expected
by the associated lambda function. This prevents runtime errors and
provides a clearer compile-time diagnostic.

Additionally, this commit corrects the order in which a `CallFrame` is
pushed onto the VM's frame stack. By pushing the frame earlier, it
ensures that slow-path `unpack` operations have access to a valid frame,
preventing "No call frame" errors.
2026-03-30 09:43:58 +02:00

24 lines
639 B
Plaintext

;; Skip: data output to stdout
(do
(def EURUSD (create-m1-stream "EURUSD" (date "2020-01-03 09:30:00") (date "2020-01-03 17:30:00")))
(def GER40 (create-m1-stream "GER40" (date "2020-01-03 09:30:00") (date "2020-01-03 17:30:00")))
;; Sink: print returns void, so nothing is propagated downstream
(def cnt 1)
(def gs (series 2))
;IDEE (pipe lookback [EURUSD acc] --> series acc
(pipe [EURUSD GER40]
(fn [eu ge]
(do
(def dax (.close ge))
(push gs dax)
(def eur (- dax (gs 1)))
(print cnt ": dax=" eur " (" (/ eur (.close eu)) "$)" )
(assign cnt (+ cnt 1))
)
)
)
)