gem 'iex-ruby-client' how to set up

  1. Add the 'iex-ruby-client' gem to your Gemfile:

ruby gem 'iex-ruby-client'

  1. Run the following command to install the gem:

bundle install

  1. Require the 'iex-ruby-client' gem in your Ruby file:

ruby require 'iex-ruby-client'

  1. Initialize the IEX::Api::Client with your API key:

ruby client = IEX::Api::Client.new( publishable_token: 'your_publishable_token', secret_token: 'your_secret_token', endpoint: 'https://cloud.iexapis.com/v1' # optional, use if different from default )

Replace 'your_publishable_token' and 'your_secret_token' with your actual IEX Cloud API tokens.

  1. Use the client to make API requests. For example, to get the quote for a specific symbol:

ruby quote = client.quote('AAPL') puts "Latest Price for AAPL: $#{quote.latest_price}"

Replace 'AAPL' with the desired stock symbol.

  1. Refer to the official documentation for more details and available methods:

  2. IEX Ruby Client GitHub Repository

  3. IEX Cloud API Documentation

Ensure you comply with IEX Cloud's terms of service and use the appropriate API token levels for your needs.