yafa 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2faaa4583f9ed8fb64fab2398144100d48095b99
4
+ data.tar.gz: bd026569282943484bca5e4f11978d3ffd47de28
5
+ SHA512:
6
+ metadata.gz: c16dbb6c15af16d38f506f2244f7a922c7572568c70d251fd2c190b916f5a5fe8f603eb8e2a6968e3948467e0b085270ea7648f3e71909bd7196f72cafb9e298
7
+ data.tar.gz: e303aed5f6b3bfa30b93eb19d1219514182da62340047106264c21c4384ea118e17398e9ab637adbea4282547337b5b6638ac8f6af6e8bb0385d385313c3640b
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ *.gem
12
+
13
+ .idea
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+
5
+ Documentation:
6
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at agc.klotz@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in YFAPI.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Andrew Klotz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # YFAPI
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/YFAPI`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'YFAPI'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install YFAPI
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/YFAPI. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'yafa'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,110 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://query.yahooapis.com/v1/public/yql?callback=&diagnostics=true&env=store://datatables.org/alltableswithkeys&format=json&q=SELECT%20*%20FROM%20yahoo.finance.quotes%20WHERE%20symbol%20IN%20(%27GOOG%27,%20%27YHOO%27)
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Yql-Host:
22
+ - prod_bf1_1;paas.yql;queryyahooapiscomproductionbf1;af760eb4-adbe-11e6-b5e7-d4ae52974741
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ Access-Control-Allow-Origin:
26
+ - "*"
27
+ Content-Type:
28
+ - application/json;charset=utf-8
29
+ Cache-Control:
30
+ - no-cache
31
+ Date:
32
+ - Sat, 26 Nov 2016 20:41:36 GMT
33
+ Age:
34
+ - '0'
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Connection:
38
+ - keep-alive
39
+ Via:
40
+ - http/1.1 a01.ue.bf1.yahoo.net (ApacheTrafficServer [cMsSf ])
41
+ Server:
42
+ - ATS
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"query":{"count":2,"created":"2016-11-26T20:41:36Z","lang":"en-US","diagnostics":{"url":[{"execution-start-time":"0","execution-stop-time":"1","execution-time":"1","content":"http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml"},{"execution-start-time":"4","execution-stop-time":"15","execution-time":"11","content":"http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=GOOG,YHOO"}],"publiclyCallable":"true","cache":{"execution-start-time":"3","execution-stop-time":"4","execution-time":"1","method":"GET","type":"MEMCACHED","content":"5d1e1de680846a307c9874dc3d6878dc"},"query":{"execution-start-time":"4","execution-stop-time":"15","execution-time":"11","params":"{url=[http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=GOOG,YHOO]}","content":"select
46
+ * from csv where url=@url and columns=''Ask,AverageDailyVolume,Bid,AskRealtime,BidRealtime,BookValue,Change&PercentChange,Change,Commission,Currency,ChangeRealtime,AfterHoursChangeRealtime,DividendShare,LastTradeDate,TradeDate,EarningsShare,ErrorIndicationreturnedforsymbolchangedinvalid,EPSEstimateCurrentYear,EPSEstimateNextYear,EPSEstimateNextQuarter,DaysLow,DaysHigh,YearLow,YearHigh,HoldingsGainPercent,AnnualizedGain,HoldingsGain,HoldingsGainPercentRealtime,HoldingsGainRealtime,MoreInfo,OrderBookRealtime,MarketCapitalization,MarketCapRealtime,EBITDA,ChangeFromYearLow,PercentChangeFromYearLow,LastTradeRealtimeWithTime,ChangePercentRealtime,ChangeFromYearHigh,PercebtChangeFromYearHigh,LastTradeWithTime,LastTradePriceOnly,HighLimit,LowLimit,DaysRange,DaysRangeRealtime,FiftydayMovingAverage,TwoHundreddayMovingAverage,ChangeFromTwoHundreddayMovingAverage,PercentChangeFromTwoHundreddayMovingAverage,ChangeFromFiftydayMovingAverage,PercentChangeFromFiftydayMovingAverage,Name,Notes,Open,PreviousClose,PricePaid,ChangeinPercent,PriceSales,PriceBook,ExDividendDate,PERatio,DividendPayDate,PERatioRealtime,PEGRatio,PriceEPSEstimateCurrentYear,PriceEPSEstimateNextYear,Symbol,SharesOwned,ShortRatio,LastTradeTime,TickerTrend,OneyrTargetPrice,Volume,HoldingsValue,HoldingsValueRealtime,YearRange,DaysValueChange,DaysValueChangeRealtime,StockExchange,DividendYield''"},"javascript":{"execution-start-time":"2","execution-stop-time":"30","execution-time":"27","instructions-used":"121854","table-name":"yahoo.finance.quotes"},"user-time":"31","service-time":"13","build-version":"2.0.79"},"results":{"quote":[{"symbol":"GOOG","Ask":"761.60","AverageDailyVolume":"1599120","Bid":"759.02","AskRealtime":null,"BidRealtime":null,"BookValue":"194.60","Change_PercentChange":"+0.69
47
+ - +0.09%","Change":"+0.69","Commission":null,"Currency":"USD","ChangeRealtime":null,"AfterHoursChangeRealtime":null,"DividendShare":null,"LastTradeDate":"11/25/2016","TradeDate":null,"EarningsShare":"27.32","ErrorIndicationreturnedforsymbolchangedinvalid":null,"EPSEstimateCurrentYear":"34.42","EPSEstimateNextYear":"40.81","EPSEstimateNextQuarter":"9.28","DaysLow":"760.52","DaysHigh":"765.00","YearLow":"663.06","YearHigh":"816.68","HoldingsGainPercent":null,"AnnualizedGain":null,"HoldingsGain":null,"HoldingsGainPercentRealtime":null,"HoldingsGainRealtime":null,"MoreInfo":null,"OrderBookRealtime":null,"MarketCapitalization":"524.98B","MarketCapRealtime":null,"EBITDA":"28.29B","ChangeFromYearLow":"98.62","PercentChangeFromYearLow":"+14.87%","LastTradeRealtimeWithTime":null,"ChangePercentRealtime":null,"ChangeFromYearHigh":"-55.00","PercebtChangeFromYearHigh":"-6.73%","LastTradeWithTime":"1:00pm
48
+ - <b>761.68</b>","LastTradePriceOnly":"761.68","HighLimit":null,"LowLimit":null,"DaysRange":"760.52
49
+ - 765.00","DaysRangeRealtime":null,"FiftydayMovingAverage":"778.78","TwoHundreddayMovingAverage":"751.79","ChangeFromTwoHundreddayMovingAverage":"9.89","PercentChangeFromTwoHundreddayMovingAverage":"+1.32%","ChangeFromFiftydayMovingAverage":"-17.10","PercentChangeFromFiftydayMovingAverage":"-2.20%","Name":"Alphabet
50
+ Inc.","Notes":null,"Open":"764.26","PreviousClose":"760.99","PricePaid":null,"ChangeinPercent":"+0.09%","PriceSales":"6.13","PriceBook":"3.91","ExDividendDate":null,"PERatio":"27.88","DividendPayDate":null,"PERatioRealtime":null,"PEGRatio":"1.19","PriceEPSEstimateCurrentYear":"22.13","PriceEPSEstimateNextYear":"18.66","Symbol":"GOOG","SharesOwned":null,"ShortRatio":"1.50","LastTradeTime":"1:00pm","TickerTrend":null,"OneyrTargetPrice":"939.00","Volume":"587421","HoldingsValue":null,"HoldingsValueRealtime":null,"YearRange":"663.06
51
+ - 816.68","DaysValueChange":null,"DaysValueChangeRealtime":null,"StockExchange":"NMS","DividendYield":null,"PercentChange":"+0.09%"},{"symbol":"YHOO","Ask":"41.88","AverageDailyVolume":"10372400","Bid":"39.80","AskRealtime":null,"BidRealtime":null,"BookValue":"36.54","Change_PercentChange":"-0.09
52
+ - -0.22%","Change":"-0.09","Commission":null,"Currency":"USD","ChangeRealtime":null,"AfterHoursChangeRealtime":null,"DividendShare":null,"LastTradeDate":"11/25/2016","TradeDate":null,"EarningsShare":"-5.08","ErrorIndicationreturnedforsymbolchangedinvalid":null,"EPSEstimateCurrentYear":"0.58","EPSEstimateNextYear":"0.62","EPSEstimateNextQuarter":"0.14","DaysLow":"40.71","DaysHigh":"41.08","YearLow":"26.15","YearHigh":"44.92","HoldingsGainPercent":null,"AnnualizedGain":null,"HoldingsGain":null,"HoldingsGainPercentRealtime":null,"HoldingsGainRealtime":null,"MoreInfo":null,"OrderBookRealtime":null,"MarketCapitalization":"39.00B","MarketCapRealtime":null,"EBITDA":"90.38M","ChangeFromYearLow":"14.72","PercentChangeFromYearLow":"+56.29%","LastTradeRealtimeWithTime":null,"ChangePercentRealtime":null,"ChangeFromYearHigh":"-4.05","PercebtChangeFromYearHigh":"-9.02%","LastTradeWithTime":"1:00pm
53
+ - <b>40.87</b>","LastTradePriceOnly":"40.87","HighLimit":null,"LowLimit":null,"DaysRange":"40.71
54
+ - 41.08","DaysRangeRealtime":null,"FiftydayMovingAverage":"41.49","TwoHundreddayMovingAverage":"40.13","ChangeFromTwoHundreddayMovingAverage":"0.74","PercentChangeFromTwoHundreddayMovingAverage":"+1.83%","ChangeFromFiftydayMovingAverage":"-0.62","PercentChangeFromFiftydayMovingAverage":"-1.48%","Name":"Yahoo!
55
+ Inc.","Notes":null,"Open":"41.08","PreviousClose":"40.96","PricePaid":null,"ChangeinPercent":"-0.22%","PriceSales":"7.86","PriceBook":"1.12","ExDividendDate":null,"PERatio":null,"DividendPayDate":null,"PERatioRealtime":null,"PEGRatio":"-116.83","PriceEPSEstimateCurrentYear":"70.47","PriceEPSEstimateNextYear":"65.92","Symbol":"YHOO","SharesOwned":null,"ShortRatio":"5.89","LastTradeTime":"1:00pm","TickerTrend":null,"OneyrTargetPrice":"45.46","Volume":"2586908","HoldingsValue":null,"HoldingsValueRealtime":null,"YearRange":"26.15
56
+ - 44.92","DaysValueChange":null,"DaysValueChangeRealtime":null,"StockExchange":"NMS","DividendYield":null,"PercentChange":"-0.22%"}]}}}'
57
+ http_version:
58
+ recorded_at: Sat, 26 Nov 2016 20:41:36 GMT
59
+ - request:
60
+ method: get
61
+ uri: https://query.yahooapis.com/v1/public/yql?callback=&diagnostics=true&env=store://datatables.org/alltableswithkeys&format=json&q=SELECT%20*%20FROM%20yahoo.finance.quotes%20WHERE%20symbol%20IN%20(%27GOOG%27)
62
+ body:
63
+ encoding: US-ASCII
64
+ string: ''
65
+ headers:
66
+ Accept-Encoding:
67
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
68
+ Accept:
69
+ - "*/*"
70
+ User-Agent:
71
+ - Ruby
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ X-Yql-Host:
78
+ - prod_bf1_1;paas.yql;queryyahooapiscomproductionbf1;99515889-b14a-11e6-b5e7-d4ae52974741
79
+ X-Content-Type-Options:
80
+ - nosniff
81
+ Access-Control-Allow-Origin:
82
+ - "*"
83
+ Content-Type:
84
+ - application/json;charset=utf-8
85
+ Cache-Control:
86
+ - no-cache
87
+ Date:
88
+ - Sat, 26 Nov 2016 20:41:37 GMT
89
+ Age:
90
+ - '0'
91
+ Transfer-Encoding:
92
+ - chunked
93
+ Connection:
94
+ - keep-alive
95
+ Via:
96
+ - http/1.1 a17.ue.bf1.yahoo.net (ApacheTrafficServer [cMsSf ])
97
+ Server:
98
+ - ATS
99
+ body:
100
+ encoding: UTF-8
101
+ string: '{"query":{"count":1,"created":"2016-11-26T20:41:37Z","lang":"en-US","diagnostics":{"url":[{"execution-start-time":"0","execution-stop-time":"1","execution-time":"1","content":"http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml"},{"execution-start-time":"4","execution-stop-time":"5","execution-time":"1","content":"http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=GOOG"}],"publiclyCallable":"true","cache":{"execution-start-time":"3","execution-stop-time":"3","execution-time":"0","method":"GET","type":"MEMCACHED","content":"5d1e1de680846a307c9874dc3d6878dc"},"query":{"execution-start-time":"4","execution-stop-time":"5","execution-time":"1","params":"{url=[http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=GOOG]}","content":"select
102
+ * from csv where url=@url and columns=''Ask,AverageDailyVolume,Bid,AskRealtime,BidRealtime,BookValue,Change&PercentChange,Change,Commission,Currency,ChangeRealtime,AfterHoursChangeRealtime,DividendShare,LastTradeDate,TradeDate,EarningsShare,ErrorIndicationreturnedforsymbolchangedinvalid,EPSEstimateCurrentYear,EPSEstimateNextYear,EPSEstimateNextQuarter,DaysLow,DaysHigh,YearLow,YearHigh,HoldingsGainPercent,AnnualizedGain,HoldingsGain,HoldingsGainPercentRealtime,HoldingsGainRealtime,MoreInfo,OrderBookRealtime,MarketCapitalization,MarketCapRealtime,EBITDA,ChangeFromYearLow,PercentChangeFromYearLow,LastTradeRealtimeWithTime,ChangePercentRealtime,ChangeFromYearHigh,PercebtChangeFromYearHigh,LastTradeWithTime,LastTradePriceOnly,HighLimit,LowLimit,DaysRange,DaysRangeRealtime,FiftydayMovingAverage,TwoHundreddayMovingAverage,ChangeFromTwoHundreddayMovingAverage,PercentChangeFromTwoHundreddayMovingAverage,ChangeFromFiftydayMovingAverage,PercentChangeFromFiftydayMovingAverage,Name,Notes,Open,PreviousClose,PricePaid,ChangeinPercent,PriceSales,PriceBook,ExDividendDate,PERatio,DividendPayDate,PERatioRealtime,PEGRatio,PriceEPSEstimateCurrentYear,PriceEPSEstimateNextYear,Symbol,SharesOwned,ShortRatio,LastTradeTime,TickerTrend,OneyrTargetPrice,Volume,HoldingsValue,HoldingsValueRealtime,YearRange,DaysValueChange,DaysValueChangeRealtime,StockExchange,DividendYield''"},"javascript":{"execution-start-time":"2","execution-stop-time":"8","execution-time":"6","instructions-used":"64006","table-name":"yahoo.finance.quotes"},"user-time":"9","service-time":"2","build-version":"2.0.79"},"results":{"quote":{"symbol":"GOOG","Ask":"761.60","AverageDailyVolume":"1599120","Bid":"759.02","AskRealtime":null,"BidRealtime":null,"BookValue":"194.60","Change_PercentChange":"+0.69
103
+ - +0.09%","Change":"+0.69","Commission":null,"Currency":"USD","ChangeRealtime":null,"AfterHoursChangeRealtime":null,"DividendShare":null,"LastTradeDate":"11/25/2016","TradeDate":null,"EarningsShare":"27.32","ErrorIndicationreturnedforsymbolchangedinvalid":null,"EPSEstimateCurrentYear":"34.42","EPSEstimateNextYear":"40.81","EPSEstimateNextQuarter":"9.28","DaysLow":"760.52","DaysHigh":"765.00","YearLow":"663.06","YearHigh":"816.68","HoldingsGainPercent":null,"AnnualizedGain":null,"HoldingsGain":null,"HoldingsGainPercentRealtime":null,"HoldingsGainRealtime":null,"MoreInfo":null,"OrderBookRealtime":null,"MarketCapitalization":"524.98B","MarketCapRealtime":null,"EBITDA":"28.29B","ChangeFromYearLow":"98.62","PercentChangeFromYearLow":"+14.87%","LastTradeRealtimeWithTime":null,"ChangePercentRealtime":null,"ChangeFromYearHigh":"-55.00","PercebtChangeFromYearHigh":"-6.73%","LastTradeWithTime":"1:00pm
104
+ - <b>761.68</b>","LastTradePriceOnly":"761.68","HighLimit":null,"LowLimit":null,"DaysRange":"760.52
105
+ - 765.00","DaysRangeRealtime":null,"FiftydayMovingAverage":"778.78","TwoHundreddayMovingAverage":"751.79","ChangeFromTwoHundreddayMovingAverage":"9.89","PercentChangeFromTwoHundreddayMovingAverage":"+1.32%","ChangeFromFiftydayMovingAverage":"-17.10","PercentChangeFromFiftydayMovingAverage":"-2.20%","Name":"Alphabet
106
+ Inc.","Notes":null,"Open":"764.26","PreviousClose":"760.99","PricePaid":null,"ChangeinPercent":"+0.09%","PriceSales":"6.13","PriceBook":"3.91","ExDividendDate":null,"PERatio":"27.88","DividendPayDate":null,"PERatioRealtime":null,"PEGRatio":"1.19","PriceEPSEstimateCurrentYear":"22.13","PriceEPSEstimateNextYear":"18.66","Symbol":"GOOG","SharesOwned":null,"ShortRatio":"1.50","LastTradeTime":"1:00pm","TickerTrend":null,"OneyrTargetPrice":"939.00","Volume":"587421","HoldingsValue":null,"HoldingsValueRealtime":null,"YearRange":"663.06
107
+ - 816.68","DaysValueChange":null,"DaysValueChangeRealtime":null,"StockExchange":"NMS","DividendYield":null,"PercentChange":"+0.09%"}}}}'
108
+ http_version:
109
+ recorded_at: Sat, 26 Nov 2016 20:41:37 GMT
110
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,373 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=1d/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Sun, 27 Nov 2016 05:13:28 GMT
23
+ P3p:
24
+ - policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV
25
+ TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY
26
+ ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
27
+ Expires:
28
+ - Sun, 27 Nov 2016 05:14:28 GMT
29
+ Last-Modified:
30
+ - Fri, 25 Nov 2016 18:00:00 GMT
31
+ Cache-Control:
32
+ - public
33
+ Content-Type:
34
+ - text/javascript; charset=utf-8
35
+ Vary:
36
+ - Accept-Encoding,X-Ssl
37
+ Age:
38
+ - '0'
39
+ Via:
40
+ - http/1.1 media-border36.global.media.bf1.yahoo.com (ApacheTrafficServer [cMsSfW]),
41
+ http/1.1 e14.ycpi.cha.yahoo.com (ApacheTrafficServer [cSsSfU])
42
+ Server:
43
+ - ATS
44
+ Transfer-Encoding:
45
+ - chunked
46
+ Connection:
47
+ - keep-alive
48
+ body:
49
+ encoding: ASCII-8BIT
50
+ string: "finance_charts_json_callback( { \"meta\" :\n {\n \"uri\" :\"/instrument/1.0/GOOG/chartdata;type=quote;range=1d/json\",\n
51
+ \ \"ticker\" : \"goog\",\n \"Company-Name\" : \"Alphabet Inc.\",\n \"Exchange-Name\"
52
+ : \"NMS\",\n \"unit\" : \"MIN\",\n \"timezone\" : \"EST\",\n \"currency\"
53
+ : \"USD\",\n \"gmtoffset\" : -18000,\n \"previous_close\" : 760.9900\n }\n
54
+ ,\n \"Timestamp\" : {\"min\" :1480084200,\"max\" :1480107600 }\n ,\n \"labels\"
55
+ : [1480086000,1480089600,1480093200,1480096800,1480100400,1480104000,1480107600
56
+ ]\n ,\n \"ranges\" : {\"close\" : {\"min\" :760.6797,\"max\" :763.7400 },\"high\"
57
+ : {\"min\" :760.7500,\"max\" :764.2600 },\"low\" : {\"min\" :760.6100,\"max\"
58
+ :763.3850 },\"open\" : {\"min\" :760.7400,\"max\" :764.2600 },\"volume\" :
59
+ {\"min\" :100,\"max\" :70100 } }\n ,\n \"series\" : [\n { \"Timestamp\" :1480084200,\"close\"
60
+ :761.1600,\"high\" :764.2600,\"low\" :761.1600,\"open\" :764.2600,\"volume\"
61
+ :43100 } \n, { \"Timestamp\" :1480084266,\"close\" :761.3200,\"high\" :761.3500,\"low\"
62
+ :760.6492,\"open\" :761.1500,\"volume\" :200 } \n, { \"Timestamp\" :1480084322,\"close\"
63
+ :763.7400,\"high\" :763.7800,\"low\" :761.3850,\"open\" :761.7400,\"volume\"
64
+ :8900 } \n, { \"Timestamp\" :1480084405,\"close\" :762.5200,\"high\" :763.4200,\"low\"
65
+ :762.5200,\"open\" :763.4200,\"volume\" :1300 } \n, { \"Timestamp\" :1480084446,\"close\"
66
+ :762.6600,\"high\" :763.0000,\"low\" :761.6500,\"open\" :763.0000,\"volume\"
67
+ :3400 } \n, { \"Timestamp\" :1480084500,\"close\" :761.7500,\"high\" :763.0700,\"low\"
68
+ :761.5100,\"open\" :762.6700,\"volume\" :8300 } \n, { \"Timestamp\" :1480084565,\"close\"
69
+ :762.2000,\"high\" :762.4000,\"low\" :761.5100,\"open\" :761.5100,\"volume\"
70
+ :6300 } \n, { \"Timestamp\" :1480084620,\"close\" :762.2345,\"high\" :762.2345,\"low\"
71
+ :761.8100,\"open\" :761.9300,\"volume\" :700 } \n, { \"Timestamp\" :1480084692,\"close\"
72
+ :762.5600,\"high\" :762.8300,\"low\" :762.5100,\"open\" :762.5100,\"volume\"
73
+ :1700 } \n, { \"Timestamp\" :1480084759,\"close\" :762.5600,\"high\" :762.7950,\"low\"
74
+ :762.5500,\"open\" :762.7500,\"volume\" :1900 } \n, { \"Timestamp\" :1480084806,\"close\"
75
+ :761.7200,\"high\" :762.6900,\"low\" :761.7200,\"open\" :762.5100,\"volume\"
76
+ :1500 } \n, { \"Timestamp\" :1480084868,\"close\" :762.7600,\"high\" :762.8500,\"low\"
77
+ :762.0400,\"open\" :762.0400,\"volume\" :3400 } \n, { \"Timestamp\" :1480084930,\"close\"
78
+ :763.0400,\"high\" :763.6300,\"low\" :762.7700,\"open\" :762.9000,\"volume\"
79
+ :3200 } \n, { \"Timestamp\" :1480085004,\"close\" :762.9600,\"high\" :763.5500,\"low\"
80
+ :762.9600,\"open\" :763.3900,\"volume\" :2600 } \n, { \"Timestamp\" :1480085058,\"close\"
81
+ :762.5973,\"high\" :762.8500,\"low\" :762.3900,\"open\" :762.8500,\"volume\"
82
+ :1400 } \n, { \"Timestamp\" :1480085110,\"close\" :761.7600,\"high\" :762.2600,\"low\"
83
+ :761.7000,\"open\" :762.2600,\"volume\" :2600 } \n, { \"Timestamp\" :1480085160,\"close\"
84
+ :762.7100,\"high\" :762.7600,\"low\" :762.1000,\"open\" :762.1000,\"volume\"
85
+ :2100 } \n, { \"Timestamp\" :1480085223,\"close\" :762.6700,\"high\" :762.9400,\"low\"
86
+ :762.5000,\"open\" :762.7250,\"volume\" :3200 } \n, { \"Timestamp\" :1480085285,\"close\"
87
+ :763.4300,\"high\" :763.4400,\"low\" :762.9350,\"open\" :762.9350,\"volume\"
88
+ :3700 } \n, { \"Timestamp\" :1480085353,\"close\" :763.3850,\"high\" :763.5000,\"low\"
89
+ :763.3850,\"open\" :763.5000,\"volume\" :600 } \n, { \"Timestamp\" :1480085402,\"close\"
90
+ :763.1400,\"high\" :763.1600,\"low\" :762.6900,\"open\" :763.1300,\"volume\"
91
+ :2700 } \n, { \"Timestamp\" :1480085472,\"close\" :762.2450,\"high\" :762.9367,\"low\"
92
+ :762.0250,\"open\" :762.9367,\"volume\" :3500 } \n, { \"Timestamp\" :1480085563,\"close\"
93
+ :762.3600,\"high\" :762.6400,\"low\" :762.3600,\"open\" :762.6400,\"volume\"
94
+ :700 } \n, { \"Timestamp\" :1480085603,\"close\" :762.7083,\"high\" :762.7100,\"low\"
95
+ :762.3050,\"open\" :762.7100,\"volume\" :1100 } \n, { \"Timestamp\" :1480085661,\"close\"
96
+ :762.0250,\"high\" :762.6700,\"low\" :762.0250,\"open\" :762.3200,\"volume\"
97
+ :2100 } \n, { \"Timestamp\" :1480085722,\"close\" :763.0000,\"high\" :763.2600,\"low\"
98
+ :762.1800,\"open\" :762.6243,\"volume\" :2900 } \n, { \"Timestamp\" :1480085781,\"close\"
99
+ :762.9700,\"high\" :762.9700,\"low\" :762.7200,\"open\" :762.7600,\"volume\"
100
+ :500 } \n, { \"Timestamp\" :1480085822,\"close\" :762.7700,\"high\" :762.9650,\"low\"
101
+ :762.2201,\"open\" :762.9650,\"volume\" :2700 } \n, { \"Timestamp\" :1480085912,\"close\"
102
+ :762.6982,\"high\" :762.6982,\"low\" :762.4791,\"open\" :762.4791,\"volume\"
103
+ :200 } \n, { \"Timestamp\" :1480085947,\"close\" :763.3400,\"high\" :763.5200,\"low\"
104
+ :762.5550,\"open\" :762.7500,\"volume\" :3800 } \n, { \"Timestamp\" :1480086000,\"close\"
105
+ :762.5500,\"high\" :763.6000,\"low\" :762.5500,\"open\" :763.6000,\"volume\"
106
+ :4800 } \n, { \"Timestamp\" :1480086072,\"close\" :762.9900,\"high\" :763.2000,\"low\"
107
+ :762.5700,\"open\" :763.0000,\"volume\" :1500 } \n, { \"Timestamp\" :1480086123,\"close\"
108
+ :762.9000,\"high\" :763.1100,\"low\" :762.7900,\"open\" :763.1100,\"volume\"
109
+ :1100 } \n, { \"Timestamp\" :1480086190,\"close\" :763.2600,\"high\" :763.2600,\"low\"
110
+ :762.9700,\"open\" :762.9700,\"volume\" :3900 } \n, { \"Timestamp\" :1480086241,\"close\"
111
+ :762.9300,\"high\" :763.5500,\"low\" :762.8300,\"open\" :763.0900,\"volume\"
112
+ :5600 } \n, { \"Timestamp\" :1480086304,\"close\" :762.8700,\"high\" :763.1000,\"low\"
113
+ :762.8600,\"open\" :763.0000,\"volume\" :1600 } \n, { \"Timestamp\" :1480086387,\"close\"
114
+ :762.9800,\"high\" :762.9800,\"low\" :762.6100,\"open\" :762.8600,\"volume\"
115
+ :1600 } \n, { \"Timestamp\" :1480086432,\"close\" :762.3800,\"high\" :762.8000,\"low\"
116
+ :762.3600,\"open\" :762.6800,\"volume\" :1900 } \n, { \"Timestamp\" :1480086484,\"close\"
117
+ :762.0000,\"high\" :762.2200,\"low\" :762.0000,\"open\" :762.2200,\"volume\"
118
+ :3000 } \n, { \"Timestamp\" :1480086599,\"close\" :761.6500,\"high\" :762.1800,\"low\"
119
+ :761.2300,\"open\" :762.1800,\"volume\" :6000 } \n, { \"Timestamp\" :1480086600,\"close\"
120
+ :762.2700,\"high\" :762.2700,\"low\" :761.3000,\"open\" :761.3000,\"volume\"
121
+ :2800 } \n, { \"Timestamp\" :1480086666,\"close\" :762.4700,\"high\" :762.4700,\"low\"
122
+ :762.0050,\"open\" :762.0050,\"volume\" :1100 } \n, { \"Timestamp\" :1480086748,\"close\"
123
+ :762.5000,\"high\" :762.6300,\"low\" :762.5000,\"open\" :762.5000,\"volume\"
124
+ :1100 } \n, { \"Timestamp\" :1480086799,\"close\" :762.4400,\"high\" :762.9700,\"low\"
125
+ :762.4400,\"open\" :762.8900,\"volume\" :3300 } \n, { \"Timestamp\" :1480086957,\"close\"
126
+ :762.5850,\"high\" :762.6100,\"low\" :762.2700,\"open\" :762.5500,\"volume\"
127
+ :5400 } \n, { \"Timestamp\" :1480086960,\"close\" :762.3000,\"high\" :762.8700,\"low\"
128
+ :762.2700,\"open\" :762.8700,\"volume\" :3300 } \n, { \"Timestamp\" :1480087032,\"close\"
129
+ :762.2800,\"high\" :762.3600,\"low\" :762.2800,\"open\" :762.3600,\"volume\"
130
+ :500 } \n, { \"Timestamp\" :1480087091,\"close\" :762.6700,\"high\" :762.6700,\"low\"
131
+ :762.3900,\"open\" :762.4000,\"volume\" :1400 } \n, { \"Timestamp\" :1480087149,\"close\"
132
+ :762.4850,\"high\" :762.5200,\"low\" :762.2500,\"open\" :762.5200,\"volume\"
133
+ :1300 } \n, { \"Timestamp\" :1480087213,\"close\" :762.4000,\"high\" :762.5500,\"low\"
134
+ :762.2600,\"open\" :762.2600,\"volume\" :2000 } \n, { \"Timestamp\" :1480087291,\"close\"
135
+ :762.2200,\"high\" :762.5050,\"low\" :762.2200,\"open\" :762.5050,\"volume\"
136
+ :1700 } \n, { \"Timestamp\" :1480087336,\"close\" :761.8800,\"high\" :762.1322,\"low\"
137
+ :761.8629,\"open\" :762.0200,\"volume\" :1300 } \n, { \"Timestamp\" :1480087383,\"close\"
138
+ :761.6600,\"high\" :761.9600,\"low\" :761.3400,\"open\" :761.8700,\"volume\"
139
+ :4300 } \n, { \"Timestamp\" :1480087444,\"close\" :761.6850,\"high\" :761.7300,\"low\"
140
+ :761.3700,\"open\" :761.7300,\"volume\" :700 } \n, { \"Timestamp\" :1480087518,\"close\"
141
+ :761.6650,\"high\" :761.6650,\"low\" :761.6650,\"open\" :761.6650,\"volume\"
142
+ :200 } \n, { \"Timestamp\" :1480087612,\"close\" :761.7616,\"high\" :761.7616,\"low\"
143
+ :761.7616,\"open\" :761.7616,\"volume\" :100 } \n, { \"Timestamp\" :1480087631,\"close\"
144
+ :761.3800,\"high\" :761.5000,\"low\" :761.3800,\"open\" :761.5000,\"volume\"
145
+ :700 } \n, { \"Timestamp\" :1480087682,\"close\" :762.0400,\"high\" :762.0400,\"low\"
146
+ :761.5500,\"open\" :761.7900,\"volume\" :3700 } \n, { \"Timestamp\" :1480087770,\"close\"
147
+ :762.0600,\"high\" :762.0600,\"low\" :761.9200,\"open\" :761.9600,\"volume\"
148
+ :300 } \n, { \"Timestamp\" :1480087808,\"close\" :762.3100,\"high\" :762.4500,\"low\"
149
+ :762.3100,\"open\" :762.3900,\"volume\" :1400 } \n, { \"Timestamp\" :1480087910,\"close\"
150
+ :762.4200,\"high\" :762.4200,\"low\" :762.4200,\"open\" :762.4200,\"volume\"
151
+ :200 } \n, { \"Timestamp\" :1480087959,\"close\" :762.1000,\"high\" :762.1400,\"low\"
152
+ :762.1000,\"open\" :762.1200,\"volume\" :400 } \n, { \"Timestamp\" :1480087985,\"close\"
153
+ :762.2650,\"high\" :762.2650,\"low\" :762.2650,\"open\" :762.2650,\"volume\"
154
+ :300 } \n, { \"Timestamp\" :1480088055,\"close\" :762.4100,\"high\" :762.4100,\"low\"
155
+ :762.0500,\"open\" :762.3000,\"volume\" :1900 } \n, { \"Timestamp\" :1480088104,\"close\"
156
+ :762.3600,\"high\" :762.4000,\"low\" :762.2300,\"open\" :762.2300,\"volume\"
157
+ :800 } \n, { \"Timestamp\" :1480088192,\"close\" :762.4800,\"high\" :762.4800,\"low\"
158
+ :762.1700,\"open\" :762.1700,\"volume\" :800 } \n, { \"Timestamp\" :1480088274,\"close\"
159
+ :762.5052,\"high\" :762.6800,\"low\" :762.3100,\"open\" :762.4650,\"volume\"
160
+ :1900 } \n, { \"Timestamp\" :1480088282,\"close\" :762.3700,\"high\" :762.6480,\"low\"
161
+ :762.2700,\"open\" :762.6480,\"volume\" :2300 } \n, { \"Timestamp\" :1480088367,\"close\"
162
+ :762.5591,\"high\" :762.5591,\"low\" :762.3803,\"open\" :762.3803,\"volume\"
163
+ :2000 } \n, { \"Timestamp\" :1480088416,\"close\" :763.0008,\"high\" :763.1700,\"low\"
164
+ :762.7600,\"open\" :762.7600,\"volume\" :3600 } \n, { \"Timestamp\" :1480088476,\"close\"
165
+ :763.0000,\"high\" :763.2000,\"low\" :762.9700,\"open\" :763.0000,\"volume\"
166
+ :2000 } \n, { \"Timestamp\" :1480088562,\"close\" :763.0400,\"high\" :763.1600,\"low\"
167
+ :763.0400,\"open\" :763.1600,\"volume\" :700 } \n, { \"Timestamp\" :1480088596,\"close\"
168
+ :763.1000,\"high\" :763.1000,\"low\" :762.7800,\"open\" :762.9300,\"volume\"
169
+ :3300 } \n, { \"Timestamp\" :1480088684,\"close\" :762.8100,\"high\" :762.8200,\"low\"
170
+ :762.8100,\"open\" :762.8200,\"volume\" :200 } \n, { \"Timestamp\" :1480088721,\"close\"
171
+ :762.9900,\"high\" :762.9900,\"low\" :762.7418,\"open\" :762.7900,\"volume\"
172
+ :1500 } \n, { \"Timestamp\" :1480088832,\"close\" :762.9650,\"high\" :762.9956,\"low\"
173
+ :762.9650,\"open\" :762.9956,\"volume\" :200 } \n, { \"Timestamp\" :1480088882,\"close\"
174
+ :762.7400,\"high\" :763.0900,\"low\" :762.7400,\"open\" :763.0500,\"volume\"
175
+ :1900 } \n, { \"Timestamp\" :1480088984,\"close\" :763.0100,\"high\" :763.1000,\"low\"
176
+ :762.8500,\"open\" :762.8500,\"volume\" :1600 } \n, { \"Timestamp\" :1480089011,\"close\"
177
+ :762.9600,\"high\" :763.0322,\"low\" :762.9600,\"open\" :763.0322,\"volume\"
178
+ :800 } \n, { \"Timestamp\" :1480089095,\"close\" :762.6450,\"high\" :762.8600,\"low\"
179
+ :762.5350,\"open\" :762.8600,\"volume\" :2500 } \n, { \"Timestamp\" :1480089131,\"close\"
180
+ :762.3000,\"high\" :762.7358,\"low\" :762.3000,\"open\" :762.7358,\"volume\"
181
+ :600 } \n, { \"Timestamp\" :1480089190,\"close\" :762.4993,\"high\" :762.6800,\"low\"
182
+ :762.0400,\"open\" :762.0400,\"volume\" :1500 } \n, { \"Timestamp\" :1480089276,\"close\"
183
+ :762.0000,\"high\" :762.2400,\"low\" :762.0000,\"open\" :762.2400,\"volume\"
184
+ :1300 } \n, { \"Timestamp\" :1480089305,\"close\" :762.1800,\"high\" :762.4550,\"low\"
185
+ :762.1300,\"open\" :762.1300,\"volume\" :6200 } \n, { \"Timestamp\" :1480089380,\"close\"
186
+ :762.3700,\"high\" :762.4400,\"low\" :762.2110,\"open\" :762.2400,\"volume\"
187
+ :1500 } \n, { \"Timestamp\" :1480089469,\"close\" :762.3600,\"high\" :762.3600,\"low\"
188
+ :762.3600,\"open\" :762.3600,\"volume\" :100 } \n, { \"Timestamp\" :1480089480,\"close\"
189
+ :762.3550,\"high\" :762.3550,\"low\" :762.3550,\"open\" :762.3550,\"volume\"
190
+ :400 } \n, { \"Timestamp\" :1480089554,\"close\" :762.4255,\"high\" :762.4255,\"low\"
191
+ :762.4255,\"open\" :762.4255,\"volume\" :700 } \n, { \"Timestamp\" :1480089607,\"close\"
192
+ :762.8800,\"high\" :762.8800,\"low\" :762.2200,\"open\" :762.2200,\"volume\"
193
+ :1900 } \n, { \"Timestamp\" :1480089660,\"close\" :762.6600,\"high\" :762.8500,\"low\"
194
+ :762.5600,\"open\" :762.8500,\"volume\" :1300 } \n, { \"Timestamp\" :1480089758,\"close\"
195
+ :762.5438,\"high\" :762.7800,\"low\" :762.5438,\"open\" :762.7799,\"volume\"
196
+ :1600 } \n, { \"Timestamp\" :1480089780,\"close\" :762.9200,\"high\" :762.9200,\"low\"
197
+ :762.5800,\"open\" :762.6000,\"volume\" :3600 } \n, { \"Timestamp\" :1480089874,\"close\"
198
+ :762.8800,\"high\" :762.9100,\"low\" :762.5100,\"open\" :762.7700,\"volume\"
199
+ :1400 } \n, { \"Timestamp\" :1480089928,\"close\" :762.5000,\"high\" :762.8100,\"low\"
200
+ :762.4150,\"open\" :762.7800,\"volume\" :4000 } \n, { \"Timestamp\" :1480089966,\"close\"
201
+ :762.6100,\"high\" :762.8800,\"low\" :762.6100,\"open\" :762.7300,\"volume\"
202
+ :700 } \n, { \"Timestamp\" :1480090033,\"close\" :763.1000,\"high\" :763.2100,\"low\"
203
+ :762.9000,\"open\" :762.9000,\"volume\" :1200 } \n, { \"Timestamp\" :1480090119,\"close\"
204
+ :762.9500,\"high\" :763.1700,\"low\" :762.9400,\"open\" :763.0900,\"volume\"
205
+ :2600 } \n, { \"Timestamp\" :1480090257,\"close\" :762.9100,\"high\" :762.9100,\"low\"
206
+ :762.9100,\"open\" :762.9100,\"volume\" :100 } \n, { \"Timestamp\" :1480090260,\"close\"
207
+ :763.0198,\"high\" :763.1950,\"low\" :762.9900,\"open\" :762.9900,\"volume\"
208
+ :2000 } \n, { \"Timestamp\" :1480090326,\"close\" :762.9750,\"high\" :762.9750,\"low\"
209
+ :762.9750,\"open\" :762.9750,\"volume\" :200 } \n, { \"Timestamp\" :1480090395,\"close\"
210
+ :762.9500,\"high\" :762.9500,\"low\" :762.5500,\"open\" :762.8300,\"volume\"
211
+ :900 } \n, { \"Timestamp\" :1480090459,\"close\" :763.2600,\"high\" :763.2600,\"low\"
212
+ :762.6600,\"open\" :762.9400,\"volume\" :3100 } \n, { \"Timestamp\" :1480090533,\"close\"
213
+ :763.2350,\"high\" :763.3600,\"low\" :763.0900,\"open\" :763.0900,\"volume\"
214
+ :2100 } \n, { \"Timestamp\" :1480090571,\"close\" :763.4300,\"high\" :763.4300,\"low\"
215
+ :763.1325,\"open\" :763.1325,\"volume\" :2000 } \n, { \"Timestamp\" :1480090632,\"close\"
216
+ :763.1200,\"high\" :763.5000,\"low\" :763.1200,\"open\" :763.2100,\"volume\"
217
+ :4300 } \n, { \"Timestamp\" :1480090709,\"close\" :763.3400,\"high\" :763.3400,\"low\"
218
+ :763.3400,\"open\" :763.3400,\"volume\" :500 } \n, { \"Timestamp\" :1480090803,\"close\"
219
+ :763.0950,\"high\" :763.3800,\"low\" :763.0300,\"open\" :763.2050,\"volume\"
220
+ :1400 } \n, { \"Timestamp\" :1480090861,\"close\" :762.5700,\"high\" :762.9300,\"low\"
221
+ :762.5700,\"open\" :762.9000,\"volume\" :1000 } \n, { \"Timestamp\" :1480090948,\"close\"
222
+ :762.8100,\"high\" :762.8500,\"low\" :762.4200,\"open\" :762.4200,\"volume\"
223
+ :300 } \n, { \"Timestamp\" :1480090993,\"close\" :763.1000,\"high\" :763.1300,\"low\"
224
+ :762.7000,\"open\" :762.7000,\"volume\" :2900 } \n, { \"Timestamp\" :1480091062,\"close\"
225
+ :762.8400,\"high\" :763.0600,\"low\" :762.8400,\"open\" :762.9000,\"volume\"
226
+ :2200 } \n, { \"Timestamp\" :1480091124,\"close\" :762.8185,\"high\" :762.8185,\"low\"
227
+ :762.4800,\"open\" :762.7000,\"volume\" :1300 } \n, { \"Timestamp\" :1480091218,\"close\"
228
+ :762.4900,\"high\" :762.6800,\"low\" :762.4900,\"open\" :762.6600,\"volume\"
229
+ :3000 } \n, { \"Timestamp\" :1480091221,\"close\" :762.6013,\"high\" :762.9100,\"low\"
230
+ :762.5100,\"open\" :762.9100,\"volume\" :900 } \n, { \"Timestamp\" :1480091292,\"close\"
231
+ :762.9300,\"high\" :762.9300,\"low\" :762.7718,\"open\" :762.8000,\"volume\"
232
+ :1300 } \n, { \"Timestamp\" :1480091344,\"close\" :763.0000,\"high\" :763.0000,\"low\"
233
+ :762.9800,\"open\" :762.9800,\"volume\" :400 } \n, { \"Timestamp\" :1480091401,\"close\"
234
+ :762.9400,\"high\" :763.2300,\"low\" :762.8903,\"open\" :763.2300,\"volume\"
235
+ :700 } \n, { \"Timestamp\" :1480091467,\"close\" :763.0600,\"high\" :763.1200,\"low\"
236
+ :763.0000,\"open\" :763.0000,\"volume\" :600 } \n, { \"Timestamp\" :1480091525,\"close\"
237
+ :762.8600,\"high\" :763.2250,\"low\" :762.6250,\"open\" :763.2250,\"volume\"
238
+ :2700 } \n, { \"Timestamp\" :1480091584,\"close\" :763.2500,\"high\" :763.2500,\"low\"
239
+ :762.7900,\"open\" :762.7900,\"volume\" :1400 } \n, { \"Timestamp\" :1480091686,\"close\"
240
+ :763.3100,\"high\" :763.3500,\"low\" :763.3100,\"open\" :763.3500,\"volume\"
241
+ :200 } \n, { \"Timestamp\" :1480091700,\"close\" :763.2000,\"high\" :763.3500,\"low\"
242
+ :763.0700,\"open\" :763.2300,\"volume\" :2200 } \n, { \"Timestamp\" :1480091767,\"close\"
243
+ :762.1800,\"high\" :763.1200,\"low\" :762.1800,\"open\" :763.1200,\"volume\"
244
+ :4300 } \n, { \"Timestamp\" :1480091823,\"close\" :762.1600,\"high\" :762.2180,\"low\"
245
+ :761.8400,\"open\" :762.2180,\"volume\" :3400 } \n, { \"Timestamp\" :1480091899,\"close\"
246
+ :762.4400,\"high\" :762.4400,\"low\" :762.1900,\"open\" :762.1900,\"volume\"
247
+ :1200 } \n, { \"Timestamp\" :1480091952,\"close\" :762.7100,\"high\" :762.7100,\"low\"
248
+ :762.7100,\"open\" :762.7100,\"volume\" :400 } \n, { \"Timestamp\" :1480092001,\"close\"
249
+ :762.5100,\"high\" :762.6050,\"low\" :762.5100,\"open\" :762.5284,\"volume\"
250
+ :1200 } \n, { \"Timestamp\" :1480092111,\"close\" :762.7900,\"high\" :762.7900,\"low\"
251
+ :762.6800,\"open\" :762.6800,\"volume\" :1300 } \n, { \"Timestamp\" :1480092121,\"close\"
252
+ :762.7755,\"high\" :762.9900,\"low\" :762.7755,\"open\" :762.8000,\"volume\"
253
+ :1100 } \n, { \"Timestamp\" :1480092202,\"close\" :762.7400,\"high\" :762.7400,\"low\"
254
+ :762.7400,\"open\" :762.7400,\"volume\" :400 } \n, { \"Timestamp\" :1480092255,\"close\"
255
+ :762.9900,\"high\" :762.9900,\"low\" :762.7800,\"open\" :762.9700,\"volume\"
256
+ :1300 } \n, { \"Timestamp\" :1480092300,\"close\" :763.1100,\"high\" :763.3500,\"low\"
257
+ :762.9100,\"open\" :763.0000,\"volume\" :3100 } \n, { \"Timestamp\" :1480092362,\"close\"
258
+ :762.5900,\"high\" :762.9500,\"low\" :762.5900,\"open\" :762.9500,\"volume\"
259
+ :1700 } \n, { \"Timestamp\" :1480092421,\"close\" :762.6600,\"high\" :762.6600,\"low\"
260
+ :762.6300,\"open\" :762.6300,\"volume\" :600 } \n, { \"Timestamp\" :1480092483,\"close\"
261
+ :762.5400,\"high\" :762.5400,\"low\" :762.5300,\"open\" :762.5300,\"volume\"
262
+ :500 } \n, { \"Timestamp\" :1480092540,\"close\" :762.6400,\"high\" :762.6400,\"low\"
263
+ :762.4633,\"open\" :762.4633,\"volume\" :1000 } \n, { \"Timestamp\" :1480092616,\"close\"
264
+ :762.6465,\"high\" :762.6465,\"low\" :762.6465,\"open\" :762.6465,\"volume\"
265
+ :300 } \n, { \"Timestamp\" :1480092674,\"close\" :762.5400,\"high\" :762.5400,\"low\"
266
+ :762.2900,\"open\" :762.3200,\"volume\" :700 } \n, { \"Timestamp\" :1480092735,\"close\"
267
+ :762.2350,\"high\" :762.4900,\"low\" :762.2350,\"open\" :762.4200,\"volume\"
268
+ :1200 } \n, { \"Timestamp\" :1480092796,\"close\" :762.1544,\"high\" :762.2907,\"low\"
269
+ :762.0200,\"open\" :762.2907,\"volume\" :1800 } \n, { \"Timestamp\" :1480092881,\"close\"
270
+ :762.0000,\"high\" :762.0300,\"low\" :762.0000,\"open\" :762.0300,\"volume\"
271
+ :800 } \n, { \"Timestamp\" :1480092915,\"close\" :762.0900,\"high\" :762.0900,\"low\"
272
+ :761.9500,\"open\" :761.9850,\"volume\" :1300 } \n, { \"Timestamp\" :1480092960,\"close\"
273
+ :762.2300,\"high\" :762.2300,\"low\" :761.9976,\"open\" :761.9976,\"volume\"
274
+ :1400 } \n, { \"Timestamp\" :1480093065,\"close\" :762.1000,\"high\" :762.1000,\"low\"
275
+ :762.1000,\"open\" :762.1000,\"volume\" :500 } \n, { \"Timestamp\" :1480093128,\"close\"
276
+ :762.1899,\"high\" :762.1899,\"low\" :762.1899,\"open\" :762.1899,\"volume\"
277
+ :100 } \n, { \"Timestamp\" :1480093141,\"close\" :762.1100,\"high\" :762.1800,\"low\"
278
+ :762.0800,\"open\" :762.0800,\"volume\" :600 } \n, { \"Timestamp\" :1480093226,\"close\"
279
+ :762.0700,\"high\" :762.1700,\"low\" :762.0700,\"open\" :762.1600,\"volume\"
280
+ :800 } \n, { \"Timestamp\" :1480093296,\"close\" :761.9200,\"high\" :762.0900,\"low\"
281
+ :761.9200,\"open\" :762.0750,\"volume\" :1300 } \n, { \"Timestamp\" :1480093330,\"close\"
282
+ :761.8900,\"high\" :762.1200,\"low\" :761.8900,\"open\" :761.9500,\"volume\"
283
+ :1500 } \n, { \"Timestamp\" :1480093384,\"close\" :762.0500,\"high\" :762.1700,\"low\"
284
+ :761.9800,\"open\" :762.1700,\"volume\" :700 } \n, { \"Timestamp\" :1480093459,\"close\"
285
+ :761.7000,\"high\" :762.0500,\"low\" :761.7000,\"open\" :761.9350,\"volume\"
286
+ :1900 } \n, { \"Timestamp\" :1480093522,\"close\" :761.4435,\"high\" :761.5700,\"low\"
287
+ :761.4435,\"open\" :761.4600,\"volume\" :1300 } \n, { \"Timestamp\" :1480093611,\"close\"
288
+ :761.4300,\"high\" :761.4300,\"low\" :761.4300,\"open\" :761.4300,\"volume\"
289
+ :200 } \n, { \"Timestamp\" :1480093639,\"close\" :761.1000,\"high\" :761.2735,\"low\"
290
+ :761.1000,\"open\" :761.2640,\"volume\" :1600 } \n, { \"Timestamp\" :1480093686,\"close\"
291
+ :761.3800,\"high\" :761.3800,\"low\" :761.1000,\"open\" :761.1500,\"volume\"
292
+ :2900 } \n, { \"Timestamp\" :1480093754,\"close\" :761.2700,\"high\" :761.2700,\"low\"
293
+ :761.2261,\"open\" :761.2261,\"volume\" :400 } \n, { \"Timestamp\" :1480093814,\"close\"
294
+ :761.2700,\"high\" :761.4600,\"low\" :761.1100,\"open\" :761.4100,\"volume\"
295
+ :2400 } \n, { \"Timestamp\" :1480093874,\"close\" :760.6900,\"high\" :761.1200,\"low\"
296
+ :760.6900,\"open\" :761.1100,\"volume\" :4000 } \n, { \"Timestamp\" :1480093941,\"close\"
297
+ :760.6900,\"high\" :760.7500,\"low\" :760.6900,\"open\" :760.7500,\"volume\"
298
+ :600 } \n, { \"Timestamp\" :1480093980,\"close\" :761.1200,\"high\" :761.1200,\"low\"
299
+ :760.7500,\"open\" :760.7500,\"volume\" :2200 } \n, { \"Timestamp\" :1480094052,\"close\"
300
+ :761.1300,\"high\" :761.1300,\"low\" :761.0060,\"open\" :761.0060,\"volume\"
301
+ :1700 } \n, { \"Timestamp\" :1480094114,\"close\" :760.9900,\"high\" :761.1800,\"low\"
302
+ :760.9900,\"open\" :761.1600,\"volume\" :1200 } \n, { \"Timestamp\" :1480094166,\"close\"
303
+ :760.9500,\"high\" :760.9800,\"low\" :760.6100,\"open\" :760.8700,\"volume\"
304
+ :2700 } \n, { \"Timestamp\" :1480094228,\"close\" :760.8700,\"high\" :761.1100,\"low\"
305
+ :760.8700,\"open\" :761.0400,\"volume\" :1200 } \n, { \"Timestamp\" :1480094281,\"close\"
306
+ :760.7900,\"high\" :761.0200,\"low\" :760.7900,\"open\" :761.0200,\"volume\"
307
+ :900 } \n, { \"Timestamp\" :1480094399,\"close\" :760.8500,\"high\" :760.9050,\"low\"
308
+ :760.8200,\"open\" :760.8797,\"volume\" :500 } \n, { \"Timestamp\" :1480094401,\"close\"
309
+ :761.3500,\"high\" :761.3500,\"low\" :760.9300,\"open\" :760.9600,\"volume\"
310
+ :2900 } \n, { \"Timestamp\" :1480094460,\"close\" :761.2350,\"high\" :761.2350,\"low\"
311
+ :761.2350,\"open\" :761.2350,\"volume\" :100 } \n, { \"Timestamp\" :1480094547,\"close\"
312
+ :761.1000,\"high\" :761.2625,\"low\" :761.1000,\"open\" :761.2625,\"volume\"
313
+ :1400 } \n, { \"Timestamp\" :1480094589,\"close\" :760.9800,\"high\" :760.9800,\"low\"
314
+ :760.8950,\"open\" :760.9600,\"volume\" :1500 } \n, { \"Timestamp\" :1480094641,\"close\"
315
+ :761.0019,\"high\" :761.0900,\"low\" :760.8300,\"open\" :760.8300,\"volume\"
316
+ :900 } \n, { \"Timestamp\" :1480094729,\"close\" :761.1600,\"high\" :761.1600,\"low\"
317
+ :761.0000,\"open\" :761.0000,\"volume\" :1000 } \n, { \"Timestamp\" :1480094782,\"close\"
318
+ :761.0000,\"high\" :761.0000,\"low\" :760.8900,\"open\" :760.9800,\"volume\"
319
+ :1000 } \n, { \"Timestamp\" :1480094820,\"close\" :761.0300,\"high\" :761.0900,\"low\"
320
+ :761.0000,\"open\" :761.0500,\"volume\" :1600 } \n, { \"Timestamp\" :1480094900,\"close\"
321
+ :761.0200,\"high\" :761.0800,\"low\" :760.8776,\"open\" :761.0800,\"volume\"
322
+ :2400 } \n, { \"Timestamp\" :1480094963,\"close\" :761.0900,\"high\" :761.0900,\"low\"
323
+ :760.9000,\"open\" :761.0700,\"volume\" :3100 } \n, { \"Timestamp\" :1480095003,\"close\"
324
+ :761.2300,\"high\" :761.2300,\"low\" :761.0300,\"open\" :761.0300,\"volume\"
325
+ :2900 } \n, { \"Timestamp\" :1480095066,\"close\" :761.1700,\"high\" :761.2900,\"low\"
326
+ :761.1700,\"open\" :761.1800,\"volume\" :1800 } \n, { \"Timestamp\" :1480095120,\"close\"
327
+ :760.8960,\"high\" :761.1500,\"low\" :760.8960,\"open\" :761.1500,\"volume\"
328
+ :1100 } \n, { \"Timestamp\" :1480095182,\"close\" :760.6797,\"high\" :761.0900,\"low\"
329
+ :760.6600,\"open\" :761.0500,\"volume\" :1600 } \n, { \"Timestamp\" :1480095266,\"close\"
330
+ :760.9800,\"high\" :760.9800,\"low\" :760.8400,\"open\" :760.8400,\"volume\"
331
+ :1200 } \n, { \"Timestamp\" :1480095351,\"close\" :760.8350,\"high\" :761.0800,\"low\"
332
+ :760.8350,\"open\" :761.0800,\"volume\" :200 } \n, { \"Timestamp\" :1480095416,\"close\"
333
+ :760.9200,\"high\" :760.9600,\"low\" :760.7200,\"open\" :760.8700,\"volume\"
334
+ :2400 } \n, { \"Timestamp\" :1480095422,\"close\" :761.2900,\"high\" :761.2900,\"low\"
335
+ :760.7100,\"open\" :760.7400,\"volume\" :3800 } \n, { \"Timestamp\" :1480095515,\"close\"
336
+ :761.1600,\"high\" :761.1700,\"low\" :761.0100,\"open\" :761.1596,\"volume\"
337
+ :3500 } \n, { \"Timestamp\" :1480095585,\"close\" :760.9600,\"high\" :761.0450,\"low\"
338
+ :760.9600,\"open\" :760.9700,\"volume\" :700 } \n, { \"Timestamp\" :1480095612,\"close\"
339
+ :761.2700,\"high\" :761.2700,\"low\" :761.0456,\"open\" :761.0456,\"volume\"
340
+ :5800 } \n, { \"Timestamp\" :1480095660,\"close\" :761.0500,\"high\" :761.1660,\"low\"
341
+ :761.0500,\"open\" :761.1660,\"volume\" :900 } \n, { \"Timestamp\" :1480095738,\"close\"
342
+ :761.2700,\"high\" :761.2700,\"low\" :760.9900,\"open\" :760.9900,\"volume\"
343
+ :2700 } \n, { \"Timestamp\" :1480095782,\"close\" :761.5180,\"high\" :761.7000,\"low\"
344
+ :761.2800,\"open\" :761.2900,\"volume\" :2800 } \n, { \"Timestamp\" :1480095843,\"close\"
345
+ :761.7300,\"high\" :761.8500,\"low\" :761.6025,\"open\" :761.6025,\"volume\"
346
+ :2300 } \n, { \"Timestamp\" :1480095901,\"close\" :761.6200,\"high\" :761.9100,\"low\"
347
+ :761.6200,\"open\" :761.7296,\"volume\" :2000 } \n, { \"Timestamp\" :1480095979,\"close\"
348
+ :761.7500,\"high\" :761.8300,\"low\" :761.5000,\"open\" :761.5900,\"volume\"
349
+ :7000 } \n, { \"Timestamp\" :1480096025,\"close\" :761.9750,\"high\" :762.0900,\"low\"
350
+ :761.8300,\"open\" :761.8300,\"volume\" :2100 } \n, { \"Timestamp\" :1480096099,\"close\"
351
+ :762.3300,\"high\" :762.3766,\"low\" :762.1000,\"open\" :762.1000,\"volume\"
352
+ :2400 } \n, { \"Timestamp\" :1480096161,\"close\" :762.4800,\"high\" :762.5400,\"low\"
353
+ :762.2800,\"open\" :762.4100,\"volume\" :4200 } \n, { \"Timestamp\" :1480096200,\"close\"
354
+ :762.6989,\"high\" :762.8800,\"low\" :762.5000,\"open\" :762.6000,\"volume\"
355
+ :6600 } \n, { \"Timestamp\" :1480096260,\"close\" :762.6500,\"high\" :762.8900,\"low\"
356
+ :762.4900,\"open\" :762.8900,\"volume\" :6700 } \n, { \"Timestamp\" :1480096321,\"close\"
357
+ :762.8400,\"high\" :762.9400,\"low\" :762.5600,\"open\" :762.7300,\"volume\"
358
+ :2700 } \n, { \"Timestamp\" :1480096381,\"close\" :762.8100,\"high\" :762.9600,\"low\"
359
+ :762.7200,\"open\" :762.7200,\"volume\" :3700 } \n, { \"Timestamp\" :1480096444,\"close\"
360
+ :762.7500,\"high\" :762.9100,\"low\" :762.6700,\"open\" :762.8336,\"volume\"
361
+ :5300 } \n, { \"Timestamp\" :1480096500,\"close\" :762.8100,\"high\" :762.8400,\"low\"
362
+ :762.6900,\"open\" :762.8000,\"volume\" :5600 } \n, { \"Timestamp\" :1480096560,\"close\"
363
+ :762.4000,\"high\" :762.8300,\"low\" :762.2300,\"open\" :762.7900,\"volume\"
364
+ :5100 } \n, { \"Timestamp\" :1480096625,\"close\" :762.4800,\"high\" :762.5000,\"low\"
365
+ :762.2100,\"open\" :762.3400,\"volume\" :4100 } \n, { \"Timestamp\" :1480096686,\"close\"
366
+ :761.8900,\"high\" :762.4800,\"low\" :761.8900,\"open\" :762.4700,\"volume\"
367
+ :4300 } \n, { \"Timestamp\" :1480096740,\"close\" :761.2000,\"high\" :762.0900,\"low\"
368
+ :761.0000,\"open\" :762.0050,\"volume\" :24400 } \n, { \"Timestamp\" :1480096800,\"close\"
369
+ :761.6800,\"high\" :761.6800,\"low\" :761.6800,\"open\" :761.6800,\"volume\"
370
+ :70100 } \n\n]\n} )"
371
+ http_version:
372
+ recorded_at: Sun, 27 Nov 2016 05:13:28 GMT
373
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,50 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ module Yafa
5
+ class StockChart
6
+ YAHOO_CHART_API = 'http://chartapi.finance.yahoo.com/instrument/1.0/'\
7
+ 'yahoo_ticker/chartdata;type=quote;range=1d/json'.freeze
8
+ READ_TIMEOUT = 5
9
+ DATA_SOURCE = 'yahoo_chart_api'.freeze
10
+
11
+ def call(ticker)
12
+ get_bars_data(ticker)
13
+ end
14
+
15
+ private
16
+
17
+ def get_bars_data(ticker)
18
+ quote_data = call_api ticker
19
+ parse_quote quote_data
20
+ end
21
+
22
+ def call_api(ticker)
23
+ url = format_api_url ticker
24
+ response = perform_api_request url
25
+
26
+ response.read
27
+ end
28
+
29
+ def perform_api_request(url)
30
+ open(
31
+ url,
32
+ ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
33
+ read_timeout: READ_TIMEOUT
34
+ )
35
+ end
36
+
37
+ def format_api_url(yahoo_ticker)
38
+ YAHOO_CHART_API.sub('yahoo_ticker', yahoo_ticker)
39
+ end
40
+
41
+ def parse_quote(data)
42
+ json_string = data.split json_regex_match
43
+ JSON.parse json_string[1]
44
+ end
45
+
46
+ def json_regex_match
47
+ /\(|\)/
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,68 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ # inputs ["ticker1", "ticker2"], returns [{quote1_hash}, {quote2_hash}]
5
+ module Yafa
6
+ class StockQuotes
7
+ BATCHLIMIT_QUOTES = 400
8
+ READ_TIMEOUT = 10
9
+
10
+ YAHOO_API_START = 'https://query.yahooapis.com/'.freeze
11
+ YAHOO_API_QUERY = 'v1/public/yql?q=SELECT * FROM yahoo.finance.quotes'\
12
+ ' WHERE symbol IN (yahoo_tickers)'.freeze
13
+ YAHOO_API_END = '&format=json&diagnostics=true&env=store%3A%2F%2Fdatata'\
14
+ 'bles.org%2Falltableswithkeys&callback='.freeze
15
+
16
+ def call(tickers)
17
+ fetch_quotes_from_api tickers
18
+ end
19
+
20
+ private
21
+
22
+ def fetch_quotes_from_api(tickers)
23
+ formatted_tickers = format_tickers tickers
24
+ quote_data = call_api(formatted_tickers)
25
+
26
+ format_quote_data(quote_data)
27
+ end
28
+
29
+ def call_api(yahoo_tickers)
30
+ url = format_api_url yahoo_tickers
31
+ response = open(
32
+ url,
33
+ ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, read_timeout: READ_TIMEOUT
34
+ )
35
+
36
+ response.read
37
+ end
38
+
39
+ def format_tickers(tickers)
40
+ tickers.map { |x| "'" + x + "'" }.join(', ')
41
+ end
42
+
43
+ def format_api_url(yahoo_tickers)
44
+ yql_query_body = build_yql_query_body(yahoo_tickers)
45
+ [YAHOO_API_START, yql_query_body, YAHOO_API_END].join('')
46
+ end
47
+
48
+ def build_yql_query_body(yahoo_tickers)
49
+ url = YAHOO_API_QUERY.gsub('yahoo_tickers', yahoo_tickers)
50
+ URI.encode(url)
51
+ end
52
+
53
+ def format_quote_data(quote_data)
54
+ response_data = parse_quote_json(quote_data)
55
+ wrap(response_data)
56
+ end
57
+
58
+ def parse_quote_json(message)
59
+ response_data = JSON.parse(message)
60
+ response_data['query']['results']['quote']
61
+ end
62
+
63
+ def wrap(obj)
64
+ return obj if obj.class == Array
65
+ [obj]
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,3 @@
1
+ module Yafa
2
+ VERSION = '0.1.0'.freeze
3
+ end
data/lib/yafa.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'yafa/version'
2
+
3
+ require File.dirname(__FILE__) + '/yafa/stock_quotes'
4
+ require File.dirname(__FILE__) + '/yafa/stock_chart'
5
+
6
+ module Yafa
7
+ # Your code goes here...
8
+ end
data/yafa.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'yafa/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'yafa'
8
+ spec.version = Yafa::VERSION
9
+ spec.authors = ['Andrew Klotz']
10
+ spec.email = ['agc.klotz@gmail.com']
11
+
12
+ spec.summary = 'yahoo finance api'
13
+ spec.description = 'wrapper for yahoo finance stock quotes and chart data'
14
+ spec.homepage = ''
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.13'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'minitest', '~> 5.0'
27
+ spec.add_development_dependency 'vcr', '~> 3.0'
28
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yafa
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Klotz
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-11-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: wrapper for yahoo finance stock quotes and chart data
70
+ email:
71
+ - agc.klotz@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - ".travis.yml"
79
+ - CODE_OF_CONDUCT.md
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - fixtures/vcr_cassettes/yahoo_finance_api.yml
87
+ - fixtures/vcr_cassettes/yahoo_finance_chart_api.yml
88
+ - lib/yafa.rb
89
+ - lib/yafa/stock_chart.rb
90
+ - lib/yafa/stock_quotes.rb
91
+ - lib/yafa/version.rb
92
+ - yafa.gemspec
93
+ homepage: ''
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.6.8
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: yahoo finance api
117
+ test_files: []
118
+ has_rdoc: