histock-simplefilter 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 870c913ca40a6b8d8101d3f737fad3134b88df9896fdecb45e0bbe5eade98671
4
- data.tar.gz: b877b752c719067f7110e8eecfae0821976ffa776ed3a47bc769bdc2f67fbbaa
3
+ metadata.gz: f17d60747c236f7faf31b6dad84c0ee603ea85a533c4ef861871708525ef178f
4
+ data.tar.gz: a16dccc9af5f0e92515fa7238eb129f4fc45533d3ff904c8f555043eca3ba53d
5
5
  SHA512:
6
- metadata.gz: 48479a08b6a662dc749f10460024a1de8e23633b388f7b1cc24dc8ac094e1d7401b036b40fa2c3f52bbfada7109702fb1566d321b5821d79f2422e8569d94ce8
7
- data.tar.gz: 4dfafe49a6ab840eefd4e8ccfb7b9615b75d9744e3eb2038b1cf769adef087830d40bcb0346af807f14b66a9df06e0edf69d7965f557bd8b9dcb161dcae6fe05
6
+ metadata.gz: 07a8d803c3130ecc851a464a008cad5cbd12155ec938750592e9a60732998e0efcbd3c18d171dc66ec90c4400c5ecfcef8a8e187331596517e7d86ee927bff15
7
+ data.tar.gz: 3f2ae8eabec3559e2f40aaa182a04fb04f52521d61eff35c77a07e1469984c266b8b27076329715598c9b040cbbfff39cc5a1983b93df63f411a050e50bd2089
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.4.1
2
+ [full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.4.0...v0.4.1)
3
+
4
+ * add error handling
5
+
1
6
  ## v0.4.0
2
7
  [full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.3.0...v0.4.0)
3
8
 
data/README.md CHANGED
@@ -88,20 +88,20 @@ histock = Histock::Simplefilter.new
88
88
  histock.dividend_policy('2330') # code '2330' is TSMC
89
89
  # [
90
90
  # ["所屬年度", "發放年度", "除權日", "除息日", "除權息前股價", "股票股利", "現金股利", "EPS", "配息率", "現金殖利率", "扣抵稅率", "增資配股率", "增資認購價"],
91
- # ["2019", "2020", "-", "06/18", "297.5", "0", "2.5", "13.32", "0.1877", "0.0084", "0", "0", "0"],
92
- # ["2019", "2020", "-", "03/19", "260", "0", "2.5", "13.32", "0.1877", "0.0096", "0", "0", "0"],
93
- # ["2018", "2019", "-", "12/19", "344.5", "0", "2.5", "13.54", "0.1846", "0.0073", "0", "0", "0"],
94
- # ["2018", "2019", "-", "09/19", "267", "0", "2", "13.54", "0.1477", "0.0075", "0", "0", "0"],
95
- # ["2018", "2019", "-", "06/24", "248.5", "0", "8", "13.54", "0.5908", "0.0322", "0", "0", "0"],
96
- # ["2017", "2018", "-", "06/25", "227.5", "0", "8", "13.23", "0.6047", "0.0352", "0", "0", "0"],
97
- # ["2016", "2017", "-", "06/26", "217", "0", "7", "12.89", "0.5431", "0.0323", "0.1394", "0", "0"],
98
- # ["2015", "2016", "-", "06/27", "159", "0", "6", "11.82", "0.5076", "0.0377", "0.1257", "0", "0"],
99
- # ["2014", "2015", "-", "06/29", "146", "0", "4.5", "10.18", "0.442", "0.0308", "0.1113", "0", "0"],
100
- # ["2013", "2014", "-", "07/14", "136.5", "0", "3", "7.26", "0.4132", "0.022", "0.0978", "0", "0"],
101
- # ["2012", "2013", "-", "07/03", "110", "0", "3", "6.41", "0.468", "0.0273", "0.0775", "0", "0"],
102
- # ["2011", "2012", "-", "07/04", "84.2", "0", "3", "5.18", "0.5792", "0.0356", "0.0669", "0", "0"],
103
- # ["2010", "2011", "-", "06/29", "72.5", "0", "3", "6.24", "0.4808", "0.0414", "0.0496", "0", "0"],
104
- # ["2009", "2010", "-", "07/06", "61.4", "0", "3", "3.45", "0.8696", "0.0489", "0.0985", "0", "0"],
91
+ # ["2019", "2020", "", "06/18", "297.5", "0", "2.5", "13.32", "0.1877", "0.0084", "0", "0", "0"],
92
+ # ["2019", "2020", "", "03/19", "260", "0", "2.5", "13.32", "0.1877", "0.0096", "0", "0", "0"],
93
+ # ["2018", "2019", "", "12/19", "344.5", "0", "2.5", "13.54", "0.1846", "0.0073", "0", "0", "0"],
94
+ # ["2018", "2019", "", "09/19", "267", "0", "2", "13.54", "0.1477", "0.0075", "0", "0", "0"],
95
+ # ["2018", "2019", "", "06/24", "248.5", "0", "8", "13.54", "0.5908", "0.0322", "0", "0", "0"],
96
+ # ["2017", "2018", "", "06/25", "227.5", "0", "8", "13.23", "0.6047", "0.0352", "0", "0", "0"],
97
+ # ["2016", "2017", "", "06/26", "217", "0", "7", "12.89", "0.5431", "0.0323", "0.1394", "0", "0"],
98
+ # ["2015", "2016", "", "06/27", "159", "0", "6", "11.82", "0.5076", "0.0377", "0.1257", "0", "0"],
99
+ # ["2014", "2015", "", "06/29", "146", "0", "4.5", "10.18", "0.442", "0.0308", "0.1113", "0", "0"],
100
+ # ["2013", "2014", "", "07/14", "136.5", "0", "3", "7.26", "0.4132", "0.022", "0.0978", "0", "0"],
101
+ # ["2012", "2013", "", "07/03", "110", "0", "3", "6.41", "0.468", "0.0273", "0.0775", "0", "0"],
102
+ # ["2011", "2012", "", "07/04", "84.2", "0", "3", "5.18", "0.5792", "0.0356", "0.0669", "0", "0"],
103
+ # ["2010", "2011", "", "06/29", "72.5", "0", "3", "6.24", "0.4808", "0.0414", "0.0496", "0", "0"],
104
+ # ["2009", "2010", "", "07/06", "61.4", "0", "3", "3.45", "0.8696", "0.0489", "0.0985", "0", "0"],
105
105
  # ["2008", "2009", "07/15", "07/15", "55.8", "0.05", "3", "3.86", "0.7772", "0.0538", "0", "0", "0"],
