iex-ruby-client 1.1.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/.env.sample +2 -0
  3. data/.github/FUNDING.yml +1 -0
  4. data/.rubocop_todo.yml +0 -8
  5. data/CHANGELOG.md +48 -10
  6. data/Dangerfile +2 -2
  7. data/Gemfile +3 -2
  8. data/README.md +260 -11
  9. data/RELEASING.md +2 -2
  10. data/iex-ruby-client.gemspec +2 -1
  11. data/lib/iex/api.rb +8 -1
  12. data/lib/iex/api/client.rb +15 -2
  13. data/lib/iex/api/config/client.rb +52 -0
  14. data/lib/iex/api/config/logger.rb +35 -0
  15. data/lib/iex/cloud/connection.rb +22 -19
  16. data/lib/iex/cloud/request.rb +1 -1
  17. data/lib/iex/cloud/response.rb +1 -1
  18. data/lib/iex/endpoints/advanced_stats.rb +11 -0
  19. data/lib/iex/endpoints/balance_sheet.rb +13 -0
  20. data/lib/iex/endpoints/cash_flow.rb +13 -0
  21. data/lib/iex/endpoints/chart.rb +1 -1
  22. data/lib/iex/endpoints/company.rb +1 -1
  23. data/lib/iex/endpoints/crypto.rb +1 -1
  24. data/lib/iex/endpoints/dividends.rb +1 -1
  25. data/lib/iex/endpoints/earnings.rb +1 -1
  26. data/lib/iex/endpoints/historial_prices.rb +30 -0
  27. data/lib/iex/endpoints/income.rb +1 -1
  28. data/lib/iex/endpoints/key_stats.rb +1 -1
  29. data/lib/iex/endpoints/largest_trades.rb +1 -1
  30. data/lib/iex/endpoints/logo.rb +1 -1
  31. data/lib/iex/endpoints/news.rb +1 -1
  32. data/lib/iex/endpoints/ohlc.rb +2 -2
  33. data/lib/iex/endpoints/price.rb +1 -1
  34. data/lib/iex/endpoints/quote.rb +1 -1
  35. data/lib/iex/endpoints/ref_data.rb +22 -0
  36. data/lib/iex/endpoints/sectors.rb +1 -1
  37. data/lib/iex/endpoints/stock_market.rb +11 -0
  38. data/lib/iex/resources.rb +6 -0
  39. data/lib/iex/resources/advanced_stats.rb +84 -0
  40. data/lib/iex/resources/balance_sheet.rb +60 -0
  41. data/lib/iex/resources/cash_flow.rb +43 -0
  42. data/lib/iex/resources/chart.rb +8 -13
  43. data/lib/iex/resources/historical_prices.rb +31 -0
  44. data/lib/iex/resources/income.rb +2 -0
  45. data/lib/iex/resources/key_stats.rb +1 -1
  46. data/lib/iex/resources/quote.rb +12 -2
  47. data/lib/iex/resources/resource.rb +12 -0
  48. data/lib/iex/resources/symbol.rb +10 -0
  49. data/lib/iex/resources/symbols.rb +19 -0
  50. data/lib/iex/version.rb +1 -1
  51. data/spec/fixtures/iex/advanced_stats/invalid.yml +50 -0
  52. data/spec/fixtures/iex/advanced_stats/msft.yml +57 -0
  53. data/spec/fixtures/iex/balance_sheet/invalid.yml +50 -0
  54. data/spec/fixtures/iex/balance_sheet/msft.yml +56 -0
  55. data/spec/fixtures/iex/cash_flow/invalid.yml +50 -0
  56. data/spec/fixtures/iex/cash_flow/msft.yml +56 -0
  57. data/spec/fixtures/iex/chart/1d.yml +440 -473
  58. data/spec/fixtures/iex/chart/20190306.yml +440 -473
  59. data/spec/fixtures/iex/chart/bad_option.yml +47 -81
  60. data/spec/fixtures/iex/chart/chartInterval.yml +89 -122
  61. data/spec/fixtures/iex/chart/dynamic/1m.yml +73 -107
  62. data/spec/fixtures/iex/chart/invalid.yml +47 -81
  63. data/spec/fixtures/iex/chart/msft.yml +74 -107
  64. data/spec/fixtures/iex/historical_prices/abcd.yml +56 -0
  65. data/spec/fixtures/iex/historical_prices/invalid.yml +50 -0
  66. data/spec/fixtures/iex/historical_prices/invalid_date.yml +50 -0
  67. data/spec/fixtures/iex/historical_prices/invalid_range.yml +47 -0
  68. data/spec/fixtures/iex/historical_prices/msft.yml +79 -0
  69. data/spec/fixtures/iex/historical_prices/msft_5d.yml +61 -0
  70. data/spec/fixtures/iex/historical_prices/msft_date_and_chart_by_day.yml +57 -0
  71. data/spec/fixtures/iex/historical_prices/msft_specific_date_trimmed.yml +445 -0
  72. data/spec/fixtures/iex/income/invalid.yml +47 -47
  73. data/spec/fixtures/iex/income/msft.yml +54 -51
  74. data/spec/fixtures/iex/income/nsrgy.yml +55 -0
  75. data/spec/fixtures/iex/ref-data/isin.yml +57 -0
  76. data/spec/fixtures/iex/ref-data/isin_mapped.yml +57 -0
  77. data/spec/fixtures/iex/ref-data/symbols.yml +9002 -0
  78. data/spec/fixtures/iex/ref-data/wrong_isin_mapped.yml +57 -0
  79. data/spec/fixtures/iex/stock_market/list_mostactive.yml +76 -0
  80. data/spec/iex/client_spec.rb +97 -14
  81. data/spec/iex/config/client_spec.rb +49 -0
  82. data/spec/iex/config/logger_spec.rb +46 -0
  83. data/spec/iex/endpoints/advanced_stats_spec.rb +110 -0
  84. data/spec/iex/endpoints/balance_sheet_spec.rb +80 -0
  85. data/spec/iex/endpoints/cash_flow_spec.rb +59 -0
  86. data/spec/iex/endpoints/chart_spec.rb +7 -7
  87. data/spec/iex/endpoints/historical_prices_spec.rb +206 -0
  88. data/spec/iex/endpoints/income_spec.rb +41 -30
  89. data/spec/iex/endpoints/key_stats_spec.rb +1 -0
  90. data/spec/iex/endpoints/quote_spec.rb +2 -0
  91. data/spec/iex/endpoints/ref_data_spec.rb +76 -0
  92. data/spec/iex/endpoints/stock_market_spec.rb +14 -0
  93. data/spec/iex/resources/resource_spec.rb +36 -0
  94. data/spec/spec_helper.rb +3 -2
  95. data/spec/support/vcr.rb +3 -0
  96. metadata +82 -14
  97. data/lib/iex/api/config.rb +0 -45
  98. data/spec/iex/config_spec.rb +0 -22
