iex-ruby-client 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +147 -2
- data/RELEASING.md +2 -2
- data/lib/iex/api.rb +3 -0
- data/lib/iex/api/client.rb +3 -0
- data/lib/iex/endpoints/balance_sheet.rb +13 -0
- data/lib/iex/endpoints/cash_flow.rb +13 -0
- data/lib/iex/endpoints/historial_prices.rb +30 -0
- data/lib/iex/resources.rb +3 -0
- data/lib/iex/resources/advanced_stats.rb +43 -1
- data/lib/iex/resources/balance_sheet.rb +60 -0
- data/lib/iex/resources/cash_flow.rb +43 -0
- data/lib/iex/resources/historical_prices.rb +31 -0
- data/lib/iex/resources/income.rb +2 -0
- data/lib/iex/resources/resource.rb +12 -0
- data/lib/iex/version.rb +1 -1
- data/spec/fixtures/iex/balance_sheet/invalid.yml +50 -0
- data/spec/fixtures/iex/balance_sheet/msft.yml +56 -0
- data/spec/fixtures/iex/cash_flow/invalid.yml +50 -0
- data/spec/fixtures/iex/cash_flow/msft.yml +56 -0
- data/spec/fixtures/iex/historical_prices/abcd.yml +56 -0
- data/spec/fixtures/iex/historical_prices/invalid.yml +50 -0
- data/spec/fixtures/iex/historical_prices/invalid_date.yml +50 -0
- data/spec/fixtures/iex/historical_prices/invalid_range.yml +47 -0
- data/spec/fixtures/iex/historical_prices/msft.yml +79 -0
- data/spec/fixtures/iex/historical_prices/msft_5d.yml +61 -0
- data/spec/fixtures/iex/historical_prices/msft_date_and_chart_by_day.yml +57 -0
- data/spec/fixtures/iex/historical_prices/msft_specific_date_trimmed.yml +445 -0
- data/spec/fixtures/iex/income/msft.yml +54 -51
- data/spec/iex/endpoints/advanced_stats_spec.rb +56 -0
- data/spec/iex/endpoints/balance_sheet_spec.rb +80 -0
- data/spec/iex/endpoints/cash_flow_spec.rb +59 -0
- data/spec/iex/endpoints/historical_prices_spec.rb +206 -0
- data/spec/iex/endpoints/income_spec.rb +31 -29
- data/spec/iex/resources/resource_spec.rb +36 -0
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36c3afc87c696f3bb31e32bc65e987f794ee40ad2e7545aa7fab2fce99b267cd
|
4
|
+
data.tar.gz: 58c9280ac2e9f36ecb5b2c00a7d8d5cccda7b54f7935f4391abe1767f90a0225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ac7d1a3a9d952e9dba3e75af5624720b31a2aa4d8c33ee432755cebfffda5d5e121b36fcaf572bb2e59123c0715864c259afe902fc19ed88ad05a6c2419302
|
7
|
+
data.tar.gz: 18fe9215733f10ab5f80c4a5e6419fcece10a7772a77a42f0c6a1ea64772fe7c279b181f3bc56af948af4e2ad5aa56c582dc31460bd0646104bbba2d1af5bbb9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 1.4.0 (2020/11/19)
|
2
|
+
* [#90](https://github.com/dblock/iex-ruby-client/pull/90): Added documentation for advanced stats and removed `avg_30_Volume` from advanced stats since it is found in key stats - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
3
|
+
* [#91](https://github.com/dblock/iex-ruby-client/pull/91): Added support for Balance Sheet API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
4
|
+
* [#92](https://github.com/dblock/iex-ruby-client/pull/92): Added support for Cash Flow Statements API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
5
|
+
* [#93](https://github.com/dblock/iex-ruby-client/pull/93): Added `fiscal_date` and `currency` to income statements - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
6
|
+
* [#94](https://github.com/dblock/iex-ruby-client/pull/94): Added `historical_prices` API endpoint - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
7
|
+
* [#95](https://github.com/dblock/iex-ruby-client/pull/95): Added all KeyStat properties to AdvancedStats since they are already returned in the API call - [@tylerhaugen-stanley](https://github.com/tylerhaugen-stanley).
|
8
|
+
|
1
9
|
### 1.3.0 (2020/10/31)
|
2
10
|
|
3
11
|
* [#82](https://github.com/dblock/iex-ruby-client/pull/82): Added `config.referer` to set HTTP `Referer` header. This enables IEX's "Manage domains" domain locking for tokens - [@agrberg](https://github.com/agrberg).
|
data/README.md
CHANGED
@@ -15,14 +15,18 @@ A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
|
|
15
15
|
- [Get a Quote](#get-a-quote)
|
16
16
|
- [Get a OHLC (Open, High, Low, Close) price](#get-a-ohlc-open-high-low-close-price)
|
17
17
|
- [Get a Market OHLC (Open, High, Low, Close) prices](#get-a-market-ohlc-open-high-low-close-prices)
|
18
|
+
- [Get Historical Prices](#get-historical-prices)
|
18
19
|
- [Get Company Information](#get-company-information)
|
19
20
|
- [Get a Company Logo](#get-a-company-logo)
|
20
21
|
- [Get Recent News](#get-recent-news)
|
21
22
|
- [Get Chart](#get-chart)
|
22
23
|
- [Get Key Stats](#get-key-stats)
|
24
|
+
- [Get Advanced Stats](#get-advanced-stats)
|
23
25
|
- [Get Dividends](#get-dividends)
|
24
26
|
- [Get Earnings](#get-earnings)
|
25
27
|
- [Get Income Statement](#get-income-statement)
|
28
|
+
- [Get Balance Sheet](#get-balance-sheet)
|
29
|
+
- [Get Cash Flow Statement](#get-cash-flow-statement)
|
26
30
|
- [Get Sector Performance](#get-sector-performance)
|
27
31
|
- [Get Largest Trades](#get-largest-trades)
|
28
32
|
- [Get a Quote for Crypto Currencies](#get-a-quote-for-crypto-currencies)
|
@@ -130,6 +134,57 @@ market['SPY'].high #
|
|
130
134
|
market['SPY'].low #
|
131
135
|
```
|
132
136
|
|
137
|
+
### Get Historical Prices
|
138
|
+
|
139
|
+
Fetches a list of historical prices.
|
140
|
+
|
141
|
+
There are currently a few limitations of this endpoint compared to the official IEX one.
|
142
|
+
|
143
|
+
Options for `range` include:
|
144
|
+
`max, ytd, 5y, 2y, 1y, 6m, 3m, 1m, 5d, date`
|
145
|
+
|
146
|
+
NOTE: If you use the `date` value for the `range` parameter:
|
147
|
+
* The options _must_ include a date entry, `{date: ...}`
|
148
|
+
* The date value _must_ be either a Date object, or a string formatted as `YYYYMMDD`. Anything else will result in an `IEX::Errors::ClientError`.
|
149
|
+
* The options _must_ include `chartByDay: 'true'` or an `ArgumentError` will be raised.
|
150
|
+
* See below for examples.
|
151
|
+
|
152
|
+
`Query params` supported include:
|
153
|
+
`chartByDay`
|
154
|
+
|
155
|
+
This is a complicated endpoint as there is a lot of granularity over the time period of data returned. See below for a variety of ways to request data, NOTE: this is _NOT_ as exhaustive list.
|
156
|
+
```ruby
|
157
|
+
historial_prices = client.historical_prices('MSFT') # One month of data
|
158
|
+
historial_prices = client.historical_prices('MSFT', {range: 'max'}) # All data up to 15 years
|
159
|
+
historial_prices = client.historical_prices('MSFT', {range: 'ytd'}) # Year to date data
|
160
|
+
historial_prices = client.historical_prices('MSFT', {range: '5y'}) # 5 years of data
|
161
|
+
historial_prices = client.historical_prices('MSFT', {range: '6m'}) # 6 months of data
|
162
|
+
historial_prices = client.historical_prices('MSFT', {range: '5d'}) # 5 days of data
|
163
|
+
historial_prices = client.historical_prices('MSFT', {range: 'date', date: '20200930', chartByDay: 'true'}) # One day of data
|
164
|
+
historial_prices = client.historical_prices('MSFT', {range: 'date', date: Date.parse('2020-09-30)', chartByDay: 'true'}) # One day of data
|
165
|
+
...
|
166
|
+
```
|
167
|
+
|
168
|
+
Once you have the data over the preferred time period, you can access the following fields
|
169
|
+
```ruby
|
170
|
+
historial_prices = client.historical_prices('MSFT') # One month of data
|
171
|
+
|
172
|
+
historial_price = historial_prices.first
|
173
|
+
historical_price.date # 2020-10-07
|
174
|
+
historical_price.open #207.06
|
175
|
+
historical_price.open_dollar # '$207.06'
|
176
|
+
historical_price.close # 209.83
|
177
|
+
historical_price.close_dollar # '$209.83'
|
178
|
+
historical_price.high # 210.11
|
179
|
+
historical_price.high_dollar # '$210.11'
|
180
|
+
historical_price.low # 206.72
|
181
|
+
historical_price.low_dollar # '$206.72'
|
182
|
+
historical_price.volume # 25681054
|
183
|
+
...
|
184
|
+
```
|
185
|
+
|
186
|
+
There are a lot of options here so I would recommend viewing the official IEX documentation [#historical-prices](https://iexcloud.io/docs/api/#historical-prices) or [historical_prices.rb](lib/iex/resources/historical_prices.rb) for returned fields.
|
187
|
+
|
133
188
|
### Get Company Information
|
134
189
|
|
135
190
|
Fetches company information for a symbol.
|
@@ -265,6 +320,50 @@ key_stats.beta # 1.4135449089973444
|
|
265
320
|
|
266
321
|
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.
|
267
322
|
|
323
|
+
### Get Advanced Stats
|
324
|
+
|
325
|
+
Fetches company's advanced stats for a symbol, this will include all key stats as well.
|
326
|
+
|
327
|
+
```ruby
|
328
|
+
advanced_stats = client.advanced_stats('MSFT')
|
329
|
+
|
330
|
+
advanced_stats.total_cash # 66301000000
|
331
|
+
advanced_stats.total_cash_dollars # "$66,301,000,000"
|
332
|
+
advanced_stats.current_debt # 20748000000
|
333
|
+
advanced_stats.current_debt_dollars # "$2,074,8000,000"
|
334
|
+
advanced_stats.revenue # 265809000000
|
335
|
+
advanced_stats.revenue_dollars # "$265,809,000,000"
|
336
|
+
advanced_stats.gross_profit # 101983000000
|
337
|
+
advanced_stats.gross_profit_dollar # "$101,983,000,000"
|
338
|
+
advanced_stats.total_revenue # 265809000000
|
339
|
+
advanced_stats.total_revenue_dollar # "$265,809,000,000"
|
340
|
+
advanced_stats.ebitda # 80342000000
|
341
|
+
advanced_stats.ebitda_dollar # "$80,342,000,000"
|
342
|
+
advanced_stats.revenue_per_share # 0.02
|
343
|
+
advanced_stats.revenue_per_share_dollar # "$0.02"
|
344
|
+
advanced_stats.revenue_per_employee # 2013704.55
|
345
|
+
advanced_stats.revenue_per_employee_dollar # "$2,013,704.55"
|
346
|
+
advanced_stats.debt_to_equity # 1.07
|
347
|
+
advanced_stats.profit_margin # 22.396157
|
348
|
+
advanced_stats.enterprise_value # 1022460690000
|
349
|
+
advanced_stats.enterprise_value_dollar # "$1,022,460,690,000"
|
350
|
+
advanced_stats.enterprise_value_to_revenue # 3.85
|
351
|
+
advanced_stats.price_to_sales # 3.49
|
352
|
+
advanced_stats.price_to_sales_dollar # "$3.49"
|
353
|
+
advanced_stats.price_to_book # 8.805916432564608
|
354
|
+
advanced_stats.forward_pe_ratio # 18.14
|
355
|
+
advanced_stats.pe_high # 22.61
|
356
|
+
advanced_stats.pe_low # 11.98
|
357
|
+
advanced_stats.peg_ratio # 2.19
|
358
|
+
advanced_stats.week_52_high_date # "2019-11-19"
|
359
|
+
advanced_stats.week_52_low_date # "2019-01-03
|
360
|
+
advanced_stats.beta # 1.4661365583766115
|
361
|
+
advanced_stats.put_call_ratio # 0.6780362005229779
|
362
|
+
...
|
363
|
+
```
|
364
|
+
|
365
|
+
See [#advanced-stats](https://iexcloud.io/docs/api/#advanced-stats) for detailed documentation or [advanced_stats.rb](lib/iex/resources/advanced_stats.rb) for returned fields.
|
366
|
+
|
268
367
|
### Get Dividends
|
269
368
|
|
270
369
|
Fetches dividends for a symbol.
|
@@ -304,12 +403,16 @@ See [#earnings](https://iexcloud.io/docs/api/#earnings) for detailed documentati
|
|
304
403
|
|
305
404
|
### Get Income Statement
|
306
405
|
|
307
|
-
Fetches income
|
406
|
+
Fetches income statements for a symbol.
|
308
407
|
|
309
408
|
```ruby
|
310
|
-
|
409
|
+
income_statements = client.income('MSFT')
|
311
410
|
|
411
|
+
# Multiple income statements are returned with 1 API call.
|
412
|
+
income = income_statements.first
|
312
413
|
income.report_date # '2019-03-31'
|
414
|
+
income.fiscal_date # '2019-03-31'
|
415
|
+
income.currency # 'USD'
|
313
416
|
income.total_revenue # 30_505_000_000
|
314
417
|
income.total_revenue_dollar # '$30,505,000,000'
|
315
418
|
income.cost_of_revenue # 10_170_000_000
|
@@ -321,6 +424,48 @@ income.gross_profit_dollar # '$20,335,000,000'
|
|
321
424
|
|
322
425
|
See [#income-statement](https://iexcloud.io/docs/api/#income-statement) for detailed documentation or [income.rb](lib/iex/resources/income.rb) for returned fields.
|
323
426
|
|
427
|
+
### Get Balance Sheet
|
428
|
+
|
429
|
+
Fetches balance sheets for a symbol.
|
430
|
+
|
431
|
+
```ruby
|
432
|
+
balance_sheets = client.balance_sheet('MSFT')
|
433
|
+
|
434
|
+
# Multiple balance sheets are returned with 1 API call.
|
435
|
+
balance_sheet = balance_sheets.first
|
436
|
+
balance_sheet.report_date # '2017-03-31'
|
437
|
+
balance_sheet.fiscal_date # '2017-03-31'
|
438
|
+
balance_sheet.currency # 'USD'
|
439
|
+
balance_sheet.current_cash # 25_913_000_000
|
440
|
+
balance_sheet.current_cash_dollar # '$25,913,000,000'
|
441
|
+
balance_sheet.short_term_investments # 40_388_000_000
|
442
|
+
balance_sheet.short_term_investments_dollar # '$40,388,000,000'
|
443
|
+
...
|
444
|
+
```
|
445
|
+
|
446
|
+
See [#balance-sheet](https://iexcloud.io/docs/api/#balance-sheet) for detailed documentation or [balance_sheet.rb](lib/iex/resources/balance_sheet.rb) for returned fields.
|
447
|
+
|
448
|
+
### Get Cash Flow Statement
|
449
|
+
|
450
|
+
Fetches cash flow statements for a symbol.
|
451
|
+
|
452
|
+
```ruby
|
453
|
+
cash_flow_statements = client.cash_flow('MSFT')
|
454
|
+
|
455
|
+
# Multiple cash flow statements are returned with 1 API call.
|
456
|
+
cash_flow = cash_flow_statements.first
|
457
|
+
cash_flow.report_date # '2018-09-30'
|
458
|
+
cash_flow.fiscal_date # '2018-09-30'
|
459
|
+
cash_flow.currency # 'USD'
|
460
|
+
cash_flow.net_income # 14_125_000_000
|
461
|
+
cash_flow.net_income_dollar # '$14,125,000,000'
|
462
|
+
cash_flow.depreciation # 2_754_000_000
|
463
|
+
cash_flow.depreciation_dollar # '$2,754,000,000'
|
464
|
+
...
|
465
|
+
```
|
466
|
+
|
467
|
+
See [#cash-flow](https://iexcloud.io/docs/api/#cash-flow) for detailed documentation or [cash_flow.rb](lib/iex/resources/cash_flow.rb) for returned fields.
|
468
|
+
|
324
469
|
### Get Sector Performance
|
325
470
|
|
326
471
|
Fetches latest sector's performance.
|
data/RELEASING.md
CHANGED
@@ -16,10 +16,10 @@ Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/
|
|
16
16
|
Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
|
17
17
|
|
18
18
|
```
|
19
|
-
### 0.2.2 (
|
19
|
+
### 0.2.2 (2015/10/07)
|
20
20
|
```
|
21
21
|
|
22
|
-
Remove the line with "Your contribution here.", since there will be no more contributions to this release.
|
22
|
+
Remove the line with "* Your contribution here.", since there will be no more contributions to this release.
|
23
23
|
|
24
24
|
Commit your changes.
|
25
25
|
|
data/lib/iex/api.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require_relative 'endpoints/advanced_stats'
|
2
|
+
require_relative 'endpoints/balance_sheet'
|
3
|
+
require_relative 'endpoints/cash_flow'
|
2
4
|
require_relative 'endpoints/chart'
|
3
5
|
require_relative 'endpoints/company'
|
4
6
|
require_relative 'endpoints/dividends'
|
5
7
|
require_relative 'endpoints/earnings'
|
8
|
+
require_relative 'endpoints/historial_prices'
|
6
9
|
require_relative 'endpoints/income'
|
7
10
|
require_relative 'endpoints/largest_trades'
|
8
11
|
require_relative 'endpoints/logo'
|
data/lib/iex/api/client.rb
CHANGED
@@ -5,11 +5,14 @@ module IEX
|
|
5
5
|
|
6
6
|
class Client
|
7
7
|
include Endpoints::AdvancedStats
|
8
|
+
include Endpoints::BalanceSheet
|
9
|
+
include Endpoints::CashFlow
|
8
10
|
include Endpoints::Chart
|
9
11
|
include Endpoints::Company
|
10
12
|
include Endpoints::Crypto
|
11
13
|
include Endpoints::Dividends
|
12
14
|
include Endpoints::Earnings
|
15
|
+
include Endpoints::HistoricalPrices
|
13
16
|
include Endpoints::Income
|
14
17
|
include Endpoints::KeyStats
|
15
18
|
include Endpoints::LargestTrades
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module IEX
|
2
|
+
module Endpoints
|
3
|
+
module BalanceSheet
|
4
|
+
def balance_sheet(symbol, options = {})
|
5
|
+
(get("stock/#{symbol}/balance-sheet", { token: publishable_token }.merge(options))['balancesheet'] || []).map do |data|
|
6
|
+
IEX::Resources::BalanceSheet.new(data)
|
7
|
+
end
|
8
|
+
rescue Faraday::ResourceNotFound => e
|
9
|
+
raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module IEX
|
2
|
+
module Endpoints
|
3
|
+
module CashFlow
|
4
|
+
def cash_flow(symbol, options = {})
|
5
|
+
(get("stock/#{symbol}/cash-flow", { token: publishable_token }.merge(options))['cashflow'] || []).map do |data|
|
6
|
+
IEX::Resources::CashFlow.new(data)
|
7
|
+
end
|
8
|
+
rescue Faraday::ResourceNotFound => e
|
9
|
+
raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module IEX
|
2
|
+
module Endpoints
|
3
|
+
module HistoricalPrices
|
4
|
+
def historical_prices(symbol, options = {})
|
5
|
+
if options[:range] == 'date'
|
6
|
+
raise ArgumentError unless options[:date].present?
|
7
|
+
raise ArgumentError unless options[:chartByDay].present?
|
8
|
+
end
|
9
|
+
|
10
|
+
options = options.dup
|
11
|
+
# Historical prices IEX endpoint expects dates passed in a specific format - YYYYMMDD
|
12
|
+
options[:date] = options[:date].strftime('%Y%m%d') if options[:date].is_a?(Date)
|
13
|
+
|
14
|
+
path = "stock/#{symbol}/chart"
|
15
|
+
path += "/#{options[:range]}" if options.key?(:range)
|
16
|
+
path += "/#{options[:date]}" if options[:range] == 'date'
|
17
|
+
|
18
|
+
# We only want options to include query params at this point, remove :range and :date
|
19
|
+
options.delete(:range)
|
20
|
+
options.delete(:date)
|
21
|
+
|
22
|
+
(get(path, { token: publishable_token }.merge(options)) || []).map do |data|
|
23
|
+
IEX::Resources::HistorialPrices.new(data)
|
24
|
+
end
|
25
|
+
rescue Faraday::ResourceNotFound => e
|
26
|
+
raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/iex/resources.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require_relative 'resources/resource'
|
2
2
|
|
3
3
|
require_relative 'resources/advanced_stats'
|
4
|
+
require_relative 'resources/balance_sheet'
|
5
|
+
require_relative 'resources/cash_flow'
|
4
6
|
require_relative 'resources/chart'
|
5
7
|
require_relative 'resources/company'
|
6
8
|
require_relative 'resources/dividends'
|
7
9
|
require_relative 'resources/earnings'
|
10
|
+
require_relative 'resources/historical_prices'
|
8
11
|
require_relative 'resources/income'
|
9
12
|
require_relative 'resources/key_stats'
|
10
13
|
require_relative 'resources/largest_trades'
|
@@ -28,11 +28,53 @@ module IEX
|
|
28
28
|
property 'forward_pe_ratio', from: 'forwardPERatio'
|
29
29
|
property 'pe_high', from: 'peHigh'
|
30
30
|
property 'pe_low', from: 'peLow'
|
31
|
-
property 'avg_30_volume', from: 'avg30Volume'
|
32
31
|
property 'peg_ratio', from: 'pegRatio'
|
33
32
|
property 'week_52_high_date', from: 'week52highDate'
|
34
33
|
property 'week_52_low_date', from: 'week52lowDate'
|
35
34
|
property 'beta'
|
35
|
+
property 'put_call_ratio', from: 'putCallRatio'
|
36
|
+
property 'company_name', from: 'companyName'
|
37
|
+
property 'market_cap', from: 'marketcap'
|
38
|
+
property 'market_cap_dollar', from: 'marketcap', with: ->(v) { Resource.to_dollar(amount: v) }
|
39
|
+
property 'week_52_high', from: 'week52high'
|
40
|
+
property 'week_52_high_dollar', from: 'week52high', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
|
41
|
+
property 'week_52_low', from: 'week52low'
|
42
|
+
property 'week_52_low_dollar', from: 'week52low', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
|
43
|
+
property 'week_52_change', from: 'week52change'
|
44
|
+
property 'week_52_change_dollar', from: 'week52change', with: ->(v) { Resource.to_dollar(amount: v, ignore_cents: false) }
|
45
|
+
property 'dividend_yield', from: 'dividendYield'
|
46
|
+
property 'ex_dividend_date', from: 'exDividendDate'
|
47
|
+
property 'shares_outstanding', from: 'sharesOutstanding'
|
48
|
+
property 'float'
|
49
|
+
property 'ttm_eps', from: 'ttmEPS'
|
50
|
+
property 'day_200_moving_avg', from: 'day200MovingAvg'
|
51
|
+
property 'day_50_moving_avg', from: 'day50MovingAvg'
|
52
|
+
property 'year_5_change_percent', from: 'year5ChangePercent'
|
53
|
+
property 'year_5_change_percent_s', from: 'year5ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
54
|
+
property 'year_2_change_percent', from: 'year2ChangePercent'
|
55
|
+
property 'year_2_change_percent_s', from: 'year2ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
56
|
+
property 'year_1_change_percent', from: 'year1ChangePercent'
|
57
|
+
property 'year_1_change_percent_s', from: 'year1ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
58
|
+
property 'ytd_change_percent', from: 'ytdChangePercent'
|
59
|
+
property 'ytd_change_percent_s', from: 'ytdChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
60
|
+
property 'month_6_change_percent', from: 'month6ChangePercent'
|
61
|
+
property 'month_6_change_percent_s', from: 'month6ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
62
|
+
property 'month_3_change_percent', from: 'month3ChangePercent'
|
63
|
+
property 'month_3_change_percent_s', from: 'month3ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
64
|
+
property 'month_1_change_percent', from: 'month1ChangePercent'
|
65
|
+
property 'month_1_change_percent_s', from: 'month1ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
66
|
+
property 'day_5_change_percent', from: 'day5ChangePercent'
|
67
|
+
property 'day_5_change_percent_s', from: 'day5ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
68
|
+
property 'employees'
|
69
|
+
property 'avg_10_volume', from: 'avg10Volume'
|
70
|
+
property 'avg_30_volume', from: 'avg30Volume'
|
71
|
+
property 'ttm_dividend_rate', from: 'ttmDividendRate'
|
72
|
+
property 'max_change_percent', from: 'maxChangePercent'
|
73
|
+
property 'day_30_change_percent', from: 'day30ChangePercent'
|
74
|
+
property 'day_30_change_percent_s', from: 'day30ChangePercent', with: ->(v) { Resource.float_to_percentage(v) }
|
75
|
+
property 'next_dividend_date', from: 'nextDividendDate'
|
76
|
+
property 'next_earnings_date', from: 'nextEarningsDate'
|
77
|
+
property 'pe_ratio', from: 'peRatio'
|
36
78
|
|
37
79
|
def initialize(data = {})
|
38
80
|
super
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module IEX
|
2
|
+
module Resources
|
3
|
+
class BalanceSheet < Resource
|
4
|
+
property 'report_date', from: 'reportDate'
|
5
|
+
property 'fiscal_date', from: 'fiscalDate'
|
6
|
+
property 'currency'
|
7
|
+
property 'current_cash', from: 'currentCash'
|
8
|
+
property 'current_cash_dollar', from: 'currentCash', with: ->(v) { to_dollar(amount: v) }
|
9
|
+
property 'short_term_investments', from: 'shortTermInvestments'
|
10
|
+
property 'short_term_investments_dollar', from: 'shortTermInvestments', with: ->(v) { to_dollar(amount: v) }
|
11
|
+
property 'receivables'
|
12
|
+
property 'receivables_dollar', from: 'receivables', with: ->(v) { to_dollar(amount: v) }
|
13
|
+
property 'inventory'
|
14
|
+
property 'inventory_dollar', from: 'inventory', with: ->(v) { to_dollar(amount: v) }
|
15
|
+
property 'other_current_assets', from: 'otherCurrentAssets'
|
16
|
+
property 'other_current_assets_dollar', from: 'otherCurrentAssets', with: ->(v) { to_dollar(amount: v) }
|
17
|
+
property 'current_assets', from: 'currentAssets'
|
18
|
+
property 'current_assets_dollar', from: 'currentAssets', with: ->(v) { to_dollar(amount: v) }
|
19
|
+
property 'long_term_investments', from: 'longTermInvestments'
|
20
|
+
property 'long_term_investments_dollar', from: 'longTermInvestments', with: ->(v) { to_dollar(amount: v) }
|
21
|
+
property 'property_plant_equipment', from: 'propertyPlantEquipment'
|
22
|
+
property 'property_plant_equipment_dollar', from: 'propertyPlantEquipment', with: ->(v) { to_dollar(amount: v) }
|
23
|
+
property 'goodwill'
|
24
|
+
property 'goodwill_dollar', from: 'goodwill', with: ->(v) { to_dollar(amount: v) }
|
25
|
+
property 'intangible_assets', from: 'intangibleAssets'
|
26
|
+
property 'intangible_assets_dollar', from: 'intangibleAssets', with: ->(v) { to_dollar(amount: v) }
|
27
|
+
property 'other_assets', from: 'otherAssets'
|
28
|
+
property 'other_assets_dollar', from: 'otherAssets', with: ->(v) { to_dollar(amount: v) }
|
29
|
+
property 'total_assets', from: 'totalAssets'
|
30
|
+
property 'total_assets_dollar', from: 'totalAssets', with: ->(v) { to_dollar(amount: v) }
|
31
|
+
property 'accounts_payable', from: 'accountsPayable'
|
32
|
+
property 'accounts_payable_dollar', from: 'accountsPayable', with: ->(v) { to_dollar(amount: v) }
|
33
|
+
property 'current_long_term_debt', from: 'currentLongTermDebt'
|
34
|
+
property 'current_long_term_debt_dollar', from: 'currentLongTermDebt', with: ->(v) { to_dollar(amount: v) }
|
35
|
+
property 'other_current_liabilities', from: 'otherCurrentLiabilities'
|
36
|
+
property 'other_current_liabilities_dollar', from: 'otherCurrentLiabilities', with: ->(v) { to_dollar(amount: v) }
|
37
|
+
property 'total_current_liabilities', from: 'totalCurrentLiabilities'
|
38
|
+
property 'total_current_liabilities_dollar', from: 'totalCurrentLiabilities', with: ->(v) { to_dollar(amount: v) }
|
39
|
+
property 'long_term_debt', from: 'longTermDebt'
|
40
|
+
property 'long_term_debt_dollar', from: 'longTermDebt', with: ->(v) { to_dollar(amount: v) }
|
41
|
+
property 'other_liabilities', from: 'otherLiabilities'
|
42
|
+
property 'other_liabilities_dollar', from: 'otherLiabilities', with: ->(v) { to_dollar(amount: v) }
|
43
|
+
property 'minority_interest', from: 'minorityInterest'
|
44
|
+
property 'minority_interest_dollar', from: 'minorityInterest', with: ->(v) { to_dollar(amount: v) }
|
45
|
+
property 'total_liabilities', from: 'totalLiabilities'
|
46
|
+
property 'total_liabilities_dollar', from: 'totalLiabilities', with: ->(v) { to_dollar(amount: v) }
|
47
|
+
property 'common_stock', from: 'commonStock'
|
48
|
+
property 'retained_earnings', from: 'retainedEarnings'
|
49
|
+
property 'retained_earnings_dollar', from: 'retainedEarnings', with: ->(v) { to_dollar(amount: v) }
|
50
|
+
property 'treasury_stock', from: 'treasuryStock'
|
51
|
+
property 'treasury_stock_dollar', from: 'treasuryStock', with: ->(v) { to_dollar(amount: v) }
|
52
|
+
property 'capital_surplus', from: 'capitalSurplus'
|
53
|
+
property 'capital_surplus_dollar', from: 'capitalSurplus', with: ->(v) { to_dollar(amount: v) }
|
54
|
+
property 'shareholder_equity', from: 'shareholderEquity'
|
55
|
+
property 'shareholder_equity_dollar', from: 'shareholderEquity', with: ->(v) { to_dollar(amount: v) }
|
56
|
+
property 'net_tangible_assets', from: 'netTangibleAssets'
|
57
|
+
property 'net_tangible_assets_dollar', from: 'netTangibleAssets', with: ->(v) { to_dollar(amount: v) }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|