iex-ruby-client 1.2.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.env.sample +2 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop_todo.yml +0 -8
  5. data/CHANGELOG.md +27 -0
  6. data/Gemfile +1 -0
  7. data/README.md +237 -18
  8. data/RELEASING.md +3 -3
  9. data/lib/iex/api.rb +8 -1
  10. data/lib/iex/api/client.rb +15 -2
  11. data/lib/iex/api/config/client.rb +52 -0
  12. data/lib/iex/api/config/logger.rb +35 -0
  13. data/lib/iex/cloud/connection.rb +2 -1
  14. data/lib/iex/endpoints/advanced_stats.rb +11 -0
  15. data/lib/iex/endpoints/balance_sheet.rb +13 -0
  16. data/lib/iex/endpoints/cash_flow.rb +13 -0
  17. data/lib/iex/endpoints/fx.rb +13 -0
  18. data/lib/iex/endpoints/historial_prices.rb +30 -0
  19. data/lib/iex/endpoints/key_stat.rb +14 -0
  20. data/lib/iex/endpoints/ref_data.rb +6 -1
  21. data/lib/iex/errors.rb +3 -1
  22. data/lib/iex/errors/invalid_symbols_list.rb +14 -0
  23. data/lib/iex/errors/stat_not_found_error.rb +13 -0
  24. data/lib/iex/resources.rb +5 -0
  25. data/lib/iex/resources/advanced_stats.rb +84 -0
  26. data/lib/iex/resources/balance_sheet.rb +60 -0
  27. data/lib/iex/resources/cash_flow.rb +43 -0
  28. data/lib/iex/resources/currency_rate.rb +9 -0
  29. data/lib/iex/resources/historical_prices.rb +31 -0
  30. data/lib/iex/resources/income.rb +2 -0
  31. data/lib/iex/resources/news.rb +3 -0
  32. data/lib/iex/resources/resource.rb +12 -0
  33. data/lib/iex/version.rb +1 -1
  34. data/script/console +9 -0
  35. data/spec/fixtures/iex/advanced_stats/invalid.yml +50 -0
  36. data/spec/fixtures/iex/advanced_stats/msft.yml +57 -0
  37. data/spec/fixtures/iex/balance_sheet/invalid.yml +50 -0
  38. data/spec/fixtures/iex/balance_sheet/msft.yml +56 -0
  39. data/spec/fixtures/iex/cash_flow/invalid.yml +50 -0
  40. data/spec/fixtures/iex/cash_flow/msft.yml +56 -0
  41. data/spec/fixtures/iex/fx/invalid.yml +83 -0
  42. data/spec/fixtures/iex/fx/latest.yml +85 -0
  43. data/spec/fixtures/iex/fx/latest_one_symbol.yml +85 -0
  44. data/spec/fixtures/iex/historical_prices/abcd.yml +56 -0
  45. data/spec/fixtures/iex/historical_prices/invalid.yml +50 -0
  46. data/spec/fixtures/iex/historical_prices/invalid_date.yml +50 -0
  47. data/spec/fixtures/iex/historical_prices/invalid_range.yml +47 -0
  48. data/spec/fixtures/iex/historical_prices/msft.yml +79 -0
  49. data/spec/fixtures/iex/historical_prices/msft_5d.yml +61 -0
  50. data/spec/fixtures/iex/historical_prices/msft_date_and_chart_by_day.yml +57 -0
  51. data/spec/fixtures/iex/historical_prices/msft_specific_date_trimmed.yml +445 -0
  52. data/spec/fixtures/iex/income/msft.yml +54 -51
  53. data/spec/fixtures/iex/key_stat/individual.yml +60 -0
  54. data/spec/fixtures/iex/key_stat/invalid_stat.yml +60 -0
  55. data/spec/fixtures/iex/key_stat/invalid_symbol.yml +50 -0
  56. data/spec/fixtures/iex/ref-data/exchange_symbols.yml +1926 -0
  57. data/spec/iex/client_spec.rb +91 -13
  58. data/spec/iex/config/client_spec.rb +49 -0
  59. data/spec/iex/config/logger_spec.rb +46 -0
  60. data/spec/iex/endpoints/advanced_stats_spec.rb +110 -0
  61. data/spec/iex/endpoints/balance_sheet_spec.rb +80 -0
  62. data/spec/iex/endpoints/cash_flow_spec.rb +59 -0
  63. data/spec/iex/endpoints/fx_spec.rb +48 -0
  64. data/spec/iex/endpoints/historical_prices_spec.rb +206 -0
  65. data/spec/iex/endpoints/income_spec.rb +31 -29
  66. data/spec/iex/endpoints/key_stat_spec.rb +43 -0
  67. data/spec/iex/endpoints/news_spec.rb +3 -0
  68. data/spec/iex/endpoints/ref_data_spec.rb +57 -12
  69. data/spec/iex/resources/resource_spec.rb +36 -0
  70. data/spec/spec_helper.rb +3 -3
  71. metadata +78 -6
  72. data/lib/iex/api/config.rb +0 -47
  73. data/spec/iex/config_spec.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71bec851d78d50e5e8625f18e94212bd3d5825a1bf90a3809258e6ef88dcae34