@@ -16,10 +16,10 @@ Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/
16
16
  Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
17
17
 
18
18
  ```
19
- ### 0.2.2 (7/10/2015)
19
+ ### 0.2.2 (2015/10/07)
20
20
  ```
21
21
 
22
- Remove the line with "Your contribution here.", since there will be no more contributions to this release.
22
+ Remove the line with "* Your contribution here.", since there will be no more contributions to this release.
23
23
 
24
24
  Commit your changes.
25
25
 
@@ -9,13 +9,14 @@ Gem::Specification.new do |s|
9
9
  s.email = 'dblock@dblock.org'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.required_rubygems_version = '>= 1.3.6'
12
+ s.required_ruby_version = '>= 2.3.0'
12
13
  s.files = `git ls-files`.split("\n")
13
14
  s.test_files = `git ls-files -- spec/*`.split("\n")
14
15
  s.require_paths = ['lib']
15
16
  s.homepage = 'http://github.com/dblock/iex-ruby-client'
16
17
  s.licenses = ['MIT']
17
18
  s.summary = 'IEX Finance API Ruby client with support for retrieving stock quotes.'
18
- s.add_dependency 'faraday', '>= 0.9'
19
+ s.add_dependency 'faraday', '>= 0.17'
19
20
  s.add_dependency 'faraday_middleware'
