stock_index 0.7.0 → 0.8.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.
@@ -0,0 +1,102 @@
1
+ ---
2
+ - III
3
+ - ABF
4
+ - ADN
5
+ - ADM
6
+ - AGK
7
+ - AAL
8
+ - ANTO
9
+ - ARM
10
+ - AHT
11
+ - AZN
12
+ - AV/
13
+ - BAB
14
+ - BA/
15
+ - BARC
16
+ - BG/
17
+ - BLT
18
+ - BP/
19
+ - BATS
20
+ - BLND
21
+ - BT/A
22
+ - BNZL
23
+ - BRBY
24
+ - CPI
25
+ - CCL
26
+ - CNA
27
+ - CCH
28
+ - CPG
29
+ - CRH
30
+ - DGE
31
+ - DLG
32
+ - DC/
33
+ - EZJ
34
+ - EXPN
35
+ - FRES
36
+ - FLG
37
+ - GFS
38
+ - GKN
39
+ - GSK
40
+ - GLEN
41
+ - HMSO
42
+ - HL/
43
+ - HSBA
44
+ - IMI
45
+ - IMT
46
+ - IHG
47
+ - ITRK
48
+ - IAG
49
+ - INTU
50
+ - ITV
51
+ - JMAT
52
+ - KGF
53
+ - LAND
54
+ - LGEN
55
+ - LLOY
56
+ - LSE
57
+ - MKS
58
+ - MGGT
59
+ - MNDI
60
+ - MRW
61
+ - NG/
62
+ - NXT
63
+ - OML
64
+ - PSON
65
+ - PSN
66
+ - PFC
67
+ - PRU
68
+ - RRS
69
+ - RDSA
70
+ - RDSB
71
+ - RB/
72
+ - REL
73
+ - RIO
74
+ - RR/
75
+ - RBS
76
+ - RMG
77
+ - RSA
78
+ - SAB
79
+ - SGE
80
+ - SBRY
81
+ - SDR
82
+ - SVT
83
+ - SHP
84
+ - SKY
85
+ - SN/
86
+ - SMIN
87
+ - SPD
88
+ - SSE
89
+ - STJ
90
+ - STAN
91
+ - SL/
92
+ - TSCO
93
+ - TPK
94
+ - TT/
95
+ - TLW
96
+ - ULVR
97
+ - UU/
98
+ - VOD
99
+ - WEIR
100
+ - WTB
101
+ - WOS
102
+ - WPP
data/spec/helper.rb CHANGED
@@ -41,6 +41,34 @@ RSpec.configure do |config|
41
41
  with(:headers => {'Accept' => '*/*'}).
42
42
  to_return(:status => 200, :body => "", :headers => {})
43
43
 
44
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=1").
45
+ with(:headers => {'Accept' => '*/*'}).
46
+ to_return(:status => 200, :body => fixture_html_ftse(1), :headers => {})
47
+
48
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=2").
49
+ with(:headers => {'Accept' => '*/*'}).
50
+ to_return(:status => 200, :body => fixture_html_ftse(2), :headers => {})
51
+
52
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=3").
53
+ with(:headers => {'Accept' => '*/*'}).
54
+ to_return(:status => 200, :body => fixture_html_ftse(3), :headers => {})
55
+
56
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=4").
57
+ with(:headers => {'Accept' => '*/*'}).
58
+ to_return(:status => 200, :body => fixture_html_ftse(4), :headers => {})
59
+
60
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=5").
61
+ with(:headers => {'Accept' => '*/*'}).
62
+ to_return(:status => 200, :body => fixture_html_ftse(5), :headers => {})
63
+
64
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=6").
65
+ with(:headers => {'Accept' => '*/*'}).
66
+ to_return(:status => 200, :body => fixture_html_ftse(6), :headers => {})
67
+
68
+ stub_request(:get, "http://en.wikipedia.org/wiki/FTSE_100_Index").
69
+ with(:headers => {'Accept' => '*/*'}).
70
+ to_return(:status => 200, :body => fixture_html('ftse_wikipedia'), :headers => {})
71
+
44
72
  end
45
73
  end
46
74
 
@@ -67,4 +95,8 @@ end
67
95
 
68
96
  def edgar_html
69
97
  File.new(File.join(fixture_path, 'html', "edgar.html"))
98
+ end
99
+
100
+ def fixture_html_ftse(page)
101
+ File.new(File.join(fixture_path, 'html', "ftse_#{page}.html"))
70
102
  end
@@ -9,10 +9,11 @@ describe StockIndex do
9
9
  # How to generate a fixture file
10
10
  #
11
11
  # require 'yaml'
