brm_finance 1.0.12 → 1.0.13

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
  SHA1:
3
- metadata.gz: 4e829683f826c8b7b6fd91cad5bc9f4bf36829e7
4
- data.tar.gz: 3ca507dc5ddb398bbbc281246fe34dea14d85b11
3
+ metadata.gz: 1dfe8f9382e9eccec1107fa2b93f18a8159886ec
4
+ data.tar.gz: 6f2c9196950e34d3801e4b35e4b54c1e36e0e7d3
5
5
  SHA512:
6
- metadata.gz: 93d061f76302621ad1a468dae7c7fa5c8287e8b9452d4570f8ca0130e3617d491531cf7e3049c66434cd8022d5f8aa0c9c3e6e73ec1525c01a1c57021ddf5aee
7
- data.tar.gz: b4c9f3f7f2033bbfee9417305cfc0bde7e17bfe9f5c1d9f0e858760168cae6e11f636253abb84649412f38eef44cc1c1e8e56ef2215e36b18c1dafe8026dc96e
6
+ metadata.gz: 2d4a5207f2dafff45e2cb181f653c1aec8f2e329d2584d07cd1f5806d5172095460dae06a6a8347d253080abeca4e5b8234414e1dcaed33858e8d37ec711e16c
7
+ data.tar.gz: ff29dfe3fafd9090f8767b1c5a3b75ccb9debeb97a499da409d90910df3581ffc6bc9b187540b189a3639fe7ac48722a67e3dd145a2e4e5c12341399e70f3f54
@@ -3,19 +3,25 @@ require "rest-client"
3
3
  require "json"
4
4
  require "date"
5
5
  require 'csv'
6
- require 'open-uri'
7
- require 'nokogiri'
8
6
 
9
7
  module BrmFinance
10
- def BrmFinance.splits(symbol)
11
- re = /(.+)\[(\d+):(\d+)\]/
12
-
13
- url = "http://finance.yahoo.com/q/bc?s=#{symbol}+Basic+Chart"
14
- doc = Nokogiri::HTML(open(URI.parse(url)))
15
- doc.css("center nobr").inject([]) do |splits, split|
16
- md = re.match split
17
- splits << [Date.parse(md[1]).strftime('%Y-%m-%d'), md[2].to_i, md[3].to_i] if md
8
+ def BrmFinance.dividends_splits(symbol, start_date=Date.today-1.year, end_date=Date.today)
9
+ symbol = [symbol] unless symbol.is_a?(Array)
10
+
11
+ #start_date = start_date.strftime('%m-%d-%Y').split('-')
12
+ #start_date = "a=#{start_date[0]}&b=#{start_date[1]}&c=#{start_date[2]}"
13
+
14
+ #end_date = end_date.strftime('%m-%d-%Y').split('-')
15
+ #end_date = "d=#{end_date[0]}&e=#{end_date[1]}&f=#{end_date[2]}"
16
+
17
+ results = []
18
+ symbol.each do |s|
19
+ #url = "http://ichart.finance.yahoo.com/x?s=#{s}&#{start_date}&#{end_date}&g=v&y=0&z=30000"
20
+ url = "http://ichart.finance.yahoo.com/x?s=#{s}&g=v&y=0&z=30000"
21
+ response = RestClient.get(url)
22
+ results.push({'Symbol' => s, 'Series' => CSV.parse(response)})
18
23
  end
24
+ results
19
25
  end
20
26
 
21
27
  class Stock
@@ -89,25 +95,6 @@ module BrmFinance
89
95
  self.parse(response, symbol)
90
96
  end
91
97
 
92
- def self.dividends_splits(symbol, start_date=Date.today-1.year, end_date=Date.today)
93
- symbol = [symbol] unless symbol.is_a?(Array)
94
-
95
- start_date = start_date.strftime('%m-%d-%Y').split('-')
96
- start_date = "a=#{start_date[0]}&b=#{start_date[1]}&c=#{start_date[2]}"
97
-
98
- end_date = end_date.strftime('%m-%d-%Y').split('-')
99
- end_date = "d=#{end_date[0]}&e=#{end_date[1]}&f=#{end_date[2]}"
100
-
101
- results = []
102
- symbol.each do |s|
103
- url = "http://ichart.finance.yahoo.com/x?s=#{s}&#{start_date}&#{end_date}&g=v&y=0&z=30000"
104
- response = RestClient.get(url)
105
- results.push({'Symbol' => s, 'Series' => CSV.parse(response)})
106
- end
107
-
108
- results
109
- end
110
-
111
98
  def self.company_info(symbol)
112
99
  url = 'http://query.yahooapis.com/v1/public/yql?q='
113
100
 
@@ -1,3 +1,3 @@
1
1
  module BrmFinance
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brm_finance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Adamson, Ty Rauber