20
21
  s.add_dependency 'hashie'
21
22
  s.add_dependency 'money_helper'
@@ -1,7 +1,11 @@
1
+ require_relative 'endpoints/advanced_stats'
2
+ require_relative 'endpoints/balance_sheet'
3
+ require_relative 'endpoints/cash_flow'
1
4
  require_relative 'endpoints/chart'
2
5
  require_relative 'endpoints/company'
3
6
  require_relative 'endpoints/dividends'
4
7
  require_relative 'endpoints/earnings'
8
+ require_relative 'endpoints/historial_prices'
5
9
  require_relative 'endpoints/income'
6
10
  require_relative 'endpoints/largest_trades'
7
11
  require_relative 'endpoints/logo'
@@ -12,6 +16,9 @@ require_relative 'endpoints/price'
12
16
  require_relative 'endpoints/quote'
13
17
  require_relative 'endpoints/sectors'
14
18
  require_relative 'endpoints/crypto'
19
+ require_relative 'endpoints/ref_data'
20
+ require_relative 'endpoints/stock_market'
15
21
 
16
- require_relative 'api/config'
22
+ require_relative 'api/config/logger'
23
+ require_relative 'api/config/client'
17
24
  require_relative 'api/client'
@@ -1,11 +1,18 @@
1
1
  module IEX
2
2
  module Api
3
+ extend Config::Client::Accessor
4
+ extend Config::Logger::Accessor
5
+
3
6
  class Client
7
+ include Endpoints::AdvancedStats
8
+ include Endpoints::BalanceSheet
9
+ include Endpoints::CashFlow
4
10
  include Endpoints::Chart
5
11
  include Endpoints::Company
6
12
  include Endpoints::Crypto
7
13
  include Endpoints::Dividends
8
14
  include Endpoints::Earnings
15
+ include Endpoints::HistoricalPrices
9
16
  include Endpoints::Income
10
17
  include Endpoints::KeyStats
11
18
  include Endpoints::LargestTrades
@@ -15,16 +22,22 @@ module IEX
15
22
  include Endpoints::Price
16
23
  include Endpoints::Quote
17
24
  include Endpoints::Sectors
25
+ include Endpoints::RefData
26
+ include Endpoints::StockMarket
18
27
 
19
28
  include Cloud::Connection
20
29
  include Cloud::Request
21
30
 
22
- include Config
31
+ attr_accessor(*Config::Client::ATTRIBUTES)
32
+
33
+ attr_reader :logger
23
34
 
24
35
  def initialize(options = {})
25
- Config::ATTRIBUTES.each do |key|
36
+ Config::Client::ATTRIBUTES.each do |key|
26
37
  send("#{key}=", options[key] || IEX::Api.config.send(key))
27
38
  end
39
+ @logger = Config::Logger.dup
40
+ @logger.instance = options[:logger] if options.key?(:logger)
28
41
  end
29
42
  end
30
43
  end
