iex-ruby-client 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63df99e38da35a6d4e4dc799e56d762b74ec873a8123b8c2f598edf6e284dc4d
4
- data.tar.gz: 7a0c154efd557d72e50c887aeae7f7076afb5b93fffe10f3af403c8d83858e83
3
+ metadata.gz: 530d80aa85cb4adbeae6839512b1e3f1bea92795c61a0b12f903518dd456d8f7
4
+ data.tar.gz: f6bdca5ca322dd32e178b0b7f0d7bd8ccad94ee121c2d4d405adc84e6de75ce4
5
5
  SHA512:
6
- metadata.gz: 70bd058e8728effc81edecb7da6aa843e725a5648f27024bdf7e0b5458fe5906dc834d3b51d64d23df5df00091e11f334bc4a672b7ac815982885261344271e2
7
- data.tar.gz: d1e9e823bc91ece071819487941a5b5d7efa4191178695e75c8ce9bdd65ee3f58c30b14354d9fdb5c839e2905b2a8acf7b5c54655377a25710d6a5cd8c26350a
6
+ metadata.gz: 2b158981fd7e35729989fb6bb50f9f859e2b905f72eb94442db29866db42e825a27c4646b3c1cdc51182f2fc73b9e268385f128619ddf949cfd7171256980be7
7
+ data.tar.gz: dc6897f3d8d51572a19aa003fd59fda2ed183bdd688307a466e7bcd2aec7a659974466d1d0ea2015895c4388f625a7466d62215e99d930ff06ab1a21b53631ec
@@ -1,3 +1,11 @@
1
+ ### 1.1.2 (2020/03/25)
2
+
3
+ * [#68](https://github.com/dblock/iex-ruby-client/pull/68): Fix ref_data_isin request with wrong isin - [@bguban](https://github.com/bguban).
4
+ * [#67](https://github.com/dblock/iex-ruby-client/pull/67): Add required ruby version to gemspec - [@wdperson](https://github.com/wdperson).
5
+ * [#66](https://github.com/dblock/iex-ruby-client/pull/66): Fix: KeyStats#week_52_change always returns nil - [@brunjo](https://github.com/brunjo).
6
+ * [#65](https://github.com/dblock/iex-ruby-client/pull/65): Add stock_market_list - [@bguban](https://github.com/bguban).
7
+ * [#64](https://github.com/dblock/iex-ruby-client/pull/64): Add ref_data_isin - [@bguban](https://github.com/bguban).
8
+
1
9
  ### 1.1.1 (2020/03/02)
2
10
 
3
11
  * [#63](https://github.com/dblock/iex-ruby-client/pull/63): Allow direct API calls with support for secret_token - [@bguban](https://github.com/bguban).
data/README.md CHANGED
@@ -26,6 +26,8 @@ A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
26
26
  - [Get Sector Performance](#get-sector-performance)
27
27
  - [Get Largest Trades](#get-largest-trades)
28
28
  - [Get a Quote for Crypto Currencies](#get-a-quote-for-crypto-currencies)
29
+ - [ISIN Mapping](#isin-mapping)
30
+ - [Get List](#get-list)
29
31
  - [Other Requests](#other-requests)
30
32
  - [Configuration](#configuration)
31
33
  - [Errors](#errors)
@@ -372,6 +374,37 @@ crypto.high_dollar #'$3,590'
372
374
 
373
375
  See [#crypto](https://iexcloud.io/docs/api/#crypto) for detailed documentation or [crypto.rb](lib/iex/resources/crypto.rb) for returned fields.
374
376
 
377
+ ### ISIN Mapping
378
+
379
+ Converts ISIN to IEX Cloud symbols.
380
+
381
+ ```ruby
382
+ symbols = client.ref_data_isin(['US0378331005'])
383
+
384
+ symbols.first.exchange # NAS
385
+ symbols.first.iex_id # IEX_4D48333344362D52
386
+ symbols.first.region # US
387
+ symbols.first.symbol # AAPL
388
+ ```
389
+
390
+ You can use `mapped: true` option to receive symbols grouped by their ISINs.
391
+
392
+ ```ruby
393
+ client.ref_data_isin(['US0378331005', 'US5949181045'], mapped: true) # {'US0378331005' => [...], 'US5949181045' => [...]}
394
+ ```
395
+
396
+ See [#ISIN Mapping](https://iexcloud.io/docs/api/#isin-mapping) for detailed documentation or [isin_mapping.rb](lib/iex/resources/isin_mapping.rb) for returned fields.
397
+
398
+ ### Get List
399
+
400
+ Returns an array of quotes for the top 10 symbols in a specified list.
401
+
402
+ ```ruby
403
+ client.stock_market_list(:mostactive) # [{symbol: 'AAPL', ...}, {...}]
404
+ ```
405
+
406
+ See [#list](https://iexcloud.io/docs/api/#list) for detailed documentation or [quote.rb](lib/iex/resources/quote.rb) for returned fields.
407
+
375
408
  ### Other Requests
376
409
 
377
410
  Public endpoints that aren't yet supported by the client can be called using `client.get`, `client.post`, `client.put`
@@ -9,6 +9,7 @@ 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']
@@ -12,6 +12,8 @@ require_relative 'endpoints/price'
12
12
  require_relative 'endpoints/quote'
13
13
  require_relative 'endpoints/sectors'
14
14
  require_relative 'endpoints/crypto'
15
+ require_relative 'endpoints/ref_data'
16
+ require_relative 'endpoints/stock_market'
15
17
 
16
18
  require_relative 'api/config'
17
19
  require_relative 'api/client'
@@ -15,6 +15,8 @@ module IEX
15
15
  include Endpoints::Price
16
16
  include Endpoints::Quote
17
17
  include Endpoints::Sectors
18
+ include Endpoints::RefData
19
+ include Endpoints::StockMarket
18
20
 
19
21
  include Cloud::Connection
20
22
  include Cloud::Request
@@ -0,0 +1,17 @@
1
+ module IEX
2
+ module Endpoints
3
+ module RefData
4
+ def ref_data_isin(isins, options = {})
5
+ response = post('ref-data/isin', { token: publishable_token, isin: isins }.merge(options))
6
+
7
+ if response.is_a?(Hash) # mapped option was set
8
+ response.transform_values do |rows|
9
+ rows&.map { |row| IEX::Resources::Symbol.new(row) }
10
+ end
11
+ else
12
+ response.map { |row| IEX::Resources::Symbol.new(row) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ module IEX
2
+ module Endpoints
3
+ module StockMarket
4
+ def stock_market_list(list_type, options = {})
5
+ get("stock/market/list/#{list_type}", { token: publishable_token }.merge(options)).map do |data|
6
+ IEX::Resources::Quote.new(data)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -13,3 +13,4 @@ require_relative 'resources/ohlc'
13
13
  require_relative 'resources/quote'
14
14
  require_relative 'resources/sectors'
15
15
  require_relative 'resources/crypto'
16
+ require_relative 'resources/symbol'
@@ -8,7 +8,7 @@ module IEX
8
8
  property 'week_52_high_dollar', from: 'week52high', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
9
9
  property 'week_52_low', from: 'week52low'
10
10
  property 'week_52_low_dollar', from: 'week52low', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
11
- property 'week_52_change'
11
+ property 'week_52_change', from: 'week52change'
12
12
  property 'week_52_change_dollar', from: 'week52change', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
13
13
  property 'dividend_yield', from: 'dividendYield'
14
14
  property 'ex_dividend_date', from: 'exDividendDate'
@@ -0,0 +1,10 @@
1
+ module IEX
2
+ module Resources
3
+ class Symbol < Resource
4
+ property 'exchange'
5
+ property 'iex_id', from: 'iexId'
6
+ property 'region'
7
+ property 'symbol'
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module IEX
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://cloud.iexapis.com/v1/ref-data/isin
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"isin":["US0378331005"],"token":"test-iex-api-secret-token"}'
8
+ string: '{"isin":["US0378331005"],"token":"test-iex-api-publishable-token"}'
9
9
  headers:
10
10
  Accept:
11
11
  - application/json; charset=utf-8
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cloud.iexapis.com/v1/ref-data/isin
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"token":"test-iex-api-publishable-token","isin":["US0378331005","US5949181045"],"mapped":true}'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ Content-Type:
13
+ - application/json; charset=utf-8
14
+ User-Agent:
15
+ - IEX Ruby Client/1.1.2
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Wed, 04 Mar 2020 09:45:05 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=b93327e2c9b4432f9c7ecb36396dcd4c; Max-Age=43200; Path=/; Expires=Wed,
35
+ 04 Mar 2020 21:45:05 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '100'
38
+ Iexcloud-Premium-Messages-Used:
39
+ - '0'
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ Strict-Transport-Security:
43
+ - max-age=15768000
44
+ Access-Control-Allow-Origin:
45
+ - "*"
46
+ Access-Control-Allow-Credentials:
47
+ - 'true'
48
+ Access-Control-Allow-Methods:
49
+ - GET, OPTIONS
50
+ Access-Control-Allow-Headers:
51
+ - Origin, X-Requested-With, Content-Type, Accept
52
+ body:
53
+ encoding: ASCII-8BIT
54
+ string: '{"US0378331005":[{"symbol":"AAPL","region":"US","exchange":"NAS","iexId":"IEX_4D48333344362D52"},{"symbol":"APC-GY","region":"DE","exchange":"ETR","iexId":"IEX_464D46474C312D52"}],"US5949181045":[{"symbol":"MSFT","region":"US","exchange":"NAS","iexId":"IEX_5038523343322D52"},{"symbol":"MSF-GY","region":"DE","exchange":"ETR","iexId":"IEX_4C42583859482D52"},{"symbol":"MSF-BB","region":"BE","exchange":"BRU","iexId":"IEX_5833345950432D52"}]}'
55
+ http_version: null
56
+ recorded_at: Wed, 04 Mar 2020 09:45:05 GMT
57
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cloud.iexapis.com/v1/ref-data/isin
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"token":"test-iex-api-publishable-token","isin":["WRONG12345"],"mapped":true}'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ Content-Type:
13
+ - application/json; charset=utf-8
14
+ User-Agent:
15
+ - IEX Ruby Client/1.1.2
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Wed, 25 Mar 2020 10:15:28 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '19'
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=9ddb19d57dea471f9855bacdb85a96a5; Max-Age=43200; Path=/; Expires=Wed,
35
+ 25 Mar 2020 22:15:28 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '100'
38
+ Iexcloud-Premium-Messages-Used:
39
+ - '0'
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ Strict-Transport-Security:
43
+ - max-age=15768000
44
+ Access-Control-Allow-Origin:
45
+ - "*"
46
+ Access-Control-Allow-Credentials:
47
+ - 'true'
48
+ Access-Control-Allow-Methods:
49
+ - GET, OPTIONS
50
+ Access-Control-Allow-Headers:
51
+ - Origin, X-Requested-With, Content-Type, Accept
52
+ body:
53
+ encoding: UTF-8
54
+ string: '{"WRONG12345":null}'
55
+ http_version: null
56
+ recorded_at: Wed, 25 Mar 2020 10:15:28 GMT
57
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/stock/market/list/mostactive?token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ Content-Type:
13
+ - application/json; charset=utf-8
14
+ User-Agent:
15
+ - IEX Ruby Client/1.1.2
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Wed, 04 Mar 2020 13:00:24 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=82c15565434a4dada8483b258390943b; Max-Age=43200; Path=/; Expires=Thu,
35
+ 05 Mar 2020 01:00:24 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '20'
38
+ Iexcloud-Premium-Messages-Used:
39
+ - '0'
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ Strict-Transport-Security:
43
+ - max-age=15768000
44
+ Access-Control-Allow-Origin:
45
+ - "*"
46
+ Access-Control-Allow-Credentials:
47
+ - 'true'
48
+ Access-Control-Allow-Methods:
49
+ - GET, OPTIONS
50
+ Access-Control-Allow-Headers:
51
+ - Origin, X-Requested-With, Content-Type, Accept
52
+ body:
53
+ encoding: ASCII-8BIT
54
+ string: '[{"symbol":"AMD","companyName":"Advanced Micro Devices, Inc.","primaryExchange":"NASDAQ","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":46.75,"latestSource":"Close","latestTime":"March
55
+ 3, 2020","latestUpdate":1583269200736,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":47.46,"previousVolume":102324726,"change":-0.71,"changePercent":-0.01496,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":69781992,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":54681605000,"peRatio":152.73,"week52High":59.27,"week52Low":21.04,"ytdChange":-0.062822,"lastTradeTime":1583269200603,"isUSMarketOpen":false},{"symbol":"BAC","companyName":"Bank
56
+ of America Corp.","primaryExchange":"New York Stock Exchange","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":27.75,"latestSource":"Close","latestTime":"March
57
+ 3, 2020","latestUpdate":1583269208334,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":29.37,"previousVolume":147776301,"change":-1.62,"changePercent":-0.05516,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":59385616,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":242216707500,"peRatio":10.03,"week52High":35.72,"week52Low":26.21,"ytdChange":-0.27654,"lastTradeTime":1583269208300,"isUSMarketOpen":false},{"symbol":"INO","companyName":"Inovio
58
+ Pharmaceuticals, Inc.","primaryExchange":"NASDAQ","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":7.45,"latestSource":"Close","latestTime":"March
59
+ 3, 2020","latestUpdate":1583269200743,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":4.39,"previousVolume":16179954,"change":3.06,"changePercent":0.69704,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":18795754,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":755139450,"peRatio":-6.32,"week52High":7.48,"week52Low":1.92,"ytdChange":2.017912,"lastTradeTime":1583269200378,"isUSMarketOpen":false},{"symbol":"GE","companyName":"General
60
+ Electric Co.","primaryExchange":"New York Stock Exchange","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":10.88,"latestSource":"Close","latestTime":"March
61
+ 3, 2020","latestUpdate":1583269204858,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":11.21,"previousVolume":124802207,"change":-0.33,"changePercent":-0.02944,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":71758664,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":95093702400,"peRatio":143.16,"week52High":13.26,"week52Low":7.65,"ytdChange":-0.117453,"lastTradeTime":1583269204815,"isUSMarketOpen":false},{"symbol":"F","companyName":"Ford
62
+ Motor Co.","primaryExchange":"New York Stock Exchange","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":6.97,"latestSource":"Close","latestTime":"March
63
+ 3, 2020","latestUpdate":1583269470045,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":7.2,"previousVolume":96766032,"change":-0.23,"changePercent":-0.03194,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":79183546,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":27636398500,"peRatio":237.88,"week52High":10.56,"week52Low":6.67,"ytdChange":-0.29202500000000003,"lastTradeTime":1583269200123,"isUSMarketOpen":false},{"symbol":"AAPL","companyName":"Apple,
64
+ Inc.","primaryExchange":"NASDAQ","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":289.32,"latestSource":"Close","latestTime":"March
65
+ 3, 2020","latestUpdate":1583269200249,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":298.81,"previousVolume":85349339,"change":-9.49,"changePercent":-0.03176,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":41771302,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":1265913873600,"peRatio":22.68,"week52High":327.85,"week52Low":169.5,"ytdChange":-0.06848399999999999,"lastTradeTime":1583269200389,"isUSMarketOpen":false},{"symbol":"MSFT","companyName":"Microsoft
66
+ Corp.","primaryExchange":"NASDAQ","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":164.51,"latestSource":"Close","latestTime":"March
67
+ 3, 2020","latestUpdate":1583269200720,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":172.79,"previousVolume":71030810,"change":-8.28,"changePercent":-0.04792,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":43623452,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":1251271285500,"peRatio":28.37,"week52High":190.7,"week52Low":108.8,"ytdChange":-0.023700999999999996,"lastTradeTime":1583269200282,"isUSMarketOpen":false},{"symbol":"T","companyName":"AT&T,
68
+ Inc.","primaryExchange":"New York Stock Exchange","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":36.3,"latestSource":"Close","latestTime":"March
69
+ 3, 2020","latestUpdate":1583269431180,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":37.18,"previousVolume":68432790,"change":-0.88,"changePercent":-0.02367,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":39604055,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":260375544000,"peRatio":19.09,"week52High":39.7,"week52Low":29.67,"ytdChange":-0.089548,"lastTradeTime":1583269199998,"isUSMarketOpen":false},{"symbol":"XOM","companyName":"Exxon
70
+ Mobil Corp.","primaryExchange":"New York Stock Exchange","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":51.3,"latestSource":"Close","latestTime":"March
71
+ 3, 2020","latestUpdate":1583269428549,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":53.88,"previousVolume":38127634,"change":-2.58,"changePercent":-0.04788,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":24981447,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":217111347000,"peRatio":15.29,"week52High":83.49,"week52Low":48.01,"ytdChange":-0.324326,"lastTradeTime":1583269199431,"isUSMarketOpen":false},{"symbol":"INTC","companyName":"Intel
72
+ Corp.","primaryExchange":"NASDAQ","calculationPrice":"close","open":null,"openTime":null,"close":null,"closeTime":null,"high":null,"low":null,"latestPrice":55.97,"latestSource":"Close","latestTime":"March
73
+ 3, 2020","latestUpdate":1583269200750,"latestVolume":null,"iexRealtimePrice":0,"iexRealtimeSize":0,"iexLastUpdated":0,"delayedPrice":null,"delayedPriceTime":null,"oddLotDelayedPrice":null,"oddLotDelayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":58.18,"previousVolume":43140304,"change":-2.21,"changePercent":-0.03799,"volume":null,"iexMarketPercent":null,"iexVolume":0,"avgTotalVolume":28110407,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":239383690000,"peRatio":11.7,"week52High":69.29,"week52Low":42.86,"ytdChange":-0.118036,"lastTradeTime":1583269200602,"isUSMarketOpen":false}]'
74
+ http_version: null
75
+ recorded_at: Wed, 04 Mar 2020 13:00:24 GMT
76
+ recorded_with: VCR 5.1.0
@@ -19,6 +19,7 @@ describe IEX::Resources::KeyStats do
19
19
  expect(subject.week_52_high_dollar).to eq '$136.04'
20
20
  expect(subject.week_52_low).to eq 95.92
21
21
  expect(subject.week_52_low_dollar).to eq '$95.92'
22
+ expect(subject.week_52_change).to eq 0.371641
22
23
  expect(subject.week_52_change_dollar).to eq '$0.37'
23
24
  end
24
25
 
@@ -3,14 +3,38 @@ require 'spec_helper'
3
3
  describe IEX::Api::Client do
4
4
  include_context 'client'
5
5
 
6
- describe 'ISIN Mapping', vcr: { cassette_name: 'ref-data/isin' } do
7
- subject do
8
- client.post('ref-data/isin', isin: ['US0378331005'], token: client.secret_token)
6
+ describe '#ref_data_isin', vcr: { cassette_name: 'ref-data/isin' } do
7
+ context 'without options' do
8
+ subject { client.ref_data_isin(['US0378331005']) }
9
+
10
+ it 'converts ISIN to IEX Cloud symbols' do
11
+ expect(subject.count).to eq(2)
12
+ expect(subject.first).to eq('exchange' => 'NAS', 'iex_id' => 'IEX_4D48333344362D52', 'region' => 'US', 'symbol' => 'AAPL')
13
+ expect(subject.last).to eq('exchange' => 'ETR', 'iex_id' => 'IEX_464D46474C312D52', 'region' => 'DE', 'symbol' => 'APC-GY')
14
+ end
9
15
  end
10
- it 'retrieves a ticker by ISIN' do
11
- expect(subject.count).to eq(2)
12
- expect(subject.first).to eq('exchange' => 'NAS', 'iexId' => 'IEX_4D48333344362D52', 'region' => 'US', 'symbol' => 'AAPL')
13
- expect(subject.last).to eq('exchange' => 'ETR', 'iexId' => 'IEX_464D46474C312D52', 'region' => 'DE', 'symbol' => 'APC-GY')
16
+
17
+ context 'with mapped option', vcr: { cassette_name: 'ref-data/isin_mapped' } do
18
+ subject { client.ref_data_isin(%w[US0378331005 US5949181045], mapped: true) }
19
+
20
+ it 'converts ISINs to IEX Cloud symbols mapped by ISIN' do
21
+ expect(subject.keys).to contain_exactly('US0378331005', 'US5949181045')
22
+
23
+ expect(subject['US0378331005'].first).to eq('exchange' => 'NAS', 'iex_id' => 'IEX_4D48333344362D52', 'region' => 'US', 'symbol' => 'AAPL')
24
+ expect(subject['US0378331005'].last).to eq('exchange' => 'ETR', 'iex_id' => 'IEX_464D46474C312D52', 'region' => 'DE', 'symbol' => 'APC-GY')
25
+
26
+ expect(subject['US5949181045'][0]).to eq('exchange' => 'NAS', 'iex_id' => 'IEX_5038523343322D52', 'region' => 'US', 'symbol' => 'MSFT')
27
+ expect(subject['US5949181045'][1]).to eq('exchange' => 'ETR', 'iex_id' => 'IEX_4C42583859482D52', 'region' => 'DE', 'symbol' => 'MSF-GY')
28
+ expect(subject['US5949181045'][2]).to eq('exchange' => 'BRU', 'iex_id' => 'IEX_5833345950432D52', 'region' => 'BE', 'symbol' => 'MSF-BB')
29
+ end
30
+
31
+ context 'with wrong ISIN', vcr: { cassette_name: 'ref-data/wrong_isin_mapped' } do
32
+ subject { client.ref_data_isin(%w[WRONG12345], mapped: true) }
33
+
34
+ it 'returns nil value for given ISIN' do
35
+ expect(subject).to eq('WRONG12345' => nil)
36
+ end
37
+ end
14
38
  end
15
39
  end
16
40
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe IEX::Endpoints::StockMarket do
4
+ include_context 'client'
5
+
6
+ describe '#stock_market_list', vcr: { cassette_name: 'stock_market/list_mostactive' } do
7
+ subject { client.stock_market_list(:mostactive) }
8
+
9
+ it 'retrieves a list of quotes' do
10
+ expect(subject).to all(be_a(IEX::Resources::Quote))
11
+ expect(subject.map(&:symbol)).to match_array(%w[AAPL AMD BAC F GE INO INTC MSFT T XOM])
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iex-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -178,7 +178,9 @@ files:
178
178
  - lib/iex/endpoints/ohlc.rb
179
179
  - lib/iex/endpoints/price.rb
180
180
  - lib/iex/endpoints/quote.rb
181
+ - lib/iex/endpoints/ref_data.rb
181
182
  - lib/iex/endpoints/sectors.rb
183
+ - lib/iex/endpoints/stock_market.rb
182
184
  - lib/iex/errors.rb
183
185
  - lib/iex/errors/client_error.rb
184
186
  - lib/iex/errors/permission_denied_error.rb
@@ -199,6 +201,7 @@ files:
199
201
  - lib/iex/resources/quote.rb
200
202
  - lib/iex/resources/resource.rb
201
203
  - lib/iex/resources/sectors.rb
204
+ - lib/iex/resources/symbol.rb
202
205
  - lib/iex/version.rb
203
206
  - spec/fixtures/iex/chart/1d.yml
204
207
  - spec/fixtures/iex/chart/20190306.yml
@@ -236,8 +239,11 @@ files:
236
239
  - spec/fixtures/iex/quote/invalid.yml
237
240
  - spec/fixtures/iex/quote/msft.yml
238
241
  - spec/fixtures/iex/ref-data/isin.yml
242
+ - spec/fixtures/iex/ref-data/isin_mapped.yml
243
+ - spec/fixtures/iex/ref-data/wrong_isin_mapped.yml
239
244
  - spec/fixtures/iex/sectors/invalid.yml
240
245
  - spec/fixtures/iex/sectors/sectors-performance.yml
246
+ - spec/fixtures/iex/stock_market/list_mostactive.yml
241
247
  - spec/iex/client_spec.rb
242
248
  - spec/iex/config_spec.rb
243
249
  - spec/iex/endpoints/chart_spec.rb
@@ -255,6 +261,7 @@ files:
255
261
  - spec/iex/endpoints/quote_spec.rb
256
262
  - spec/iex/endpoints/ref_data_spec.rb
257
263
  - spec/iex/endpoints/sectors_spec.rb
264
+ - spec/iex/endpoints/stock_market_spec.rb
258
265
  - spec/iex/resources/resource_spec.rb
259
266
  - spec/iex/version_spec.rb
260
267
  - spec/spec_helper.rb
@@ -272,14 +279,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
279
  requirements:
273
280
  - - ">="
274
281
  - !ruby/object:Gem::Version
275
- version: '0'
282
+ version: 2.3.0
276
283
  required_rubygems_version: !ruby/object:Gem::Requirement
277
284
  requirements:
278
285
  - - ">="
279
286
  - !ruby/object:Gem::Version
280
287
  version: 1.3.6
281
288
  requirements: []
282
- rubygems_version: 3.0.3
289
+ rubygems_version: 3.0.6
283
290
  signing_key:
284
291
  specification_version: 4
285
292
  summary: IEX Finance API Ruby client with support for retrieving stock quotes.
@@ -320,8 +327,11 @@ test_files:
320
327
  - spec/fixtures/iex/quote/invalid.yml
321
328
  - spec/fixtures/iex/quote/msft.yml
322
329
  - spec/fixtures/iex/ref-data/isin.yml
330
+ - spec/fixtures/iex/ref-data/isin_mapped.yml
331
+ - spec/fixtures/iex/ref-data/wrong_isin_mapped.yml
323
332
  - spec/fixtures/iex/sectors/invalid.yml
324
333
  - spec/fixtures/iex/sectors/sectors-performance.yml
334
+ - spec/fixtures/iex/stock_market/list_mostactive.yml
325
335
  - spec/iex/client_spec.rb
326
336
  - spec/iex/config_spec.rb
327
337
  - spec/iex/endpoints/chart_spec.rb
@@ -339,6 +349,7 @@ test_files:
339
349
  - spec/iex/endpoints/quote_spec.rb
340
350
  - spec/iex/endpoints/ref_data_spec.rb
341
351
  - spec/iex/endpoints/sectors_spec.rb
352
+ - spec/iex/endpoints/stock_market_spec.rb
342
353
  - spec/iex/resources/resource_spec.rb
343
354
  - spec/iex/version_spec.rb
344
355
  - spec/spec_helper.rb