iex-ruby-client 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: df29afbbbd95d15992840fdfe66fd8fa31ed1cee
4
- data.tar.gz: df551117e4b8dcfa5e223a765c1fa97e7bc4bedb
3
+ metadata.gz: cc54c99b44f20089d95fa121c4bdf07c799bcf85
4
+ data.tar.gz: c8ffcde3452f7141c61342f510d2700f6c0a0bbf
5
5
  SHA512:
6
- metadata.gz: b28d4ea0c36db77958e86a5c0ad347a04876a7bd8e51582f853435316444f0b7277c1a1b98bd299e4b77f89821ec89dc58e9923c45e631e961433dcc5dfe2aa9
7
- data.tar.gz: 34f851cf3b8e46f2475531717055c1a9cf9ca7abb96675fc50c88a766a5ff6f92f6f52459fda71e1d046eba4ade185d7e368639222195a662c8ee1bba957c4e9
6
+ metadata.gz: cc798095fd893860bcf460bd836c6c0c8922f4a5831df83184842a2a5be537008220f51e42a5bdfab29a791b0ef7d9f28fd50b9781e59d8fc7d0a4b9238de331
7
+ data.tar.gz: cbad4c6f007f914c7548a92cdc5c9b0a77ea60c7b9f4dfd73a38c96930d8ccfca0f0ae0f436e6709e207c4afa91951b73f80c906361d86577b9757fe57ae8a62
@@ -1,3 +1,8 @@
1
+ ### 1.0.1 (2019/07/08)
2
+
3
+ * [#50](https://github.com/dblock/iex-ruby-client/pull/50): Add missing properties for key stats API - [@bingxie](https://github.com/bingxie).
4
+ * Fix: `uninitialized constant IEX::Endpoints::Chart::Date (NameError)` - [@dblock](https://github.com/dblock).
5
+
1
6
  ### 1.0.0 (2019/04/23)
2
7
 
3
8
  * [#42](https://github.com/dblock/iex-ruby-client/pull/42): Migrated to the IEX Cloud API - [@bingxie](https://github.com/bingxie).
data/README.md CHANGED
@@ -47,20 +47,24 @@ Run `bundle install`.
47
47
 
48
48
  ### Get an API Token
49
49
 
50
- Create an account on [IEX Cloud](https://iexcloud.io) and get a publishable token from the cloud console.
50
+ Create an account on [IEX Cloud](https://iexcloud.io) and get a publishable token from the IEX cloud console. You should use a sandbox token and endpoint for testing.
51
51
 
52
52
  ### Configure
53
53
 
54
54
  ```ruby
55
55
  IEX::Api.configure do |config|
56
56
  config.publishable_token = 'token' # defaults to ENV['IEX_API_PUBLISHABLE_TOKEN']
57
+ config.endpoint = 'https://sandbox.iexapis.com/v1' # defaults to 'https://cloud.iexapis.com/v1'
57
58
  end
58
59
  ```
59
60
 
60
61
  You can also configure an instance of a client directly.
61
62
 
62
63
  ```ruby
63
- client = IEX::Api::Client.new(publishable_token: 'token')
64
+ client = IEX::Api::Client.new(
65
+ publishable_token: 'token',
66
+ endpoint: 'https://sandbox.iexapis.com/v1'
67
+ )
64
68
  ```
65
69
 
66
70
  ### Get a Single Price
@@ -68,7 +72,7 @@ client = IEX::Api::Client.new(publishable_token: 'token')
68
72
  Fetches a single number, being the IEX real time price, the 15 minute delayed market price, or the previous close price.
69
73
 
70
74
  ```ruby
71
- client.get('MSFT') # 93.78
75
+ client.price('MSFT') # 93.78
72
76
  ```
73
77
 
74
78
  See [#price](https://iexcloud.io/docs/api/#price) for detailed documentation.
@@ -186,6 +190,19 @@ client.chart('MSFT', Date.new(2018, 3, 26)) # a specific date
186
190
  client.chart('MSFT', '1d', chart_interval: 10) # every n-th data point
187
191
  ```
188
192
 
193
+ Note that calling the chart API weighs more than 1 IEX message (you pay more than 1 call).
194
+
195
+ ```
196
+ # 1 message per minute capped at 50 messages to intraday_prices
197
+ client.chart('MSFT', '1d')
198
+
199
+ # 2x22 trading days = 44 messages to historical_close_prices
200
+ client.chart('MSFT', '1m', chart_close_only: true)
201
+
202
+ # 2x251 trading days = 502 messages to historical_close_prices
203
+ client.chart('MSFT', '1y', chart_close_only: true)
204
+ ```
205
+
189
206
  ### Get Key Stats
190
207
 
191
208
  Fetches company's key stats for a symbol.
@@ -193,35 +210,48 @@ Fetches company's key stats for a symbol.
193
210
  ```ruby
194
211
  key_stats = client.key_stats('MSFT')
195
212
 
196
- key_stats.market_cap # 825814890000
197
- key_stats.market_cap_dollars # '$825,814,890,000'
198
- key_stats.week_52_high # 111.15
199
- key_stats.week_52_high_dollar # '$111.15'
200
- key_stats.week_52_low # 71.28
201
- key_stats.week_52_low_dollar # '$71.28'
202
- key_stats.week_52_change_dollar # '$51.77'
203
- key_stats.dividend_yield # 1.5617738
204
- key_stats.ex_dividend_date # '2018-08-15 00:00:00.0'
205
- key_stats.shares_outstanding # 7677000000
206
- key_stats.float # 7217387757
207
- key_stats.ttm_eps # 3.51
208
- key_stats.day_200_moving_avg # 91.99065
209
- key_stats.day_50_moving_avg # 102.2528
210
- key_stats.year_5_change_percent # 2.85141424991049
211
- key_stats.year_5_change_percent_s # '+285.14%'
212
- key_stats.year_2_change_percent # 0.9732002824884664
213
- key_stats.year_2_change_percent_s # '+97.32%'
214
- key_stats.year_1_change_percent # 0.5200287133805482
215
- key_stats.year_1_change_percent_s # '+52.00%'
216
- key_stats.ytd_change_percent # 0.2628699562098638
217
- key_stats.month_6_change_percent # 0.23345097958275707
218
- key_stats.month_6_change_percent_s # '+23.35%'
219
- key_stats.month_3_change_percent # 0.14846686026648437
220
- key_stats.month_3_change_percent_s # '+14.85%'
221
- key_stats.month_1_change_percent # 0.08601716304896513
222
- key_stats.month_1_change_percent_s # '+8.60%'
223
- key_stats.day_5_change_percent # -0.0010215453194652084
224
- key_stats.day_5_change_percent_s # '-0.10%'
213
+ key_stats.week_52_change_dollar # "$0.37"
214
+ key_stats.week_52_high # 136.04
215
+ key_stats.week_52_high_dollar # "$136.04"
216
+ key_stats.week_52_low # 95.92,
217
+ key_stats.week_52_low_dollar # "$95.92"
218
+ key_stats.market_cap # 990869169557
219
+ key_stats.market_cap_dollars # "$990,869,169,557"
220
+ key_stats.employees # 133074
221
+ key_stats.day_200_moving_avg # 112.43
222
+ key_stats.day_50_moving_avg # 121
223
+ key_stats.float # 7694414092
224
+ key_stats.avg_10_volume # 25160156.2
225
+ key_stats.avg_30_volume # 23123700.13
226
+ key_stats.ttm_eps # 4.66
227
+ key_stats.ttm_dividend_rate # 1.8
228
+ key_stats.company_name # "Microsoft Corp."
229
+ key_stats.shares_outstanding # 7849945172
230
+ key_stats.max_change_percent # 4.355607
231
+ key_stats.year_5_change_percent # 2.32987
232
+ key_stats.year_5_change_percent_s # "+232.99%"
233
+ key_stats.year_2_change_percent # 0.84983
234
+ key_stats.year_2_change_percent_s # "+84.98%"
235
+ key_stats.year_1_change_percent # 0.383503
236
+ key_stats.year_1_change_percent_s # "+38.35%"
237
+ key_stats.ytd_change_percent # 0.270151
238
+ key_stats.ytd_change_percent_s # "+27.02%"
239
+ key_stats.month_6_change_percent # 0.208977
240
+ key_stats.month_6_change_percent_s # "+20.90%"
241
+ key_stats.month_3_change_percent # 0.212188
242
+ key_stats.month_3_change_percent_s # "+21.22%"
243
+ key_stats.month_1_change_percent # 0.076335
244
+ key_stats.month_1_change_percent_s # "+7.63%"
245
+ key_stats.day_30_change_percent # 0.089589
246
+ key_stats.day_30_change_percent_s # "+8.96%"
247
+ key_stats.day_5_change_percent # -0.010013
248
+ key_stats.day_5_change_percent_s # "-1.00%"
249
+ key_stats.next_dividend_date # "2019-05-21"
250
+ key_stats.dividend_yield # 0.014087248841960684
251
+ key_stats.next_earnings_date # "2019-07-29"
252
+ key_stats.ex_dividend_date # "2019-05-24"
253
+ key_stats.pe_ratio # 29.47
254
+ key_stats.beta # 1.4135449089973444
225
255
  ```
226
256
 
227
257
  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.
@@ -325,14 +355,15 @@ You can configure client options globally or directly with a `IEX::Api::Client`
325
355
 
326
356
  ```ruby
327
357
  IEX::Api::Client.configure do |config|
328
- config.user_agent = 'IEX Ruby Client/1.0.0'
358
+ config.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
359
+ config.endpoint = 'https://sandbox.iexapis.com/v1' # use sandbox environment
329
360
  end
330
361
  ```
331
362
 
332
363
  ```ruby
333
364
  client = IEX::Api::Client.new(
334
- publishable_token: 'token',
335
- user_agent: 'IEX Ruby Client/1.0.0'
365
+ publishable_token: ENV['IEX_API_PUBLISHABLE_TOKEN'],
366
+ endpoint: 'https://sandbox.iexapis.com/v1'
336
367
  )
337
368
  ```
338
369
 
@@ -3,6 +3,7 @@ require 'faraday_middleware'
3
3
  require 'faraday_middleware/response_middleware'
4
4
  require 'hashie'
5
5
  require 'money_helper'
6
+ require 'date'
6
7
 
7
8
  require_relative 'iex/version'
8
9
  require_relative 'iex/errors'
@@ -24,6 +24,7 @@ module IEX
24
24
  property 'year_1_change_percent', from: 'year1ChangePercent'
25
25
  property 'year_1_change_percent_s', from: 'year1ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
26
26
  property 'ytd_change_percent', from: 'ytdChangePercent'
27
+ property 'ytd_change_percent_s', from: 'ytdChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
27
28
  property 'month_6_change_percent', from: 'month6ChangePercent'
28
29
  property 'month_6_change_percent_s', from: 'month6ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
29
30
  property 'month_3_change_percent', from: 'month3ChangePercent'
@@ -32,6 +33,17 @@ module IEX
32
33
  property 'month_1_change_percent_s', from: 'month1ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
33
34
  property 'day_5_change_percent', from: 'day5ChangePercent'
34
35
  property 'day_5_change_percent_s', from: 'day5ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
36
+ property 'employees'
37
+ property 'avg_10_volume', from: 'avg10Volume'
38
+ property 'avg_30_volume', from: 'avg30Volume'
39
+ property 'ttm_dividend_rate', from: 'ttmDividendRate'
40
+ property 'max_change_percent', from: 'maxChangePercent'
41
+ property 'day_30_change_percent', from: 'day30ChangePercent'
42
+ property 'day_30_change_percent_s', from: 'day30ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
43
+ property 'next_dividend_date', from: 'nextDividendDate'
44
+ property 'next_earnings_date', from: 'nextEarningsDate'
45
+ property 'pe_ratio', from: 'peRatio'
46
+ property 'beta'
35
47
 
36
48
  def initialize(data = {})
37
49
  super
@@ -1,3 +1,3 @@
1
1
  module IEX
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -7,12 +7,12 @@ http_interactions:
7
7
  encoding: US-ASCII
8
8
  string: ""
9
9
  headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
10
12
  User-Agent:
11
- - Faraday v0.15.4
13
+ - IEX Ruby Client/1.0.1
12
14
  Accept-Encoding:
13
15
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
16
  response:
17
17
  status:
18
18
  code: 404
@@ -21,7 +21,7 @@ http_interactions:
21
21
  Server:
22
22
  - nginx
23
23
  Date:
24
- - Fri, 05 Apr 2019 11:12:07 GMT
24
+ - Thu, 02 May 2019 12:12:52 GMT
25
25
  Content-Type:
26
26
  - text/html; charset=utf-8
27
27
  Transfer-Encoding:
@@ -29,42 +29,8 @@ http_interactions:
29
29
  Connection:
30
30
  - keep-alive
31
31
  Set-Cookie:
32
- - ctoken=7789b1a215e44d0fb0f4f533454ee0e4; Max-Age=43200; Path=/; Expires=Fri,
33
- 05 Apr 2019 23:12:07 GMT
34
- Content-Security-Policy:
35
- - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
36
- 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
37
- https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
38
- https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
39
- data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
40
- https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
41
- https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
42
- wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
43
- https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
44
- https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
45
- wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
46
- 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
47
- https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
48
- https://js.intercomcdn.com/ https://www.googletagmanager.com;"
49
- X-Content-Security-Policy:
50
- - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
51
- 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
52
- https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
53
- https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
54
- data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
55
- https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
56
- https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
57
- wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
58
- https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
59
- https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
60
- wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
61
- 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
62
- https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
63
- https://js.intercomcdn.com/ https://www.googletagmanager.com;"
64
- Frame-Options:
65
- - SAMEORIGIN
66
- X-Frame-Options:
67
- - SAMEORIGIN
32
+ - ctoken=ef64ea7432894da3a5df0d13ec3a1d5a; Max-Age=43200; Path=/; Expires=Fri,
33
+ 03 May 2019 00:12:52 GMT
68
34
  Strict-Transport-Security:
69
35
  - max-age=15768000
70
36
  Access-Control-Allow-Origin:
@@ -79,5 +45,5 @@ http_interactions:
79
45
  encoding: ASCII-8BIT
80
46
  string: Unknown symbol
81
47
  http_version:
82
- recorded_at: Fri, 05 Apr 2019 11:12:07 GMT
48
+ recorded_at: Thu, 02 May 2019 12:12:52 GMT
83
49
  recorded_with: VCR 4.0.0
@@ -7,12 +7,12 @@ http_interactions:
7
7
  encoding: US-ASCII
8
8
  string: ""
9
9
  headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
10
12
  User-Agent:
11
- - Faraday v0.15.4
13
+ - IEX Ruby Client/1.0.1
12
14
  Accept-Encoding:
13
15
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -21,7 +21,7 @@ http_interactions:
21
21
  Server:
22
22
  - nginx
23
23
  Date:
24
- - Fri, 05 Apr 2019 11:12:06 GMT
24
+ - Thu, 02 May 2019 12:12:04 GMT
25
25
  Content-Type:
26
26
  - application/json; charset=utf-8
27
27
  Transfer-Encoding:
@@ -29,42 +29,10 @@ http_interactions:
29
29
  Connection:
30
30
  - keep-alive
31
31
  Set-Cookie:
32
- - ctoken=d97d88c8b53e4d2a8bb9f9dd1d48984f; Max-Age=43200; Path=/; Expires=Fri,
33
- 05 Apr 2019 23:12:06 GMT
34
- Content-Security-Policy:
35
- - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
36
- 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
37
- https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
38
- https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
39
- data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
40
- https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
41
- https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
42
- wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
43
- https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
44
- https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
45
- wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
46
- 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
47
- https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
48
- https://js.intercomcdn.com/ https://www.googletagmanager.com;"
49
- X-Content-Security-Policy:
50
- - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
51
- 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
52
- https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
53
- https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
54
- data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
55
- https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
56
- https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
57
- wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
58
- https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
59
- https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
60
- wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
61
- 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
62
- https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
63
- https://js.intercomcdn.com/ https://www.googletagmanager.com;"
64
- Frame-Options:
65
- - SAMEORIGIN
66
- X-Frame-Options:
67
- - SAMEORIGIN
32
+ - ctoken=8df9fdfb440744638edd9bfdc8e0d27b; Max-Age=43200; Path=/; Expires=Fri,
33
+ 03 May 2019 00:12:04 GMT
34
+ Iexcloud-Messages-Used:
35
+ - "5"
68
36
  X-Content-Type-Options:
69
37
  - nosniff
70
38
  Strict-Transport-Security:
@@ -80,8 +48,8 @@ http_interactions:
80
48
  body:
81
49
  encoding: ASCII-8BIT
82
50
  string:
83
- '{"week52change":0.292055,"week52high":120.82,"week52low":89.48,"marketcap":915754985600,"employees":131000,"day200MovingAvg":108.04,"day50MovingAvg":111.56,"float":7541169096,"avg10Volume":23716223.6,"avg30Volume":26552395.97,"ttmEPS":4.35,"ttmDividendRate":1.76,"companyName":"Microsoft
84
- Corp.","sharesOutstanding":7672210000,"maxChangePercent":3.901848,"year5ChangePercent":1.998995,"year2ChangePercent":0.820622,"year1ChangePercent":0.292055,"ytdChangePercent":0.18038,"month6ChangePercent":0.064479,"month3ChangePercent":0.169508,"month1ChangePercent":0.068577,"day30ChangePercent":0.075606,"day5ChangePercent":0.01204,"nextDividendRate":null,"nextDividendDate":"2019-05-15","dividendYield":0.014745308310991957,"nextEarningsDate":"2019-04-25","exDividendDate":"2019-05-15","peRatio":27.44}'
51
+ '{"week52change":0.371641,"week52high":136.04,"week52low":95.92,"marketcap":990869169557,"employees":133074,"day200MovingAvg":112.43,"day50MovingAvg":121,"float":7694414092,"avg10Volume":25160156.2,"avg30Volume":23123700.13,"ttmEPS":4.66,"ttmDividendRate":1.8,"companyName":"Microsoft
52
+ Corp.","sharesOutstanding":7849945172,"maxChangePercent":4.355607,"year5ChangePercent":2.32987,"year2ChangePercent":0.84983,"year1ChangePercent":0.383503,"ytdChangePercent":0.270151,"month6ChangePercent":0.208977,"month3ChangePercent":0.212188,"month1ChangePercent":0.076335,"day30ChangePercent":0.089589,"day5ChangePercent":-0.010013,"nextDividendDate":"2019-05-21","dividendYield":0.014087248841960684,"nextEarningsDate":"2019-07-29","exDividendDate":"2019-05-24","peRatio":29.47,"beta":1.4135449089973444}'
85
53
  http_version:
86
- recorded_at: Fri, 05 Apr 2019 11:12:06 GMT
54
+ recorded_at: Thu, 02 May 2019 12:12:04 GMT
87
55
  recorded_with: VCR 4.0.0
@@ -9,44 +9,56 @@ describe IEX::Resources::KeyStats do
9
9
  end
10
10
  it 'retrieves a keyStats' do
11
11
  expect(subject.company_name).to eq 'Microsoft Corp.'
12
- expect(subject.market_cap).to eq 915_754_985_600
13
- expect(subject.market_cap_dollars).to eq '$915,754,985,600'
12
+ expect(subject.market_cap).to eq 990_869_169_557
13
+ expect(subject.market_cap_dollars).to eq '$990,869,169,557'
14
+ expect(subject.employees).to eq 133_074
14
15
  end
15
16
 
16
17
  it 'weekly stats' do
17
- expect(subject.week_52_high).to eq 120.82
18
- expect(subject.week_52_high_dollar).to eq '$120.82'
19
- expect(subject.week_52_low).to eq 89.48
20
- expect(subject.week_52_low_dollar).to eq '$89.48'
21
- expect(subject.week_52_change_dollar).to eq '$0.29'
18
+ expect(subject.week_52_high).to eq 136.04
19
+ expect(subject.week_52_high_dollar).to eq '$136.04'
20
+ expect(subject.week_52_low).to eq 95.92
21
+ expect(subject.week_52_low_dollar).to eq '$95.92'
22
+ expect(subject.week_52_change_dollar).to eq '$0.37'
22
23
  end
23
24
 
24
25
  it 'general stats' do
25
- expect(subject.dividend_yield).to eq 0.014745308310991957
26
- expect(subject.ex_dividend_date).to eq '2019-05-15'
27
- expect(subject.shares_outstanding).to eq 7_672_210_000
28
- expect(subject.float).to eq 7_541_169_096
29
- expect(subject.ttm_eps).to eq 4.35
30
- expect(subject.day_200_moving_avg).to eq 108.04
31
- expect(subject.day_50_moving_avg).to eq 111.56
26
+ expect(subject.ttm_dividend_rate).to eq 1.8
27
+ expect(subject.dividend_yield).to eq 0.014087248841960684
28
+ expect(subject.ex_dividend_date).to eq '2019-05-24'
29
+ expect(subject.shares_outstanding).to eq 7_849_945_172
30
+ expect(subject.float).to eq 7_694_414_092
31
+ expect(subject.ttm_eps).to eq 4.66
32
+ expect(subject.next_dividend_date).to eq '2019-05-21'
33
+ expect(subject.next_earnings_date).to eq '2019-07-29'
34
+ expect(subject.pe_ratio).to eq 29.47
35
+ expect(subject.beta).to eq 1.4135449089973444
36
+ expect(subject.day_200_moving_avg).to eq 112.43
37
+ expect(subject.day_50_moving_avg).to eq 121
32
38
  end
33
39
 
34
40
  it 'changes stats' do
35
- expect(subject.year_5_change_percent).to be 1.998995
36
- expect(subject.year_5_change_percent_s).to eq '+199.90%'
37
- expect(subject.year_2_change_percent).to eq 0.820622
38
- expect(subject.year_2_change_percent_s).to eq '+82.06%'
39
- expect(subject.year_1_change_percent).to eq 0.292055
40
- expect(subject.year_1_change_percent_s).to eq '+29.21%'
41
- expect(subject.ytd_change_percent).to eq 0.18038
42
- expect(subject.month_6_change_percent).to eq 0.064479
43
- expect(subject.month_6_change_percent_s).to eq '+6.45%'
44
- expect(subject.month_3_change_percent).to eq 0.169508
45
- expect(subject.month_3_change_percent_s).to eq '+16.95%'
46
- expect(subject.month_1_change_percent).to eq 0.068577
47
- expect(subject.month_1_change_percent_s).to eq '+6.86%'
48
- expect(subject.day_5_change_percent).to eq 0.01204
49
- expect(subject.day_5_change_percent_s).to eq '+1.20%'
41
+ expect(subject.avg_10_volume).to be 25_160_156.2
42
+ expect(subject.avg_30_volume).to be 23_123_700.13
43
+ expect(subject.max_change_percent).to eq 4.355607
44
+ expect(subject.year_5_change_percent).to be 2.32987
45
+ expect(subject.year_5_change_percent_s).to eq '+232.99%'
46
+ expect(subject.year_2_change_percent).to eq 0.84983
47
+ expect(subject.year_2_change_percent_s).to eq '+84.98%'
48
+ expect(subject.year_1_change_percent).to eq 0.383503
49
+ expect(subject.year_1_change_percent_s).to eq '+38.35%'
50
+ expect(subject.ytd_change_percent).to eq 0.270151
51
+ expect(subject.ytd_change_percent_s).to eq '+27.02%'
52
+ expect(subject.month_6_change_percent).to eq 0.208977
53
+ expect(subject.month_6_change_percent_s).to eq '+20.90%'
54
+ expect(subject.month_3_change_percent).to eq 0.212188
55
+ expect(subject.month_3_change_percent_s).to eq '+21.22%'
56
+ expect(subject.month_1_change_percent).to eq 0.076335
57
+ expect(subject.month_1_change_percent_s).to eq '+7.63%'
58
+ expect(subject.day_5_change_percent).to eq(-0.010013)
59
+ expect(subject.day_5_change_percent_s).to eq '-1.00%'
60
+ expect(subject.day_30_change_percent).to eq 0.089589
61
+ expect(subject.day_30_change_percent_s).to eq '+8.96%'
50
62
  end
51
63
  end
52
64
 
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday