📦 SQA::Strategy::KBS¶
🏭 Class Methods¶
.trade(vector)¶
Main strategy interface - compatible with SQA::Strategy framework
Source Location
🔨 Instance Methods¶
#kb()¶
Returns the value of attribute kb.
Source Location
#default_rules_loaded()¶
Returns the value of attribute default_rules_loaded.
Source Location
#initialize(load_defaults: = true)¶
Returns
Type: KBS
a new instance of KBS
Source Location
#execute(vector)¶
Execute strategy with given market data
Source Location
#add_rule(name, &block)¶
Add a custom trading rule
Example: add_rule :buy_dip do on :rsi, { value: ->(v) { v < 30 } } on :macd, { signal: :bullish } perform { kb.assert(:signal, { action: :buy, confidence: :high }) } end
Note: Use kb.assert in perform blocks, not just assert
Source Location
#assert_fact(type, attributes = {})¶
Assert a fact into working memory
Source Location
#query_facts(type, pattern = {})¶
Query facts from working memory
Source Location
#print_facts()¶
Print current working memory (for debugging)
Source Location
#print_rules()¶
Print all rules (for debugging)
Source Location
📝 Attributes¶
👁️ kb read-only¶
Returns the value of attribute kb.
👁️ default_rules_loaded read-only¶
Returns the value of attribute default_rules_loaded.