histock-simplefilter 0.2.0 → 0.6.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/.rspec +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +32 -0
- data/Gemfile +4 -0
- data/README.md +122 -29
- data/lib/histock/simplefilter/error.rb +2 -0
- data/lib/histock/simplefilter/fetch.rb +60 -25
- data/lib/histock/simplefilter/fetch/basic_financial_statements.rb +15 -0
- data/lib/histock/simplefilter/fetch/company_profile.rb +10 -0
- data/lib/histock/simplefilter/fetch/corporate_value.rb +15 -0
- data/lib/histock/simplefilter/fetch/profitability.rb +21 -0
- data/lib/histock/simplefilter/version.rb +1 -1
- metadata +6 -3
- data/lib/histock/simplefilter/fetch/financial_statements.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39b936e936e24634a8fa18457f99d283ef85e6e4ef73af8f3e58630328a2bdfe
|
4
|
+
data.tar.gz: 382675be25c844453a8cbb6f787b1fe0fcb199303c68da97da33dc155d65bc17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03a4e28be238de40eb5eee13ca94e4ec672ce9bc9b4f053110b96e643d1cd8094ab3bd61677d276cbb0b39f39861293e4beab80d2400476ab14a49cb27fbd84b
|
7
|
+
data.tar.gz: 9583ae98ce913dd2d15e45d5a60a1d0130b2ba00463b4ccb19730f55e0bd2b07574e4c786c8225e7c90e1b7cd2da28cf12b6c65a35a5be2d60f8b16b85a6dd13
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
+
## v0.6.0
|
2
|
+
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.5.0...v0.6.0)
|
3
|
+
|
4
|
+
* support new request
|
5
|
+
- company profile
|
6
|
+
|
7
|
+
## v0.5.0
|
8
|
+
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.4.1...v0.5.0)
|
9
|
+
|
10
|
+
* support new request
|
11
|
+
- price to earning ratio
|
12
|
+
- price book ratio
|
13
|
+
|
14
|
+
## v0.4.1
|
15
|
+
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.4.0...v0.4.1)
|
16
|
+
|
17
|
+
* add error handling
|
18
|
+
|
19
|
+
## v0.4.0
|
20
|
+
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.3.0...v0.4.0)
|
21
|
+
|
22
|
+
* support new request
|
23
|
+
- profit ratio
|
24
|
+
- income rate
|
25
|
+
|
26
|
+
## v0.3.0
|
27
|
+
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.2.0...v0.3.0)
|
28
|
+
|
29
|
+
* change request name
|
30
|
+
- before: financial statements
|
31
|
+
after: monthly revenue
|
32
|
+
|
1
33
|
## v0.2.0
|
2
34
|
[full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.1.2...v0.2.0)
|
3
35
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
[](https://badge.fury.io/rb/histock-simplefilter)
|
2
2
|
[](https://travis-ci.org/ysato5654/histock-simplefilter)
|
3
|
+
[](https://coveralls.io/github/ysato5654/histock-simplefilter?branch=master)
|
3
4
|
|
4
5
|
# Histock::Simplefilter
|
5
6
|
|
6
|
-
[HiStock嗨投資理財社群](https://histock.tw/)
|
7
|
+
histock-simplefilter is Ruby library to get the finance data of listed stock on the Taiwan stock exchange market from [HiStock嗨投資理財社群](https://histock.tw/).
|
8
|
+
The library provides you to basic output data.
|
9
|
+
|
10
|
+
If you would like to get more organized data, refer to [histock-filter](https://github.com/ysato5654/histock-filter).
|
7
11
|
|
8
12
|
## Installation
|
9
13
|
|
@@ -27,37 +31,15 @@ $ gem install histock-simplefilter
|
|
27
31
|
|
28
32
|
## Usage
|
29
33
|
|
30
|
-
###
|
34
|
+
### Basic Financial Statements (基本財報)
|
31
35
|
|
32
|
-
|
33
|
-
histock = Histock::Simplefilter.new
|
34
|
-
histock.dividend_policy('2330')
|
35
|
-
# [
|
36
|
-
# ["所屬年度", "發放年度", "除權日", "除息日", "除權息前股價", "股票股利", "現金股利", "EPS", "配息率", "現金殖利率", "扣抵稅率", "增資配股率", "增資認購價"],
|
37
|
-
# ["2019", "2020", "-", "06/18", "297.5", "0", "2.5", "13.32", "0.1877", "0.0084", "0", "0", "0"],
|
38
|
-
# ["2019", "2020", "-", "03/19", "260", "0", "2.5", "13.32", "0.1877", "0.0096", "0", "0", "0"],
|
39
|
-
# ["2018", "2019", "-", "12/19", "344.5", "0", "2.5", "13.54", "0.1846", "0.0073", "0", "0", "0"],
|
40
|
-
# ["2018", "2019", "-", "09/19", "267", "0", "2", "13.54", "0.1477", "0.0075", "0", "0", "0"],
|
41
|
-
# ["2018", "2019", "-", "06/24", "248.5", "0", "8", "13.54", "0.5908", "0.0322", "0", "0", "0"],
|
42
|
-
# ["2017", "2018", "-", "06/25", "227.5", "0", "8", "13.23", "0.6047", "0.0352", "0", "0", "0"],
|
43
|
-
# ["2016", "2017", "-", "06/26", "217", "0", "7", "12.89", "0.5431", "0.0323", "0.1394", "0", "0"],
|
44
|
-
# ["2015", "2016", "-", "06/27", "159", "0", "6", "11.82", "0.5076", "0.0377", "0.1257", "0", "0"],
|
45
|
-
# ["2014", "2015", "-", "06/29", "146", "0", "4.5", "10.18", "0.442", "0.0308", "0.1113", "0", "0"],
|
46
|
-
# ["2013", "2014", "-", "07/14", "136.5", "0", "3", "7.26", "0.4132", "0.022", "0.0978", "0", "0"],
|
47
|
-
# ["2012", "2013", "-", "07/03", "110", "0", "3", "6.41", "0.468", "0.0273", "0.0775", "0", "0"],
|
48
|
-
# ["2011", "2012", "-", "07/04", "84.2", "0", "3", "5.18", "0.5792", "0.0356", "0.0669", "0", "0"],
|
49
|
-
# ["2010", "2011", "-", "06/29", "72.5", "0", "3", "6.24", "0.4808", "0.0414", "0.0496", "0", "0"],
|
50
|
-
# ["2009", "2010", "-", "07/06", "61.4", "0", "3", "3.45", "0.8696", "0.0489", "0.0985", "0", "0"],
|
51
|
-
# ["2008", "2009", "07/15", "07/15", "55.8", "0.05", "3", "3.86", "0.7772", "0.0538", "0", "0", "0"],
|
52
|
-
# ["2007", "2008", "07/16", "07/16", "55.8", "0.05", "3.03", "-", "-", "0", "0.0186", "0.02", "0"]
|
53
|
-
# ]
|
54
|
-
```
|
55
|
-
|
56
|
-
### Financial statements
|
36
|
+
#### Monthly Revenue (每月營收)
|
57
37
|
|
58
38
|
```rb
|
39
|
+
require 'histock/simplefilter'
|
40
|
+
|
59
41
|
histock = Histock::Simplefilter.new
|
60
|
-
histock.
|
42
|
+
histock.monthly_revenue('2330') # code '2330' is TSMC
|
61
43
|
# [
|
62
44
|
# ["年度/月份", "單月營收", "去年同月營收", "單月月增率", "單月年增率", "累計營收", "去年累計營收", "累積年增率"],
|
63
45
|
# ["2020/04", "96,001,568", "74,693,616", "-15.4%", "28.5%", "406,598,784", "293,398,112", "38.6%"],
|
@@ -71,6 +53,117 @@ histock.financial_statements('2330')
|
|
71
53
|
# ["2019/08", "106,117,600", "91,055,040", "25.2%", "16.5%", "650,578,304", "646,781,376", "0.6%"],
|
72
54
|
# ["2019/07", "84,757,728", "74,370,928", "-1.3%", "14%", "544,460,672", "555,726,400", "-2%"],
|
73
55
|
# ["2019/06", "85,867,928", "70,438,304", "6.8%", "21.9%", "459,702,912", "481,355,488", "-4.5%"],
|
74
|
-
# ["2019/05", "80,436,928", "80,968,736", "7.7%", "-0.6%", "373,835,008", "410,917,184", "-9%"]
|
56
|
+
# ["2019/05", "80,436,928", "80,968,736", "7.7%", "-0.6%", "373,835,008", "410,917,184", "-9%"]
|
57
|
+
# ]
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Income Statement (損益表)
|
61
|
+
|
62
|
+
```rb
|
63
|
+
histock = Histock::Simplefilter.new
|
64
|
+
histock.income_statement('2330')
|
65
|
+
# [
|
66
|
+
# ["年度/季別", "營收", "毛利", "營業利益", "稅前淨利", "稅後淨利"],
|
67
|
+
# ["2019Q4", "317,237,065", "159,240,985", "124,243,722", "128,781,973", "116,078,194"],
|
68
|
+
# ["2019Q3", "293,045,439", "139,432,161", "107,887,292", "112,336,271", "101,102,454"],
|
69
|
+
# ["2019Q2", "240,998,475", "103,673,230", "76,304,053", "80,545,440", "66,775,851"],
|
70
|
+
# ["2019Q1", "218,704,469", "90,352,125", "64,266,023", "68,181,652", "61,387,310"],
|
71
|
+
# ["2018Q4", "289,770,193", "138,042,400", "107,123,251", "111,082,092", "100,005,385"],
|
72
|
+
# ["2018Q3", "260,347,882", "123,380,843", "95,245,181", "98,896,942", "89,098,072"],
|
73
|
+
# ["2018Q2", "233,276,811", "111,588,104", "84,428,146", "87,587,608", "72,293,375"],
|
74
|
+
# ["2018Q1", "248,078,671", "124,974,694", "96,826,946", "99,943,621", "89,787,574"]
|
75
|
+
# ]
|
76
|
+
```
|
77
|
+
|
78
|
+
### Dividend Policy (股利政策)
|
79
|
+
|
80
|
+
#### 除權除息
|
81
|
+
|
82
|
+
```rb
|
83
|
+
histock = Histock::Simplefilter.new
|
84
|
+
histock.dividend_policy('2330')
|
85
|
+
# [
|
86
|
+
# ["所屬年度", "發放年度", "除權日", "除息日", "除權息前股價", "股票股利", "現金股利", "EPS", "配息率", "現金殖利率", "扣抵稅率", "增資配股率", "增資認購價"],
|
87
|
+
# ["2019", "2020", "", "06/18", "297.5", "0", "2.5", "13.32", "0.1877", "0.0084", "0", "0", "0"],
|
88
|
+
# ["2019", "2020", "", "03/19", "260", "0", "2.5", "13.32", "0.1877", "0.0096", "0", "0", "0"],
|
89
|
+
# ["2018", "2019", "", "12/19", "344.5", "0", "2.5", "13.54", "0.1846", "0.0073", "0", "0", "0"],
|
90
|
+
# ["2018", "2019", "", "09/19", "267", "0", "2", "13.54", "0.1477", "0.0075", "0", "0", "0"],
|
91
|
+
# ["2018", "2019", "", "06/24", "248.5", "0", "8", "13.54", "0.5908", "0.0322", "0", "0", "0"],
|
92
|
+
# ["2017", "2018", "", "06/25", "227.5", "0", "8", "13.23", "0.6047", "0.0352", "0", "0", "0"],
|
93
|
+
# ["2016", "2017", "", "06/26", "217", "0", "7", "12.89", "0.5431", "0.0323", "0.1394", "0", "0"],
|
94
|
+
# ["2015", "2016", "", "06/27", "159", "0", "6", "11.82", "0.5076", "0.0377", "0.1257", "0", "0"],
|
95
|
+
# ["2014", "2015", "", "06/29", "146", "0", "4.5", "10.18", "0.442", "0.0308", "0.1113", "0", "0"],
|
96
|
+
# ["2013", "2014", "", "07/14", "136.5", "0", "3", "7.26", "0.4132", "0.022", "0.0978", "0", "0"],
|
97
|
+
# ["2012", "2013", "", "07/03", "110", "0", "3", "6.41", "0.468", "0.0273", "0.0775", "0", "0"],
|
98
|
+
# ["2011", "2012", "", "07/04", "84.2", "0", "3", "5.18", "0.5792", "0.0356", "0.0669", "0", "0"],
|
99
|
+
# ["2010", "2011", "", "06/29", "72.5", "0", "3", "6.24", "0.4808", "0.0414", "0.0496", "0", "0"],
|
100
|
+
# ["2009", "2010", "", "07/06", "61.4", "0", "3", "3.45", "0.8696", "0.0489", "0.0985", "0", "0"],
|
101
|
+
# ["2008", "2009", "07/15", "07/15", "55.8", "0.05", "3", "3.86", "0.7772", "0.0538", "0", "0", "0"],
|
102
|
+
# ["2007", "2008", "07/16", "07/16", "55.8", "0.05", "3.03", "-", "-", "0", "0.0186", "0.02", "0"]
|
103
|
+
# ]
|
104
|
+
```
|
105
|
+
|
106
|
+
### Profitability (獲利能力)
|
107
|
+
|
108
|
+
#### Profit Ratio (利潤比率)
|
109
|
+
|
110
|
+
```rb
|
111
|
+
histock = Histock::Simplefilter.new
|
112
|
+
histock.profit_ratio('2330')
|
113
|
+
```
|
114
|
+
|
115
|
+
#### Income Rate (報酬率)
|
116
|
+
|
117
|
+
```rb
|
118
|
+
histock = Histock::Simplefilter.new
|
119
|
+
# monthly data
|
120
|
+
histock.income_rate('2330', 'month')
|
121
|
+
# quarterly data
|
122
|
+
histock.income_rate('2330', 'quarter')
|
123
|
+
# yearly data
|
124
|
+
histock.income_rate('2330', 'year')
|
125
|
+
```
|
126
|
+
|
127
|
+
### Corporate Value (企業價值)
|
128
|
+
|
129
|
+
#### PER (本益比)
|
130
|
+
|
131
|
+
```rb
|
132
|
+
histock = Histock::Simplefilter.new
|
133
|
+
histock.price_to_earning_ratio('2330')
|
134
|
+
# [
|
135
|
+
# ["年度/月份", "本益比"],
|
136
|
+
# ["2020/06", "20.44"],
|
137
|
+
# [],
|
138
|
+
# :
|
75
139
|
# ]
|
76
140
|
```
|
141
|
+
|
142
|
+
#### PBR (股價淨值比)
|
143
|
+
|
144
|
+
```rb
|
145
|
+
histock = Histock::Simplefilter.new
|
146
|
+
histock.price_book_ratio('2330')
|
147
|
+
# [
|
148
|
+
# ["年度/月份", "股價淨值比"],
|
149
|
+
# ["2020/06", "4.89"],
|
150
|
+
# [],
|
151
|
+
# :
|
152
|
+
# ]
|
153
|
+
```
|
154
|
+
|
155
|
+
### Request Lists (Method)
|
156
|
+
|
157
|
+
| Category | Request (Ch) | Request (En) | Source URL |
|
158
|
+
|--|--|--|--|
|
159
|
+
| 基本財報 | 每月營收 | Monthly Revenue | https://histock.tw/stock/financial.aspx?no=CODE&t=1&st=1 |
|
160
|
+
| 基本財報 | 損益表 | Income Statement | https://histock.tw/stock/financial.aspx?no=CODE&t=1&st=4 |
|
161
|
+
| 股利政策 | 除權除息 | | https://histock.tw/stock/financial.aspx?no=CODE&t=2 |
|
162
|
+
| 獲利能力 | 利潤比率 | Profit Ratio | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=1 |
|
163
|
+
| 獲利能力 | 報酬率(單一季) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=1 |
|
164
|
+
| 獲利能力 | 報酬率(近四季) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=2 |
|
165
|
+
| 獲利能力 | 報酬率(年度) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=3 |
|
166
|
+
| 企業價值 | 本益比 | Price-to-Earning Ratio | https://histock.tw/stock/financial.aspx?no=CODE&t=6&st=1 |
|
167
|
+
| 企業價值 | 股價淨值比 | Price-Book Ratio | https://histock.tw/stock/financial.aspx?no=CODE&t=6&st=2 |
|
168
|
+
|
169
|
+
(note) You can fill real code number in 'CODE' field.
|
@@ -1,11 +1,18 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/error'
|
3
|
+
require File.expand_path(File.dirname(__FILE__)) + '/fetch/basic_financial_statements'
|
2
4
|
require File.expand_path(File.dirname(__FILE__)) + '/fetch/dividend_policy'
|
3
|
-
require File.expand_path(File.dirname(__FILE__)) + '/fetch/
|
5
|
+
require File.expand_path(File.dirname(__FILE__)) + '/fetch/profitability'
|
6
|
+
require File.expand_path(File.dirname(__FILE__)) + '/fetch/corporate_value'
|
7
|
+
require File.expand_path(File.dirname(__FILE__)) + '/fetch/company_profile'
|
4
8
|
|
5
9
|
module Histock
|
6
10
|
module Fetch
|
11
|
+
include BasicFinancialStatements
|
7
12
|
include DividendPolicy
|
8
|
-
include
|
13
|
+
include Profitability
|
14
|
+
include CorporateValue
|
15
|
+
include CompanyProfile
|
9
16
|
|
10
17
|
private
|
11
18
|
|
@@ -13,8 +20,21 @@ module Histock
|
|
13
20
|
doc = Nokogiri::HTML.parse(html, nil, @charset)
|
14
21
|
# => Nokogiri::HTML::Document
|
15
22
|
|
16
|
-
|
17
|
-
|
23
|
+
case query
|
24
|
+
when :monthly_revenue, :dividend_policy
|
25
|
+
nodes = doc.xpath("//div[@class='row-stock']/div[@class='tb-outline']/table[@class='tb-stock text-center tbBasic']")
|
26
|
+
# => Nokogiri::XML::NodeSet
|
27
|
+
when :income_statement
|
28
|
+
nodes = doc.xpath("//div[@class='row-stock']/div[@class='tb-outline']/div/table[@class='tb-stock tbBasic']")
|
29
|
+
when :profit_ratio, :income_rate
|
30
|
+
nodes = doc.xpath("//div[@class='row-stock w1060']/div[@class='tb-outline']/div/table[@class='tb-stock tbBasic']")
|
31
|
+
when :price_to_earning_ratio
|
32
|
+
nodes = doc.xpath("//div[@class='row-stock w740']/table[@class='tb-stock tb-outline tbBasic']")
|
33
|
+
when :price_book_ratio
|
34
|
+
nodes = doc.xpath("//div[@class='row-stock']/table[@class='tb-stock tb-outline tbBasic']")
|
35
|
+
when :company_profile
|
36
|
+
nodes = doc.xpath("//div[@class='grid-item w788 mt10']/div[@class='grid-body']/table/tr/td/table[@class='tb-stock tbBasic']")
|
37
|
+
end
|
18
38
|
|
19
39
|
raise InformationNotFound if nodes.empty?
|
20
40
|
raise XMLNodeSetError unless nodes.length.is_one?
|
@@ -26,7 +46,39 @@ module Histock
|
|
26
46
|
end
|
27
47
|
|
28
48
|
def parse_table query:, element:
|
29
|
-
|
49
|
+
if children_is_tbody(:element => element)
|
50
|
+
table = parse_tr(:query => query, :element => fetch_tbody(:element => element))
|
51
|
+
else
|
52
|
+
table = parse_tr(:query => query, :element => element)
|
53
|
+
end
|
54
|
+
|
55
|
+
case query
|
56
|
+
when :price_to_earning_ratio, :price_book_ratio
|
57
|
+
_table = Array.new
|
58
|
+
|
59
|
+
_table.concat([table[0][0..1]])
|
60
|
+
|
61
|
+
# remove header
|
62
|
+
table.slice!(0)
|
63
|
+
|
64
|
+
until table.flatten.empty? do
|
65
|
+
_table.concat(table.map { |e| e.slice!(0, 2) })
|
66
|
+
end
|
67
|
+
|
68
|
+
table = _table
|
69
|
+
end
|
70
|
+
|
71
|
+
table
|
72
|
+
end
|
73
|
+
|
74
|
+
def children_is_tbody element:
|
75
|
+
nodes = element.children
|
76
|
+
|
77
|
+
nodes.length.is_one? and nodes.first.name == 'tbody'
|
78
|
+
end
|
79
|
+
|
80
|
+
def fetch_tbody element:
|
81
|
+
element.children
|
30
82
|
end
|
31
83
|
|
32
84
|
# column
|
@@ -47,7 +99,7 @@ module Histock
|
|
47
99
|
end
|
48
100
|
|
49
101
|
case query
|
50
|
-
when :
|
102
|
+
when :monthly_revenue
|
51
103
|
header = array.delete_at(0)
|
52
104
|
header.delete_at(-1)
|
53
105
|
header.delete_at(-1)
|
@@ -66,6 +118,8 @@ module Histock
|
|
66
118
|
array = Array.new
|
67
119
|
|
68
120
|
element.children.each do |e|
|
121
|
+
next unless e.element?
|
122
|
+
|
69
123
|
case e.name
|
70
124
|
when 'th' then array.push e.children.text.gsub(/\<br\>/, '')
|
71
125
|
when 'td' then array.push e.children.text
|
@@ -79,26 +133,7 @@ module Histock
|
|
79
133
|
end
|
80
134
|
|
81
135
|
class Integer
|
82
|
-
def is_zero?
|
83
|
-
self == 0
|
84
|
-
end
|
85
|
-
|
86
136
|
def is_one?
|
87
137
|
self == 1
|
88
138
|
end
|
89
139
|
end
|
90
|
-
|
91
|
-
class String
|
92
|
-
def is_currency?
|
93
|
-
(self =~ /^[+-]?[0-9]*[\,]?[0-9]*[\.]?[0-9]+$/).nil? ? false : true
|
94
|
-
end
|
95
|
-
|
96
|
-
def to_currency
|
97
|
-
unless self.is_currency?
|
98
|
-
STDERR.puts "#{__FILE__}:#{__LINE__}: argument - #{self}"
|
99
|
-
raise ArgumentError
|
100
|
-
end
|
101
|
-
|
102
|
-
self.gsub(/[\,]/, '').to_f
|
103
|
-
end
|
104
|
-
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Histock
|
2
|
+
module Fetch
|
3
|
+
module BasicFinancialStatements
|
4
|
+
def monthly_revenue(code)
|
5
|
+
params = {:no => code, :t => 1, :st => 1}
|
6
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
7
|
+
end
|
8
|
+
|
9
|
+
def income_statement(code)
|
10
|
+
params = {:no => code, :t => 1, :st => 4}
|
11
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Histock
|
2
|
+
module Fetch
|
3
|
+
module CorporateValue
|
4
|
+
def price_to_earning_ratio(code)
|
5
|
+
params = {:no => code, :t => 6, :st => 1}
|
6
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
7
|
+
end
|
8
|
+
|
9
|
+
def price_book_ratio(code)
|
10
|
+
params = {:no => code, :t => 6, :st => 2}
|
11
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Histock
|
2
|
+
module Fetch
|
3
|
+
module Profitability
|
4
|
+
def profit_ratio(code)
|
5
|
+
params = {:no => code, :t => 3, :st => 1}
|
6
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
7
|
+
end
|
8
|
+
|
9
|
+
def income_rate(code, period)
|
10
|
+
case period
|
11
|
+
when 'month' then params = {:no => code, :t => 3, :st => 2, :q => 1}
|
12
|
+
when 'quarter' then params = {:no => code, :t => 3, :st => 2, :q => 2}
|
13
|
+
when 'year' then params = {:no => code, :t => 3, :st => 2, :q => 3}
|
14
|
+
else raise ArgumentError
|
15
|
+
end
|
16
|
+
|
17
|
+
parse(:query => __method__, :html => get('/financial.aspx', params))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: histock-simplefilter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -102,8 +102,11 @@ files:
|
|
102
102
|
- lib/histock/simplefilter/connection.rb
|
103
103
|
- lib/histock/simplefilter/error.rb
|
104
104
|
- lib/histock/simplefilter/fetch.rb
|
105
|
+
- lib/histock/simplefilter/fetch/basic_financial_statements.rb
|
106
|
+
- lib/histock/simplefilter/fetch/company_profile.rb
|
107
|
+
- lib/histock/simplefilter/fetch/corporate_value.rb
|
105
108
|
- lib/histock/simplefilter/fetch/dividend_policy.rb
|
106
|
-
- lib/histock/simplefilter/fetch/
|
109
|
+
- lib/histock/simplefilter/fetch/profitability.rb
|
107
110
|
- lib/histock/simplefilter/version.rb
|
108
111
|
homepage: https://github.com/ysato5654/histock-simplefilter
|
109
112
|
licenses:
|