Module: TickerSymbolJpn
- Extended by:
- TickerSymbolJpn
- Included in:
- TickerSymbolJpn
- Defined in:
- lib/ticker_symbol_jpn.rb,
lib/ticker_symbol_jpn/version.rb
Constant Summary collapse
- FIRST_LINE =
"コード"
- SHEET_NAME =
"Sheet1"
- FIRST_URL =
[ "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/first-d-j.xls", "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/first-f-j.xls" ]
- SECOND_URL =
[ "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/second-d-j.xls", "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/second-f-j.xls" ]
- MOTHERS_URL =
[ "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/mothers-d-j.xls", "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/mothers-f-j.xls" ]
- JASDAQ_URL =
[ "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/jasdaq-g-j.xls", "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/jasdaq-s-j.xls", "http://www.jpx.co.jp/markets/statistics-equities/misc/tvdivq0000001vg2-att/jasdaq-f-j.xls" ]
- VERSION =
"0.2.1"
Instance Method Summary collapse
- #all_codes ⇒ Object
- #first_codes ⇒ Object
- #jasdaq_codes ⇒ Object
- #load_codes(json_file_path) ⇒ Object
- #mothers_codes ⇒ Object
- #save_codes(json_file_path) ⇒ Object
- #second_codes ⇒ Object
Instance Method Details
#all_codes ⇒ Object
28 29 30 31 |
# File 'lib/ticker_symbol_jpn.rb', line 28 def all_codes urls = FIRST_URL + SECOND_URL + MOTHERS_URL + JASDAQ_URL get_codes urls end |
#first_codes ⇒ Object
33 34 35 |
# File 'lib/ticker_symbol_jpn.rb', line 33 def first_codes get_codes FIRST_URL end |
#jasdaq_codes ⇒ Object
45 46 47 |
# File 'lib/ticker_symbol_jpn.rb', line 45 def jasdaq_codes get_codes JASDAQ_URL end |
#load_codes(json_file_path) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/ticker_symbol_jpn.rb', line 56 def load_codes json_file_path json_data = open(json_file_path) do |io| JSON.load(io) end json_data.keys.each do |key| json_data[(Integer(key) rescue key) || key] = json_data.delete(key) end json_data end |
#mothers_codes ⇒ Object
41 42 43 |
# File 'lib/ticker_symbol_jpn.rb', line 41 def mothers_codes get_codes MOTHERS_URL end |
#save_codes(json_file_path) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/ticker_symbol_jpn.rb', line 49 def save_codes json_file_path codes = all_codes open(json_file_path, 'w') do |io| JSON.dump(codes, io) end end |
#second_codes ⇒ Object
37 38 39 |
# File 'lib/ticker_symbol_jpn.rb', line 37 def second_codes get_codes SECOND_URL end |