histock-filter 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +42 -0
- data/histock-filter.gemspec +1 -1
- data/lib/histock/filter.rb +15 -2
- data/lib/histock/filter/helper.rb +4 -0
- data/lib/histock/filter/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88873eae7ffb99f849806fa79ab0b4ac67e5bf729f9ed2dff867d3a78f266c6c
|
4
|
+
data.tar.gz: cdb11409acbb672c4545ff8e5af195add6c68acdef301fd8d5e8bbd3fefd6b65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968f1e689116b47e3638f0ec920e7c80d4b53c17334a3593f165f66268c6985af54cf938baa78b84c3bd0bada415f5dff6aff574d75bf9004c33d6b89a27601f
|
7
|
+
data.tar.gz: d0a7c60edb131d9e4701b82bc14429335b94e98eef3af5828667dc617aaf9d1b924cbae91b0eddfbdc23692a61cb3bd6dbe4c0d991abdd0e8b6af9c805143d91
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v1.1.0
|
2
|
+
[full changelog](http://github.com/ysato5654/histock-filter/compare/v1.0.0...v1.1.0)
|
3
|
+
|
4
|
+
* support new request
|
5
|
+
- price to earning ratio
|
6
|
+
- price book ratio
|
7
|
+
|
1
8
|
## v1.0.0
|
2
9
|
[full changelog](http://github.com/ysato5654/histock-filter/compare/v0.4.1...v1.0.0)
|
3
10
|
|
data/README.md
CHANGED
@@ -218,3 +218,45 @@ histock.income_rate('2330', 'year')
|
|
218
218
|
# :
|
219
219
|
# ]
|
220
220
|
```
|
221
|
+
|
222
|
+
### Corporate Value
|
223
|
+
|
224
|
+
#### PER
|
225
|
+
|
226
|
+
| key | type |
|
227
|
+
|-----|------|
|
228
|
+
| 年度/月份 | string |
|
229
|
+
| 本益比 | float |
|
230
|
+
|
231
|
+
```rb
|
232
|
+
histock = Histock::Filter.new
|
233
|
+
histock.price_to_earning_ratio('2330')
|
234
|
+
# [
|
235
|
+
# {
|
236
|
+
# "年度/月份" => "2020/06",
|
237
|
+
# "本益比" => 20.44
|
238
|
+
# },
|
239
|
+
# {},
|
240
|
+
# :
|
241
|
+
# ]
|
242
|
+
```
|
243
|
+
|
244
|
+
#### PBR
|
245
|
+
|
246
|
+
| key | type |
|
247
|
+
|-----|------|
|
248
|
+
| 年度/月份 | string |
|
249
|
+
| 股價淨值比 | float |
|
250
|
+
|
251
|
+
```rb
|
252
|
+
histock = Histock::Filter.new
|
253
|
+
histock.price_book_ratio('2330')
|
254
|
+
# [
|
255
|
+
# {
|
256
|
+
# "年度/月份" => "2020/06",
|
257
|
+
# "股價淨值比" => 4.89
|
258
|
+
# },
|
259
|
+
# {},
|
260
|
+
# :
|
261
|
+
# ]
|
262
|
+
```
|
data/histock-filter.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.required_ruby_version = '~> 2.5'
|
28
28
|
|
29
|
-
spec.add_runtime_dependency 'histock-simplefilter', '~> 0.
|
29
|
+
spec.add_runtime_dependency 'histock-simplefilter', '~> 0.5.0'
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
32
32
|
spec.add_development_dependency 'rake', '~> 13.0'
|
data/lib/histock/filter.rb
CHANGED
@@ -5,8 +5,19 @@ require File.expand_path(File.dirname(__FILE__)) + '/filter/helper'
|
|
5
5
|
module Histock
|
6
6
|
class Filter
|
7
7
|
CONFIG = [
|
8
|
-
|
9
|
-
[
|
8
|
+
# one argument
|
9
|
+
[
|
10
|
+
'monthly_revenue',
|
11
|
+
'income_statement',
|
12
|
+
'dividend_policy',
|
13
|
+
'profit_ratio',
|
14
|
+
'price_to_earning_ratio',
|
15
|
+
'price_book_ratio'
|
16
|
+
],
|
17
|
+
# two arguments
|
18
|
+
[
|
19
|
+
'income_rate'
|
20
|
+
]
|
10
21
|
]
|
11
22
|
|
12
23
|
def initialize
|
@@ -41,6 +52,8 @@ module Histock
|
|
41
52
|
hash[key] = Histock::Helper.persentage_to_number(val)
|
42
53
|
elsif Histock::Helper.is_currency?(val)
|
43
54
|
hash[key] = Histock::Helper.currency_to_number(val)
|
55
|
+
elsif Histock::Helper.is_float?(val)
|
56
|
+
hash[key] = val.to_f
|
44
57
|
end
|
45
58
|
end
|
46
59
|
end
|
@@ -9,6 +9,10 @@ module Histock
|
|
9
9
|
str.match(/^[+-]?\d{1,3}(,\d{3})*$/).nil? ? false : true
|
10
10
|
end
|
11
11
|
|
12
|
+
def is_float?(str)
|
13
|
+
str.match(/^[+-]?([0-9]+(\.[0-9]*)?|\.[0-9]+)$/).nil? ? false : true
|
14
|
+
end
|
15
|
+
|
12
16
|
# should check str by 'is_persentage?' method before calling this method
|
13
17
|
def persentage_to_number(str)
|
14
18
|
str.to_s.gsub(/%/,'').to_f
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: histock-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: histock-simplefilter
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
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: 0.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|