Implementing Pipes

This commit is contained in:
Michael Schimmel
2025-12-21 16:30:09 +01:00
parent ac96a105a5
commit 8b765487ae
6 changed files with 515 additions and 336 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
(*
(*TODO
; Record-Streams sind Record-Series, an die "Pipes" andocken können.
; Es handelt sich um ein reaktives Producer-Consumer-Pattern.
@@ -11,7 +12,6 @@
(def btc-sma
(pipe [btc [:Close]]
(fn [price]
; KEIN emit mehr. Wir geben einfach die Map zurück.
; Die Engine nimmt diesen Rückgabewert und publiziert ihn.
{:ma (sma (get price 0))}
)
@@ -34,9 +34,10 @@
(def btc-buy-only
(pipe [btc [:Close] btc-sma [:ma]]
(fn [price ma]
; Ein IF ohne ELSE.
; Ein IF ohne ELSE -> optionaler Typ
; Wenn die Bedingung FALSE ist, ist das Ergebnis der Funktion "Void".
; Die Engine erkennt "Void" und sendet NICHTS an die Observer.
; Die ermöglich Aggregation.
(if (> (get price 0) (get ma 0))
{:signal :buy})
)