iex-ruby-client 0.3.1 → 0.3.2
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 +4 -4
- data/.rubocop_todo.yml +3 -25
- data/CHANGELOG.md +4 -0
- data/lib/iex/resources/quote.rb +9 -7
- data/lib/iex/resources/resource.rb +0 -1
- data/lib/iex/version.rb +1 -1
- data/spec/fixtures/iex/quote/msft.yml +7 -7
- data/spec/iex/resources/quote_spec.rb +10 -10
- 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: 7baa081dbd5a61e40dc8ba2b265d15809327edf6
|
4
|
+
data.tar.gz: b780dbaa9f3a68d24d78b8c3974fbabcf4660295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b22f4e83f9f9db5298d1c224da5209b3118f9d8d49900206325fd46064617d71320bc4dc189f1309cd0bc6344adbd6ba2797904ce2414ae828dcdc85c86c31
|
7
|
+
data.tar.gz: 8318da35e7f2ae1fdbe2514dcdd63934238d88132dcc1c3e78decdbde71d44273309a9fcab8fce3615674397823d2552c38bb85a21283b543dad03fd10629ec4
|
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-05-
|
3
|
+
# on 2018-05-23 18:14:22 -0400 using RuboCop version 0.51.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
Lint/AmbiguousOperator:
|
11
|
-
Exclude:
|
12
|
-
- 'spec/iex/resources/quote_spec.rb'
|
13
|
-
|
14
9
|
# Offense count: 4
|
15
10
|
# Configuration parameters: CountComments, ExcludedMethods.
|
16
11
|
Metrics/BlockLength:
|
@@ -45,23 +40,6 @@ Style/DateTime:
|
|
45
40
|
- 'lib/iex/resources/news.rb'
|
46
41
|
- 'spec/iex/resources/news_spec.rb'
|
47
42
|
|
48
|
-
# Offense count:
|
43
|
+
# Offense count: 16
|
49
44
|
Style/Documentation:
|
50
|
-
|
51
|
-
- 'spec/**/*'
|
52
|
-
- 'test/**/*'
|
53
|
-
- 'lib/iex/api.rb'
|
54
|
-
- 'lib/iex/api/chart.rb'
|
55
|
-
- 'lib/iex/api/company.rb'
|
56
|
-
- 'lib/iex/api/news.rb'
|
57
|
-
- 'lib/iex/api/price.rb'
|
58
|
-
- 'lib/iex/api/quote.rb'
|
59
|
-
- 'lib/iex/errors/symbol_not_found_error.rb'
|
60
|
-
- 'lib/iex/resources/chart.rb'
|
61
|
-
- 'lib/iex/resources/chart/base.rb'
|
62
|
-
- 'lib/iex/resources/chart/default.rb'
|
63
|
-
- 'lib/iex/resources/chart/one_day.rb'
|
64
|
-
- 'lib/iex/resources/company.rb'
|
65
|
-
- 'lib/iex/resources/news.rb'
|
66
|
-
- 'lib/iex/resources/price.rb'
|
67
|
-
- 'lib/iex/resources/quote.rb'
|
45
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.3.2 (2018/05/26)
|
2
|
+
|
3
|
+
* Fix: undefined method > for nil:NilClass error - [@dblock](https://github.com/dblock).
|
4
|
+
|
1
5
|
### 0.3.1 (2018/05/23)
|
2
6
|
|
3
7
|
* [#3](https://github.com/dblock/iex-ruby-client/issues/3): Fix: do not error on undefined properties - [@dblock](https://github.com/dblock).
|
data/lib/iex/resources/quote.rb
CHANGED
@@ -16,12 +16,12 @@ module IEX
|
|
16
16
|
property 'latest_source', from: 'latestSource' # the source of latestPrice - IEX real time price, 15 minute delayed price, Close or Previous close
|
17
17
|
property 'latest_time', from: 'latestTime' # human readable time of the latestPrice
|
18
18
|
property 'latest_update', from: 'latestUpdate' # the update time of latestPrice in milliseconds since midnight Jan 1, 1970
|
19
|
-
property 'latest_update_t', from: 'latestUpdate', with: ->(v) { Time.at(v / 1000) } # the update time of latestPrice
|
19
|
+
property 'latest_update_t', from: 'latestUpdate', with: ->(v) { v && v > 0 ? Time.at(v / 1000) : nil } # the update time of latestPrice
|
20
20
|
property 'latest_volume', from: 'latestVolume' # the total market volume of the stock
|
21
21
|
property 'iex_realtime_price', from: 'iexRealtimePrice' # last sale price of the stock on IEX
|
22
22
|
property 'iex_realtime_size', from: 'iexRealtimeSize' # last sale size of the stock on IEX
|
23
23
|
property 'iex_last_updated', from: 'iexLastUpdated' # last update time of the data in milliseconds since midnight Jan 1, 1970 UTC or -1 or 0; if the value is -1 or 0, IEX has not quoted the symbol in the trading day
|
24
|
-
property 'iex_last_updated_t', from: 'iexLastUpdated', with: ->(v) { v > 0 ? Time.at(v / 1000) : nil } # last update time of the data
|
24
|
+
property 'iex_last_updated_t', from: 'iexLastUpdated', with: ->(v) { v && v > 0 ? Time.at(v / 1000) : nil } # last update time of the data
|
25
25
|
property 'delayed_price', from: 'delayedPrice' # 15 minute delayed market price
|
26
26
|
property 'delayed_price_time', from: 'delayedPriceTime' # time of the delayed market price
|
27
27
|
property 'extended_price', from: 'extendedPrice' # ?
|
@@ -30,11 +30,13 @@ module IEX
|
|
30
30
|
property 'change' # change in value, calculated using calculation_price from previous_close
|
31
31
|
property 'change_percent', from: 'changePercent' # change in percent, calculated using calculation_price from previous_close
|
32
32
|
property 'change_percent_s', from: 'changePercent', with: lambda { |v|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
if v
|
34
|
+
[
|
35
|
+
v > 0 ? '+' : '',
|
36
|
+
format('%.2f', v * 100),
|
37
|
+
'%'
|
38
|
+
].join
|
39
|
+
end
|
38
40
|
} # change in percent as a String with a leading + or - sign
|
39
41
|
property 'iex_market_percent', from: 'iexMarketPercent' # IEX’s percentage of the market in the stock
|
40
42
|
property 'iex_volume', from: 'iexVolume' # shares traded in the stock on IEX
|
data/lib/iex/version.rb
CHANGED
@@ -21,16 +21,16 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Sat, 26 May 2018 22:44:50 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/json; charset=utf-8
|
27
27
|
Content-Length:
|
28
|
-
- '
|
28
|
+
- '912'
|
29
29
|
Connection:
|
30
30
|
- keep-alive
|
31
31
|
Set-Cookie:
|
32
|
-
- ctoken=
|
33
|
-
|
32
|
+
- ctoken=b25c6a137426493aa77de4345b947c48; Domain=.iextrading.com; Path=/; Expires=Sun,
|
33
|
+
27 May 2018 10:44:50 GMT; Secure
|
34
34
|
Content-Security-Policy:
|
35
35
|
- default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
|
36
36
|
'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
|
@@ -62,8 +62,8 @@ http_interactions:
|
|
62
62
|
body:
|
63
63
|
encoding: UTF-8
|
64
64
|
string: '{"symbol":"MSFT","companyName":"Microsoft Corporation","primaryExchange":"Nasdaq
|
65
|
-
Global Select","sector":"Technology","calculationPrice":"close","open":
|
66
|
-
|
65
|
+
Global Select","sector":"Technology","calculationPrice":"close","open":98.3,"openTime":1527255000372,"close":98.36,"closeTime":1527278400376,"high":null,"low":null,"latestPrice":98.36,"latestSource":"Close","latestTime":"May
|
66
|
+
25, 2018","latestUpdate":1527278400376,"latestVolume":17944712,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":98.36,"delayedPriceTime":1527281515371,"extendedPrice":98.48,"extendedChange":0.12,"extendedChangePercent":0.00122,"extendedPriceTime":1527281940950,"previousClose":98.31,"change":0.05,"changePercent":0.00051,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":25656536,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":755719306395,"peRatio":29.1,"week52High":98.98,"week52Low":68.02,"ytdChange":0.15474471407271742}'
|
67
67
|
http_version:
|
68
|
-
recorded_at:
|
68
|
+
recorded_at: Sat, 26 May 2018 22:44:50 GMT
|
69
69
|
recorded_with: VCR 4.0.0
|
@@ -9,21 +9,21 @@ describe IEX::Resources::Quote do
|
|
9
9
|
expect(subject.symbol).to eq 'MSFT'
|
10
10
|
expect(subject.primary_exchange).to eq 'Nasdaq Global Select'
|
11
11
|
expect(subject.company_name).to eq 'Microsoft Corporation'
|
12
|
-
expect(subject.market_cap).to eq
|
12
|
+
expect(subject.market_cap).to eq 755_719_306_395
|
13
13
|
end
|
14
14
|
it 'coerces numbers' do
|
15
|
-
expect(subject.latest_price).to eq 98.
|
16
|
-
expect(subject.change).to eq
|
17
|
-
expect(subject.week_52_high).to eq 98.
|
15
|
+
expect(subject.latest_price).to eq 98.36
|
16
|
+
expect(subject.change).to eq 0.05
|
17
|
+
expect(subject.week_52_high).to eq 98.98
|
18
18
|
expect(subject.week_52_low).to eq 68.02
|
19
|
-
expect(subject.change_percent).to eq 0.
|
20
|
-
expect(subject.change_percent_s).to eq '+
|
19
|
+
expect(subject.change_percent).to eq 0.00051
|
20
|
+
expect(subject.change_percent_s).to eq '+0.05%'
|
21
21
|
end
|
22
22
|
it 'coerces times' do
|
23
|
-
expect(subject.latest_update).to eq
|
24
|
-
expect(subject.latest_update_t).to eq Time.at(
|
25
|
-
expect(subject.iex_last_updated).to
|
26
|
-
expect(subject.iex_last_updated_t).to
|
23
|
+
expect(subject.latest_update).to eq 1_527_278_400_376
|
24
|
+
expect(subject.latest_update_t).to eq Time.at(1_527_278_400)
|
25
|
+
expect(subject.iex_last_updated).to be nil
|
26
|
+
expect(subject.iex_last_updated_t).to be nil
|
27
27
|
end
|
28
28
|
end
|
29
29
|
context 'invalid symbol', vcr: { cassette_name: 'quote/invalid' } do
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|