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.
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
;; Skip: data output to stdout
|
||||
(do
|
||||
(def ohlc (create-m1-stream "EURUSD"))
|
||||
(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
|
||||
(pipe ohlc
|
||||
(fn [bar]
|
||||
(print (.close bar)))))
|
||||
|
||||
(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))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user