File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
lib/ruby_technical_analysis/indicators
spec/ruby_technical_analysis/indicators Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 11# Ruby Technical Analysis
22
3+ ## 1.0.4 (2024-02-10)
4+ - Update PriceChannel to include #valid?
5+
36## 1.0.3 (2024-01-24)
47
58### Breaking Changes
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ def call
1818 calculate_price_channel
1919 end
2020
21+ # @return [Boolean] Whether the object is valid
22+ def valid?
23+ series . length >= period
24+ end
25+
2126 private
2227
2328 def _highs
Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ module RubyTechnicalAnalysis
3737 expect ( price_channel . call ) . to eq ( [ 2.974 , 2.8127 ] )
3838 end
3939 end
40+
41+ describe "#valid?" do
42+ it "returns true if the object is valid" do
43+ expect ( price_channel . valid? ) . to eq ( true )
44+ end
45+
46+ it "returns false if the object is invalid" do
47+ expect ( described_class . new ( series : [ ] ) . valid? ) . to eq ( false )
48+ end
49+ end
4050 end
4151
4252 describe "secondary series" do
You can’t perform that action at this time.
0 commit comments