ystock 0.4.10 → 0.4.11
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 +4 -4
- data/README.markdown +12 -5
- data/lib/ystock/ystock.rb +4 -37
- data/ystock.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 714d1b3574d35826a84b09f3427b76b65548e98d
|
|
4
|
+
data.tar.gz: bd38ea7454ec3c31c7bca4f44e177a121f700b0f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af4c6bad050c6b2deed0e70d43589f300b18083f16833e46823646d293e967c7c87a05d0af5a353d6a63e522f9d84359cfd0f8ba3e5acd6b337f738ba0e36154
|
|
7
|
+
data.tar.gz: 063f50b0a3ed2d12a49a50bc87006de5b36225f4c54bb0e80bbdfce55203bbb74b25314d12014e43750eb9200c5a1471f74bf28a1159dbe06e57dcd5060a532b
|
data/README.markdown
CHANGED
|
@@ -6,10 +6,10 @@ This gem provides you with the latest market data avalable, pulling from Yahoo F
|
|
|
6
6
|
## Install
|
|
7
7
|
Add the following to your Gemfile
|
|
8
8
|
```ruby
|
|
9
|
-
gem "ystock", "~> 0.4.
|
|
9
|
+
gem "ystock", "~> 0.4.11"
|
|
10
10
|
|
|
11
11
|
# Or simply install it
|
|
12
|
-
gem install ystock -v=0.4.
|
|
12
|
+
gem install ystock -v=0.4.11
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Bundle
|
|
@@ -29,10 +29,10 @@ The examples below are how to use the Yahoo potion of the gem. All Yahoo request
|
|
|
29
29
|
|
|
30
30
|
## Quote Usage
|
|
31
31
|
```ruby
|
|
32
|
-
# Single Stock lookup
|
|
32
|
+
# Single Stock lookup 'String'
|
|
33
33
|
Ystock.quote("aapl")
|
|
34
34
|
|
|
35
|
-
# Multiple Stock lookup
|
|
35
|
+
# Multiple Stock lookup [Array]
|
|
36
36
|
Ystock.quote(["aapl", "f", "goog"])
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -57,7 +57,7 @@ exchange
|
|
|
57
57
|
|
|
58
58
|
----
|
|
59
59
|
|
|
60
|
-
### Tested
|
|
60
|
+
### Tested Ruby Versions
|
|
61
61
|
This gem was tested with:
|
|
62
62
|
|
|
63
63
|
Ruby: ~~1.9.2~~ -> No longer supported.
|
|
@@ -69,3 +69,10 @@ Ruby: 2.0.0
|
|
|
69
69
|
Ruby: 2.1.2
|
|
70
70
|
|
|
71
71
|
Ruby: 2.2.2
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Run RSpec tests
|
|
75
|
+
```
|
|
76
|
+
rspec spec/yahoo_spec.rb
|
|
77
|
+
```
|
|
78
|
+
|
data/lib/ystock/ystock.rb
CHANGED
|
@@ -5,54 +5,21 @@
|
|
|
5
5
|
def self.quote(stocks)
|
|
6
6
|
if stocks.is_a? Array
|
|
7
7
|
# => Many stocks
|
|
8
|
-
|
|
8
|
+
format(send_request(stocks.join(",")))
|
|
9
9
|
else
|
|
10
10
|
# => Single Stock
|
|
11
|
-
|
|
11
|
+
format(send_request(stocks)).first
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
private
|
|
16
|
-
def self.find(args)
|
|
17
|
-
stock_string = ""
|
|
18
|
-
last_stock = args.last.to_s
|
|
19
|
-
args.each do |stock|
|
|
20
|
-
if last_stock == stock.to_sym
|
|
21
|
-
stock_string += stock.to_s
|
|
22
|
-
else
|
|
23
|
-
stock_string += stock.to_s + ","
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
format(send_request(stock_string))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def self.get_quote(stock)
|
|
30
|
-
stock_data = Hash.new
|
|
31
|
-
s = send_request(stock)
|
|
32
|
-
a = s.chomp.split(",")
|
|
33
|
-
return {:symbol => stock,
|
|
34
|
-
:price => a[0],
|
|
35
|
-
:change => a[1],
|
|
36
|
-
:volume => a[2],
|
|
37
|
-
:change_percent => a[4].gsub("\r\n", "").gsub('"', ''),
|
|
38
|
-
:open => a[5],
|
|
39
|
-
:day_high => a[6],
|
|
40
|
-
:day_low => a[7],
|
|
41
|
-
:previous_close => a[8],
|
|
42
|
-
:after_hours_change => a[9].gsub("\r\n", "").gsub('"', ''),
|
|
43
|
-
:ma50 => a[10],
|
|
44
|
-
:ma200 => a[11],
|
|
45
|
-
:week52_range => a[12].gsub("\r\n", "").gsub('"', ''),
|
|
46
|
-
:pe_ratio => a[13],
|
|
47
|
-
:exchange => a[14]
|
|
48
|
-
}
|
|
49
|
-
end
|
|
50
|
-
|
|
51
16
|
def self.format(results)
|
|
52
17
|
output = Array.new
|
|
53
18
|
results.each_line("\n") do |row|
|
|
54
19
|
stockdata = row.split(",")
|
|
55
20
|
if !stockdata.nil?
|
|
21
|
+
|
|
22
|
+
# => Check to see if the Symbol is nil
|
|
56
23
|
if !stockdata[3].nil?
|
|
57
24
|
stockdata[3] = stockdata[3].gsub("\r\n", "").gsub('"', '')
|
|
58
25
|
|
data/ystock.gemspec
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'ystock'
|
|
3
|
-
s.version = "0.4.
|
|
3
|
+
s.version = "0.4.11"
|
|
4
4
|
s.authors = ["Greg Winn"]
|
|
5
|
-
s.date = '
|
|
5
|
+
s.date = '2015-07-28'
|
|
6
6
|
s.description = %q{Grab stock information from Yahoo}
|
|
7
7
|
s.email = %q{winn.greg@gmail.com}
|
|
8
8
|
s.extra_rdoc_files = ["README.markdown", "lib/ystock.rb"]
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ystock
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Greg Winn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Grab stock information from Yahoo
|
|
14
14
|
email: winn.greg@gmail.com
|
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
42
42
|
version: '0'
|
|
43
43
|
requirements: []
|
|
44
44
|
rubyforge_project:
|
|
45
|
-
rubygems_version: 2.
|
|
45
|
+
rubygems_version: 2.2.2
|
|
46
46
|
signing_key:
|
|
47
47
|
specification_version: 4
|
|
48
48
|
summary: Grab stock information from Yahoo
|