4
- data.tar.gz: b3f668404aada9eb2bcfa7f56767ce51083222c9f40a2fa95f15d005be9ee7ed
3
+ metadata.gz: ab2cf9c9b5a300629e51b810e4f556ba5d3113a226faa0b2a9293be2939cdb24
4
+ data.tar.gz: cbab6366388a36eddac8a9e55c4eb4e9e5254cd883f0fe135bdb63d7e359f137
5
5
  SHA512:
6
- metadata.gz: bf29091889a722d957ea6abceb5dc60d761fde868abc4212829c48723fc668870dbad46a75815823224bf324bd466fc917669792b320c85b0a907979b37008cc
7
- data.tar.gz: 1222b56a8c47e79cd36b92b124128fa0162f8acbd9aa466f212cd0bc3bbe94036c2cc0c79243e348cf3b65ebb527ba47d46b91850dc8059cd081cab247568971
6
+ metadata.gz: 3a08d8c90fdc3a1ac756321711a76d2b65f01d8c5935b160125fcb41751452da65588d5b29ab1f3f000026171c61ceafdb9ce270af62c342c701512e83a706e0
7
+ data.tar.gz: b6cbac7f892c7e1ce514cb5906180d60d73b66b5a80edb777eb7ac754fad309b9ce8745b08e8ce1c5f4cc27c109f84b558025f70bc53b754c1ef2e0ac4ccd3e4
data/.env.sample ADDED
@@ -0,0 +1,2 @@
1
+ IEX_API_PUBLISHABLE_TOKEN=test-iex-api-publishable-token
2
+ IEX_API_SECRET_TOKEN=test-iex-api-secret-token
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  .DS_Store
5
5
  .bundle
6
6
  .idea
7
+ .irbrc
data/.rubocop_todo.yml CHANGED
@@ -11,11 +11,3 @@
11
11
  Style/AsciiComments:
12
12
  Exclude:
13
13
  - 'lib/iex/resources/quote.rb'
