-
Couldn't load subscription status.
- Fork 115
Open
Labels
Description
This is the LHS of my rule:
(defrule calculate-dlp-add-ratio
"Calculate Dlp Add Ratio"
;{:salience 1500}
[VolumeAccumulation (= accumulationLevel VolumeAccumulation$AccumulationLevel/ACCOUNT_SYMBOL)
(= accumulationCode "nqeAddDlp")
(= ?exchangeSymbol symbol)
(= ?acctVolume totalVolume)
(= ?acctIdentifier accountIdentifier)
(= ?firmIdentifier firmIdentifier)
(= ?symbol symbol)
( pos? totalVolume)
]
[DlpFirm
(= ?acctIdentifier mpid)
(= ?exchangeSymbol symbol)
(= portId "PrimaryDLP")
]
[?sumTotalVolume <-(acc/sum :totalVolume) :from [VolumeAccumulation
(= accumulationLevel VolumeAccumulation$AccumulationLevel/EXCHANGE_SYMBOL)
(= accumulationCode "nqeAddDlp")
(= symbol ?exchangeSymbol)
]]
[:test (and (some? ?sumTotalVolume) (>= (.doubleValue ?sumTotalVolume) 1)) ]
I'm getting the following NPE from the acc/sum:
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "x" is null
at clojure.lang.Numbers.ops (Numbers.java:1095)
clojure.lang.Numbers.add (Numbers.java:155)
clara.rules.accumulators$sum$fn__7939.invoke (accumulators.cljc:158)
clojure.lang.ArrayChunk.reduce (ArrayChunk.java:58)
clojure.core.protocols$fn__8244.invokeStatic (protocols.clj:136)
I've ensured that totalVolume is never null, even by hardcoding the getter to always return 100L. Still get the same error:
I'm stumped. Any suggestions?