12
- # File.open('spec/fixtures/DJI.yaml', 'w') {|f| f.write StockIndex.new('^DJI').components.map{ |e| e[:symbol]}.to_yaml }
13
- # File.open('spec/fixtures/GSPC.yaml', 'w') {|f| f.write StockIndex.new('^GSPC').components.map{ |e| e[:symbol]}.to_yaml }
14
- # File.open('spec/fixtures/NDX.yaml', 'w') {|f| f.write StockIndex.new('^NDX').components.map{ |e| e[:symbol]}.to_yaml }
15
- # File.open('spec/fixtures/N225.yaml', 'w') {|f| f.write StockIndex.new('^N225').components.map{ |e| e[:symbol]}.to_yaml }
12
+ # File.open('spec/fixtures/yaml/DJI.yaml', 'w') {|f| f.write StockIndex.new('^DJI').components.map{ |e| e[:symbol]}.to_yaml }
13
+ # File.open('spec/fixtures/yaml/GSPC.yaml', 'w') {|f| f.write StockIndex.new('^GSPC').components.map{ |e| e[:symbol]}.to_yaml }
14
+ # File.open('spec/fixtures/yaml/NDX.yaml', 'w') {|f| f.write StockIndex.new('^NDX').components.map{ |e| e[:symbol]}.to_yaml }
15
+ # File.open('spec/fixtures/yaml/N225.yaml', 'w') {|f| f.write StockIndex.new('^N225').components.map{ |e| e[:symbol]}.to_yaml }
16
+ # File.open('spec/fixtures/yaml/FTSE.yaml', 'w') {|f| f.write StockIndex.new('^FTSE').components.map{ |e| e[:symbol]}.to_yaml }
16
17
 
17
18
  it 'returns components for ^DJI' do
18
19
  expect(StockIndex.new('^DJI').components.map{ |e| e[:symbol] }).to match_array(components_from_fixture('^DJI'))
@@ -30,4 +31,8 @@ describe StockIndex do
30
31
  expect(StockIndex.new('^N225').components.map{ |e| e[:symbol] }).to match_array(components_from_fixture('^N225'))
31
32
  end
32
33
 
34
+ it 'returns components for ^FTSE' do
35
+ expect(StockIndex.new('^FTSE').components.map{ |e| e[:symbol] }).to match_array(components_from_fixture('^FTSE'))
36
+ end
37
+
33
38
  end
@@ -5,7 +5,7 @@ describe SymbolParser do
5
5
  describe '#sp500_to_bsym' do
6
6
 
7
7
  it "returns 'BRK/B' when 'BRK.B'" do
8
- expect(SymbolParser.new('BRK.B').sp500_to_bsym).to eq('BRK/B')
8
+ expect(SymbolParser.new('BRK.B').symbol_to_bsym).to eq('BRK/B')
9
9
  end
10
10
 
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stock_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Vidal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,8 +151,10 @@ files:
151
151
  - README.md
152
152
  - Rakefile
153
153
  - bsym/JP.csv
154
+ - bsym/LN.csv
154
155
  - bsym/US.csv
155
156
  - cache/XJPX.pstore
157
+ - cache/XLON.pstore
156
158
  - cache/XNAS.pstore
157
159
  - cache/XNYS.pstore
158
160
  - cache/test.pstore
@@ -164,6 +166,7 @@ files:
164
166
  - lib/stock_index/scrapers/SP500_scraper.rb
165
167
  - lib/stock_index/scrapers/base_scraper.rb
166
168
  - lib/stock_index/scrapers/dji_scraper.rb
169
+ - lib/stock_index/scrapers/ftse_scraper.rb
167
170
  - lib/stock_index/scrapers/nasdaq_scraper.rb
168
171
  - lib/stock_index/scrapers/nikkei_scraper.rb
169
172
  - lib/stock_index/stock_index.rb
@@ -171,11 +174,19 @@ files:
171
174
  - lib/stock_index/version.rb
172
175
  - spec/fixtures/html/dji.html
173
176
  - spec/fixtures/html/edgar.html
177
+ - spec/fixtures/html/ftse_1.html
178
+ - spec/fixtures/html/ftse_2.html
179
+ - spec/fixtures/html/ftse_3.html
180
+ - spec/fixtures/html/ftse_4.html
181
+ - spec/fixtures/html/ftse_5.html
182
+ - spec/fixtures/html/ftse_6.html
183
+ - spec/fixtures/html/ftse_wikipedia.html
174
184
  - spec/fixtures/html/gspc.html
175
185
  - spec/fixtures/html/n225.html
176
186
  - spec/fixtures/html/n225_wikipedia.html
177
187
  - spec/fixtures/html/ndx.html
178
188
  - spec/fixtures/yaml/DJI.yaml
189
+ - spec/fixtures/yaml/FTSE.yaml
179
190
  - spec/fixtures/yaml/GSPC.yaml
180
191
  - spec/fixtures/yaml/N225.yaml
181
192
  - spec/fixtures/yaml/NDX.yaml
@@ -212,11 +223,19 @@ summary: Stock Index
212
223
  test_files:
213
224
  - spec/fixtures/html/dji.html
214
225
  - spec/fixtures/html/edgar.html
226
+ - spec/fixtures/html/ftse_1.html
227
+ - spec/fixtures/html/ftse_2.html
228
+ - spec/fixtures/html/ftse_3.html
229
+ - spec/fixtures/html/ftse_4.html
230
+ - spec/fixtures/html/ftse_5.html
231
+ - spec/fixtures/html/ftse_6.html
232
+ - spec/fixtures/html/ftse_wikipedia.html
215
233
  - spec/fixtures/html/gspc.html
216
234
  - spec/fixtures/html/n225.html
217
235
  - spec/fixtures/html/n225_wikipedia.html
218
236
  - spec/fixtures/html/ndx.html
219
237
  - spec/fixtures/yaml/DJI.yaml
238
+ - spec/fixtures/yaml/FTSE.yaml
220
239
  - spec/fixtures/yaml/GSPC.yaml
221
240
  - spec/fixtures/yaml/N225.yaml
222
241
  - spec/fixtures/yaml/NDX.yaml