histock-simplefilter 0.2.0 → 0.3.0

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: e32979ce299039612c2aa20f15b18562e1dabdbdeec3a25b981f03c7ecab084c
4
- data.tar.gz: fd56926c121afc019093988e891bb41c42437699ab28187de32ad825852d066f
3
+ metadata.gz: 367f02f9a46aa029be6e2b7db5069b8c55fcafa90078f6e4ac588d8df5fc76b9
4
+ data.tar.gz: b4e7ca90ac0e7c501c0d5fcf5ad4a64db359e84c0b98673766a611ab743cf405
5
5
  SHA512:
6
- metadata.gz: 1c0412f9bb2c4861d66ad676024761804bc5ae0d62ce9b82f666dc7e328315ebb438be13bc426081ec89ab8ebefff3394a26e8f6f4daea7f6d2b64470a5c8fc5
7
- data.tar.gz: f29c7bea0fe1f5b0dfa54dcee98031c607083232e61330547256f26617284aba0b17f64b64bfcd96e0a085c3f503850e54590f37d1df558b02061f78920b50fd
6
+ metadata.gz: c13e23dd5c5748724910857767f7756dadac5ab87c1faab2a017905f1784044c25a7610feb815e5a0c285eb4ee144d6b37bbd2f402191f13acf86115e63a600c
7
+ data.tar.gz: 7f5ab0cd11e0e578518c576a6f92a5bd0f529c53f0a2e97cf8a9ac4f49fcaaa25394efd2ef9b4d103d84c3b57319f282edc4af2770bbc4a98c89f56d65072257
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
+ --require spec_helper
1
2
  --format documentation
2
3
  --color
data/.travis.yml CHANGED
@@ -4,3 +4,5 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5.8
6
6
  before_install: gem install bundler -v 2.1.4
7
+ notifications:
8
+ email: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v0.3.0
2
+ [full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.2.0...v0.3.0)
3
+
4
+ * change request name
5
+ - before: financial statements
6
+ after: monthly revenue
7
+
1
8
  ## v0.2.0