@@ -0,0 +1,52 @@
1
+ module IEX
2
+ module Api
3
+ module Config
4
+ module Client
5
+ ATTRIBUTES = %i[
6
+ ca_file
7
+ ca_path
8
+ endpoint
9
+ open_timeout
10
+ proxy
11
+ publishable_token
12
+ referer
13
+ secret_token
14
+ timeout
15
+ user_agent
16
+ ].freeze
17
+
18
+ class << self
19
+ include Config::Logger::Accessor
20
+
21
+ attr_accessor(*ATTRIBUTES)
22
+
23
+ def reset!
24
+ self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
25
+ self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
26
+ self.endpoint = 'https://cloud.iexapis.com/v1'
27
+ self.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
28
+ self.secret_token = ENV['IEX_API_SECRET_TOKEN']
29
+ self.user_agent = "IEX Ruby Client/#{IEX::VERSION}"
30
+
31
+ self.open_timeout = nil
32
+ self.proxy = nil
33
+ self.referer = nil
34
+ self.timeout = nil
35
+ end
36
+ end
37
+
38
+ module Accessor
39
+ def configure
40
+ block_given? ? yield(Config::Client) : Config::Client
41
+ end
42
+
43
+ def config
44
+ Config::Client
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ IEX::Api::Config::Client.reset!
@@ -0,0 +1,35 @@
1
+ module IEX
2
+ module Api
3
+ module Config
4
+ module Logger
5
+ ATTRIBUTES = %i[
6
+ instance
7
+ options
8
+ proc
9
+ ].freeze
10
+
11
+ class << self
12
+ attr_accessor(*ATTRIBUTES)
13
+
14
+ def reset!
15
+ self.instance = nil
16
+ self.options = {}
17
+ self.proc = nil
18
+ end
19
+ end
20
+
21
+ module Accessor
22
+ def logger
23
+ block_given? ? yield(Config::Logger) : Config::Logger
24
+ end
25
+
26
+ def logger=(instance)
27
+ logger.instance = instance
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ IEX::Api::Config::Logger.reset!
@@ -8,28 +8,31 @@ module IEX
8
8
  end
9
9
 
10
10
  def connection
11
- options = {}
11
+ @connection ||= begin
12
+ options = {}
12
13
 
13
- options[:headers] = {}
14
- options[:headers]['Accept'] = 'application/json; charset=utf-8'
15
- options[:headers]['User-Agent'] = user_agent if user_agent
16
- options[:proxy] = proxy if proxy
17
- options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
18
- options[:params] = { token: publishable_token } if publishable_token
14
+ options[:headers] = {}
15
+ options[:headers]['Accept'] = 'application/json; charset=utf-8'
16
+ options[:headers]['Content-Type'] = 'application/json; charset=utf-8'
17
+ options[:headers]['User-Agent'] = user_agent if user_agent
18
+ options[:headers]['Referer'] = referer if referer
19
+ options[:proxy] = proxy if proxy
20
+ options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
19
21
 
20
- request_options = {}
21
- request_options[:timeout] = timeout if timeout
22
- request_options[:open_timeout] = open_timeout if open_timeout
23
- request_options[:params_encoder] = Faraday::FlatParamsEncoder
24
- options[:request] = request_options if request_options.any?
22
+ request_options = {}
23
+ request_options[:timeout] = timeout if timeout
24
+ request_options[:open_timeout] = open_timeout if open_timeout
25
+ request_options[:params_encoder] = Faraday::FlatParamsEncoder
26
+ options[:request] = request_options if request_options.any?
25
27
 
26
- ::Faraday::Connection.new(endpoint, options) do |connection|
27
- connection.use ::Faraday::Request::Multipart
28
- connection.use ::Faraday::Request::UrlEncoded
29
- connection.use ::IEX::Cloud::Response::RaiseError
30
- connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
31
- connection.response :logger, logger if logger
32
- connection.adapter ::Faraday.default_adapter
28
+ ::Faraday::Connection.new(endpoint, options) do |connection|
29
+ connection.use ::Faraday::Request::Multipart
30
+ connection.use ::Faraday::Request::UrlEncoded
31
+ connection.use ::IEX::Cloud::Response::RaiseError
32
+ connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
33
+ connection.response(:logger, logger.instance, logger.options, &logger.proc) if logger.instance
34
+ connection.adapter ::Faraday.default_adapter
35
+ end
33
36
  end
34
37
  end
35
38
  end
@@ -27,7 +27,7 @@ module IEX
27
27
  request.url(path, options)
