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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +66 -35
- data/lib/iex-ruby-client.rb +1 -0
- data/lib/iex/resources/key_stats.rb +12 -0
- data/lib/iex/version.rb +1 -1
- data/spec/fixtures/iex/key_stats/invalid.yml +7 -41
- data/spec/fixtures/iex/key_stats/msft.yml +11 -43
- data/spec/iex/endpoints/key_stats_spec.rb +41 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc54c99b44f20089d95fa121c4bdf07c799bcf85
|
4
|
+
data.tar.gz: c8ffcde3452f7141c61342f510d2700f6c0a0bbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc798095fd893860bcf460bd836c6c0c8922f4a5831df83184842a2a5be537008220f51e42a5bdfab29a791b0ef7d9f28fd50b9781e59d8fc7d0a4b9238de331
|
7
|
+
data.tar.gz: cbad4c6f007f914c7548a92cdc5c9b0a77ea60c7b9f4dfd73a38c96930d8ccfca0f0ae0f436e6709e207c4afa91951b73f80c906361d86577b9757fe57ae8a62
|
data/CHANGELOG.md
CHANGED
@@ -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(
|
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.
|
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.
|
197
|
-
key_stats.
|
198
|
-
key_stats.
|
199
|
-
key_stats.
|
200
|
-
key_stats.
|
201
|
-
key_stats.
|
202
|
-
key_stats.
|
203
|
-
key_stats.
|
204
|
-
key_stats.
|
205
|
-
key_stats.
|
206
|
-
key_stats.float #
|
207
|
-
key_stats.
|
208
|
-
key_stats.
|
209
|
-
key_stats.
|
210
|
-
key_stats.
|
211
|
-
key_stats.
|
212
|
-
key_stats.
|
213
|
-
key_stats.
|
214
|
-
key_stats.
|
215
|
-
key_stats.
|
216
|
-
key_stats.
|
217
|
-
key_stats.
|
218
|
-
key_stats.
|
219
|
-
key_stats.
|
220
|
-
key_stats.
|
221
|
-
key_stats.
|
222
|
-
key_stats.
|
223
|
-
key_stats.
|
224
|
-
key_stats.
|
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.
|
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: '
|
335
|
-
|
365
|
+
publishable_token: ENV['IEX_API_PUBLISHABLE_TOKEN'],
|
366
|
+
endpoint: 'https://sandbox.iexapis.com/v1'
|
336
367
|
)
|
337
368
|
```
|
338
369
|
|
data/lib/iex-ruby-client.rb
CHANGED
@@ -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
|
data/lib/iex/version.rb
CHANGED
@@ -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
|
-
-
|
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
|
-
-
|
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=
|
33
|
-
|
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:
|
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
|
-
-
|
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
|
-
-
|
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=
|
33
|
-
|
34
|
-
|
35
|
-
- "
|
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.
|
84
|
-
Corp.","sharesOutstanding":
|
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:
|
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
|
13
|
-
expect(subject.market_cap_dollars).to eq '$
|
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
|
18
|
-
expect(subject.week_52_high_dollar).to eq '$
|
19
|
-
expect(subject.week_52_low).to eq
|
20
|
-
expect(subject.week_52_low_dollar).to eq '$
|
21
|
-
expect(subject.week_52_change_dollar).to eq '$0.
|
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.
|
26
|
-
expect(subject.
|
27
|
-
expect(subject.
|
28
|
-
expect(subject.
|
29
|
-
expect(subject.
|
30
|
-
expect(subject.
|
31
|
-
expect(subject.
|
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.
|
36
|
-
expect(subject.
|
37
|
-
expect(subject.
|
38
|
-
expect(subject.
|
39
|
-
expect(subject.
|
40
|
-
expect(subject.
|
41
|
-
expect(subject.
|
42
|
-
expect(subject.
|
43
|
-
expect(subject.
|
44
|
-
expect(subject.
|
45
|
-
expect(subject.
|
46
|
-
expect(subject.
|
47
|
-
expect(subject.
|
48
|
-
expect(subject.
|
49
|
-
expect(subject.
|
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.
|
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-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|