Class: SQA::StrategyGenerator::Pattern
- Inherits:
-
Object
- Object
- SQA::StrategyGenerator::Pattern
- Defined in:
- lib/sqa/strategy_generator.rb
Overview
Represents a discovered indicator pattern
Instance Attribute Summary collapse
-
#avg_gain ⇒ Object
Returns the value of attribute avg_gain.
-
#avg_holding_days ⇒ Object
Returns the value of attribute avg_holding_days.
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#context ⇒ Object
Returns the value of attribute context.
-
#frequency ⇒ Object
Returns the value of attribute frequency.
-
#occurrences ⇒ Object
Returns the value of attribute occurrences.
-
#success_rate ⇒ Object
Returns the value of attribute success_rate.
Instance Method Summary collapse
-
#initialize(conditions: {}) ⇒ Pattern
constructor
A new instance of Pattern.
- #to_s ⇒ Object
Constructor Details
#initialize(conditions: {}) ⇒ Pattern
Returns a new instance of Pattern.
74 75 76 77 78 79 80 81 82 |
# File 'lib/sqa/strategy_generator.rb', line 74 def initialize(conditions: {}) @conditions = conditions @frequency = 0 @avg_gain = 0.0 @avg_holding_days = 0.0 @success_rate = 0.0 @occurrences = [] @context = PatternContext.new end |
Instance Attribute Details
#avg_gain ⇒ Object
Returns the value of attribute avg_gain.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def avg_gain @avg_gain end |
#avg_holding_days ⇒ Object
Returns the value of attribute avg_holding_days.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def avg_holding_days @avg_holding_days end |
#conditions ⇒ Object
Returns the value of attribute conditions.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def conditions @conditions end |
#context ⇒ Object
Returns the value of attribute context.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def context @context end |
#frequency ⇒ Object
Returns the value of attribute frequency.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def frequency @frequency end |
#occurrences ⇒ Object
Returns the value of attribute occurrences.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def occurrences @occurrences end |
#success_rate ⇒ Object
Returns the value of attribute success_rate.
70 71 72 |
# File 'lib/sqa/strategy_generator.rb', line 70 def success_rate @success_rate end |
Instance Method Details
#to_s ⇒ Object
84 85 86 87 |
# File 'lib/sqa/strategy_generator.rb', line 84 def to_s ctx_info = @context.valid? ? " [#{@context.summary}]" : "" "Pattern(conditions=#{conditions.size}, freq=#{frequency}, gain=#{avg_gain.round(2)}%, success=#{success_rate.round(2)}%#{ctx_info})" end |