2
9
  [full changelog](http://github.com/ysato5654/histock-simplefilter/compare/v0.1.2...v0.2.0)
3
10
 
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in histock-simplefilter.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'coveralls', require: false
8
+ end
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/histock-simplefilter.svg)](https://badge.fury.io/rb/histock-simplefilter)
2
2
  [![Build Status](https://travis-ci.org/ysato5654/histock-simplefilter.svg?branch=master)](https://travis-ci.org/ysato5654/histock-simplefilter)
3
+ [![Coverage Status](https://coveralls.io/repos/github/ysato5654/histock-simplefilter/badge.svg?branch=master)](https://coveralls.io/github/ysato5654/histock-simplefilter?branch=master)
3
4
 
4
5
  # Histock::Simplefilter
5
6
 
6
- [HiStock嗨投資理財社群](https://histock.tw/) filter by Ruby
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,11 +31,41 @@ $ gem install histock-simplefilter
27
31
 
28
32
  ## Usage
29
33
 
30
- ### Dividend policy
34
+ ### Basic Financial Statements (基本財報)
35
+
36
+ #### Monthly Revenue (每月營收)
31
37
 
32
38
  ```rb
39
+ require 'histock/simplefilter'
40
+
33
41
  histock = Histock::Simplefilter.new
34
- histock.dividend_policy('2330')
42
+ histock.monthly_revenue('2330') # code '2330' is TSMC
43
+ # [
44
+ # ["年度/月份", "單月營收", "去年同月營收", "單月月增率", "單月年增率", "累計營收", "去年累計營收", "累積年增率"],
45
+ # ["2020/04", "96,001,568", "74,693,616", "-15.4%", "28.5%", "406,598,784", "293,398,112", "38.6%"],
46
+ # ["2020/03", "113,519,600", "79,721,584", "21.5%", "42.4%", "310,597,184", "218,704,496", "42%"],
47
+ # ["2020/02", "93,394,448", "60,889,060", "-9.9%", "53.4%", "197,077,600", "138,982,896", "41.8%"],
48
+ # ["2020/01", "103,683,104", "78,093,824", "0.3%", "32.8%", "103,683,104", "78,093,824", "32.8%"],
49
+ # ["2019/12", "103,313,104", "89,830,600", "-4.2%", "15%", "1,069,985,024", "1,031,473,984", "3.7%"],
50
+ # ["2019/11", "107,884,400", "98,389,424", "1.7%", "9.6%", "966,672,320", "941,642,880", "2.7%"],
51
+ # ["2019/10", "106,039,504", "101,550,200", "3.8%", "4.4%", "858,787,904", "843,253,632", "1.8%"],
52
+ # ["2019/09", "102,170,096", "94,921,920", "-3.7%", "7.6%", "752,748,416", "741,703,424", "1.5%"],
53
+ # ["2019/08", "106,117,600", "91,055,040", "25.2%", "16.5%", "650,578,304", "646,781,376", "0.6%"],
54
+ # ["2019/07", "84,757,728", "74,370,928", "-1.3%", "14%", "544,460,672", "555,726,400", "-2%"],
55
+ # ["2019/06", "85,867,928", "70,438,304", "6.8%", "21.9%", "459,702,912", "481,355,488", "-4.5%"],
56
+ # ["2019/05", "80,436,928", "80,968,736", "7.7%", "-0.6%", "373,835,008", "410,917,184", "-9%"]
57
+ # ]
58
+ ```
59
+
60
+ ### Dividend Policy (股利政策)
61
+
62
+ #### 除權除息
63
+
64
+ ```rb
65
+ require 'histock/simplefilter'
66
+
67
+ histock = Histock::Simplefilter.new
68
+ histock.dividend_policy('2330') # code '2330' is TSMC
35
69
  # [
36
70
  # ["所屬年度", "發放年度", "除權日", "除息日", "除權息前股價", "股票股利", "現金股利", "EPS", "配息率", "現金殖利率", "扣抵稅率", "增資配股率", "增資認購價"],
37
71
  # ["2019", "2020", "-", "06/18", "297.5", "0", "2.5", "13.32", "0.1877", "0.0084", "0", "0", "0"],
@@ -52,25 +86,3 @@ histock.dividend_policy('2330')
52
86
  # ["2007", "2008", "07/16", "07/16", "55.8", "0.05", "3.03", "-", "-", "0", "0.0186", "0.02", "0"]
53
87
  # ]
54
88
  ```
55
-
56
- ### Financial statements
57
-
58
- ```rb
59
- histock = Histock::Simplefilter.new
60
- histock.financial_statements('2330')
61
- # [
62
- # ["年度/月份", "單月營收", "去年同月營收", "單月月增率", "單月年增率", "累計營收", "去年累計營收", "累積年增率"],
63
- # ["2020/04", "96,001,568", "74,693,616", "-15.4%", "28.5%", "406,598,784", "293,398,112", "38.6%"],
64
- # ["2020/03", "113,519,600", "79,721,584", "21.5%", "42.4%", "310,597,184", "218,704,496", "42%"],
65
- # ["2020/02", "93,394,448", "60,889,060", "-9.9%", "53.4%", "197,077,600", "138,982,896", "41.8%"],
66
- # ["2020/01", "103,683,104", "78,093,824", "0.3%", "32.8%", "103,683,104", "78,093,824", "32.8%"],
67
- # ["2019/12", "103,313,104", "89,830,600", "-4.2%", "15%", "1,069,985,024", "1,031,473,984", "3.7%"],
68
- # ["2019/11", "107,884,400", "98,389,424", "1.7%", "9.6%", "966,672,320", "941,642,880", "2.7%"],
69
- # ["2019/10", "106,039,504", "101,550,200", "3.8%", "4.4%", "858,787,904", "843,253,632", "1.8%"],
70
- # ["2019/09", "102,170,096", "94,921,920", "-3.7%", "7.6%", "752,748,416", "741,703,424", "1.5%"],
71
- # ["2019/08", "106,117,600", "91,055,040", "25.2%", "16.5%", "650,578,304", "646,781,376", "0.6%"],
72
- # ["2019/07", "84,757,728", "74,370,928", "-1.3%", "14%", "544,460,672", "555,726,400", "-2%"],
73
- # ["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%"],
75
- # ]
76
- ```
@@ -1,7 +1,7 @@
1
1
  module Histock
2
2
  module Fetch
3
- module FinancialStatements
4
- def financial_statements(code)
3
+ module BasicFinancialStatements
4
+ def monthly_revenue(code)
5
5
  params = {:no => code, :t => 1}
6
6
  parse(:query => __method__, :html => get('/financial.aspx', params))
7
7
  end
@@ -1,11 +1,11 @@
1
1
  require 'nokogiri'
2
2
  require File.expand_path(File.dirname(__FILE__)) + '/fetch/dividend_policy'
3
- require File.expand_path(File.dirname(__FILE__)) + '/fetch/financial_statements'
3
+ require File.expand_path(File.dirname(__FILE__)) + '/fetch/basic_financial_statements'
4
4
 
5
5
  module Histock
6
6
  module Fetch
7
7
  include DividendPolicy
8
- include FinancialStatements
8
+ include BasicFinancialStatements
9
9
 
10
10
  private
11
11
 
@@ -47,7 +47,7 @@ module Histock
47
47
  end
48
48
 
49
49
  case query
50
- when :financial_statements
50
+ when :monthly_revenue
51
51
  header = array.delete_at(0)
52
52
  header.delete_at(-1)
53
53
  header.delete_at(-1)
@@ -79,26 +79,7 @@ module Histock
79
79
  end
80
80
 
81
81
  class Integer
82
- def is_zero?
83
- self == 0
84
- end
85
-
86
82
  def is_one?
87
83
  self == 1
88
84
  end
89
85
  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
@@ -1,5 +1,5 @@
1
1
  module Histock
2
2
  class Simplefilter
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
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.2.0
4
+ version: 0.3.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-05-08 00:00:00.000000000 Z
11
+ date: 2020-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -102,8 +102,8 @@ 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
105
106
  - lib/histock/simplefilter/fetch/dividend_policy.rb
106
- - lib/histock/simplefilter/fetch/financial_statements.rb
107
107
  - lib/histock/simplefilter/version.rb
108
108
  homepage: https://github.com/ysato5654/histock-simplefilter
109
109
  licenses: