cotcube-bardata 0.1.15.5 → 0.1.18

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: e1ab9094e7e7e6c04a90f1f1a640b902de5a0c688403a5d79c53a7b3f11c9434
4
- data.tar.gz: 16175de316f036ec9a930b43d700fc241999afaffca728bf2ba436470255c957
3
+ metadata.gz: 748713da1657b8a6793d565bb512e4b75e5e42eac3f8358f0539fdc68bf01b15
4
+ data.tar.gz: b5f2357bec4f8a2bef007deaae1bfa03ebf55f8cfdeee4ed7a3ad54070d1b0a4
5
5
  SHA512:
6
- metadata.gz: f549b77c54222c0424d0f96c20a43634ab18af6001efffbc27ef3a4d21ee56e4fe67e727399dbbce47335b82d7e3733350b7b5469a22acee970c682eefef1d0c
7
- data.tar.gz: 5153e8ad6cfae659c0f538e42cf635b53a3e543bb41a0decc8daf9169f62bce92dd0f7cd8b2d7a71a983a953b5be57b1e2fff7e6679f14662d6369524b486ca0
6
+ metadata.gz: 14390b66e537a384dd769d228e6f48ecf27fffb0cfcfdaf3f459cd01ad3db911ab886f450fdc4ba097aa79a27c0ee31ea820553d084d967a597dd71a1f508ea4
7
+ data.tar.gz: c92e81d2d6488ed4b7fcffc8b000fcde62ec94ebe5e6e0ff461b40febb4ac19cadb6126b8a3c7241ec0e647cde9c43126176ae573a18769e42287eb206c02c2b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.1.18 (December 23, 2021)
2
+ - gemspec: raised activesupport to v7
3
+ - daily: added check for valid/allowed month pattern in continuous_overview
4
+
5
+ ## 0.1.17 (December 06, 2021)
6
+ - changed parameter for building of continuous (in daily.rb)
7
+ - added bin/intra + symbols. improved bin/daily
8
+ - bin/*: created (sym, daily) and improved (eod) cmd wrappers
9
+ - daily.rb: improved silence in .continuous
10
+
11
+ ## 0.1.16 (November 23, 2021)
12
+ - bin/eod.rb: little helper to display eod data in bash resp. in xinetdhttpservice
13
+ - eods.rb: minor change to adapt move of symbols to Helpers
14
+ - daily.rb: in continuous, changed default indicators to %i[ tr atr5 dist ]
15
+
16
+ ## 0.1.15.6 (November 19, 2021)
17
+ - daily: added filter_series
18
+
1
19
  ## 0.1.15.5 (November 08, 2021)
2
20
  - decommissioned .get_id_set in favor of Cotcube::Helpers.get_id_set
3
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.15.5
1
+ 0.1.18
data/bin/daily.rb ADDED
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/cotcube-bardata'
4
+ require 'cotcube-level'
5
+ require 'cotcube-indicators'
6
+ CcI = Cotcube::Indicators
7
+
8
+ def exit_with_error(err)
9
+ msg = { error: 1, message: "#{err}" }
10
+ p msg.to_json
11
+ exit 1
12
+ end
13
+
14
+
15
+ contract = ARGV[0].nil? ? nil : ARGV[0].upcase
16
+ if contract.nil?
17
+ exit_with_error('No contract given')
18
+ end
19
+
20
+ output = true
21
+
22
+ sym = Cotcube::Helpers.get_id_set(symbol: contract[..1])
23
+ # TODO: apply daylight time pimped diff to all relevant datetimes in series
24
+ timediff = if %w[ NYBOT NYMEX ].include? sym[:exchange]
25
+ 5.hours
26
+ elsif %w[ DTB ].include? sym[:exchane]
27
+ 1.hour
28
+ else
29
+ 6.hours
30
+ end
31
+
32
+ continuous = %w[currencies interest indices].include? sym[:type]
33
+ intraday = false
34
+ interval = intraday ? 30.minutes : 1.day
35
+ ema_period = 50
36
+
37
+ indicators = {
38
+ ema_high: CcI.ema(key: :high, length: ema_period, smoothing: 2),
39
+ ema_low: CcI.ema(key: :low, length: ema_period, smoothing: 2)
40
+ }
41
+
42
+ dailybase = []
43
+ stencil = nil
44
+ stencil = Cotcube::Level::EOD_Stencil.new( interval: :daily, swap_type: :full)
45
+ dailybase = if continuous
46
+ Cotcube::Bardata.continuous(symbol: contract[..1], indicators: indicators)[-300..].
47
+ map{ |z|
48
+ z[:datetime] = DateTime.parse(z[:date])
49
+ z.delete(:contracts)
50
+ z
51
+ }
52
+ else
53
+ Cotcube::Bardata.provide_daily(contract: contract, indicators: indicators)[-300..]
54
+ end
55
+
56
+ base = dailybase
57
+ base.select!{|z| z[:high]}
58
+
59
+ scaleBreaks = []
60
+ brb = stencil.base
61
+ brb.each_with_index.map{|z,i|
62
+ next if i.zero?
63
+ if brb[i][:datetime] - brb[i-1][:datetime] > (intraday ? 1 : 1.day) and brb[i][:datetime] > base.first[:datetime] and brb[i-1][:datetime] < base.last[:datetime]
64
+ scaleBreaks << { startValue: brb[i-1][:datetime] + 0.5 * interval, endValue: brb[i][:datetime] - 0.5 * interval }
65
+ end
66
+ } unless base.empty?
67
+
68
+ pkg = {
69
+ base: base,
70
+ breaks: scaleBreaks
71
+ }
72
+
73
+ puts pkg.to_json if output
data/bin/eod.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/cotcube-bardata.rb'
4
+
5
+ symbol = ARGV[0].nil? ? nil : ARGV[0].upcase
6
+ json = ARGV.include? 'json'
7
+
8
+ begin
9
+ s = Cotcube::Bardata.provide_eods(threshold: 0.10, contracts_only: false, symbol: symbol, filter: :oi_part)
10
+ if json
11
+ p s.to_json
12
+ else
13
+ s.each {|x| puts x.values.to_csv}
14
+ end
15
+ rescue
16
+ msg = { error: 503, message: "Could not processes symbol '#{symbol}'." }
17
+ p msg.to_json
18
+ end
data/bin/intra.rb ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cotcube-bardata'
4
+ require 'cotcube-level'
5
+ require 'cotcube-indicators'
6
+
7
+ def exit_with_error(err)
8
+ msg = { error: 1, message: "#{err}" }
9
+ p msg.to_json
10
+ exit 1
11
+ end
12
+
13
+
14
+ contract = ARGV[0].nil? ? nil : ARGV[0].upcase
15
+
16
+ debug = ARGV.include? 'debug'
17
+ if contract.nil?
18
+ exit_with_error('No contract given')
19
+ end
20
+
21
+ sym = Cotcube::Helpers.get_id_set(symbol: contract[..1])
22
+ # TODO: apply daylight time pimped diff to all relevant datetimes in series
23
+ timediff = if %w[ NYBOT NYMEX ].include? sym[:exchange]
24
+ 5.hours
25
+ elsif %w[ DTB ].include? sym[:exchane]
26
+ 1.hour
27
+ else
28
+ 6.hours
29
+ end
30
+
31
+ continuous = %w[currencies interest indices].include? sym[:type]
32
+ interval = 30.minutes
33
+
34
+ intrabase = []
35
+ istencil = []
36
+ collector_threads = []
37
+
38
+ collector_threads << Thread.new do
39
+ istencil = Cotcube::Level::Intraday_Stencil.new( interval: 30.minutes, swap_type: :full, asset: :full, weeks: 8)
40
+ end
41
+
42
+ collector_threads << Thread.new do
43
+ begin
44
+ intrabase = JSON.parse(Cotcube::Helpers::DataClient.new.get_historical(contract: contract, interval: :min30, duration: '3_W' ), symbolize_names: true)[:base].
45
+ map{ |z|
46
+ z[:datetime] = DateTime.parse(z[:time])
47
+ %i[time created_at wap trades].each{|k| z.delete(k)}
48
+ z
49
+ }
50
+ rescue
51
+ intrabase = []
52
+ end
53
+ end
54
+
55
+ collector_threads.each(&:join)
56
+
57
+ base = intrabase
58
+ base.select!{|z| z[:high]}
59
+
60
+ scaleBreaks = []
61
+ brb = istencil.base
62
+ brb.each_with_index.map{|z,i|
63
+ next if i.zero?
64
+ if brb[i][:datetime] - brb[i-1][:datetime] > (1) and brb[i][:datetime] > base.first[:datetime] and brb[i-1][:datetime] < base.last[:datetime]
65
+ scaleBreaks << { startValue: brb[i-1][:datetime] + 0.5 * interval, endValue: brb[i][:datetime] - 0.5 * interval }
66
+ end
67
+ } unless base.empty?
68
+
69
+ pkg = {
70
+ sym: sym,
71
+ base: base,
72
+ breaks: scaleBreaks
73
+ }
74
+
75
+ puts pkg.to_json
data/bin/sym.rb ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cotcube-level'
4
+ require 'cotcube-helpers'
5
+ include Cotcube::Helpers
6
+ require_relative '../lib/cotcube-bardata.rb'
7
+
8
+ contract = ARGV[0].nil? ? nil : ARGV[0].upcase
9
+
10
+ begin
11
+ s = Cotcube::Helpers.get_id_set(symbol: contract[..1])
12
+ p s.to_json
13
+ rescue
14
+ msg = { error: 503, message: "Could not process contract '#{contract}'." }
15
+ p msg.to_json
16
+ end
data/bin/symbols.rb ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cotcube-helpers'
4
+
5
+ begin
6
+ s = Cotcube::Helpers.symbols + Cotcube::Helpers.micros
7
+ p s.to_json
8
+ rescue
9
+ msg = { error: 503, message: "Could not provide symbols." }
10
+ p msg.to_json
11
+ end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ['lib']
28
28
 
29
- spec.add_dependency 'activesupport', '~> 6'
29
+ spec.add_dependency 'activesupport', '~> 7'
30
30
  spec.add_dependency 'colorize', '~> 0.8'
31
31
  spec.add_dependency 'cotcube-helpers', '~> 0.2'
32
32
  spec.add_dependency 'cotcube-indicators', '~> 0.1'
@@ -7,7 +7,7 @@ module Cotcube
7
7
  def provide_daily(contract:, # rubocop:disable Metrics/ParameterLists
8
8
  symbol: nil, id: nil,
9
9
  range: nil,
10
- timezone: Time.find_zone('America/Chicago'),
10
+ timezone: Cotcube::Helpers::CHICAGO,
11
11
  keep_last: false,
12
12
  add_eods: true,
13
13
  indicators: {},
@@ -29,7 +29,7 @@ module Cotcube
29
29
 
30
30
  unless range.nil?
31
31
  range_begin = range.begin.nil? ? nil : timezone.parse(range.begin.to_s)
32
- range_end = range.end.nil? ? nil : timezone.parse(range.end.to_s)
32
+ range_end = range.end.nil? ? nil : timezone.parse(range. end.to_s)
33
33
  range = (range_begin..range_end)
34
34
  end
35
35
 
@@ -116,7 +116,7 @@ module Cotcube
116
116
  # this boosts from 4.5sec to 0.3sec
117
117
  rewriting = (force_rewrite or not(File.exist?(c_file)) or (Time.now - File.mtime(c_file) > 8.days))
118
118
  if rewriting
119
- puts "In daily+continuous: Rewriting #{c_file} #{force_rewrite ? "forcibly" : "due to fileage"}.".light_yellow
119
+ puts "In daily+continuous: Rewriting #{c_file} #{force_rewrite ? "forcibly" : "due to fileage"}.".light_yellow if debug
120
120
  `rm #{c_file}; find #{id_path} | xargs cat 2>/dev/null | grep -v ',0,' | grep -v ',0$'| sort -t, -k2 | cut -d, -f1-8 | grep ',.*,' | uniq > #{c_file}`
121
121
  end
122
122
  loading = lambda do
@@ -146,17 +146,13 @@ module Cotcube
146
146
 
147
147
  measuring.call("Finished retrieving dailies.")
148
148
  result = []
149
- rounding = 8 # sym[:format].split('.').last.to_i rescue 6
149
+ rounding = 8
150
150
  indicators ||= {
151
- typical: Cotcube::Indicators.calc(a: :high, b: :low, c: :close) {|high, low, close| (high + low + close) / 3 },
152
- sma250_high: Cotcube::Indicators.sma(key: :high, length: 250),
153
- sma250_low: Cotcube::Indicators.sma(key: :low, length: 250),
154
- sma250_typ: Cotcube::Indicators.sma(key: :typical, length: 250),
155
- dist: Cotcube::Indicators.calc(a: :high, b: :low, finalize: :to_i) {|high, low| ((high-low) / ticksize) },
151
+ tr: Cotcube::Indicators.true_range,
152
+ atr5: Cotcube::Indicators.ema(key: :tr, length: 5),
153
+ dist: Cotcube::Indicators.calc(a: :high, b: :low, finalize: :to_i) {|high, low| ((high-low) / ticksize) }
156
154
  }
157
155
 
158
-
159
-
160
156
  data.group_by { |x| x[:date] }.map do |k, v|
161
157
  v.map { |x| x.delete(:date) }
162
158
  avg_bar = {
@@ -180,9 +176,9 @@ module Cotcube
180
176
  avg_bar[k] = tmp.respond_to?(:round) ? tmp.round(rounding) : tmp
181
177
  puts avg_bar[k] if debug
182
178
  end
183
- %i[tr atr5].each { |ind|
184
- avg_bar[ind] = (avg_bar[ind] / sym[:ticksize]).round.to_i unless avg_bar[ind].nil?
185
- }
179
+ #%i[tr atr5].each { |ind|
180
+ # avg_bar[ind] = (avg_bar[ind] / sym[:ticksize]).round.to_i unless avg_bar[ind].nil?
181
+ #}
186
182
  result << avg_bar
187
183
  result.last[:contracts] = v
188
184
  end
@@ -198,6 +194,57 @@ module Cotcube
198
194
  date.nil? ? Cotcube::Bardata.const_get(constname).map{|z| z.dup } : Cotcube::Bardata.const_get(constname).find { |x| x[:date] == date }
199
195
  end
200
196
 
197
+ # the filter series is an indicator based on the Cotcube::Bardata.continuous of the asset price.
198
+ # current default filter is the ema50
199
+ def filter_series(ema_length: 50, symbol: , print_range: nil)
200
+ ema_high_n = "ema#{ema_length}_high".to_sym
201
+ ema_low_n = "ema#{ema_length}_low".to_sym
202
+ ema_filter = "ema#{ema_length}_filter".to_sym
203
+ indicators = {
204
+ ema_high_n => Cotcube::Indicators.ema(key: :high, length: ema_length, smoothing: 2),
205
+ ema_low_n => Cotcube::Indicators.ema(key: :low, length: ema_length, smoothing: 2),
206
+ # NOTE: TR / ATR5 are in default set of continuous
207
+ :tr => Cotcube::Indicators.true_range,
208
+ :atr5 => Cotcube::Indicators.ema(key: :tr, length: 5, smoothing: 2),
209
+ ema_filter => Cotcube::Indicators.calc(a: :high, b: :low, c: :close,
210
+ d: ema_high_n, e: ema_low_n, f: :atr5,
211
+ finalize: :to_i) do |high, low, close, ema_high, ema_low, atr5|
212
+
213
+ if close > ema_high and (low - ema_high).abs <= atr5 / 5.0; 3 # :bullish_tipped
214
+ elsif low > ema_high and (low - ema_high).abs >= atr5 * 3.0; 5 # :bullish_away
215
+ elsif low > ema_high and (low - ema_high).abs <= atr5 / 1.5; 2 # :bullish_nearby
216
+ elsif low > ema_high; 4 # :bullish
217
+
218
+ elsif close < ema_low and (high - ema_low).abs <= atr5 / 5.0; -3 # :bearish_tipped
219
+ elsif high < ema_low and (high - ema_low).abs >= atr5 * 3.0; -5 # :bearish_away
220
+ elsif high < ema_low and (high - ema_low).abs <= atr5 / 1.5; -2 # :bearish_nearby
221
+ elsif high < ema_low; -4 # :bearish
222
+
223
+ elsif close >= ema_high and (close - ema_high).abs > atr5 ; 2 # :bullish_closed
224
+ elsif close <= ema_low and (close - ema_low ).abs > atr5 ; -2 # :bearish_closed
225
+ elsif close >= ema_high; 1 # :bullish_weak
226
+ elsif close <= ema_low; -1 # :bearish_weak
227
+ elsif close > ema_low and close < ema_high; 0 # :ambigue
228
+ else
229
+ raise RuntimeError, "Unconsidered Indicator value with #{high}, #{low}, #{close}, #{ema_high}, #{ema_low}, #{atr5}"
230
+
231
+ end
232
+ end
233
+ }
234
+ filter = Cotcube::Bardata.continuous(symbol: symbol, indicators: indicators).
235
+ map{ |z| z[:datetime] = DateTime.parse(z[:date]); z[:datetime] += z[:datetime].wday == 5 ? 3 : 1; z.slice(:datetime, ema_filter) }.
236
+ group_by{ |z| z[:datetime] }.
237
+ map{ |k,v| [ k, v[0][ema_filter] ] }.
238
+ to_h.
239
+ tap{ |z|
240
+ z.to_a[print_range].each { |v|
241
+ puts "#{symbol} #{v[0].strftime('%Y-%m-%d')
242
+ } #{format '%2d', v[1]
243
+ }".colorize(v[1] > 3 ? :light_green : v[1] > 1 ? :green : v[1] < -3 ? :light_red : v[1] < -1 ? :red : :white )
244
+ } if print_range.is_a? Range
245
+ }
246
+ end
247
+
201
248
  def continuous_ml(symbol: nil, id: nil, base: nil)
202
249
  (base.nil? ? Cotcube::Bardata.continuous(symbol: symbol, id: id) : base).map do |x|
203
250
  x[:ml] = x[:contracts].max_by { |z| z[:volume] }[:contract]
@@ -319,14 +366,17 @@ module Cotcube
319
366
  ytoday = date.yday
320
367
  data = continuous_overview(id: id, selector: selector, filter: filter, human: false, config: init, measure: measure)
321
368
  .reject { |k, _| k[-2..].to_i >= date.year % 2000 }
369
+ .select { |k, _| sym[:months].chars.include? k[2] }
322
370
  .group_by { |k, _| k[2] }
323
371
  measuring.call("Retrieved continous_overview")
324
- output_sent = []
325
- early_year=nil
326
372
  long_output = []
373
+
374
+ toydate = -> (z,y=2021) { str = "#{z>365 ? y+1 : y} #{z>365 ? z-365 : z}"; DateTime.strptime(str, '%Y %j').strftime('%Y-%m-%d') }
375
+
327
376
  data.keys.sort.each do |month|
328
377
  puts "Processing #{sym[:symbol]}#{month}" if debuglevel > 1
329
378
  v0 = data[month]
379
+
330
380
  # ldays is the list of 'last days'
331
381
  ldays = v0.map { |_, v1| Date.parse(v1.last[:date]).yday }
332
382
  # fdays is the list of 'first days'
@@ -335,6 +385,23 @@ module Cotcube
335
385
  ldays.map! { |x| x > 350 ? x - 366 : x } if ldays.min < 50
336
386
  fday = fdays[fdays.size / 2]
337
387
  lavg = ldays.reduce(:+) / ldays.size
388
+
389
+ # rubocop:disable Layout/ClosingParenthesisIndentation
390
+ current = {
391
+ month: month,
392
+ contract: "#{sym[:symbol]}#{month}",
393
+ first_ml: fday,
394
+ last_min: ldays.min,
395
+ last_avg: lavg,
396
+ last_max: ldays.max,
397
+ until_start: fday - ytoday,
398
+ until_end: lavg - ytoday
399
+ }
400
+ current[:until_end] += 365 if current[:until_end] - current[:until_start] < 0
401
+ current[:until_end] -= 365 if current[:until_end] > 365
402
+
403
+ long_output << current
404
+
338
405
  # a contract is proposed to use after fday - 1, but before ldays.min (green)
339
406
  # it is warned to user after fday - 1 but before lavg - 1 (red)
340
407
  # it is warned red >= lavg - 1 and <= lavg + 1
@@ -347,55 +414,42 @@ module Cotcube
347
414
  else
348
415
  :white
349
416
  end
350
- # rubocop:disable Layout/ClosingParenthesisIndentation
351
- long_output << {
352
- month: month,
353
- first_ml: fday,
354
- last_min: ldays.min,
355
- last_avg: lavg,
356
- last_max: ldays.max }
417
+
357
418
  output = "#{sym[:symbol]
358
- }#{month
359
- }\t#{format '%12s', sym[:type]
360
- }\ttoday is #{ytoday
361
- } -- median of first is #{fday
362
- }\tlast ranges from #{format '%5d', ldays.min
363
- }: #{dfm.call(ldays.min)
364
- }\t#{format '%5d', lavg
365
- }: #{dfm.call(lavg)
366
- }\tto #{format '%5d', ldays.max
367
- }: #{dfm.call(ldays.max)}".colorize(color)
368
- if debug || (color != :white)
369
- puts output unless silent
370
- end
371
- output_sent << "#{sym[:symbol]}#{month}" unless color == :white
372
- early_year ||= output
373
- next if silent or not (debug and debuglevel >= 2)
374
-
375
- v0.each do |contract, v1|
376
- puts "\t#{contract
377
- }\t#{v1.first[:date]
378
- } (#{format '%3d', Date.parse(v1.first[:date]).yday
379
- })\t#{Date.parse(v1.last[:date]).strftime('%a, %Y-%m-%d')
380
- } (#{Date.parse(v1.last[:date]).yday})" unless silent
381
- # rubocop:enable Layout/ClosingParenthesisIndentation
382
- end
419
+ }#{month
420
+ }\t#{format '%12s', sym[:type]
421
+ }\ttoday is #{ytoday
422
+ } -- median of first is #{fday
423
+ }\tlast ranges from #{format '%5d', ldays.min
424
+ }: #{dfm.call(ldays.min)
425
+ }\t#{format '%5d', lavg
426
+ }: #{dfm.call(lavg)
427
+ }\tto #{format '%5d', ldays.max
428
+ }: #{dfm.call(ldays.max)}".colorize(color)
429
+
430
+ if debug || (color != :white)
431
+ puts output unless silent
432
+ end
433
+ next if silent or not (debug and debuglevel >= 2)
434
+
435
+ v0.each do |contract, v1|
436
+ puts "\t#{contract
437
+ }\t#{v1.first[:date]
438
+ } (#{format '%3d', Date.parse(v1.first[:date]).yday
439
+ })\t#{Date.parse(v1.last[:date]).strftime('%a, %Y-%m-%d')
440
+ } (#{Date.parse(v1.last[:date]).yday})" unless silent
441
+ # rubocop:enable Layout/ClosingParenthesisIndentation
442
+ end
443
+
383
444
  end
384
- case output_sent.size
385
- when 0
386
- unless silent
387
- puts "WARNING: No output was sent for symbol '#{sym[:symbol]}'.".colorize(:light_yellow)
388
- puts " Assuming late-year-processing.".light_yellow
389
- puts early_year.light_green
390
- end
391
- when 1
392
- # all ok
393
- true
394
- else
395
- puts "Continuous table show #{output_sent.size} active contracts ( #{output_sent} ) for #{sym[:symbol]} ---------------" unless silent
445
+ long_output.sort_by!{|z| z[:until_end] + (z[:until_end].negative? ? 365 : 0)}
446
+
447
+ if short
448
+ return ([long_output.first] + long_output.select{|z| z[:until_start].positive? and z[:until_start] < 10 }).map{|z| z[:contract] }.uniq
396
449
  end
450
+
397
451
  measuring.call("Finished processing")
398
- short ? output_sent : long_output
452
+ return long_output
399
453
  end
400
454
  end
401
455
  end
@@ -68,7 +68,7 @@ module Cotcube
68
68
  raise ArgumentError, ':filter must be in [:volume_part, :oi_part]' unless %i[volume_part oi_part].include? filter
69
69
 
70
70
  # noinspection RubyScope
71
- ids = sym.nil? ? symbols.map { |x| x[:id] } : [sym[:id]]
71
+ ids = sym.nil? ? Cotcube::Helpers.symbols.map { |x| x[:id] } : [sym[:id]]
72
72
  dates = [dates] unless dates.is_a?(Array) || dates.nil?
73
73
 
74
74
  id_path_get = ->(local_id) { "#{config[:data_path]}/eods/#{local_id}" }
@@ -78,12 +78,14 @@ module Cotcube
78
78
  # l_symbol = l_sym[:symbol]
79
79
  id_path = id_path_get.call(i)
80
80
  data_file = "#{id_path}/#{d}.csv"
81
+ current_sym = Cotcube::Helpers.get_id_set(id: i, config: config)
81
82
  raise "No data found for requested :id (#{id_path} does not exist)" unless Dir.exist?(id_path)
82
83
 
83
84
  unless File.exist?(data_file)
84
85
  unless quiet
85
- puts 'WARNING: No data found for requested id/symbol'\
86
- " #{id}/#{symbol} in #{id_path} for #{d}.".colorize(:light_yellow)
86
+ puts 'WARNING: No data found for requested symbol'\
87
+ " #{current_sym[:symbol]} in #{id_path} for #{d}.".colorize(:light_yellow)
88
+
87
89
  end
88
90
  return []
89
91
  end
@@ -56,6 +56,8 @@ module Cotcube
56
56
  :continuous_overview,
57
57
  # provider estimation of current ML usability
58
58
  :continuous_table,
59
+ # provide a simple filter series
60
+ :filter_series,
59
61
  # provide the list of quarters, possibly as hours or days.
60
62
  :provide_quarters,
61
63
  # some statistics to estimate daily volatility of specific contract
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cotcube-bardata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15.5
4
+ version: 0.1.18
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-11-18 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6'
19
+ version: '7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6'
26
+ version: '7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colorize
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,11 @@ files:
164
164
  - README.md
165
165
  - Rakefile
166
166
  - VERSION
167
+ - bin/daily.rb
168
+ - bin/eod.rb
169
+ - bin/intra.rb
170
+ - bin/sym.rb
171
+ - bin/symbols.rb
167
172
  - cotcube-bardata.gemspec
168
173
  - lib/cotcube-bardata.rb
169
174
  - lib/cotcube-bardata/cached.rb