cotcube-bardata 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/cotcube-bardata/daily.rb +26 -19
- data/lib/cotcube-bardata/provide.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc417f9b8b33204bbc1b345ec28e2c5604b2a5f59c183a6a0a1ad15a6cf223b1
|
4
|
+
data.tar.gz: f631c5507dff588e4f2e19209aca5d135514e450ddc9b311e407b9733f539191
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5276bd185a561658226f65b92ce696774f1da7442bf0c10704925e4afd295566844d02bf866921575bf60cea6944555c7dd6abc28214ed5852ca8228553d2f3
|
7
|
+
data.tar.gz: c73f923b1bf4399bf6a9cea56e4adf2acc3aaeab770d4b56cc1daae7d5a4f7c4617f30baff58b03f9ced45a9987a4bf8106c709f12a1cfb17f0021cfe36a6d71
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.1.11 (March 07, 2021)
|
2
|
+
- daily.rb: added new technique 'caching in constants' to accelerate computation, also referring to continuous
|
3
|
+
- provide.rb: minor change, so disregarded contracts can be used in swapproximate
|
4
|
+
|
1
5
|
## 0.1.10 (February 11, 2021)
|
2
6
|
- Daily.rb: Added measure parameters to continous_suite
|
3
7
|
- cached.rb: Minor fix in comparison
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -73,31 +73,38 @@ module Cotcube
|
|
73
73
|
|
74
74
|
# instead of using the provide_daily methods above, for this bulk operation a 'continuous.csv' is created
|
75
75
|
# this boosts from 4.5sec to 0.3sec
|
76
|
-
|
76
|
+
rewriting = force_rewrite or not(File.exist?(c_file)) or (Time.now - File.mtime(c_file) > 8.days)
|
77
|
+
if rewriting
|
77
78
|
puts "In daily+continuous: Rewriting #{c_file} #{force_rewrite ? "forcibly" : "due to fileage"}.".light_yellow
|
78
79
|
`rm #{c_file}; find #{id_path} | xargs cat 2>/dev/null | grep -v '0,0,0,0' | sort -t, -k2 | cut -d, -f1,2,7,8 > #{c_file}`
|
79
80
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
loading = lambda do
|
82
|
+
data = CSV.read(c_file).map do |row|
|
83
|
+
r = { contract: row[0],
|
84
|
+
date: row[1],
|
85
|
+
volume: row[2].to_i,
|
86
|
+
oi: row[3].to_i
|
87
|
+
}
|
88
|
+
end
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
90
|
+
measuring.call("Finished retrieving dailies.")
|
91
|
+
result = []
|
92
|
+
data.group_by { |x| x[:date] }.map do |k, v|
|
93
|
+
v.map { |x| x.delete(:date) }
|
94
|
+
result << {
|
95
|
+
date: k,
|
96
|
+
volume: v.map { |x| x[:volume] }.reduce(:+),
|
97
|
+
oi: v.map { |x| x[:oi] }.reduce(:+)
|
98
|
+
}
|
99
|
+
result.last[:contracts] = v
|
100
|
+
end
|
101
|
+
end
|
102
|
+
constname = "CONTINUOUS_#{symbol}".to_sym
|
103
|
+
if rewriting or not Cotcube::Bardata.const_defined?( constname)
|
104
|
+
Cotcube::Bardata.const_set constname, loading.call
|
98
105
|
end
|
99
106
|
measuring.call("Finished processing")
|
100
|
-
date.nil? ?
|
107
|
+
date.nil? ? Cotcube::Bardata.const_get(constname) : Cotcube::Bardata.const_get(constname).find { |x| x[:date] == date }
|
101
108
|
end
|
102
109
|
|
103
110
|
def continuous_ml(symbol: nil, id: nil, base: nil)
|
@@ -44,7 +44,7 @@ module Cotcube
|
|
44
44
|
days = provide_cached contract: contract, symbol: symbol, id: id, config: config, filter: filter,
|
45
45
|
range: range, force_recent: force_recent
|
46
46
|
dailies = provide_daily contract: contract, symbol: symbol, id: id, config: config, range: range
|
47
|
-
if days.last[:datetime] > dailies.last[:datetime]
|
47
|
+
if ((days.last[:datetime] > dailies.last[:datetime]) rescue false)
|
48
48
|
dailies[..-2] + days.select { |d| d[:datetime] > dailies[-2][:datetime] }
|
49
49
|
else
|
50
50
|
dailies
|
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.
|
4
|
+
version: 0.1.11
|
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
|
+
date: 2021-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|