iex-ruby-client 0.4.4 → 1.0.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/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +8 -36
- data/CHANGELOG.md +5 -0
- data/LICENSE.md +1 -1
- data/README.md +113 -160
- data/UPGRADING.md +55 -3
- data/iex-ruby-client.gemspec +1 -1
- data/lib/iex-ruby-client.rb +2 -0
- data/lib/iex/api.rb +15 -31
- data/lib/iex/api/client.rb +30 -0
- data/lib/iex/api/config.rb +45 -0
- data/lib/iex/cloud.rb +3 -0
- data/lib/iex/cloud/connection.rb +37 -0
- data/lib/iex/cloud/request.rb +38 -0
- data/lib/iex/cloud/response.rb +20 -0
- data/lib/iex/endpoints/chart.rb +39 -0
- data/lib/iex/endpoints/company.rb +11 -0
- data/lib/iex/endpoints/crypto.rb +11 -0
- data/lib/iex/endpoints/dividends.rb +18 -0
- data/lib/iex/endpoints/earnings.rb +13 -0
- data/lib/iex/endpoints/key_stats.rb +11 -0
- data/lib/iex/endpoints/largest_trades.rb +13 -0
- data/lib/iex/endpoints/logo.rb +11 -0
- data/lib/iex/endpoints/news.rb +19 -0
- data/lib/iex/endpoints/ohlc.rb +17 -0
- data/lib/iex/endpoints/price.rb +11 -0
- data/lib/iex/endpoints/quote.rb +11 -0
- data/lib/iex/endpoints/sectors.rb +17 -0
- data/lib/iex/errors.rb +1 -0
- data/lib/iex/errors/client_error.rb +13 -1
- data/lib/iex/errors/permission_denied_error.rb +5 -0
- data/lib/iex/logger.rb +13 -0
- data/lib/iex/resources.rb +0 -1
- data/lib/iex/resources/chart.rb +38 -21
- data/lib/iex/resources/company.rb +2 -8
- data/lib/iex/resources/crypto.rb +10 -18
- data/lib/iex/resources/dividends.rb +5 -15
- data/lib/iex/resources/earnings.rb +1 -15
- data/lib/iex/resources/key_stats.rb +11 -57
- data/lib/iex/resources/largest_trades.rb +0 -10
- data/lib/iex/resources/logo.rb +0 -8
- data/lib/iex/resources/news.rb +1 -11
- data/lib/iex/resources/ohlc.rb +8 -16
- data/lib/iex/resources/quote.rb +0 -8
- data/lib/iex/resources/resource.rb +19 -2
- data/lib/iex/resources/sectors.rb +0 -10
- data/lib/iex/version.rb +1 -1
- data/spec/fixtures/iex/chart/1d.yml +472 -444
- data/spec/fixtures/iex/chart/20190306.yml +475 -0
- data/spec/fixtures/iex/chart/bad_option.yml +80 -62
- data/spec/fixtures/iex/chart/chartInterval.yml +121 -98
- data/spec/fixtures/iex/chart/dynamic/1m.yml +106 -81
- data/spec/fixtures/iex/chart/invalid.yml +80 -58
- data/spec/fixtures/iex/chart/msft.yml +106 -81
- data/spec/fixtures/iex/client/access_denied.yml +49 -0
- data/spec/fixtures/iex/company/invalid.yml +80 -58
- data/spec/fixtures/iex/company/msft.yml +87 -65
- data/spec/fixtures/iex/crypto/btcusdt.yml +87 -0
- data/spec/fixtures/iex/dividends/invalid.yml +80 -62
- data/spec/fixtures/iex/dividends/msft.yml +88 -66
- data/spec/fixtures/iex/dividends/msft_1y.yml +92 -68
- data/spec/fixtures/iex/dividends/msft_default_range.yml +85 -65
- data/spec/fixtures/iex/dividends/msft_invalid_range.yml +82 -64
- data/spec/fixtures/iex/earnings/invalid.yml +80 -62
- data/spec/fixtures/iex/earnings/msft.yml +84 -68
- data/spec/fixtures/iex/key_stats/invalid.yml +80 -62
- data/spec/fixtures/iex/key_stats/msft.yml +84 -65
- data/spec/fixtures/iex/largest-trades/aapl.yml +91 -73
- data/spec/fixtures/iex/largest-trades/invalid.yml +80 -62
- data/spec/fixtures/iex/logo/msft.yml +82 -64
- data/spec/fixtures/iex/news/invalid.yml +80 -58
- data/spec/fixtures/iex/news/msft.yml +83 -61
- data/spec/fixtures/iex/news/msft_7.yml +83 -61
- data/spec/fixtures/iex/ohlc/market.yml +82 -65
- data/spec/fixtures/iex/ohlc/msft.yml +82 -64
- data/spec/fixtures/iex/price/invalid.yml +80 -58
- data/spec/fixtures/iex/price/msft.yml +82 -60
- data/spec/fixtures/iex/quote/invalid.yml +80 -62
- data/spec/fixtures/iex/quote/msft.yml +84 -66
- data/spec/fixtures/iex/sectors/invalid.yml +80 -62
- data/spec/fixtures/iex/sectors/sectors-performance.yml +88 -69
- data/spec/iex/client_spec.rb +138 -0
- data/spec/iex/config_spec.rb +22 -0
- data/spec/iex/{resources → endpoints}/chart_spec.rb +23 -21
- data/spec/iex/{resources → endpoints}/company_spec.rb +11 -7
- data/spec/iex/endpoints/crypto_spec.rb +66 -0
- data/spec/iex/{resources → endpoints}/dividends_spec.rb +17 -14
- data/spec/iex/endpoints/earnings_spec.rb +36 -0
- data/spec/iex/endpoints/key_stats_spec.rb +62 -0
- data/spec/iex/{resources → endpoints}/largest_trades_spec.rb +8 -6
- data/spec/iex/{resources → endpoints}/logo_spec.rb +3 -1
- data/spec/iex/endpoints/news_spec.rb +36 -0
- data/spec/iex/{resources → endpoints}/ohlc_spec.rb +15 -13
- data/spec/iex/{resources → endpoints}/price_spec.rb +6 -4
- data/spec/iex/endpoints/quote_spec.rb +38 -0
- data/spec/iex/{resources → endpoints}/sectors_spec.rb +7 -6
- data/spec/iex/resources/{base_spec.rb → resource_spec.rb} +6 -6
- data/spec/spec_helper.rb +2 -0
- data/spec/support/client.rb +6 -0
- metadata +66 -59
- data/lib/iex/api/chart.rb +0 -24
- data/lib/iex/api/company.rb +0 -13
- data/lib/iex/api/crypto.rb +0 -13
- data/lib/iex/api/dividends.rb +0 -17
- data/lib/iex/api/earnings.rb +0 -13
- data/lib/iex/api/key_stats.rb +0 -13
- data/lib/iex/api/largest_trades.rb +0 -13
- data/lib/iex/api/logo.rb +0 -13
- data/lib/iex/api/news.rb +0 -18
- data/lib/iex/api/ohlc.rb +0 -17
- data/lib/iex/api/price.rb +0 -13
- data/lib/iex/api/quote.rb +0 -13
- data/lib/iex/api/sectors.rb +0 -16
- data/lib/iex/resources/base.rb +0 -27
- data/lib/iex/resources/chart/base.rb +0 -14
- data/lib/iex/resources/chart/default.rb +0 -21
- data/lib/iex/resources/chart/one_day.rb +0 -20
- data/lib/iex/resources/ohlc/base.rb +0 -14
- data/lib/iex/resources/ohlc/timed_price.rb +0 -12
- data/lib/iex/resources/price.rb +0 -13
- data/spec/fixtures/iex/chart/20180227.yml +0 -452
- data/spec/fixtures/iex/crypto.yml +0 -101
- data/spec/fixtures/iex/news/market.yml +0 -64
- data/spec/iex/resources/crypto_spec.rb +0 -65
- data/spec/iex/resources/earnings_spec.rb +0 -38
- data/spec/iex/resources/key_stats_spec.rb +0 -94
- data/spec/iex/resources/news_spec.rb +0 -44
- data/spec/iex/resources/quote_spec.rb +0 -38
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IEX::Resources::KeyStats do
|
4
|
+
include_context 'client'
|
5
|
+
|
6
|
+
context 'general information', vcr: { cassette_name: 'key_stats/msft' } do
|
7
|
+
subject do
|
8
|
+
client.key_stats('MSFT')
|
9
|
+
end
|
10
|
+
it 'retrieves a keyStats' do
|
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'
|
14
|
+
end
|
15
|
+
|
16
|
+
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'
|
22
|
+
end
|
23
|
+
|
24
|
+
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
|
32
|
+
end
|
33
|
+
|
34
|
+
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%'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'invalid symbol', vcr: { cassette_name: 'key_stats/invalid' } do
|
54
|
+
subject do
|
55
|
+
client.key_stats('INVALID')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'fails with SymbolNotFoundError' do
|
59
|
+
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,15 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe IEX::Resources::LargestTrades do
|
4
|
+
include_context 'client'
|
5
|
+
|
4
6
|
context 'retrieves the largest trade for a specific stock', vcr: { cassette_name: 'largest-trades/aapl' } do
|
5
7
|
subject do
|
6
|
-
|
8
|
+
client.largest_trades('aapl')
|
7
9
|
end
|
8
10
|
it 'retrieve largest trades' do
|
9
|
-
expect(subject.first.size).to eq
|
10
|
-
expect(subject.first.price).to eq
|
11
|
-
expect(subject.first.time).to eq
|
12
|
-
expect(subject.first.time_label).to eq '
|
11
|
+
expect(subject.first.size).to eq 18_400
|
12
|
+
expect(subject.first.price).to eq 195.82
|
13
|
+
expect(subject.first.time).to eq 1_554_403_101_504
|
14
|
+
expect(subject.first.time_label).to eq '14:38:21'
|
13
15
|
expect(subject.first.venue).to eq('None')
|
14
16
|
expect(subject.first.venue_name).to eq('Off Exchange')
|
15
17
|
end
|
@@ -17,7 +19,7 @@ describe IEX::Resources::LargestTrades do
|
|
17
19
|
|
18
20
|
context 'invalid symbol', vcr: { cassette_name: 'largest-trades/invalid' } do
|
19
21
|
subject do
|
20
|
-
|
22
|
+
client.largest_trades('INVALID')
|
21
23
|
end
|
22
24
|
it 'fails with SymbolNotFoundError' do
|
23
25
|
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe IEX::Resources::Logo do
|
4
|
+
include_context 'client'
|
5
|
+
|
4
6
|
context "retrieves company's logo", vcr: { cassette_name: 'logo/msft' } do
|
5
7
|
subject do
|
6
|
-
|
8
|
+
client.logo('MSFT')
|
7
9
|
end
|
8
10
|
|
9
11
|
it 'retrieves a logo' do
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IEX::Resources::News do
|
4
|
+
include_context 'client'
|
5
|
+
|
6
|
+
context 'known symbol' do
|
7
|
+
context 'with defaults', vcr: { cassette_name: 'news/msft' } do
|
8
|
+
subject do
|
9
|
+
client.news('MSFT')
|
10
|
+
end
|
11
|
+
let(:news) { subject.first }
|
12
|
+
it 'retrieves news' do
|
13
|
+
expect(subject.size).to eq 10
|
14
|
+
expect(news.datetime.to_f).to eq 1_554_412_248.0
|
15
|
+
expect(news.headline).to eq "Spotify joins Microsoft's Xbox Game Bar"
|
16
|
+
expect(news.related).to eq(['MSFT'])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context 'with range', vcr: { cassette_name: 'news/msft_7' } do
|
20
|
+
subject do
|
21
|
+
client.news('MSFT', 7)
|
22
|
+
end
|
23
|
+
it 'retrieves news' do
|
24
|
+
expect(subject.size).to eq 7
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
context 'invalid symbol', vcr: { cassette_name: 'news/invalid' } do
|
29
|
+
subject do
|
30
|
+
client.news('INVALID')
|
31
|
+
end
|
32
|
+
it 'fails with SymbolNotFoundError' do
|
33
|
+
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,48 +1,50 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe IEX::Resources::OHLC do
|
4
|
+
include_context 'client'
|
5
|
+
|
4
6
|
context 'known symbol', vcr: { cassette_name: 'ohlc/msft' } do
|
5
7
|
subject do
|
6
|
-
|
8
|
+
client.ohlc('MSFT')
|
7
9
|
end
|
8
10
|
it 'retrieves a close price' do
|
9
|
-
expect(subject.close.price).to eq
|
11
|
+
expect(subject.close.price).to eq 119.36
|
10
12
|
end
|
11
13
|
it 'retrieves a open price' do
|
12
|
-
expect(subject.open.price).to eq
|
14
|
+
expect(subject.open.price).to eq 120
|
13
15
|
end
|
14
16
|
it 'retrieves a high price' do
|
15
|
-
expect(subject.high).to eq
|
17
|
+
expect(subject.high).to eq 120.23
|
16
18
|
end
|
17
19
|
it 'retrieves a low price' do
|
18
|
-
expect(subject.low).to eq
|
20
|
+
expect(subject.low).to eq 118.38
|
19
21
|
end
|
20
22
|
it 'retrieves a close price date/time' do
|
21
|
-
expect(subject.close.time.to_f).to eq
|
23
|
+
expect(subject.close.time.to_f).to eq 1_554_408_000.193
|
22
24
|
end
|
23
25
|
it 'retrieves a open price date/time' do
|
24
|
-
expect(subject.open.time.to_f).to eq
|
26
|
+
expect(subject.open.time.to_f).to eq 1_554_384_600.42
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
context 'market', vcr: { cassette_name: 'ohlc/market' } do
|
29
31
|
subject do
|
30
|
-
|
32
|
+
client.market
|
31
33
|
end
|
32
34
|
it 'retrieves a right number of stocks' do
|
33
|
-
expect(subject.size).to eq
|
35
|
+
expect(subject.size).to eq 8890
|
34
36
|
end
|
35
37
|
it 'retrieves a close price for known symbol' do
|
36
|
-
expect(subject['MSFT'].close.price).to eq
|
38
|
+
expect(subject['MSFT'].close.price).to eq 119.36
|
37
39
|
end
|
38
40
|
it 'retrieves a close price time for known symbol' do
|
39
|
-
expect(subject['MSFT'].close.time.to_f).to eq
|
41
|
+
expect(subject['MSFT'].close.time.to_f).to eq 1_554_408_000.193
|
40
42
|
end
|
41
43
|
it 'retrieves a open price for known symbol' do
|
42
|
-
expect(subject['MSFT'].open.price).to eq
|
44
|
+
expect(subject['MSFT'].open.price).to eq 120
|
43
45
|
end
|
44
46
|
it 'retrieves a open price time for known symbol' do
|
45
|
-
expect(subject['MSFT'].open.time.to_f).to eq
|
47
|
+
expect(subject['MSFT'].open.time.to_f).to eq 1_554_384_600.42
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe IEX::
|
3
|
+
describe IEX::Api::Client do
|
4
|
+
include_context 'client'
|
5
|
+
|
4
6
|
context 'known symbol', vcr: { cassette_name: 'price/msft' } do
|
5
7
|
subject do
|
6
|
-
|
8
|
+
client.price('MSFT')
|
7
9
|
end
|
8
10
|
it 'retrieves a price' do
|
9
|
-
expect(subject).to eq
|
11
|
+
expect(subject).to eq 119.36
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
15
|
context 'invalid symbol', vcr: { cassette_name: 'price/invalid' } do
|
14
16
|
subject do
|
15
|
-
|
17
|
+
client.price('INVALID')
|
16
18
|
end
|
17
19
|
it 'fails with SymbolNotFoundError' do
|
18
20
|
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IEX::Resources::Quote do
|
4
|
+
include_context 'client'
|
5
|
+
context 'known symbol', vcr: { cassette_name: 'quote/msft' } do
|
6
|
+
subject do
|
7
|
+
client.quote('MSFT')
|
8
|
+
end
|
9
|
+
it 'retrieves a quote' do
|
10
|
+
expect(subject.symbol).to eq 'MSFT'
|
11
|
+
expect(subject.company_name).to eq 'Microsoft Corp.'
|
12
|
+
expect(subject.market_cap).to eq 915_754_985_600
|
13
|
+
end
|
14
|
+
it 'coerces numbers' do
|
15
|
+
expect(subject.latest_price).to eq 119.36
|
16
|
+
expect(subject.change).to eq(-0.61)
|
17
|
+
expect(subject.week_52_high).to eq 120.82
|
18
|
+
expect(subject.week_52_low).to eq 87.73
|
19
|
+
expect(subject.change_percent).to eq(-0.00508)
|
20
|
+
expect(subject.change_percent_s).to eq '-0.51%'
|
21
|
+
end
|
22
|
+
it 'coerces times' do
|
23
|
+
expect(subject.latest_update).to eq 1_554_408_000_193
|
24
|
+
expect(subject.latest_update_t).to eq Time.at(1_554_408_000)
|
25
|
+
expect(subject.iex_last_updated).to eq 1_554_407_999_529
|
26
|
+
expect(subject.iex_last_updated_t).to eq Time.at(1_554_407_999)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'invalid symbol', vcr: { cassette_name: 'quote/invalid' } do
|
31
|
+
subject do
|
32
|
+
client.quote('INVALID')
|
33
|
+
end
|
34
|
+
it 'fails with SymbolNotFoundError' do
|
35
|
+
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,25 +1,26 @@
|
|
1
|
-
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe IEX::Resources::Sectors do
|
4
|
+
include_context 'client'
|
5
|
+
|
5
6
|
context 'known symbol' do
|
6
7
|
context 'with defaults', vcr: { cassette_name: 'sectors/sectors-performance' } do
|
7
8
|
subject do
|
8
|
-
|
9
|
+
client.sectors('market')
|
9
10
|
end
|
10
11
|
let(:Sectors) { subject.first }
|
11
12
|
it 'retrieves Sectors' do
|
12
13
|
expect(subject.size).to eq 11
|
13
14
|
expect(subject.first.type).to eq('sector')
|
14
|
-
expect(subject.first.name).to eq '
|
15
|
-
expect(subject.first.performance).to eq 0.
|
16
|
-
expect(subject.first.last_updated).to eq
|
15
|
+
expect(subject.first.name).to eq 'Materials'
|
16
|
+
expect(subject.first.performance).to eq 0.01013
|
17
|
+
expect(subject.first.last_updated).to eq 1_554_408_000_270
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
21
|
context 'invalid symbol', vcr: { cassette_name: 'sectors/invalid' } do
|
21
22
|
subject do
|
22
|
-
|
23
|
+
client.sectors('INVALID')
|
23
24
|
end
|
24
25
|
it 'fails with SymbolNotFoundError' do
|
25
26
|
expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe IEX::Resources::
|
3
|
+
describe IEX::Resources::Resource do
|
4
4
|
context 'float number to percent (Positive)' do
|
5
5
|
subject do
|
6
|
-
IEX::Resources::
|
6
|
+
IEX::Resources::Resource.float_to_percentage(0.09123)
|
7
7
|
end
|
8
8
|
it 'converts to percentage' do
|
9
9
|
expect(subject).to eq '+9.12%'
|
@@ -12,7 +12,7 @@ describe IEX::Resources::Base do
|
|
12
12
|
|
13
13
|
context 'float number to percent (Negative)' do
|
14
14
|
subject do
|
15
|
-
IEX::Resources::
|
15
|
+
IEX::Resources::Resource.float_to_percentage(-0.09123)
|
16
16
|
end
|
17
17
|
it 'converts to percentage' do
|
18
18
|
expect(subject).to eq '-9.12%'
|
@@ -21,7 +21,7 @@ describe IEX::Resources::Base do
|
|
21
21
|
|
22
22
|
context 'float number to percent (nil)' do
|
23
23
|
subject do
|
24
|
-
IEX::Resources::
|
24
|
+
IEX::Resources::Resource.float_to_percentage(nil)
|
25
25
|
end
|
26
26
|
it 'nil argument does not convert' do
|
27
27
|
expect(subject).to eq nil
|
@@ -30,7 +30,7 @@ describe IEX::Resources::Base do
|
|
30
30
|
|
31
31
|
context 'float number to percent (0)' do
|
32
32
|
subject do
|
33
|
-
IEX::Resources::
|
33
|
+
IEX::Resources::Resource.float_to_percentage(0)
|
34
34
|
end
|
35
35
|
it 'Zero converts to +0.00%' do
|
36
36
|
expect(subject).to eq '+0.00%'
|
@@ -39,7 +39,7 @@ describe IEX::Resources::Base do
|
|
39
39
|
|
40
40
|
context 'Unformatted money amount to dollar' do
|
41
41
|
subject do
|
42
|
-
IEX::Resources::
|
42
|
+
IEX::Resources::Resource.to_dollar(amount: 123_391)
|
43
43
|
end
|
44
44
|
it 'converts to dollar' do
|
45
45
|
expect(subject).to eq '$123,391'
|
data/spec/spec_helper.rb
CHANGED
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.67.2
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.67.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: vcr
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,28 +159,32 @@ files:
|
|
159
159
|
- iex-ruby-client.gemspec
|
160
160
|
- lib/iex-ruby-client.rb
|
161
161
|
- lib/iex/api.rb
|
162
|
-
- lib/iex/api/
|
163
|
-
- lib/iex/api/
|
164
|
-
- lib/iex/
|
165
|
-
- lib/iex/
|
166
|
-
- lib/iex/
|
167
|
-
- lib/iex/
|
168
|
-
- lib/iex/
|
169
|
-
- lib/iex/
|
170
|
-
- lib/iex/
|
171
|
-
- lib/iex/
|
172
|
-
- lib/iex/
|
173
|
-
- lib/iex/
|
174
|
-
- lib/iex/
|
162
|
+
- lib/iex/api/client.rb
|
163
|
+
- lib/iex/api/config.rb
|
164
|
+
- lib/iex/cloud.rb
|
165
|
+
- lib/iex/cloud/connection.rb
|
166
|
+
- lib/iex/cloud/request.rb
|
167
|
+
- lib/iex/cloud/response.rb
|
168
|
+
- lib/iex/endpoints/chart.rb
|
169
|
+
- lib/iex/endpoints/company.rb
|
170
|
+
- lib/iex/endpoints/crypto.rb
|
171
|
+
- lib/iex/endpoints/dividends.rb
|
172
|
+
- lib/iex/endpoints/earnings.rb
|
173
|
+
- lib/iex/endpoints/key_stats.rb
|
174
|
+
- lib/iex/endpoints/largest_trades.rb
|
175
|
+
- lib/iex/endpoints/logo.rb
|
176
|
+
- lib/iex/endpoints/news.rb
|
177
|
+
- lib/iex/endpoints/ohlc.rb
|
178
|
+
- lib/iex/endpoints/price.rb
|
179
|
+
- lib/iex/endpoints/quote.rb
|
180
|
+
- lib/iex/endpoints/sectors.rb
|
175
181
|
- lib/iex/errors.rb
|
176
182
|
- lib/iex/errors/client_error.rb
|
183
|
+
- lib/iex/errors/permission_denied_error.rb
|
177
184
|
- lib/iex/errors/symbol_not_found_error.rb
|
185
|
+
- lib/iex/logger.rb
|
178
186
|
- lib/iex/resources.rb
|
179
|
-
- lib/iex/resources/base.rb
|
180
187
|
- lib/iex/resources/chart.rb
|
181
|
-
- lib/iex/resources/chart/base.rb
|
182
|
-
- lib/iex/resources/chart/default.rb
|
183
|
-
- lib/iex/resources/chart/one_day.rb
|
184
188
|
- lib/iex/resources/company.rb
|
185
189
|
- lib/iex/resources/crypto.rb
|
186
190
|
- lib/iex/resources/dividends.rb
|
@@ -190,23 +194,21 @@ files:
|
|
190
194
|
- lib/iex/resources/logo.rb
|
191
195
|
- lib/iex/resources/news.rb
|
192
196
|
- lib/iex/resources/ohlc.rb
|
193
|
-
- lib/iex/resources/ohlc/base.rb
|
194
|
-
- lib/iex/resources/ohlc/timed_price.rb
|
195
|
-
- lib/iex/resources/price.rb
|
196
197
|
- lib/iex/resources/quote.rb
|
197
198
|
- lib/iex/resources/resource.rb
|
198
199
|
- lib/iex/resources/sectors.rb
|
199
200
|
- lib/iex/version.rb
|
200
201
|
- spec/fixtures/iex/chart/1d.yml
|
201
|
-
- spec/fixtures/iex/chart/
|
202
|
+
- spec/fixtures/iex/chart/20190306.yml
|
202
203
|
- spec/fixtures/iex/chart/bad_option.yml
|
203
204
|
- spec/fixtures/iex/chart/chartInterval.yml
|
204
205
|
- spec/fixtures/iex/chart/dynamic/1m.yml
|
205
206
|
- spec/fixtures/iex/chart/invalid.yml
|
206
207
|
- spec/fixtures/iex/chart/msft.yml
|
208
|
+
- spec/fixtures/iex/client/access_denied.yml
|
207
209
|
- spec/fixtures/iex/company/invalid.yml
|
208
210
|
- spec/fixtures/iex/company/msft.yml
|
209
|
-
- spec/fixtures/iex/crypto.yml
|
211
|
+
- spec/fixtures/iex/crypto/btcusdt.yml
|
210
212
|
- spec/fixtures/iex/dividends/invalid.yml
|
211
213
|
- spec/fixtures/iex/dividends/msft.yml
|
212
214
|
- spec/fixtures/iex/dividends/msft_1y.yml
|
@@ -220,7 +222,6 @@ files:
|
|
220
222
|
- spec/fixtures/iex/largest-trades/invalid.yml
|
221
223
|
- spec/fixtures/iex/logo/msft.yml
|
222
224
|
- spec/fixtures/iex/news/invalid.yml
|
223
|
-
- spec/fixtures/iex/news/market.yml
|
224
225
|
- spec/fixtures/iex/news/msft.yml
|
225
226
|
- spec/fixtures/iex/news/msft_7.yml
|
226
227
|
- spec/fixtures/iex/ohlc/market.yml
|
@@ -231,22 +232,25 @@ files:
|
|
231
232
|
- spec/fixtures/iex/quote/msft.yml
|
232
233
|
- spec/fixtures/iex/sectors/invalid.yml
|
233
234
|
- spec/fixtures/iex/sectors/sectors-performance.yml
|
234
|
-
- spec/iex/
|
235
|
-
- spec/iex/
|
236
|
-
- spec/iex/
|
237
|
-
- spec/iex/
|
238
|
-
- spec/iex/
|
239
|
-
- spec/iex/
|
240
|
-
- spec/iex/
|
241
|
-
- spec/iex/
|
242
|
-
- spec/iex/
|
243
|
-
- spec/iex/
|
244
|
-
- spec/iex/
|
245
|
-
- spec/iex/
|
246
|
-
- spec/iex/
|
247
|
-
- spec/iex/
|
235
|
+
- spec/iex/client_spec.rb
|
236
|
+
- spec/iex/config_spec.rb
|
237
|
+
- spec/iex/endpoints/chart_spec.rb
|
238
|
+
- spec/iex/endpoints/company_spec.rb
|
239
|
+
- spec/iex/endpoints/crypto_spec.rb
|
240
|
+
- spec/iex/endpoints/dividends_spec.rb
|
241
|
+
- spec/iex/endpoints/earnings_spec.rb
|
242
|
+
- spec/iex/endpoints/key_stats_spec.rb
|
243
|
+
- spec/iex/endpoints/largest_trades_spec.rb
|
244
|
+
- spec/iex/endpoints/logo_spec.rb
|
245
|
+
- spec/iex/endpoints/news_spec.rb
|
246
|
+
- spec/iex/endpoints/ohlc_spec.rb
|
247
|
+
- spec/iex/endpoints/price_spec.rb
|
248
|
+
- spec/iex/endpoints/quote_spec.rb
|
249
|
+
- spec/iex/endpoints/sectors_spec.rb
|
250
|
+
- spec/iex/resources/resource_spec.rb
|
248
251
|
- spec/iex/version_spec.rb
|
249
252
|
- spec/spec_helper.rb
|
253
|
+
- spec/support/client.rb
|
250
254
|
- spec/support/vcr.rb
|
251
255
|
homepage: http://github.com/dblock/iex-ruby-client
|
252
256
|
licenses:
|
@@ -268,21 +272,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
272
|
version: 1.3.6
|
269
273
|
requirements: []
|
270
274
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
275
|
+
rubygems_version: 2.6.14.1
|
272
276
|
signing_key:
|
273
277
|
specification_version: 4
|
274
278
|
summary: IEX Finance API Ruby client with support for retrieving stock quotes.
|
275
279
|
test_files:
|
276
280
|
- spec/fixtures/iex/chart/1d.yml
|
277
|
-
- spec/fixtures/iex/chart/
|
281
|
+
- spec/fixtures/iex/chart/20190306.yml
|
278
282
|
- spec/fixtures/iex/chart/bad_option.yml
|
279
283
|
- spec/fixtures/iex/chart/chartInterval.yml
|
280
284
|
- spec/fixtures/iex/chart/dynamic/1m.yml
|
281
285
|
- spec/fixtures/iex/chart/invalid.yml
|
282
286
|
- spec/fixtures/iex/chart/msft.yml
|
287
|
+
- spec/fixtures/iex/client/access_denied.yml
|
283
288
|
- spec/fixtures/iex/company/invalid.yml
|
284
289
|
- spec/fixtures/iex/company/msft.yml
|
285
|
-
- spec/fixtures/iex/crypto.yml
|
290
|
+
- spec/fixtures/iex/crypto/btcusdt.yml
|
286
291
|
- spec/fixtures/iex/dividends/invalid.yml
|
287
292
|
- spec/fixtures/iex/dividends/msft.yml
|
288
293
|
- spec/fixtures/iex/dividends/msft_1y.yml
|
@@ -296,7 +301,6 @@ test_files:
|
|
296
301
|
- spec/fixtures/iex/largest-trades/invalid.yml
|
297
302
|
- spec/fixtures/iex/logo/msft.yml
|
298
303
|
- spec/fixtures/iex/news/invalid.yml
|
299
|
-
- spec/fixtures/iex/news/market.yml
|
300
304
|
- spec/fixtures/iex/news/msft.yml
|
301
305
|
- spec/fixtures/iex/news/msft_7.yml
|
302
306
|
- spec/fixtures/iex/ohlc/market.yml
|
@@ -307,20 +311,23 @@ test_files:
|
|
307
311
|
- spec/fixtures/iex/quote/msft.yml
|
308
312
|
- spec/fixtures/iex/sectors/invalid.yml
|
309
313
|
- spec/fixtures/iex/sectors/sectors-performance.yml
|
310
|
-
- spec/iex/
|
311
|
-
- spec/iex/
|
312
|
-
- spec/iex/
|
313
|
-
- spec/iex/
|
314
|
-
- spec/iex/
|
315
|
-
- spec/iex/
|
316
|
-
- spec/iex/
|
317
|
-
- spec/iex/
|
318
|
-
- spec/iex/
|
319
|
-
- spec/iex/
|
320
|
-
- spec/iex/
|
321
|
-
- spec/iex/
|
322
|
-
- spec/iex/
|
323
|
-
- spec/iex/
|
314
|
+
- spec/iex/client_spec.rb
|
315
|
+
- spec/iex/config_spec.rb
|
316
|
+
- spec/iex/endpoints/chart_spec.rb
|
317
|
+
- spec/iex/endpoints/company_spec.rb
|
318
|
+
- spec/iex/endpoints/crypto_spec.rb
|
319
|
+
- spec/iex/endpoints/dividends_spec.rb
|
320
|
+
- spec/iex/endpoints/earnings_spec.rb
|
321
|
+
- spec/iex/endpoints/key_stats_spec.rb
|
322
|
+
- spec/iex/endpoints/largest_trades_spec.rb
|
323
|
+
- spec/iex/endpoints/logo_spec.rb
|
324
|
+
- spec/iex/endpoints/news_spec.rb
|
325
|
+
- spec/iex/endpoints/ohlc_spec.rb
|
326
|
+
- spec/iex/endpoints/price_spec.rb
|
327
|
+
- spec/iex/endpoints/quote_spec.rb
|
328
|
+
- spec/iex/endpoints/sectors_spec.rb
|
329
|
+
- spec/iex/resources/resource_spec.rb
|
324
330
|
- spec/iex/version_spec.rb
|
325
331
|
- spec/spec_helper.rb
|
332
|
+
- spec/support/client.rb
|
326
333
|
- spec/support/vcr.rb
|