Skip to content

bcarreno/yahoo_quote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yahoo_quote

Easy interaction with Yahoo Finance API

Installation

gem install yahoo_quote

Usage

require 'yahoo_quote'
quote = YahooQuote::Quote.new('AAPL', ['Name', 'Last Trade (Price Only)', 'P/E Ratio'])
quote.valid?
# => true
quote.data['Name']
# => "Apple Inc."
quote.data['Last Trade (Price Only)']
# => 502.12
quote.data['P/E Ratio']
# => 14.29
quote = YahooQuote::Quote.new('ECOMMERCE', ['Name', 'Last Trade (Price Only)', 'P/E Ratio'])
quote.valid?
# => false

To get list of supported fields:

puts quote.field_mappings.keys

Configuration

Specify a directory to keep a simple file-based cache:

YahooQuote::Configuration.cache_dir = "/tmp"

Credits

Thanks to danchoi for providing the initial code and encouraging me to extend it and make the gem.

About

Easy interaction with Yahoo Finance API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages