cotcube-level 0.3.4 → 0.3.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04184473172dd9ffd09c49a16bf6c2a724eb5cbef3f0f3d5423c44dea55f530f'
4
- data.tar.gz: 75d1363041e3767a2f79c277a0d945fd830c1521df481194d8162c36b36044f2
3
+ metadata.gz: 71bc6b4ca29ab4ff089b95568a0d592d4bc2b3d8c1824ea9158d661792f1c5b7
4
+ data.tar.gz: 670d5a69457411fc7539542a1bd0ad1712ef9111f7b5a876b3c7bdd5d6de90c0
5
5
  SHA512:
6
- metadata.gz: 70875d4dd83cb114b62456866b7c8ddaaa9753890442b06d71d770bb6408994cadcf3a5cd12704d658e049ed2aba0cd14bdbf79ce9d25e462ff9453c785a5142
7
- data.tar.gz: 34aa4547dab7a3b13c896db860bcb23d36c432a0c3480cadf2e8a542351316d92cbe10a321ff8b20da236556312da27e8bb53ac6f65a1d885b48ccbe270c41ef
6
+ metadata.gz: 3221bf00e3532ae51f62d98f191332273a2241ae34f0eff99e9840f28f41e339a816d23d100150aca70719855c6a1d0507f6509f2598cad75c880f86089286b3
7
+ data.tar.gz: 652072c05872418b438ca7ac937e3e5735a5967804c0d0e8f75b4e5381553b55e8b64ecf769cb820745650717077eae1ac7b0b844325725a1c0c78b6b2fbbf85
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.4.1 (October 09, 2021)
2
+ - intraday_stencil: fixing @index, that did not work when used outside active hours
3
+
1
4
  ## 0.3.4 (October 06, 2021)
2
5
  - intraday_stencil: major rework resp. rebuild ... now beta-ready
3
6
  - helpers: preparing puts_swap and get_jsonl_name to work intraday
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.4.1
@@ -39,17 +39,17 @@ module Cotcube
39
39
  stencil: nil, # instead of preparing, use this one if set
40
40
  warnings: true # be more quiet
41
41
  )
42
- @shiftset = Intraday_Stencil.shiftset(asset: asset)
43
- @timezone = Cotcube::Level::TIMEZONES[@shiftset[:tz]]
44
- @debug = debug
45
- @interval = interval
46
- @swap_type = swap_type
47
- @warnings = warnings
48
- datetime ||= DateTime.now
49
- datetime = @timezone.at(datetime.to_i) unless datetime.is_a? ActiveSupport::TimeWithZone
50
- @datetime = datetime.beginning_of_day
51
- @datetime += interval while @datetime <= datetime - interval
52
- @datetime -= interval
42
+ @shiftset = Intraday_Stencil.shiftset(asset: asset)
43
+ @timezone = Cotcube::Level::TIMEZONES[@shiftset[:tz]]
44
+ @debug = debug
45
+ @interval = interval
46
+ @swap_type = swap_type
47
+ @warnings = warnings
48
+ datetime ||= DateTime.now
49
+ datetime = @timezone.at(datetime.to_i) unless datetime.is_a? ActiveSupport::TimeWithZone
50
+ @datetime = datetime.beginning_of_day
51
+ @datetime += interval while @datetime <= datetime - interval
52
+ @datetime -= interval
53
53
 
54
54
  const = "RAW_INTRA_STENCIL_#{@shiftset[:nr]}_#{interval.in_minutes.to_i}".to_sym
55
55
  if Object.const_defined? const
@@ -120,22 +120,22 @@ module Cotcube
120
120
  @base.select!{|x| %i[ pre rth post ].include?(x[:type]) }
121
121
  when :rth
122
122
  @base.select!{|x| x[:type] == :rth }
123
- # to.map{ |x| [:high, :low, :volume].map{|z| x[z] = nil} if x[:block] }
124
123
  when :flow
125
- @base.reject!{|x| %i[ meow postmm postmm5 ].include?(x[:type]) }
124
+ @base.reject!{|x| %i[ sow eow mpost mpost ].include?(x[:type]) }
126
125
  @base.
127
126
  map{ |x|
128
127
  [:high, :low, :volume].map{|z| x[z] = nil} unless x[:type] == :rth
129
- # [:high, :low, :volume].map{|z| x[z] = nil} if x[:block]
130
128
  }
131
129
  when :run
132
- @base.select!{|x| %i[ premarket rth postmarket ].include? x[:type]}
130
+ @base.select!{|x| %i[ pre rth post ].include? x[:type]}
133
131
  else
134
- raise ArgumentError, "Unknown stencil/swap type '#{type}'"
132
+ raise ArgumentError, "Unknown stencil/swap type '#{swap_type}'"
135
133
  end
136
134
  @base.map!{|z| z.dup}
137
135
 
138
- @index = @base.index{|x| x[:datetime] == @datetime }
136
+ # zero is, were either x[:datetime] == @datetime (when we are intraday)
137
+ # or otherwise {x[:datetime] <= @datetime}.last (when on maintenance)
138
+ @index = @base.index{|x| x == @base.select{|y| y[:datetime] <= @datetime }.last }
139
139
  @index -= 1 while %i[sow sod mpre mpost eod eow].include? @base[@index][:type]
140
140
  @datetime = @base[@index][:datetime]
141
141
  @zero = @base[@index]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cotcube-level
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin L. Tischendorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-06 00:00:00.000000000 Z
11
+ date: 2021-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport