{"id":15512954,"url":"https://github.com/dblock/google-finance-ruby-client","last_synced_at":"2025-10-12T09:31:59.507Z","repository":{"id":56874926,"uuid":"112856870","full_name":"dblock/google-finance-ruby-client","owner":"dblock","description":"Google Finance web API ruby client with support for retrieving stock quotes and historical prices.","archived":true,"fork":false,"pushed_at":"2020-10-11T01:35:47.000Z","size":209,"stargazers_count":9,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T00:59:07.185Z","etag":null,"topics":["google","google-finance","ruby","stock-prices","stock-quotes","stocks","yahoo-finance","yahoo-finance-api"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dblock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-02T16:15:50.000Z","updated_at":"2024-08-15T18:50:35.000Z","dependencies_parsed_at":"2022-08-20T10:11:16.264Z","dependency_job_id":null,"html_url":"https://github.com/dblock/google-finance-ruby-client","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fgoogle-finance-ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fgoogle-finance-ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fgoogle-finance-ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fgoogle-finance-ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dblock","download_url":"https://codeload.github.com/dblock/google-finance-ruby-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236196700,"owners_count":19110760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-finance","ruby","stock-prices","stock-quotes","stocks","yahoo-finance","yahoo-finance-api"],"created_at":"2024-10-02T09:53:57.043Z","updated_at":"2025-10-12T09:31:54.142Z","avatar_url":"https://github.com/dblock.png","language":"Ruby","readme":"Google Finance Ruby Client\n==========================\n\n[![Gem Version](https://badge.fury.io/rb/google-finance-ruby-client.svg)](https://badge.fury.io/rb/google-finance-ruby-client)\n[![Build Status](https://travis-ci.org/dblock/google-finance-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/google-finance-ruby-client)\n\nA Ruby client for the undocumented Google Finance web API. Supports stock quotes and historical prices. Attempts to make sense of, coerce and structure the data.\n\n\u003ca href='http://finance.google.com/finance'\u003e![](google-finance.png)\u003c/a\u003e\n\n_IANAL, but do note that if your application is for public consumption, using the Google Finance API [seems to be against Google's terms of service](https://groups.google.com/forum/#!msg/google-finance-apis/O8fjsgnamHE/-ZKSjif4yDIJ)._\n\n## Installation\n\nAdd to Gemfile.\n\n```\ngem 'google-finance-ruby-client'\n```\n\nRun `bundle install`.\n\n## Usage\n\n### Get a Quote\n\nFetches stock quotes via [https://finance.google.com/finance](lib/google-finance/api/index.rb).\n\n```ruby\nquote = GoogleFinance::Quote.get('MSFT')\n\nquote.last_trade_price # 84.26\nquote.change # 0.09\nquote.change_in_percent # 0.11\nquote.change_in_percent_s # \"+0.11%\"\n```\n\nSee [quote.rb](lib/google-finance/quote.rb) for returned fields.\n\nIf a symbol cannot be found a [GoogleFinance::Errors::SymbolNotFound](lib/google-finance/errors/symbol_not_found_error.rb) is raised.\n\n### Get Multiple Quotes\n\nSearches for a ticker or tickers, then fetches each quote.\n\n```ruby\nquotes = GoogleFinance::Quotes.search('MSFT', 'AB')\n\nquotes.size # 2\n\nquotes[0] # GoogleFinance::Quote.get('MSFT')\nquotes[1] # GoogleFinance::Quote.get('AB')\n```\n\nIf one of the symbols cannot be found a [GoogleFinance::Errors::SymbolsNotFound](lib/google-finance/errors/symbols_not_found_error.rb) is raised.\n\n### Get Price History\n\n#### Daily Price History\n\nFetches price history for a ticker via [https://finance.google.com/finance/historical](lib/google-finance/api/historical.rb).\n\n```ruby\nprices = GoogleFinance::History.get('MSFT')\n\n# prices for the last year of open markets\nprices.count # 251\n\n# prices appear in reverse chronological order\nprices.first # #\u003cGoogleFinance::Price close=85.54 date=#\u003cDate: 2017-12-29\u003e high=86.05 low=85.5 open=85.63 volume=18717406\u003e\nprices[1] # #\u003cGoogleFinance::Price close=85.72 date=#\u003cDate: 2017-12-28\u003e high=85.93 low=85.55 open=85.9 volume=10594344\u003e\n ```\n\nIf a symbol cannot be found a [GoogleFinance::Errors::SymbolNotFound](lib/google-finance/errors/symbol_not_found_error.rb) is raised.\n\nThe following options are supported.\n\n* `start_date`: date to start retrieving from\n* `end_date`: date to retrieve data up to\n\nRetrieve prices in the first trading week of 2016. No trading on the week-end or during holidays.\n\n```ruby\nprices = GoogleFinance::History.get('MSFT', start_date: Date.parse('2016-01-03'), end_date: Date.parse('2016-01-10'))\n\nprices.count # 5\nprices.first # #\u003cGoogleFinance::Price close=52.33 date=#\u003cDate: 2016-01-08\u003e high=53.28 low=52.15 open=52.37 volume=48753969\u003e\n```\n\n#### Intraday Price History\n\nFetches price history, including at intraday intervals, for a ticker via [https://finance.google.com/finance/getprices](lib/google-finance/api/get_prices.rb).\n\n```ruby\nprices = GoogleFinance::Prices.get('MSFT')\n\nprices.exchange # NASDAQ\n\n# prices for the last month of open markets\nprices.count # 21\n\n# prices appear in reverse chronological order\nprices.last #\u003cGoogleFinance::Price close=85.71 date=2017-12-27 16:00:00 -0500 high=85.98 low=85.215 open=85.65 volume=14678025\u003e\nprices[-2] #\u003cGoogleFinance::Price close=85.4 date=2017-12-26 16:00:00 -0500 high=85.5346 low=85.03 open=85.31 volume=9891237\u003e\n```\n\nSee [price.rb](lib/google-finance/price.rb) for returned fields.\n\nIf a symbol cannot be found a [GoogleFinance::Errors::SymbolNotFound](lib/google-finance/errors/symbol_not_found_error.rb) is raised.\n\nThe following options are supported.\n\n* `exchange`: stock exchange symbol on which stock is traded, eg. `NASDAQ`\n* `interval`: interval size in seconds\n* `period`: period, a number followed by `d` (days) or `Y` (years)\n* `fields`: array of data to return\n  * `date`: timestamp\n  * `open`: price at market open\n  * `close`: price at market close\n  * `volume`: volume\n  * `low`: low price\n  * `high`: high price\n\nRetrieve intraday prices in 1 hour intervals.\n\n```ruby\nprices = GoogleFinance::Prices.get('GOOG', interval: 60 * 60, period: '1d')\n\nprices.count # 7\n\nprices # array of GoogleFinance::Price, date=2017-12-29 10:00AM, 11:00AM, etc.\n```\n\nRetrieve only prices at market close.\n\n```ruby\nprices = GoogleFinance::Prices.get('GOOG', fields: [:days, :close])\n\nprices.first # #\u003cGoogleFinance::Price close=1047.41 date=2017-11-28 16:00:00 -0500\u003e\n```\n\n## Contributing\n\nSee [CONTRIBUTING](CONTRIBUTING.md).\n\n## Copyright and License\n\nCopyright (c) 2017, [Daniel Doubrovkine](https://twitter.com/dblockdotorg) and [Contributors](CHANGELOG.md).\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fgoogle-finance-ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdblock%2Fgoogle-finance-ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fgoogle-finance-ruby-client/lists"}