28
28
  when :post, :put
29
29
  request.path = path
30
- request.body = options unless options.empty?
30
+ request.body = options.to_json unless options.empty?
31
31
  end
32
32
  request.options.merge!(options.delete(:request)) if options.key?(:request)
33
33
  end
@@ -5,7 +5,7 @@ module IEX
5
5
  def on_complete(env)
6
6
  case env[:status]
7
7
  when 404
8
- raise Faraday::Error::ResourceNotFound, response_values(env)
8
+ raise Faraday::ResourceNotFound, response_values(env)
9
9
  when 403
10
10
  raise IEX::Errors::PermissionDeniedError, response_values(env)
11
11
  when ClientErrorStatuses
@@ -0,0 +1,11 @@
1
+ module IEX
2
+ module Endpoints
3
+ module AdvancedStats
4
+ def advanced_stats(symbol, options = {})
5
+ IEX::Resources::AdvancedStats.new(get("stock/#{symbol}/advanced-stats", { token: publishable_token }.merge(options)))
6
+ rescue Faraday::ResourceNotFound => e
7
+ raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module IEX
2
+ module Endpoints
3
+ module BalanceSheet
4
+ def balance_sheet(symbol, options = {})
5
+ (get("stock/#{symbol}/balance-sheet", { token: publishable_token }.merge(options))['balancesheet'] || []).map do |data|
6
+ IEX::Resources::BalanceSheet.new(data)
7
+ end
8
+ rescue Faraday::ResourceNotFound => e
9
+ raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module IEX
2
+ module Endpoints
3
+ module CashFlow
4
+ def cash_flow(symbol, options = {})
5
+ (get("stock/#{symbol}/cash-flow", { token: publishable_token }.merge(options))['cashflow'] || []).map do |data|
6
+ IEX::Resources::CashFlow.new(data)
7
+ end
8
+ rescue Faraday::ResourceNotFound => e
9
+ raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
10
+ end
11
+ end
12
+ end
13
+ end
@@ -16,7 +16,7 @@ module IEX
16
16
  params[k.to_sym] = v
17
17
  end
18
18
 
19
- response = get(url, params)
19
+ response = get(url, { token: publishable_token }.merge(params))
20
20
 
21
21
  if range && range.to_s == 'dynamic'
22
22
  range = response['range']
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module Company
4
4
  def company(symbol, options = {})
5
- IEX::Resources::Company.new(get("stock/#{symbol}/company", options))
5
+ IEX::Resources::Company.new(get("stock/#{symbol}/company", { token: publishable_token }.merge(options)))
6
6
  rescue Faraday::ResourceNotFound => e
7
7
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
8
  end
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module Crypto
4
4
  def crypto(symbol, options = {})
5
- IEX::Resources::Crypto.new(get("crypto/#{symbol}/quote", options))
5
+ IEX::Resources::Crypto.new(get("crypto/#{symbol}/quote", { token: publishable_token }.merge(options)))
6
6
  rescue Faraday::ResourceNotFound => e
7
7
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
8
  end
@@ -7,7 +7,7 @@ module IEX
7
7
  symbol,
8
8
  'dividends',
9
9
  range
10
- ].compact.join('/'), options).map do |data|
10
+ ].compact.join('/'), { token: publishable_token }.merge(options)).map do |data|
11
11
  IEX::Resources::Dividends.new(data)
12
12
  end
13
13
  rescue Faraday::ResourceNotFound => e
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module Earnings
4
4
  def earnings(symbol, options = {})
5
- get("stock/#{symbol}/earnings", options)['earnings'].map do |data|
5
+ get("stock/#{symbol}/earnings", { token: publishable_token }.merge(options))['earnings'].map do |data|
6
6
  IEX::Resources::Earnings.new(data)
7
7
  end
8
8
  rescue Faraday::ResourceNotFound => e
