iex-ruby-client 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +1 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +37 -7
- data/Dangerfile +2 -2
- data/Gemfile +2 -2
- data/README.md +159 -37
- data/iex-ruby-client.gemspec +3 -2
- data/lib/iex-ruby-client.rb +1 -0
- data/lib/iex/api.rb +3 -0
- data/lib/iex/api/client.rb +3 -0
- data/lib/iex/api/config.rb +2 -0
- data/lib/iex/cloud/connection.rb +21 -19
- data/lib/iex/cloud/request.rb +1 -1
- data/lib/iex/cloud/response.rb +1 -1
- data/lib/iex/endpoints/chart.rb +5 -6
- data/lib/iex/endpoints/company.rb +1 -1
- data/lib/iex/endpoints/crypto.rb +1 -1
- data/lib/iex/endpoints/dividends.rb +1 -1
- data/lib/iex/endpoints/earnings.rb +1 -1
- data/lib/iex/endpoints/income.rb +13 -0
- data/lib/iex/endpoints/key_stats.rb +1 -1
- data/lib/iex/endpoints/largest_trades.rb +1 -1
- data/lib/iex/endpoints/logo.rb +1 -1
- data/lib/iex/endpoints/news.rb +1 -1
- data/lib/iex/endpoints/ohlc.rb +2 -2
- data/lib/iex/endpoints/price.rb +1 -1
- data/lib/iex/endpoints/quote.rb +1 -1
- data/lib/iex/endpoints/ref_data.rb +22 -0
- data/lib/iex/endpoints/sectors.rb +1 -1
- data/lib/iex/endpoints/stock_market.rb +11 -0
- data/lib/iex/resources.rb +3 -0
- data/lib/iex/resources/chart.rb +9 -14
- data/lib/iex/resources/company.rb +1 -0
- data/lib/iex/resources/income.rb +36 -0
- data/lib/iex/resources/key_stats.rb +14 -2
- data/lib/iex/resources/quote.rb +15 -5
- data/lib/iex/resources/resource.rb +1 -1
- data/lib/iex/resources/symbol.rb +10 -0
- data/lib/iex/resources/symbols.rb +19 -0
- data/lib/iex/version.rb +1 -1
- data/spec/fixtures/iex/chart/1d.yml +440 -473
- data/spec/fixtures/iex/chart/20190306.yml +440 -473
- data/spec/fixtures/iex/chart/bad_option.yml +47 -81
- data/spec/fixtures/iex/chart/chartInterval.yml +89 -122
- data/spec/fixtures/iex/chart/dynamic/1m.yml +73 -107
- data/spec/fixtures/iex/chart/invalid.yml +47 -81
- data/spec/fixtures/iex/chart/msft.yml +74 -107
- data/spec/fixtures/iex/income/invalid.yml +49 -0
- data/spec/fixtures/iex/income/msft.yml +53 -0
- data/spec/fixtures/iex/income/nsrgy.yml +55 -0
- data/spec/fixtures/iex/key_stats/invalid.yml +7 -41
- data/spec/fixtures/iex/key_stats/msft.yml +11 -43
- data/spec/fixtures/iex/ref-data/isin.yml +57 -0
- data/spec/fixtures/iex/ref-data/isin_mapped.yml +57 -0
- data/spec/fixtures/iex/ref-data/symbols.yml +9002 -0
- data/spec/fixtures/iex/ref-data/wrong_isin_mapped.yml +57 -0
- data/spec/fixtures/iex/stock_market/list_mostactive.yml +76 -0
- data/spec/iex/client_spec.rb +6 -1
- data/spec/iex/endpoints/chart_spec.rb +7 -7
- data/spec/iex/endpoints/company_spec.rb +1 -0
- data/spec/iex/endpoints/income_spec.rb +68 -0
- data/spec/iex/endpoints/key_stats_spec.rb +42 -29
- data/spec/iex/endpoints/quote_spec.rb +2 -0
- data/spec/iex/endpoints/ref_data_spec.rb +66 -0
- data/spec/iex/endpoints/stock_market_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/vcr.rb +3 -0
- metadata +41 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 71bec851d78d50e5e8625f18e94212bd3d5825a1bf90a3809258e6ef88dcae34
|
4
|
+
data.tar.gz: b3f668404aada9eb2bcfa7f56767ce51083222c9f40a2fa95f15d005be9ee7ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf29091889a722d957ea6abceb5dc60d761fde868abc4212829c48723fc668870dbad46a75815823224bf324bd466fc917669792b320c85b0a907979b37008cc
|
7
|
+
data.tar.gz: 1222b56a8c47e79cd36b92b124128fa0162f8acbd9aa466f212cd0bc3bbe94036c2cc0c79243e348cf3b65ebb527ba47d46b91850dc8059cd081cab247568971
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [dblock]
|
data/.rubocop.yml
CHANGED
@@ -2,12 +2,15 @@ AllCops:
|
|
2
2
|
Exclude:
|
3
3
|
- vendor/**/*
|
4
4
|
|
5
|
+
Style/FrozenStringLiteralComment:
|
6
|
+
Enabled: false
|
7
|
+
|
5
8
|
Naming/MethodName:
|
6
9
|
Enabled: false
|
7
10
|
|
8
11
|
Naming/FileName:
|
9
12
|
Exclude:
|
10
|
-
-
|
13
|
+
- "lib/iex-ruby-client.rb"
|
11
14
|
|
12
15
|
Style/Documentation:
|
13
16
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
### 1.2.0 (2020/09/01)
|
2
|
+
|
3
|
+
* [#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).
|
4
|
+
* [#71](https://github.com/dblock/iex-ruby-client/pull/71): Added `symbols` resource - [@ryosuke-endo](https://github.com/ryosuke-endo).
|
5
|
+
* [#69](https://github.com/dblock/iex-ruby-client/pull/69): Fixed `ref_data_isin` request - [@bguban](https://github.com/bguban).
|
6
|
+
* [#72](https://github.com/dblock/iex-ruby-client/pull/72): Cache `Faraday::Connection` for persistent adapters - [@dblock](https://github.com/dblock).
|
7
|
+
|
8
|
+
### 1.1.2 (2020/03/25)
|
9
|
+
|
10
|
+
* [#68](https://github.com/dblock/iex-ruby-client/pull/68): Fixed `ref_data_isin` request with wrong isin - [@bguban](https://github.com/bguban).
|
11
|
+
* [#67](https://github.com/dblock/iex-ruby-client/pull/67): Added required ruby version to gemspec - [@wdperson](https://github.com/wdperson).
|
12
|
+
* [#66](https://github.com/dblock/iex-ruby-client/pull/66): Fixed `KeyStats#week_52_change always` returns nil - [@brunjo](https://github.com/brunjo).
|
13
|
+
* [#65](https://github.com/dblock/iex-ruby-client/pull/65): Added `stock_market_list` - [@bguban](https://github.com/bguban).
|
14
|
+
* [#64](https://github.com/dblock/iex-ruby-client/pull/64): Added `ref_data_isin` - [@bguban](https://github.com/bguban).
|
15
|
+
|
16
|
+
### 1.1.1 (2020/03/02)
|
17
|
+
|
18
|
+
* [#63](https://github.com/dblock/iex-ruby-client/pull/63): Allow direct API calls with support for secret_token - [@bguban](https://github.com/bguban).
|
19
|
+
* [#61](https://github.com/dblock/iex-ruby-client/pull/61): Fixed income endpoint if the api returns no result - [@brunjo](https://github.com/brunjo).
|
20
|
+
* [#57](https://github.com/dblock/iex-ruby-client/pull/57): Updated properties for chart api endpoint - [@brunjo](https://github.com/brunjo).
|
21
|
+
|
22
|
+
### 1.1.0 (2019/07/08)
|
23
|
+
|
24
|
+
* [#55](https://github.com/dblock/iex-ruby-client/pull/55): Added `income` statement API and add `tags` to the `company` - [@bingxie](https://github.com/bingxie).
|
25
|
+
|
26
|
+
### 1.0.1 (2019/07/08)
|
27
|
+
|
28
|
+
* [#50](https://github.com/dblock/iex-ruby-client/pull/50): Added missing properties for key stats API - [@bingxie](https://github.com/bingxie).
|
29
|
+
* Fixed `uninitialized constant IEX::Endpoints::Chart::Date (NameError)` - [@dblock](https://github.com/dblock).
|
30
|
+
|
1
31
|
### 1.0.0 (2019/04/23)
|
2
32
|
|
3
33
|
* [#42](https://github.com/dblock/iex-ruby-client/pull/42): Migrated to the IEX Cloud API - [@bingxie](https://github.com/bingxie).
|
@@ -6,9 +36,9 @@
|
|
6
36
|
### 0.4.4 (2018/12/27)
|
7
37
|
|
8
38
|
* [#39](https://github.com/dblock/iex-ruby-client/pull/39): Remove default range and use iextrading default range 1m instead in `IEX::Api::Dividends` - [@ildarkayumov](https://github.com/ildarkayumov).
|
9
|
-
* [#37](https://github.com/dblock/iex-ruby-client/pull/37):
|
10
|
-
* [#34](https://github.com/dblock/iex-ruby-client/pull/34):
|
11
|
-
* [#32](https://github.com/dblock/iex-ruby-client/pull/32):
|
39
|
+
* [#37](https://github.com/dblock/iex-ruby-client/pull/37): Added `IEX::Resource::Crypto` - [@rodolfobandeira](https://github.com/rodolfobandeira).
|
40
|
+
* [#34](https://github.com/dblock/iex-ruby-client/pull/34): Added `IEX::Resource::LargestTrades` - [@gil27](https://github.com/gil27).
|
41
|
+
* [#32](https://github.com/dblock/iex-ruby-client/pull/32): Added `IEX::Resource::Sectors` - [@gil27](https://github.com/gil27).
|
12
42
|
|
13
43
|
### 0.4.3 (2018/08/18)
|
14
44
|
|
@@ -16,7 +46,7 @@
|
|
16
46
|
|
17
47
|
### 0.4.2 (2018/08/14)
|
18
48
|
|
19
|
-
* [#24](https://github.com/dblock/iex-ruby-client/pull/24):
|
49
|
+
* [#24](https://github.com/dblock/iex-ruby-client/pull/24): Added danger-toc and danger-changelog - [@rodolfobandeira](https://github.com/rodolfobandeira).
|
20
50
|
* [#21](https://github.com/dblock/iex-ruby-client/pull/21): Added `IEX::Resources::Dividends` - [@rodolfobandeira](https://github.com/rodolfobandeira).
|
21
51
|
|
22
52
|
### 0.4.1 (2018/08/07)
|
@@ -35,18 +65,18 @@
|
|
35
65
|
|
36
66
|
### 0.3.2 (2018/05/26)
|
37
67
|
|
38
|
-
*
|
68
|
+
* Fixed undefined method > for nil:NilClass error - [@dblock](https://github.com/dblock).
|
39
69
|
|
40
70
|
### 0.3.1 (2018/05/23)
|
41
71
|
|
42
|
-
* [#3](https://github.com/dblock/iex-ruby-client/issues/3):
|
72
|
+
* [#3](https://github.com/dblock/iex-ruby-client/issues/3): Fixed do not error on undefined properties - [@dblock](https://github.com/dblock).
|
43
73
|
|
44
74
|
### 0.3.0 (2018/05/22)
|
45
75
|
|
46
76
|
* Added `IEX::Resources::Chart#get` - [@dblock](https://github.com/dblock).
|
47
77
|
* Added `IEX::Resources::News#get` - [@dblock](https://github.com/dblock).
|
48
78
|
* Added `IEX::Resources::Price#get` - [@dblock](https://github.com/dblock).
|
49
|
-
*
|
79
|
+
* Fixed added `IEX::Resources::Quote#extendedPrice` and `IEX::Resources::Quote#extendedPriceTime` - [@dblock](https://github.com/dblock).
|
50
80
|
|
51
81
|
### 0.2.0 (2018/03/26)
|
52
82
|
|
data/Dangerfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
toc.check
|
2
|
-
changelog.check
|
1
|
+
toc.check!
|
2
|
+
changelog.check!
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,10 +22,16 @@ A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
|
|
22
22
|
- [Get Key Stats](#get-key-stats)
|
23
23
|
- [Get Dividends](#get-dividends)
|
24
24
|
- [Get Earnings](#get-earnings)
|
25
|
+
- [Get Income Statement](#get-income-statement)
|
25
26
|
- [Get Sector Performance](#get-sector-performance)
|
26
27
|
- [Get Largest Trades](#get-largest-trades)
|
27
28
|
- [Get a Quote for Crypto Currencies](#get-a-quote-for-crypto-currencies)
|
29
|
+
- [ISIN Mapping](#isin-mapping)
|
30
|
+
- [Get Symbols](#get-symbols)
|
31
|
+
- [Get List](#get-list)
|
32
|
+
- [Other Requests](#other-requests)
|
28
33
|
- [Configuration](#configuration)
|
34
|
+
- [Sandbox Environment](#sandbox-environment)
|
29
35
|
- [Errors](#errors)
|
30
36
|
- [SymbolNotFound](#symbolnotfound)
|
31
37
|
- [PermissionDeniedError](#permissiondeniederror)
|
@@ -47,20 +53,26 @@ Run `bundle install`.
|
|
47
53
|
|
48
54
|
### Get an API Token
|
49
55
|
|
50
|
-
Create an account on [IEX Cloud](https://iexcloud.io) and get a publishable token from the cloud console.
|
56
|
+
Create an account on [IEX Cloud](https://iexcloud.io) and get a publishable token from the IEX cloud console.
|
51
57
|
|
52
58
|
### Configure
|
53
59
|
|
54
60
|
```ruby
|
55
61
|
IEX::Api.configure do |config|
|
56
|
-
config.publishable_token = '
|
62
|
+
config.publishable_token = 'publishable_token' # defaults to ENV['IEX_API_PUBLISHABLE_TOKEN']
|
63
|
+
config.secret_token = 'secret_token' # defaults to ENV['IEX_API_SECRET_TOKEN']
|
64
|
+
config.endpoint = 'https://cloud.iexapis.com/v1' # use 'https://sandbox.iexapis.com/v1' for Sandbox
|
57
65
|
end
|
58
66
|
```
|
59
67
|
|
60
68
|
You can also configure an instance of a client directly.
|
61
69
|
|
62
70
|
```ruby
|
63
|
-
client = IEX::Api::Client.new(
|
71
|
+
client = IEX::Api::Client.new(
|
72
|
+
publishable_token: 'publishable_token',
|
73
|
+
secret_token: 'secret_token',
|
74
|
+
endpoint: 'https://cloud.iexapis.com/v1'
|
75
|
+
)
|
64
76
|
```
|
65
77
|
|
66
78
|
### Get a Single Price
|
@@ -68,7 +80,7 @@ client = IEX::Api::Client.new(publishable_token: 'token')
|
|
68
80
|
Fetches a single number, being the IEX real time price, the 15 minute delayed market price, or the previous close price.
|
69
81
|
|
70
82
|
```ruby
|
71
|
-
client.
|
83
|
+
client.price('MSFT') # 93.78
|
72
84
|
```
|
73
85
|
|
74
86
|
See [#price](https://iexcloud.io/docs/api/#price) for detailed documentation.
|
@@ -93,7 +105,7 @@ See [#quote](https://iexcloud.io/docs/api/#quote) for detailed documentation or
|
|
93
105
|
Fetches a single stock OHLC price. Open and Close prices contain timestamp.
|
94
106
|
|
95
107
|
```ruby
|
96
|
-
ohlc = client.ohlc
|
108
|
+
ohlc = client.ohlc('MSFT')
|
97
109
|
|
98
110
|
ohlc.close.price # 90.165
|
99
111
|
ohlc.close.time #
|
@@ -186,6 +198,19 @@ client.chart('MSFT', Date.new(2018, 3, 26)) # a specific date
|
|
186
198
|
client.chart('MSFT', '1d', chart_interval: 10) # every n-th data point
|
187
199
|
```
|
188
200
|
|
201
|
+
Note that calling the chart API weighs more than 1 IEX message (you pay more than 1 call).
|
202
|
+
|
203
|
+
```
|
204
|
+
# 1 message per minute capped at 50 messages to intraday_prices
|
205
|
+
client.chart('MSFT', '1d')
|
206
|
+
|
207
|
+
# 2x22 trading days = 44 messages to historical_close_prices
|
208
|
+
client.chart('MSFT', '1m', chart_close_only: true)
|
209
|
+
|
210
|
+
# 2x251 trading days = 502 messages to historical_close_prices
|
211
|
+
client.chart('MSFT', '1y', chart_close_only: true)
|
212
|
+
```
|
213
|
+
|
189
214
|
### Get Key Stats
|
190
215
|
|
191
216
|
Fetches company's key stats for a symbol.
|
@@ -193,35 +218,48 @@ Fetches company's key stats for a symbol.
|
|
193
218
|
```ruby
|
194
219
|
key_stats = client.key_stats('MSFT')
|
195
220
|
|
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.
|
221
|
+
key_stats.week_52_change_dollar # "$0.37"
|
222
|
+
key_stats.week_52_high # 136.04
|
223
|
+
key_stats.week_52_high_dollar # "$136.04"
|
224
|
+
key_stats.week_52_low # 95.92,
|
225
|
+
key_stats.week_52_low_dollar # "$95.92"
|
226
|
+
key_stats.market_cap # 990869169557
|
227
|
+
key_stats.market_cap_dollar # "$990,869,169,557"
|
228
|
+
key_stats.employees # 133074
|
229
|
+
key_stats.day_200_moving_avg # 112.43
|
230
|
+
key_stats.day_50_moving_avg # 121
|
231
|
+
key_stats.float # 7694414092
|
232
|
+
key_stats.avg_10_volume # 25160156.2
|
233
|
+
key_stats.avg_30_volume # 23123700.13
|
234
|
+
key_stats.ttm_eps # 4.66
|
235
|
+
key_stats.ttm_dividend_rate # 1.8
|
236
|
+
key_stats.company_name # "Microsoft Corp."
|
237
|
+
key_stats.shares_outstanding # 7849945172
|
238
|
+
key_stats.max_change_percent # 4.355607
|
239
|
+
key_stats.year_5_change_percent # 2.32987
|
240
|
+
key_stats.year_5_change_percent_s # "+232.99%"
|
241
|
+
key_stats.year_2_change_percent # 0.84983
|
242
|
+
key_stats.year_2_change_percent_s # "+84.98%"
|
243
|
+
key_stats.year_1_change_percent # 0.383503
|
244
|
+
key_stats.year_1_change_percent_s # "+38.35%"
|
245
|
+
key_stats.ytd_change_percent # 0.270151
|
246
|
+
key_stats.ytd_change_percent_s # "+27.02%"
|
247
|
+
key_stats.month_6_change_percent # 0.208977
|
248
|
+
key_stats.month_6_change_percent_s # "+20.90%"
|
249
|
+
key_stats.month_3_change_percent # 0.212188
|
250
|
+
key_stats.month_3_change_percent_s # "+21.22%"
|
251
|
+
key_stats.month_1_change_percent # 0.076335
|
252
|
+
key_stats.month_1_change_percent_s # "+7.63%"
|
253
|
+
key_stats.day_30_change_percent # 0.089589
|
254
|
+
key_stats.day_30_change_percent_s # "+8.96%"
|
255
|
+
key_stats.day_5_change_percent # -0.010013
|
256
|
+
key_stats.day_5_change_percent_s # "-1.00%"
|
257
|
+
key_stats.next_dividend_date # "2019-05-21"
|
258
|
+
key_stats.dividend_yield # 0.014087248841960684
|
259
|
+
key_stats.next_earnings_date # "2019-07-29"
|
260
|
+
key_stats.ex_dividend_date # "2019-05-24"
|
261
|
+
key_stats.pe_ratio # 29.47
|
262
|
+
key_stats.beta # 1.4135449089973444
|
225
263
|
```
|
226
264
|
|
227
265
|
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.
|
@@ -263,6 +301,25 @@ earnings.year_ago_change_percent_s # '+15.31%'
|
|
263
301
|
|
264
302
|
See [#earnings](https://iexcloud.io/docs/api/#earnings) for detailed documentation or [earnings.rb](lib/iex/resources/earnings.rb) for returned fields.
|
265
303
|
|
304
|
+
### Get Income Statement
|
305
|
+
|
306
|
+
Fetches income statement for a symbol.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
income = client.income('MSFT')
|
310
|
+
|
311
|
+
income.report_date # '2019-03-31'
|
312
|
+
income.total_revenue # 30_505_000_000
|
313
|
+
income.total_revenue_dollar # '$30,505,000,000'
|
314
|
+
income.cost_of_revenue # 10_170_000_000
|
315
|
+
income.cost_of_revenue_dollar # '$10,170,000,000'
|
316
|
+
income.gross_profit # 20_335_000_000
|
317
|
+
income.gross_profit_dollar # '$20,335,000,000'
|
318
|
+
...
|
319
|
+
```
|
320
|
+
|
321
|
+
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
|
+
|
266
323
|
### Get Sector Performance
|
267
324
|
|
268
325
|
Fetches latest sector's performance.
|
@@ -319,20 +376,77 @@ crypto.high_dollar #'$3,590'
|
|
319
376
|
|
320
377
|
See [#crypto](https://iexcloud.io/docs/api/#crypto) for detailed documentation or [crypto.rb](lib/iex/resources/crypto.rb) for returned fields.
|
321
378
|
|
379
|
+
### ISIN Mapping
|
380
|
+
|
381
|
+
Converts ISIN to IEX Cloud symbols.
|
382
|
+
|
383
|
+
```ruby
|
384
|
+
symbols = client.ref_data_isin(['US0378331005'])
|
385
|
+
|
386
|
+
symbols.first.exchange # NAS
|
387
|
+
symbols.first.iex_id # IEX_4D48333344362D52
|
388
|
+
symbols.first.region # US
|
389
|
+
symbols.first.symbol # AAPL
|
390
|
+
```
|
391
|
+
|
392
|
+
You can use `mapped: true` option to receive symbols grouped by their ISINs.
|
393
|
+
|
394
|
+
```ruby
|
395
|
+
client.ref_data_isin(['US0378331005', 'US5949181045'], mapped: true) # {'US0378331005' => [...], 'US5949181045' => [...]}
|
396
|
+
```
|
397
|
+
|
398
|
+
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.
|
399
|
+
|
400
|
+
### Get Symbols
|
401
|
+
|
402
|
+
Returns an array of symbols
|
403
|
+
|
404
|
+
```ruby
|
405
|
+
symbols = client.ref_data_symbols()
|
406
|
+
|
407
|
+
symbol = symbols.first
|
408
|
+
symbol.exchange # NAS
|
409
|
+
symbol.iex_id # IEX_46574843354B2D52
|
410
|
+
symbol.region # US
|
411
|
+
symbol.symbol # A
|
412
|
+
```
|
413
|
+
|
414
|
+
See [#symbols](https://iexcloud.io/docs/api/#symbols) for detailed documentation or [symbols.rb](lib/iex/resources/symbols.rb) for returned fields.
|
415
|
+
|
416
|
+
### Get List
|
417
|
+
|
418
|
+
Returns an array of quotes for the top 10 symbols in a specified list.
|
419
|
+
|
420
|
+
```ruby
|
421
|
+
client.stock_market_list(:mostactive) # [{symbol: 'AAPL', ...}, {...}]
|
422
|
+
```
|
423
|
+
|
424
|
+
See [#list](https://iexcloud.io/docs/api/#list) for detailed documentation or [quote.rb](lib/iex/resources/quote.rb) for returned fields.
|
425
|
+
|
426
|
+
### Other Requests
|
427
|
+
|
428
|
+
Public endpoints that aren't yet supported by the client can be called using `client.get`, `client.post`, `client.put`
|
429
|
+
and `client.delete` methods. Pass the required token explicitly:
|
430
|
+
|
431
|
+
```ruby
|
432
|
+
client.post('ref-data/isin', isin: ['US0378331005'], token: 'secret_token') # [{'exchange' => 'NAS', ..., 'symbol' => 'AAPL'}, {'exchange' => 'ETR', ..., 'symbol' => 'APC-GY']
|
433
|
+
```
|
434
|
+
|
322
435
|
## Configuration
|
323
436
|
|
324
437
|
You can configure client options globally or directly with a `IEX::Api::Client` instance.
|
325
438
|
|
326
439
|
```ruby
|
327
440
|
IEX::Api::Client.configure do |config|
|
328
|
-
config.
|
441
|
+
config.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
|
442
|
+
config.endpoint = 'https://sandbox.iexapis.com/v1' # use sandbox environment
|
329
443
|
end
|
330
444
|
```
|
331
445
|
|
332
446
|
```ruby
|
333
447
|
client = IEX::Api::Client.new(
|
334
|
-
publishable_token: '
|
335
|
-
|
448
|
+
publishable_token: ENV['IEX_API_PUBLISHABLE_TOKEN'],
|
449
|
+
endpoint: 'https://cloud.iexapis.com/v1'
|
336
450
|
)
|
337
451
|
```
|
338
452
|
|
@@ -350,6 +464,14 @@ open_timeout | Optional connection open timeout in seconds.
|
|
350
464
|
publishable_token | IEX Cloud API publishable token.
|
351
465
|
endpoint | Defaults to `https://cloud.iexapis.com/v1`.
|
352
466
|
|
467
|
+
## Sandbox Environment
|
468
|
+
|
469
|
+
IEX recommends you use a sandbox token and endpoint for testing.
|
470
|
+
|
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.
|
472
|
+
|
473
|
+
See [IEX sandbox environment](https://intercom.help/iexcloud/en/articles/2915433-testing-with-the-iex-cloud-sandbox) for more information.
|
474
|
+
|
353
475
|
## Errors
|
354
476
|
|
355
477
|
### SymbolNotFound
|
data/iex-ruby-client.gemspec
CHANGED
@@ -9,19 +9,20 @@ 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']
|
15
16
|
s.homepage = 'http://github.com/dblock/iex-ruby-client'
|
16
17
|
s.licenses = ['MIT']
|
17
18
|
s.summary = 'IEX Finance API Ruby client with support for retrieving stock quotes.'
|
18
|
-
s.add_dependency 'faraday', '>= 0.
|
19
|
+
s.add_dependency 'faraday', '>= 0.17'
|
19
20
|
s.add_dependency 'faraday_middleware'
|
20
21
|
s.add_dependency 'hashie'
|
21
22
|
s.add_dependency 'money_helper'
|
22
23
|
s.add_development_dependency 'rake', '~> 10'
|
23
24
|
s.add_development_dependency 'rspec'
|
24
|
-
s.add_development_dependency 'rubocop', '0.
|
25
|
+
s.add_development_dependency 'rubocop', '0.72.0'
|
25
26
|
s.add_development_dependency 'vcr'
|
26
27
|
s.add_development_dependency 'webmock'
|
27
28
|
end
|
data/lib/iex-ruby-client.rb
CHANGED
data/lib/iex/api.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative 'endpoints/chart'
|
|
2
2
|
require_relative 'endpoints/company'
|
3
3
|
require_relative 'endpoints/dividends'
|
4
4
|
require_relative 'endpoints/earnings'
|
5
|
+
require_relative 'endpoints/income'
|
5
6
|
require_relative 'endpoints/largest_trades'
|
6
7
|
require_relative 'endpoints/logo'
|
7
8
|
require_relative 'endpoints/key_stats'
|
@@ -11,6 +12,8 @@ require_relative 'endpoints/price'
|
|
11
12
|
require_relative 'endpoints/quote'
|
12
13
|
require_relative 'endpoints/sectors'
|
13
14
|
require_relative 'endpoints/crypto'
|
15
|
+
require_relative 'endpoints/ref_data'
|
16
|
+
require_relative 'endpoints/stock_market'
|
14
17
|
|
15
18
|
require_relative 'api/config'
|
16
19
|
require_relative 'api/client'
|