finance-ytd 1.1.1 → 1.1.2
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/lib/finance-ytd.rb +2 -2
- data/test/test-finance-ytd.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a6af1dbf73dd5c599e1acac864c10f5c15dbec0
|
4
|
+
data.tar.gz: 13684c390601300e4bcc51e508eddde434c49158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4c4b663f737da79285691931177ca603faf81064d3f854566f70b2bab1da511ff087df82e4bb1c810a15c80bd5590f46aed9cd14c9d09548f08c022191e928
|
7
|
+
data.tar.gz: 19e4dfbf1acc6b9af3b409bcb797d068c98c6e1d86f3662041ed3dd05b891d5e271f49ea6072c687a69c5932616c7feedac567244f7e663efd0b7656f329a833
|
data/lib/finance-ytd.rb
CHANGED
@@ -38,11 +38,11 @@ class FinanceYtd
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
class
|
41
|
+
class CnnFinanceYtd < FinanceYtd
|
42
42
|
def initialize(options)
|
43
43
|
super(options)
|
44
44
|
@css = 'td.wsod_ytd > span'
|
45
|
-
@url = 'http://money.cnn.com/quote/
|
45
|
+
@url = 'http://money.cnn.com/quote/quote.html?exHours=off&symb=' + @symbol
|
46
46
|
match()
|
47
47
|
calculate()
|
48
48
|
end
|
data/test/test-finance-ytd.rb
CHANGED
@@ -2,8 +2,8 @@ require 'minitest/autorun'
|
|
2
2
|
require_relative '../lib/finance-ytd'
|
3
3
|
|
4
4
|
class FinanceYtdTest < Minitest::Test
|
5
|
-
def
|
6
|
-
f =
|
5
|
+
def testCnnFinanceYtd(symbol, friendly_name, decimal_places)
|
6
|
+
f = CnnFinanceYtd.new({ :symbol => symbol, :friendly_name => friendly_name, :decimal_places => decimal_places })
|
7
7
|
puts f
|
8
8
|
assert f.ytd_return.is_a? Float
|
9
9
|
end
|
@@ -15,7 +15,7 @@ class FinanceYtdTest < Minitest::Test
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_
|
18
|
-
|
18
|
+
testCnnFinanceYtd('VT', 'World Stocks', 0)
|
19
19
|
|
20
20
|
f = ApmexGoldFinanceYtd.new({ :symbol => 'Gold Spot', :friendly_name => 'Gold', :decimal_places => 0, :price_last_year => 1183.90 })
|
21
21
|
puts f
|
@@ -25,16 +25,16 @@ class FinanceYtdTest < Minitest::Test
|
|
25
25
|
assert f.ytd_return.is_a? Float
|
26
26
|
puts
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
testCnnFinanceYtd('VTI', 'U.S. Stocks', 0)
|
29
|
+
testCnnFinanceYtd('VXUS', 'Foreign Stocks', 0)
|
30
|
+
testCnnFinanceYtd('SGDM', 'Gold Miners', 0)
|
31
|
+
testCnnFinanceYtd('BWZ', 'Foreign Cash', 0)
|
32
32
|
testCnnMarketFinanceYtd('dow', 'Dow', 0)
|
33
33
|
testCnnMarketFinanceYtd('sandp', 'S&P 500', 0)
|
34
34
|
f = BloombergFinanceYtd.new({ :symbol => 'USGG10YR:IND', :friendly_name => '10 Year', :decimal_places => 0 })
|
35
35
|
puts f
|
36
36
|
assert f.ytd_return.is_a? Float
|
37
|
-
|
37
|
+
testCnnFinanceYtd('XBT', 'Bitcoin', 0)
|
38
38
|
puts
|
39
39
|
end
|
40
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finance-ytd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cscribn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|