14
-
15
- # Offense count: 1
16
- # Cop supports --auto-correct.
17
- # Configuration parameters: EnforcedStyle, Autocorrect.
18
- # SupportedStyles: module_function, extend_self
19
- Style/ModuleFunction:
20
- Exclude:
21
- - 'lib/iex/api/config.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ### 1.5.0 (2021/08/15)
2
+ * [#105](https://github.com/dblock/iex-ruby-client/pull/105): Added support for fetching latest foreign exchange rates - [@mathu97](https://github.com/mathu97).
3
+ * [#106](https://github.com/dblock/iex-ruby-client/pull/106): Added support for fetching a single key stat with `key_stat(symbol, stat)` endpoint - [@agrberg](https://github.com/agrberg).
4
+ * [#107](https://github.com/dblock/iex-ruby-client/pull/107): Added `./script/console` for ease of local development - [@agrberg](https://github.com/agrberg).
5
+
6
+ ### 1.4.1 (2021/05/15)
7
+ * [#103](https://github.com/dblock/iex-ruby-client/pull/103): Added support for fetching symbols for an exchange - [@mathu97](https://github.com/mathu97).
8
+ * [#99](https://github.com/dblock/iex-ruby-client/pull/99): Added `image` and `paywalled` to news - [@reddavis](https://github.com/reddavis).
9
+ * [#100](https://github.com/dblock/iex-ruby-client/pull/100): Added `language` to news - [@reddavis](https://github.com/reddavis).
10
+
11
+ ### 1.4.0 (2020/11/19)
12
+ * [#90](https://github.com/dblock/iex-ruby-client/pull/90): Added documentation for advanced stats and removed `avg_30_Volume` from advanced stats since it is found in key stats - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
13
+ * [#91](https://github.com/dblock/iex-ruby-client/pull/91): Added support for Balance Sheet API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
14
+ * [#92](https://github.com/dblock/iex-ruby-client/pull/92): Added support for Cash Flow Statements API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
15
+ * [#93](https://github.com/dblock/iex-ruby-client/pull/93): Added `fiscal_date` and `currency` to income statements - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
16
+ * [#94](https://github.com/dblock/iex-ruby-client/pull/94): Added `historical_prices` API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
17
+ * [#95](https://github.com/dblock/iex-ruby-client/pull/95): Added all KeyStat properties to AdvancedStats since they are already returned in the API call - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
18
+
19
+ ### 1.3.0 (2020/10/31)
20
+
21
+ * [#82](https://github.com/dblock/iex-ruby-client/pull/82): Added `config.referer` to set HTTP `Referer` header. This enables IEX's "Manage domains" domain locking for tokens - [@agrberg](https://github.com/agrberg).
22
+ * [#70](https://github.com/dblock/iex-ruby-client/pull/70): Added support for `ref_data_isin` taking a single `String` parameter - [@rodolfobandeira](https://github.com/rodolfobandeira).
23
+ * [#84](https://github.com/dblock/iex-ruby-client/pull/84): Added support for Advanced Stats API - [@FanaHOVA](https://github.com/fanahova).
24
+ * [#86](https://github.com/dblock/iex-ruby-client/issues/86): Added advanced logger configuration to `config.logger`. Now a hash with keys `:instance, :options, and :proc` can be passed and used directly with Faraday - [@agrberg](https://github.com/agrberg).
25
+ * [#88](https://github.com/dblock/iex-ruby-client/pull/88): Updated logger configuration to work like `Config` class and allow attribute and block based configuration - [@agrberg](https://github.com/agrberg).
26
+ * [#89](https://github.com/dblock/iex-ruby-client/pull/89): Backfill breaking `Config#logger` setting change from [#88](https://github.com/dblock/iex-ruby-client/pull/88) - [@agrberg](https://github.com/agrberg).
27
+
1
28
  ### 1.2.0 (2020/09/01)
2
29
 
3
30
  * [#78](https://github.com/dblock/iex-ruby-client/pull/78): Added `Quote#extended_change_percent` and `Quote#extended_change_percent_s` properties to Quote - [@reddavis](https://github.com/reddavis).
data/Gemfile CHANGED
@@ -5,5 +5,6 @@ gemspec
5
5
  group :test do
6
6
  gem 'danger-changelog', '~> 0.6.0'
7
7
  gem 'danger-toc', '~> 0.2.0'
8
+ gem 'dotenv'
8
9
  gem 'pry'
9
10
  end
data/README.md CHANGED
@@ -15,22 +15,29 @@ A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
15
15
  - [Get a Quote](#get-a-quote)
16
16
  - [Get a OHLC (Open, High, Low, Close) price](#get-a-ohlc-open-high-low-close-price)
17
17
  - [Get a Market OHLC (Open, High, Low, Close) prices](#get-a-market-ohlc-open-high-low-close-prices)
18
+ - [Get Historical Prices](#get-historical-prices)
18
19
  - [Get Company Information](#get-company-information)
19
20
  - [Get a Company Logo](#get-a-company-logo)
20
21
  - [Get Recent News](#get-recent-news)
21
22
  - [Get Chart](#get-chart)
22
23
  - [Get Key Stats](#get-key-stats)
24
+ - [Get Advanced Stats](#get-advanced-stats)
23
25
  - [Get Dividends](#get-dividends)
24
26
  - [Get Earnings](#get-earnings)
25
27
  - [Get Income Statement](#get-income-statement)
28
+ - [Get Balance Sheet](#get-balance-sheet)
29
+ - [Get Cash Flow Statement](#get-cash-flow-statement)
26
30
  - [Get Sector Performance](#get-sector-performance)
27
31
  - [Get Largest Trades](#get-largest-trades)
28
32
  - [Get a Quote for Crypto Currencies](#get-a-quote-for-crypto-currencies)
29
33
  - [ISIN Mapping](#isin-mapping)
30
34
  - [Get Symbols](#get-symbols)
35
+ - [Get Symbols for an Exchange](#get-symbols-for-an-exchange)
36
+ - [Get Latest Foreign Exchange Rates](#get-latest-foreign-exchange-rates)
31
37
  - [Get List](#get-list)
32
38
  - [Other Requests](#other-requests)
33
39
  - [Configuration](#configuration)
40
+ - [Logging](#logging)
34
41
  - [Sandbox Environment](#sandbox-environment)
35
42
  - [Errors](#errors)
36
43
  - [SymbolNotFound](#symbolnotfound)
@@ -129,6 +136,60 @@ market['SPY'].high #
129
136
  market['SPY'].low #
130
137
  ```
131
138
 
139
+ ### Get Historical Prices
140
+
141
+ Fetches a list of historical prices.
142
+
143
+ There are currently a few limitations of this endpoint compared to the official IEX one.
144
+
145
+ Options for `range` include:
146
+ `max, ytd, 5y, 2y, 1y, 6m, 3m, 1m, 5d, date`
147
+
148
+ NOTE: If you use the `date` value for the `range` parameter:
149
+
150
+ - The options _must_ include a date entry, `{date: ...}`
151
+ - The date value _must_ be either a Date object, or a string formatted as `YYYYMMDD`. Anything else will result in an `IEX::Errors::ClientError`.
152
+ - The options _must_ include `chartByDay: 'true'` or an `ArgumentError` will be raised.
153
+ - See below for examples.
154
+
155
+ `Query params` supported include:
156
+ `chartByDay`
157
+
158
+ This is a complicated endpoint as there is a lot of granularity over the time period of data returned. See below for a variety of ways to request data, NOTE: this is _NOT_ as exhaustive list.
159
+
160
+ ```ruby
161
+ historical_prices = client.historical_prices('MSFT') # One month of data
162
+ historical_prices = client.historical_prices('MSFT', {range: 'max'}) # All data up to 15 years
163
+ historical_prices = client.historical_prices('MSFT', {range: 'ytd'}) # Year to date data
164
+ historical_prices = client.historical_prices('MSFT', {range: '5y'}) # 5 years of data
165
+ historical_prices = client.historical_prices('MSFT', {range: '6m'}) # 6 months of data
166
+ historical_prices = client.historical_prices('MSFT', {range: '5d'}) # 5 days of data
167
+ historical_prices = client.historical_prices('MSFT', {range: 'date', date: '20200930', chartByDay: 'true'}) # One day of data
168
+ historical_prices = client.historical_prices('MSFT', {range: 'date', date: Date.parse('2020-09-30'), chartByDay: 'true'}) # One day of data
169
+ ...
170
+ ```
171
+
172
+ Once you have the data over the preferred time period, you can access the following fields
173
+
174
+ ```ruby
175
+ historical_prices = client.historical_prices('MSFT') # One month of data
176
+
177
+ historical_price = historical_prices.first
178
+ historical_price.date # 2020-10-07
179
+ historical_price.open #207.06
180
+ historical_price.open_dollar # '$207.06'
181
+ historical_price.close # 209.83
182
+ historical_price.close_dollar # '$209.83'
183
+ historical_price.high # 210.11
184
+ historical_price.high_dollar # '$210.11'
185
+ historical_price.low # 206.72
186
+ historical_price.low_dollar # '$206.72'
187
+ historical_price.volume # 25681054
188
+ ...
189
+ ```
190
+
191
+ There are a lot of options here so I would recommend viewing the official IEX documentation [#historical-prices](https://iexcloud.io/docs/api/#historical-prices) or [historical_prices.rb](lib/iex/resources/historical_prices.rb) for returned fields.
192
+
132
193
  ### Get Company Information
133
194
 
134
195
  Fetches company information for a symbol.
@@ -262,8 +323,58 @@ key_stats.pe_ratio # 29.47
262
323
  key_stats.beta # 1.4135449089973444
263
324
  ```
264
325
 
326
+ You can also fetch a single stat for a symbol. **Note** that IEX uses `lowerCamelCase` for the names of the stats.
327
+
328
+ ```ruby
329
+ client.key_stat('VTI', 'dividendYield') # 0.01271760965303361
330
+ ```
331
+
265
332
  See [#key-stats](https://iexcloud.io/docs/api/#key-stats) for detailed documentation or [key_stats.rb](lib/iex/resources/key_stats.rb) for returned fields.
266
333
 
334
+ ### Get Advanced Stats
335
+
336
+ Fetches company's advanced stats for a symbol, this will include all key stats as well.
337
+
338
+ ```ruby
339
+ advanced_stats = client.advanced_stats('MSFT')
340
+
341
+ advanced_stats.total_cash # 66301000000
342
+ advanced_stats.total_cash_dollars # "$66,301,000,000"
343
+ advanced_stats.current_debt # 20748000000
344
+ advanced_stats.current_debt_dollars # "$2,074,8000,000"
345
+ advanced_stats.revenue # 265809000000
346
+ advanced_stats.revenue_dollars # "$265,809,000,000"
347
+ advanced_stats.gross_profit # 101983000000
348
+ advanced_stats.gross_profit_dollar # "$101,983,000,000"
349
+ advanced_stats.total_revenue # 265809000000
350
+ advanced_stats.total_revenue_dollar # "$265,809,000,000"
351
+ advanced_stats.ebitda # 80342000000
352
+ advanced_stats.ebitda_dollar # "$80,342,000,000"
353
+ advanced_stats.revenue_per_share # 0.02
354
+ advanced_stats.revenue_per_share_dollar # "$0.02"
355
+ advanced_stats.revenue_per_employee # 2013704.55
356
+ advanced_stats.revenue_per_employee_dollar # "$2,013,704.55"
357
+ advanced_stats.debt_to_equity # 1.07
358
+ advanced_stats.profit_margin # 22.396157
359
+ advanced_stats.enterprise_value # 1022460690000
360
+ advanced_stats.enterprise_value_dollar # "$1,022,460,690,000"
361
+ advanced_stats.enterprise_value_to_revenue # 3.85
362
+ advanced_stats.price_to_sales # 3.49
363
+ advanced_stats.price_to_sales_dollar # "$3.49"
364
+ advanced_stats.price_to_book # 8.805916432564608
365
+ advanced_stats.forward_pe_ratio # 18.14
366
+ advanced_stats.pe_high # 22.61
367
+ advanced_stats.pe_low # 11.98
368
+ advanced_stats.peg_ratio # 2.19
369
+ advanced_stats.week_52_high_date # "2019-11-19"
370
+ advanced_stats.week_52_low_date # "2019-01-03
371
+ advanced_stats.beta # 1.4661365583766115
372
+ advanced_stats.put_call_ratio # 0.6780362005229779
373
+ ...
374
+ ```
375
+
376
+ See [#advanced-stats](https://iexcloud.io/docs/api/#advanced-stats) for detailed documentation or [advanced_stats.rb](lib/iex/resources/advanced_stats.rb) for returned fields.
377
+
267
378
  ### Get Dividends
268
379
 
269
380
  Fetches dividends for a symbol.
@@ -303,12 +414,16 @@ See [#earnings](https://iexcloud.io/docs/api/#earnings) for detailed documentati
303
414
 
304
415
  ### Get Income Statement
305
416
 
306
- Fetches income statement for a symbol.
417
+ Fetches income statements for a symbol.
307
418
 
308
419
  ```ruby
309
- income = client.income('MSFT')
420
+ income_statements = client.income('MSFT')
310
421
 
422
+ # Multiple income statements are returned with 1 API call.
423
+ income = income_statements.first
311
424
  income.report_date # '2019-03-31'
425
+ income.fiscal_date # '2019-03-31'
426
+ income.currency # 'USD'
312
427
  income.total_revenue # 30_505_000_000
313
428
  income.total_revenue_dollar # '$30,505,000,000'
314
429
  income.cost_of_revenue # 10_170_000_000
@@ -320,6 +435,48 @@ income.gross_profit_dollar # '$20,335,000,000'
320
435
 
321
436
  See [#income-statement](https://iexcloud.io/docs/api/#income-statement) for detailed documentation or [income.rb](lib/iex/resources/income.rb) for returned fields.
322
437
 
438
+ ### Get Balance Sheet
439
+
440
+ Fetches balance sheets for a symbol.
441
+
442
+ ```ruby
443
+ balance_sheets = client.balance_sheet('MSFT')
444
+
445
+ # Multiple balance sheets are returned with 1 API call.
446
+ balance_sheet = balance_sheets.first
447
+ balance_sheet.report_date # '2017-03-31'
448
+ balance_sheet.fiscal_date # '2017-03-31'
449
+ balance_sheet.currency # 'USD'
450
+ balance_sheet.current_cash # 25_913_000_000
451
+ balance_sheet.current_cash_dollar # '$25,913,000,000'
452
+ balance_sheet.short_term_investments # 40_388_000_000
453
+ balance_sheet.short_term_investments_dollar # '$40,388,000,000'
454
+ ...
455
+ ```
456
+
457
+ See [#balance-sheet](https://iexcloud.io/docs/api/#balance-sheet) for detailed documentation or [balance_sheet.rb](lib/iex/resources/balance_sheet.rb) for returned fields.
458
+
459
+ ### Get Cash Flow Statement
460
+
461
+ Fetches cash flow statements for a symbol.
462
+
463
+ ```ruby
464
+ cash_flow_statements = client.cash_flow('MSFT')
465
+
466
+ # Multiple cash flow statements are returned with 1 API call.
467
+ cash_flow = cash_flow_statements.first
468
+ cash_flow.report_date # '2018-09-30'
469
+ cash_flow.fiscal_date # '2018-09-30'
470
+ cash_flow.currency # 'USD'
471
+ cash_flow.net_income # 14_125_000_000
472
+ cash_flow.net_income_dollar # '$14,125,000,000'
473
+ cash_flow.depreciation # 2_754_000_000
474
+ cash_flow.depreciation_dollar # '$2,754,000,000'
475
+ ...
476
+ ```
477
+
478
+ See [#cash-flow](https://iexcloud.io/docs/api/#cash-flow) for detailed documentation or [cash_flow.rb](lib/iex/resources/cash_flow.rb) for returned fields.
479
+
323
480
  ### Get Sector Performance
324
481
 
325
482
  Fetches latest sector's performance.
@@ -378,10 +535,10 @@ See [#crypto](https://iexcloud.io/docs/api/#crypto) for detailed documentation o
378
535
 
379
536
  ### ISIN Mapping
380
537
 
381
- Converts ISIN to IEX Cloud symbols.
538
+ Convert ISIN to IEX Cloud symbols.
382
539
 
383
540
  ```ruby
384
- symbols = client.ref_data_isin(['US0378331005'])
541
+ symbols = client.ref_data_isin('US0378331005')
385
542
 
386
543
  symbols.first.exchange # NAS
387
544
  symbols.first.iex_id # IEX_4D48333344362D52
@@ -389,6 +546,12 @@ symbols.first.region # US
389
546
  symbols.first.symbol # AAPL
390
547
  ```
391
548
 
549
+ The API also lets you convert multiple ISINs to IEX Cloud symbols.
550
+
551
+ ```ruby
552
+ symbols = client.ref_data_isin(['US0378331005', 'US0378331006'])
553
+ ```
554
+
392
555
  You can use `mapped: true` option to receive symbols grouped by their ISINs.
393
556
 
394
557
  ```ruby
@@ -399,7 +562,7 @@ See [#ISIN Mapping](https://iexcloud.io/docs/api/#isin-mapping) for detailed doc
399
562
 
400
563
  ### Get Symbols
401
564
 
402
- Returns an array of symbols
565
+ Returns an array of symbols.
403
566
 
404
567
  ```ruby
405
568
  symbols = client.ref_data_symbols()
@@ -413,6 +576,37 @@ symbol.symbol # A
413
576
 
414
577
  See [#symbols](https://iexcloud.io/docs/api/#symbols) for detailed documentation or [symbols.rb](lib/iex/resources/symbols.rb) for returned fields.
415
578
 
579
+ ### Get Symbols for an Exchange
580
+
581
+ Returns an array of symbols for a given exchange.
582
+
583
+ ```ruby
584
+ symbols = client.ref_data_symbols_for_exchange('TSX')
585
+
586
+ symbol = symbols.first
587
+ symbol.exchange # TSX
588
+ symbol.iex_id # IEX_4656374258322D52
589
+ symbol.region # CA
590
+ symbol.symbol # A-CV
591
+ ```
592
+
593
+ See [#international-symbols](https://iexcloud.io/docs/api/#international-symbols) for returned fields.
594
+
595
+ ### Get Latest Foreign Exchange Rates
596
+
597
+ Returns an array of foreign exchange rates for a given list of symbols.
598
+
599
+ ```ruby
600
+ rates = client.fx_latest(['USDCAD', 'USDGBP', 'USDJPY'])
601
+
602
+ rate = rates.first
603
+ rate.symbol # USDCAD
604
+ rate.rate # 1.25674
605
+ rate.timestamp # <Date: 2021-07-23 ((2459419j,0s,0n),+0s,2299161j)>
606
+ ```
607
+
608
+ See [#latest-currency-rates](https://iexcloud.io/docs/api/#latest-currency-rates) for returned fields.
609
+
416
610
  ### Get List
417
611
 
418
612
  Returns an array of quotes for the top 10 symbols in a specified list.
@@ -437,7 +631,7 @@ client.post('ref-data/isin', isin: ['US0378331005'], token: 'secret_token') # [{
437
631
  You can configure client options globally or directly with a `IEX::Api::Client` instance.
438
632
 
439
633
  ```ruby
440
- IEX::Api::Client.configure do |config|
634
+ IEX::Api.configure do |config|
441
635
  config.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
442
636
  config.endpoint = 'https://sandbox.iexapis.com/v1' # use sandbox environment
443
637
  end
@@ -452,23 +646,48 @@ client = IEX::Api::Client.new(
452
646
 
453
647
  The following settings are supported.
454
648
 
455
- setting | description
456
- --------------------|------------
457
- user_agent | User-agent, defaults to _IEX Ruby Client/version_.
458
- proxy | Optional HTTP proxy.
459
- ca_path | Optional SSL certificates path.
460
- ca_file | Optional SSL certificates file.
461
- logger | Optional `Logger` instance that logs HTTP requests.
462
- timeout | Optional open/read timeout in seconds.
463
- open_timeout | Optional connection open timeout in seconds.
464
- publishable_token | IEX Cloud API publishable token.
465
- endpoint | Defaults to `https://cloud.iexapis.com/v1`.
649
+ | setting | description |
650
+ | ----------------- | --------------------------------------------------------------------------- |
651
+ | user_agent | User-agent, defaults to _IEX Ruby Client/version_. |
652
+ | proxy | Optional HTTP proxy. |
653
+ | ca_path | Optional SSL certificates path. |
654
+ | ca_file | Optional SSL certificates file. |
655
+ | logger | Optional `Logger` instance or logger configuration to log HTTP requests. |
656
+ | timeout | Optional open/read timeout in seconds. |
657
+ | open_timeout | Optional connection open timeout in seconds. |
658
+ | publishable_token | IEX Cloud API publishable token. |
659
+ | endpoint | Defaults to `https://cloud.iexapis.com/v1`. |
660
+ | referer | Optional string for HTTP `Referer` header, enables token domain management. |
661
+
662
+ ### Logging
663
+
664
+ Faraday will not log HTTP requests by default. In order to do this you can either provide a `logger` instance or configuration attributes to `IEX::Api::Client`. Configuration allows you to supply the `instance`, `options`, and `proc` to [Faraday](https://lostisland.github.io/faraday/middleware/logger#include-and-exclude-headersbodies).
665
+
666
+ ```ruby
667
+ logger_instance = Logger.new(STDOUT)
668
+
669
+ IEX::Api.configure do |config|
670
+ config.logger.instance = logger_instance
671
+ config.logger.options = { bodies: true }
672
+ config.logger.proc = proc { |logger| logger.filter(/T?[sp]k_\w+/i, '[REMOVED]') }
673
+ end
674
+ # or
675
+ IEX::Api.logger do |logger|
676
+ logger.instance = logger_instance
677
+ logger.options = …
678
+ logger.proc = …
679
+ end
680
+ # or
681
+ IEX::Api.logger = logger_instance
682
+ # or
683
+ IEX::Api::Client.new(logger: logger_instance)
684
+ ```
466
685
 
467
686
  ## Sandbox Environment
468
687
 
469
688
  IEX recommends you use a sandbox token and endpoint for testing.
470
689
 
471
- However, please note that data in the IEX sandbox environment is scrambled. Therefore elements such as company and people names, descriptions, tags, and website URLs don't render any coherent data.
690
+ However, please note that data in the IEX sandbox environment is scrambled. Therefore elements such as company and people names, descriptions, tags, and website URLs don't render any coherent data. In addition, results, such as closing market prices and dividend yield, are not accurate and vary on every call.
472
691
 
473
692
  See [IEX sandbox environment](https://intercom.help/iexcloud/en/articles/2915433-testing-with-the-iex-cloud-sandbox) for more information.
474
693
 
data/RELEASING.md CHANGED
@@ -11,15 +11,15 @@ bundle install
11
11
  rake
12
12
  ```
13
13
 
14
- Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/iex-ruby-client) for all supported platforms.
14
+ Check that the last build succeeded in [Travis CI](https://travis-ci.com/github/dblock/iex-ruby-client) for all supported platforms.
15
15
 
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