README.md in iex-ruby-client-0.2.0 vs README.md in iex-ruby-client-0.3.0

- old
+ new

@@ -16,10 +16,20 @@ Run `bundle install`. ## Usage +### Get a Single Price + +Fetches a single number, being the IEX real time price, the 15 minute delayed market price, or the previous close price. + +```ruby +IEX::Resources::Price.get('MSFT') # 93.78 +``` + +See [#price](https://iextrading.com/developer/docs/#price) for detailed documentation. + ### Get a Quote Fetches a single stock quote. ```ruby @@ -43,9 +53,66 @@ company.ceo # 'Satya Nadella' company.company_name # 'Microsoft Corporation' ``` See [#company](https://iextrading.com/developer/docs/#company) for detailed documentation or [company.rb](lib/iex/resources/company.rb) for returned fields. + +### Get Recent News + +Fetches news for a symbol. + +```ruby +news = IEX::Resources::News.get('MSFT') + +news.size # 10 + +latest = news.first +latest.headline # 'Smartsheet files for $100M IPO with growing losses' +latest.url # 'https://...' +``` + +Use `market` to get market-wide news. + +```ruby +news = IEX::Resources::News.get(:market) +``` + +Retrieve a range between 1 and 50. + +```ruby +news = IEX::Resources::News.get('MSFT', 5) +``` + +See [#news](https://iextrading.com/developer/docs/#news) for detailed documentation or [news.rb](lib/iex/resources/news.rb) for returned fields. + +### Get Chart + +Fetches charts for a symbol. + +```ruby +chart = IEX::Resources::Chart.get('MSFT') + +chart.size # 38510 + +first = chart.first +first.label # '9:30 AM' +first.high # 94.97 +``` + +You can specify a chart range and additional options. + +```ruby +# 1d or 1m data depending on the day or week and time of day +IEX::Resources::Chart.get('MSFT', 'dynamic') + +# a specific date +IEX::Resources::Chart.get('MSFT', Date.new(2018, 3, 26)) + +# every n-th data point +IEX::Resources::Chart.get('MSFT', '1d', chart_interval: 10) +``` + +See [#chart](https://iextrading.com/developer/docs/#chart) for detailed documentation or [chart/default](lib/iex/resources/chart/default.rb) and [chart/one_day](lib/iex/resources/chart/one_day.rb) for returned fields. ## Errors ### SymbolNotFound