add instructions, is breaking things tho?
This commit is contained in:
parent
a4703d60a8
commit
4ff98629f9
@ -20,6 +20,16 @@
|
||||
(fn [stack state]
|
||||
(make-instruction state > [stack stack] :boolean)))
|
||||
|
||||
;; Pushes :buy onto the SIGNAL stack if the first item is greater than the second
|
||||
;; item, and acts as a no-op otherwise.
|
||||
(def _gt_buy
|
||||
"Pushes :buy onto the SIGNAL stack if the first item is greater
|
||||
than the second item, and acts as a no-op otherwise"
|
||||
^{:stacks #{:signal}
|
||||
:name "_gt_buy"}
|
||||
(fn [stack state]
|
||||
(make-instruction state #(if (%1 > %2) :buy nil) [stack stack] :signal)))
|
||||
|
||||
;; Pushes TRUE onto the BOOLEAN stack if the second item is greater than or
|
||||
;; equal to the top item, and FALSE otherwise
|
||||
(def _gte
|
||||
@ -173,11 +183,10 @@ Otherwise, acts as a NOOP"
|
||||
(fn [stack state]
|
||||
(make-instruction state dec [stack] stack)))
|
||||
|
||||
;; 2 types x 16 functions = 32 instructions
|
||||
(generate-instructions
|
||||
[:float :integer]
|
||||
[_gt _gte _lt _lte _add _subtract _mult _quot _mod _max _min _inc _dec
|
||||
_from_boolean _from_char _from_string])
|
||||
_from_boolean _from_char _from_string, _gt_buy])
|
||||
|
||||
;; =============================================================================
|
||||
;; FLOAT Instructions only
|
||||
|
@ -17,7 +17,9 @@
|
||||
:vector_boolean '()
|
||||
:vector_float '()
|
||||
:vector_integer '()
|
||||
:vector_string '()})
|
||||
:vector_string '()
|
||||
:signal '() ;; stock trading signal (:buy, :sell, or :hold only), long only for now
|
||||
})
|
||||
|
||||
;; All stack types available in a Push state
|
||||
(defonce ^:no-doc stacks (set (keys empty-state)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user