106
106
  # ["2007", "2008", "07/16", "07/16", "55.8", "0.05", "3.03", "-", "-", "0", "0.0186", "0.02", "0"]
107
107
  # ]
@@ -131,3 +131,17 @@ histock.income_rate('2330', 'quarter')
131
131
  # yearly data
132
132
  histock.income_rate('2330', 'year')
133
133
  ```
134
+
135
+ ### Request Lists (Method)
136
+
137
+ | Category | Request (Ch) | Request (En) | Source URL |
138
+ |--|--|--|--|
139
+ | 基本財報 | 每月營收 | Monthly Revenue | https://histock.tw/stock/financial.aspx?no=CODE&t=1&st=1 |
140
+ | 基本財報 | 損益表 | Income Statement | https://histock.tw/stock/financial.aspx?no=CODE&t=1&st=4 |
141
+ | 股利政策 | 除權除息 | | https://histock.tw/stock/financial.aspx?no=CODE&t=2 |
142
+ | 獲利能力 | 利潤比率 | Profit Ratio | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=1 |
143
+ | 獲利能力 | 報酬率(單一季) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=1 |
144
+ | 獲利能力 | 報酬率(近四季) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=2 |
145
+ | 獲利能力 | 報酬率(年度) | Income Rate | https://histock.tw/stock/financial.aspx?no=CODE&t=3&st=2&q=3 |
146
+
147
+ (note) You can fill real code number in 'CODE' field.
@@ -2,6 +2,8 @@ module Histock
2
2
  class Error < StandardError
3
3
  end
4
4
 
5
+ class ArgumentError < Error; end
6
+
5
7
  class InformationNotFound < Error; end
6
8
 
7
9
  class XMLNodeSetError < Error; end
@@ -6,12 +6,12 @@ module Histock
6
6
  parse(:query => __method__, :html => get('/financial.aspx', params))
7
7
  end
8
8
 
9
- def income_rate(code, term)
10
- case term
9
+ def income_rate(code, period)
10
+ case period
11
11
  when 'month' then params = {:no => code, :t => 3, :st => 2, :q => 1}
12
12
  when 'quarter' then params = {:no => code, :t => 3, :st => 2, :q => 2}
13
13
  when 'year' then params = {:no => code, :t => 3, :st => 2, :q => 3}
14
- else
14
+ else raise ArgumentError
15
15
  end
16
16
 
17
17
  parse(:query => __method__, :html => get('/financial.aspx', params))
@@ -1,4 +1,5 @@
1
1
  require 'nokogiri'
2
+ require File.expand_path(File.dirname(__FILE__)) + '/error'
2
3
  require File.expand_path(File.dirname(__FILE__)) + '/fetch/basic_financial_statements'
3
4
  require File.expand_path(File.dirname(__FILE__)) + '/fetch/dividend_policy'
4
5
  require File.expand_path(File.dirname(__FILE__)) + '/fetch/profitability'
@@ -1,5 +1,5 @@
1
1
  module Histock
2
2
  class Simplefilter
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  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.0
4
+ version: 0.4.1
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-05-09 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri