github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

nas / yahoo_stock

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (3)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (3)
    • version=1.0.4
    • version=1.0.3
    • version=1.0.2
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Provides an interface to yahoo finance to get stock related data — Read more

  cancel

http://wiki.github.com/nas/yahoo_stock

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Add rdoc info in README 
nas (author)
Mon Nov 09 18:43:56 -0800 2009
commit  777f45701ac48c7ffb6d79d4487c644fdd274bfa
tree    51bd63869fa794c7252966d41c27d389a3aaa142
parent  9e9b80594b43d603535ad6c09d7fee4a334733d0
yahoo_stock /
name age
history
message
file History.txt Loading commit data...
file Manifest.txt
file README.rdoc
file Rakefile
directory features/
directory lib/
directory spec/
file yahoo_stock.gemspec
README.rdoc

yahoo_stock

        * http://github.com/nas/yahoo_stock

DESCRIPTION:

Provides an interface to yahoo finance to get stock related data. For instance, latest trade related data, volume, 50 day moving average, market cap, etc, virtually any thing that yahoo finance provides.

If you don’t know the stock / scrip symbol of the company then you can find that out by using the YahooStock::ScripSymbol class. The methods are mentioned in the Usage section below. For instance, YHOO for yahoo, GOOG for google, etc. The kind of parameters to be passed can be found after initializing the YahooStock::Quote object and passing valid_parameters message to the quote object, example is given below in the USAGE section.

For details : nasir.wordpress.com/2009/10/28/ruby-gem-for-finance-data

INSTALL:

        gem sources -a http://gemcutter.org

        sudo gem install nas-yahoo_stock

USAGE:

require ‘rubygems’

require ‘yahoo_stock’

  • Initialize quote object

quote = YahooStock::Quote.new(:stock_symbols => [‘YHOO’, ‘GOOG’])

  • To view the valid parameters that can be passed

quote.valid_parameters

  • To view the current parameters used

quote.current_parameters

  • To view the current stock symbols used

quote.current_symbols

  • To add more stocks to the list

quote.add_symbols(‘MSFT’, ‘AAPL’)

  • To remove stocks from list

quote.remove_symbols(‘MSFT’, ‘AAPL’)

  • To find data for all stocks, this will give a string containing all values

quote.results

        to return an array instead of a string use:

        quote.results(:to_array).output

        to return a hash, use:

        quote.results(:to_hash).output

        to return xml, use:

        quote.results(:to_xml).output

        to store results in a file, use:

        quote.results.store('filename')
  • To find out the stock symbol for a company

symbol = YahooStock::ScripSymbol.new(‘Yahoo’)

  • To find all symbols for that company, this will give a string containing all values

symbol.results

        to return an array instead of a string use:

        symbol.results(:to_array).output

        to return a hash, use:

        symbol.results(:to_hash).output

        to return xml, use:

        quote.results(:to_xml).output

        to store results in a file, use:

        symbol.results.store('filename')
  • To find symbols for multiple companies

symbols = YahooStock::ScripSymbol.results(‘Yahoo’, ‘Company1’, ‘Company3’)

  • to get the result in a string

symbols.output

  • to store output in a file

symbols.store(‘filename’)

  • To find historical data for a stock

    history = YahooStock::History.new(:stock_symbols => ‘yhoo’, :start_date => Date.today-20, end_date => Date.today -2)

          to return an array instead of a string use:
    
          history.results(:to_array).output
    
          to return a hash, use:
    
          to return xml, use:
    
          quote.results(:to_xml).output
    
          history.results(:to_hash).output
    
          to store results in a file, use:
    
          history.results.store('filename')
    

Docs

rdoc.info/projects/nas/yahoo_stock

TESTS:

Tests are written using Rspec 1.2.2

To run all tests ‘rake spec’ from the root directory

LICENSE:

(The MIT License)

Copyright © 2009 Nasir Jamal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server