@@ -0,0 +1,30 @@
1
+ module IEX
2
+ module Endpoints
3
+ module HistoricalPrices
4
+ def historical_prices(symbol, options = {})
5
+ if options[:range] == 'date'
6
+ raise ArgumentError unless options[:date].present?
7
+ raise ArgumentError unless options[:chartByDay].present?
8
+ end
9
+
10
+ options = options.dup
11
+ # Historical prices IEX endpoint expects dates passed in a specific format - YYYYMMDD
12
+ options[:date] = options[:date].strftime('%Y%m%d') if options[:date].is_a?(Date)
13
+
14
+ path = "stock/#{symbol}/chart"
15
+ path += "/#{options[:range]}" if options.key?(:range)
16
+ path += "/#{options[:date]}" if options[:range] == 'date'
17
+
18
+ # We only want options to include query params at this point, remove :range and :date
19
+ options.delete(:range)
20
+ options.delete(:date)
21
+
22
+ (get(path, { token: publishable_token }.merge(options)) || []).map do |data|
23
+ IEX::Resources::HistorialPrices.new(data)
24
+ end
25
+ rescue Faraday::ResourceNotFound => e
26
+ raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module Income
4
4
  def income(symbol, options = {})
5
- get("stock/#{symbol}/income", options)['income'].map do |data|
5
+ (get("stock/#{symbol}/income", { token: publishable_token }.merge(options))['income'] || []).map do |data|
6
6
  IEX::Resources::Income.new(data)
7
7
  end
8
8
  rescue Faraday::ResourceNotFound => e
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module KeyStats
4
4
  def key_stats(symbol, options = {})
5
- IEX::Resources::KeyStats.new(get("stock/#{symbol}/stats", options))
5
+ IEX::Resources::KeyStats.new(get("stock/#{symbol}/stats", { token: publishable_token }.merge(options)))
6
6
  rescue Faraday::ResourceNotFound => e
7
7
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
8
  end
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module LargestTrades
4
4
  def largest_trades(symbol, options = {})
5
- get("stock/#{symbol}/largest-trades", options).map do |data|
5
+ get("stock/#{symbol}/largest-trades", { token: publishable_token }.merge(options)).map do |data|
6
6
  IEX::Resources::LargestTrades.new(data)
7
7
  end
8
8
  rescue Faraday::ResourceNotFound => e
@@ -2,7 +2,7 @@ module IEX
2
2
  module Endpoints
3
3
  module Logo
4
4
  def logo(symbol, options = {})
5
- IEX::Resources::Logo.new(get("stock/#{symbol.downcase}/logo", options))
5
+ IEX::Resources::Logo.new(get("stock/#{symbol.downcase}/logo", { token: publishable_token }.merge(options)))
6
6
  rescue Faraday::ResourceNotFound => e
7
7
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
8
  end
@@ -8,7 +8,7 @@ module IEX
8
8
  'news',
9
9
  range ? 'last' : nil,
10
10
  range
11
- ].compact.join('/'), options).map do |data|
11
+ ].compact.join('/'), { token: publishable_token }.merge(options)).map do |data|
12
12
  IEX::Resources::News.new(data)
13
13
  end
14
14
  rescue Faraday::ResourceNotFound => e
@@ -2,13 +2,13 @@ module IEX
2
2
  module Endpoints
3
3
  module Ohlc
4
4
  def ohlc(symbol, options = {})
5
- IEX::Resources::OHLC.new(get("stock/#{symbol}/ohlc", options))
5
+ IEX::Resources::OHLC.new(get("stock/#{symbol}/ohlc", { token: publishable_token }.merge(options)))
6
6
  rescue Faraday::ResourceNotFound => e
7
7
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
8
8
  end
9
9
 
10
10
  def market(options = {})
11
- Hash[get('stock/market/ohlc', options).map do |k, v|
11
+ Hash[get('stock/market/ohlc', { token: publishable_token }.merge(options)).map do |k, v|
12
12
  [k, IEX::Resources::OHLC.new(v)]
13
13
  end]
14
14
  end