8000 GitHub - wofockham/stock_quote: A ruby gem that retrieves stock quotes from Google.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wofockham/stock_quote

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stock_quote

Real-time, stock data and historical pricing. Data provided for free by IEX.

Update

On March 17, 2018, Google Finance terminated public access to it's API. As a result, Version 2.0.0 of stock_quote now uses the IEX Trading API (iextrading.com). Although functionally similar, the results, and therefore attributes, had changed. Please update accordingly.

Installation

To install the 'stock_quote' ruby gem:

gem install stock_quote

Gem Configuration

To use the gem in your Rails Application, include it in your Gemfile:

gem "stock_quote", github: 'tyrauber/stock_quote', branch: 'iex'

StockQuote::Stock.quote(symbol)

Quote is the primary method, returning a StockQuote::Stock instance, including the following attributes (new in v2.0.0).

symbol, company_name, primary_exchange, sector, calculation_price, open, open_time, close, close_time, high, low, latest_price, latest_source, latest_time, latest_update, latest_volume, iex_realtime_price, iex_realtime_size, iex_last_updated, delayed_price, delayed_price_time, previous_close, change, change_percent, iex_market_percent, iex_volume, avg_total_volume, iex_bid_price, iex_bid_size, iex_ask_price, iex_ask_size, market_cap, pe_ratio, week52_high, week52_low, ytd_change, chart

You can get a current quote with the following syntax:

stock = StockQuote::Stock.quote("symbol")

Where symbol equals the company stock symbol you want a quote for. For example, "aapl" for Apple, Inc.

You may search for multiple stocks by separating symbols with a comma (or array). For example:

stocks = StockQuote::Stock.quote("aapl,tsla")

These queries will return a Stock object or an array of Stock objects which you may iterate through.

Note: You can receive a raw json hash response with the following syntax:

stocks = StockQuote::Stock.raw_quote("aapl,tsla")

The raw_ method is available on all supported methods.

Other Methods

The IEX API is quite extensive and well documented.

V2.0.0 of stock_quote mirrors the IEX API:

Batch allows you to batch requests. All methods in stock_quote use batch under-the-hood.

Batch follows the syntax:

StockQuote::Stock.batch(type, symbol, range)

Where type can be multiple of the above methods and symbol can be an array of company symbols.

Range can be:

5y, 2y, 1y, ytd, 6m, 3m, 1m, 1d, date, dynmaic

And are applied to chart method.

TBD

The following IEX methods are currently unsupported:

Special thanks to

IEX for making this api publicly available.

License

Copyright (c) 2017 Ty Rauber

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.

About

A ruby gem that retrieves stock quotes from Google.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%
0