iex-ruby-client 0.4.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +6 -0
  3. data/.rubocop_todo.yml +8 -36
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.md +1 -1
  6. data/README.md +113 -160
  7. data/UPGRADING.md +55 -3
  8. data/iex-ruby-client.gemspec +1 -1
  9. data/lib/iex-ruby-client.rb +2 -0
  10. data/lib/iex/api.rb +15 -31
  11. data/lib/iex/api/client.rb +30 -0
  12. data/lib/iex/api/config.rb +45 -0
  13. data/lib/iex/cloud.rb +3 -0
  14. data/lib/iex/cloud/connection.rb +37 -0
  15. data/lib/iex/cloud/request.rb +38 -0
  16. data/lib/iex/cloud/response.rb +20 -0
  17. data/lib/iex/endpoints/chart.rb +39 -0
  18. data/lib/iex/endpoints/company.rb +11 -0
  19. data/lib/iex/endpoints/crypto.rb +11 -0
  20. data/lib/iex/endpoints/dividends.rb +18 -0
  21. data/lib/iex/endpoints/earnings.rb +13 -0
  22. data/lib/iex/endpoints/key_stats.rb +11 -0
  23. data/lib/iex/endpoints/largest_trades.rb +13 -0
  24. data/lib/iex/endpoints/logo.rb +11 -0
  25. data/lib/iex/endpoints/news.rb +19 -0
  26. data/lib/iex/endpoints/ohlc.rb +17 -0
  27. data/lib/iex/endpoints/price.rb +11 -0
  28. data/lib/iex/endpoints/quote.rb +11 -0
  29. data/lib/iex/endpoints/sectors.rb +17 -0
  30. data/lib/iex/errors.rb +1 -0
  31. data/lib/iex/errors/client_error.rb +13 -1
  32. data/lib/iex/errors/permission_denied_error.rb +5 -0
  33. data/lib/iex/logger.rb +13 -0
  34. data/lib/iex/resources.rb +0 -1
  35. data/lib/iex/resources/chart.rb +38 -21
  36. data/lib/iex/resources/company.rb +2 -8
  37. data/lib/iex/resources/crypto.rb +10 -18
  38. data/lib/iex/resources/dividends.rb +5 -15
  39. data/lib/iex/resources/earnings.rb +1 -15
  40. data/lib/iex/resources/key_stats.rb +11 -57
  41. data/lib/iex/resources/largest_trades.rb +0 -10
  42. data/lib/iex/resources/logo.rb +0 -8
  43. data/lib/iex/resources/news.rb +1 -11
  44. data/lib/iex/resources/ohlc.rb +8 -16
  45. data/lib/iex/resources/quote.rb +0 -8
  46. data/lib/iex/resources/resource.rb +19 -2
  47. data/lib/iex/resources/sectors.rb +0 -10
  48. data/lib/iex/version.rb +1 -1
  49. data/spec/fixtures/iex/chart/1d.yml +472 -444
  50. data/spec/fixtures/iex/chart/20190306.yml +475 -0
  51. data/spec/fixtures/iex/chart/bad_option.yml +80 -62
  52. data/spec/fixtures/iex/chart/chartInterval.yml +121 -98
  53. data/spec/fixtures/iex/chart/dynamic/1m.yml +106 -81
  54. data/spec/fixtures/iex/chart/invalid.yml +80 -58
  55. data/spec/fixtures/iex/chart/msft.yml +106 -81
  56. data/spec/fixtures/iex/client/access_denied.yml +49 -0
  57. data/spec/fixtures/iex/company/invalid.yml +80 -58
  58. data/spec/fixtures/iex/company/msft.yml +87 -65
  59. data/spec/fixtures/iex/crypto/btcusdt.yml +87 -0
  60. data/spec/fixtures/iex/dividends/invalid.yml +80 -62
  61. data/spec/fixtures/iex/dividends/msft.yml +88 -66
  62. data/spec/fixtures/iex/dividends/msft_1y.yml +92 -68
  63. data/spec/fixtures/iex/dividends/msft_default_range.yml +85 -65
  64. data/spec/fixtures/iex/dividends/msft_invalid_range.yml +82 -64
  65. data/spec/fixtures/iex/earnings/invalid.yml +80 -62
  66. data/spec/fixtures/iex/earnings/msft.yml +84 -68
  67. data/spec/fixtures/iex/key_stats/invalid.yml +80 -62
  68. data/spec/fixtures/iex/key_stats/msft.yml +84 -65
  69. data/spec/fixtures/iex/largest-trades/aapl.yml +91 -73
  70. data/spec/fixtures/iex/largest-trades/invalid.yml +80 -62
  71. data/spec/fixtures/iex/logo/msft.yml +82 -64
  72. data/spec/fixtures/iex/news/invalid.yml +80 -58
  73. data/spec/fixtures/iex/news/msft.yml +83 -61
  74. data/spec/fixtures/iex/news/msft_7.yml +83 -61
  75. data/spec/fixtures/iex/ohlc/market.yml +82 -65
  76. data/spec/fixtures/iex/ohlc/msft.yml +82 -64
  77. data/spec/fixtures/iex/price/invalid.yml +80 -58
  78. data/spec/fixtures/iex/price/msft.yml +82 -60
  79. data/spec/fixtures/iex/quote/invalid.yml +80 -62
  80. data/spec/fixtures/iex/quote/msft.yml +84 -66
  81. data/spec/fixtures/iex/sectors/invalid.yml +80 -62
  82. data/spec/fixtures/iex/sectors/sectors-performance.yml +88 -69
  83. data/spec/iex/client_spec.rb +138 -0
  84. data/spec/iex/config_spec.rb +22 -0
  85. data/spec/iex/{resources → endpoints}/chart_spec.rb +23 -21
  86. data/spec/iex/{resources → endpoints}/company_spec.rb +11 -7
  87. data/spec/iex/endpoints/crypto_spec.rb +66 -0
  88. data/spec/iex/{resources → endpoints}/dividends_spec.rb +17 -14
  89. data/spec/iex/endpoints/earnings_spec.rb +36 -0
  90. data/spec/iex/endpoints/key_stats_spec.rb +62 -0
  91. data/spec/iex/{resources → endpoints}/largest_trades_spec.rb +8 -6
  92. data/spec/iex/{resources → endpoints}/logo_spec.rb +3 -1
  93. data/spec/iex/endpoints/news_spec.rb +36 -0
  94. data/spec/iex/{resources → endpoints}/ohlc_spec.rb +15 -13
  95. data/spec/iex/{resources → endpoints}/price_spec.rb +6 -4
  96. data/spec/iex/endpoints/quote_spec.rb +38 -0
  97. data/spec/iex/{resources → endpoints}/sectors_spec.rb +7 -6
  98. data/spec/iex/resources/{base_spec.rb → resource_spec.rb} +6 -6
  99. data/spec/spec_helper.rb +2 -0
  100. data/spec/support/client.rb +6 -0
  101. metadata +66 -59
  102. data/lib/iex/api/chart.rb +0 -24
  103. data/lib/iex/api/company.rb +0 -13
  104. data/lib/iex/api/crypto.rb +0 -13
  105. data/lib/iex/api/dividends.rb +0 -17
  106. data/lib/iex/api/earnings.rb +0 -13
  107. data/lib/iex/api/key_stats.rb +0 -13
  108. data/lib/iex/api/largest_trades.rb +0 -13
  109. data/lib/iex/api/logo.rb +0 -13
  110. data/lib/iex/api/news.rb +0 -18
  111. data/lib/iex/api/ohlc.rb +0 -17
  112. data/lib/iex/api/price.rb +0 -13
  113. data/lib/iex/api/quote.rb +0 -13
  114. data/lib/iex/api/sectors.rb +0 -16
  115. data/lib/iex/resources/base.rb +0 -27
  116. data/lib/iex/resources/chart/base.rb +0 -14
  117. data/lib/iex/resources/chart/default.rb +0 -21
  118. data/lib/iex/resources/chart/one_day.rb +0 -20
  119. data/lib/iex/resources/ohlc/base.rb +0 -14
  120. data/lib/iex/resources/ohlc/timed_price.rb +0 -12
  121. data/lib/iex/resources/price.rb +0 -13
  122. data/spec/fixtures/iex/chart/20180227.yml +0 -452
  123. data/spec/fixtures/iex/crypto.yml +0 -101
  124. data/spec/fixtures/iex/news/market.yml +0 -64
  125. data/spec/iex/resources/crypto_spec.rb +0 -65
  126. data/spec/iex/resources/earnings_spec.rb +0 -38
  127. data/spec/iex/resources/key_stats_spec.rb +0 -94
  128. data/spec/iex/resources/news_spec.rb +0 -44
  129. data/spec/iex/resources/quote_spec.rb +0 -38
@@ -1,101 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.iextrading.com/1.0/stock/market/crypto
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.15.3
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx
23
- Date:
24
- - Tue, 02 Oct 2018 02:22:21 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- Set-Cookie:
32
- - ctoken=fc7bf66e5ffb490da87f4e2d35d36fb4; Domain=.iextrading.com; Path=/; Expires=Tue,
33
- 02 Oct 2018 14:22:21 GMT; Secure
34
- Content-Security-Policy:
35
- - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
- 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
37
- https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
38
- wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
39
- 'self' 'unsafe-inline' 'unsafe-eval';
40
- X-Content-Security-Policy:
41
- - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
42
- 'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
43
- https://api.iextrading.com https://api.iextrading.com wss://iextrading.com
44
- wss://tops.iextrading.com wss://api.iextrading.com wss://iextrading.com; script-src
45
- 'self' 'unsafe-inline' 'unsafe-eval';
46
- Frame-Options:
47
- - SAMEORIGIN
48
- X-Frame-Options:
49
- - SAMEORIGIN
50
- X-Content-Type-Options:
51
- - nosniff
52
- Strict-Transport-Security:
53
- - max-age=15768000
54
- Access-Control-Allow-Origin:
55
- - "*"
56
- Access-Control-Allow-Credentials:
57
- - 'true'
58
- Access-Control-Allow-Methods:
59
- - GET, OPTIONS
60
- Access-Control-Allow-Headers:
61
- - Origin, X-Requested-With, Content-Type, Accept
62
- body:
63
- encoding: ASCII-8BIT
64
- string: '[{"symbol":"BTCUSDT","companyName":"Bitcoin USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":6645.76,"openTime":1538360540423,"close":6595.49934953,"closeTime":1538446940423,"high":6663.1,"low":6510,"latestPrice":6618.7,"latestSource":"Real
65
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940423,"latestVolume":20027.36393,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":6645.76,"change":-27.06,"changePercent":-0.00407,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":6613.16,"bidSize":2.166213,"askPrice":6617.99,"askSize":0.264944},{"symbol":"EOSUSDT","companyName":"EOS
66
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":5.7533,"openTime":1538360540309,"close":5.70433093,"closeTime":1538446940309,"high":5.85,"low":5.5155,"latestPrice":5.7458,"latestSource":"Real
67
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940309,"latestVolume":9532237.8,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":5.7561,"change":-0.0075,"changePercent":-0.0013,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":5.7427,"bidSize":3.47,"askPrice":5.7497,"askSize":10.41},{"symbol":"ETHUSDT","companyName":"Ethereum
68
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":234.19,"openTime":1538360540436,"close":230.01696503,"closeTime":1538446940436,"high":234.49,"low":224.46,"latestPrice":230.73,"latestSource":"Real
69
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940436,"latestVolume":346689.83604,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":234.36,"change":-3.46,"changePercent":-0.01477,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":230.73,"bidSize":0.6498,"askPrice":230.84,"askSize":20},{"symbol":"BNBUSDT","companyName":"Binance
70
- Coin USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":9.9994,"openTime":1538360538358,"close":9.95253395,"closeTime":1538446938358,"high":10.0329,"low":9.85,"latestPrice":9.9866,"latestSource":"Real
71
- time price","latestTime":"10:22:18 PM","latestUpdate":1538446938358,"latestVolume":923897.92,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":9.9998,"change":-0.0128,"changePercent":-0.00128,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":9.9607,"bidSize":21.02,"askPrice":9.9835,"askSize":2.5},{"symbol":"ONTUSDT","companyName":"Ontology
72
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":2.008,"openTime":1538360536750,"close":1.98192884,"closeTime":1538446936750,"high":2.027,"low":1.944,"latestPrice":1.997,"latestSource":"Real
73
- time price","latestTime":"10:22:16 PM","latestUpdate":1538446936750,"latestVolume":1686521.618,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":2.009,"change":-0.011,"changePercent":-0.0054800000000000005,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":1.993,"bidSize":45.978,"askPrice":1.997,"askSize":501.748},{"symbol":"BCCUSDT","companyName":"Bitcoin
74
- Cash USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":534.18,"openTime":1538360540109,"close":533.74758813,"closeTime":1538446940109,"high":543,"low":520,"latestPrice":539.22,"latestSource":"Real
75
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940109,"latestVolume":39343.33172,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":534.29,"change":5.04,"changePercent":0.009439999999999999,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":538.92,"bidSize":2.19032,"askPrice":539.54,"askSize":0.37091},{"symbol":"ADAUSDT","companyName":"Cardano
76
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.08569,"openTime":1538360540360,"close":0.08429287,"closeTime":1538446940360,"high":0.08575,"low":0.08203,"latestPrice":0.08424,"latestSource":"Real
77
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940360,"latestVolume":132217812.3,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.08569,"change":-0.00145,"changePercent":-0.01692,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.08418,"bidSize":2726.7,"askPrice":0.08426,"askSize":250.1},{"symbol":"XRPUSDT","companyName":"Ripple
78
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.59365,"openTime":1538360540262,"close":0.56958488,"closeTime":1538446940262,"high":0.6,"low":0.532,"latestPrice":0.57401,"latestSource":"Real
79
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940262,"latestVolume":260432857.5,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.59365,"change":-0.01964,"changePercent":-0.03308,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.57401,"bidSize":99973.6,"askPrice":0.57442,"askSize":12219},{"symbol":"TUSDUSDT","companyName":"TrueUSD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":1.0048,"openTime":1538360538332,"close":1.00553888,"closeTime":1538446938332,"high":1.0122,"low":1.0026,"latestPrice":1.0055,"latestSource":"Real
80
- time price","latestTime":"10:22:18 PM","latestUpdate":1538446938332,"latestVolume":8097983.67,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":1.0049,"change":0.0007,"changePercent":0.0007000000000000001,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":1.0047,"bidSize":2268.09,"askPrice":1.0056,"askSize":5444.01},{"symbol":"TRXUSDT","companyName":"TRON
81
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.02233,"openTime":1538360540281,"close":0.0220567,"closeTime":1538446940281,"high":0.02236,"low":0.02155,"latestPrice":0.02218,"latestSource":"Real
82
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940281,"latestVolume":585607984.5,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.02231,"change":-0.00015,"changePercent":-0.00672,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.02217,"bidSize":19688,"askPrice":0.02219,"askSize":10000},{"symbol":"LTCUSDT","companyName":"Litecoin
83
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":61.71,"openTime":1538360537821,"close":60.54623046,"closeTime":1538446937821,"high":62,"low":59.51,"latestPrice":60.58,"latestSource":"Real
84
- time price","latestTime":"10:22:17 PM","latestUpdate":1538446937821,"latestVolume":177534.30977,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":61.72,"change":-1.13,"changePercent":-0.01831,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":60.55,"bidSize":0.32992,"askPrice":60.59,"askSize":0.32023},{"symbol":"ETCUSDT","companyName":"Ethereum
85
- Classic USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":11.3415,"openTime":1538360534873,"close":11.26541056,"closeTime":1538446934873,"high":11.3892,"low":11.0502,"latestPrice":11.2747,"latestSource":"Real
86
- time price","latestTime":"10:22:14 PM","latestUpdate":1538446934873,"latestVolume":838869.15,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":11.3208,"change":-0.0668,"changePercent":-0.005889999999999999,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":11.2746,"bidSize":1.77,"askPrice":11.2848,"askSize":25.71},{"symbol":"IOTAUSDT","companyName":"MIOTA
87
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.5766,"openTime":1538360540320,"close":0.56461739,"closeTime":1538446940320,"high":0.58,"low":0.542,"latestPrice":0.5641,"latestSource":"Real
88
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940320,"latestVolume":11153714.63,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.5777,"change":-0.0125,"changePercent":-0.02168,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.5641,"bidSize":549.85,"askPrice":0.5654,"askSize":0.43},{"symbol":"ICXUSDT","companyName":"ICON
89
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.6589,"openTime":1538360538452,"close":0.66885327,"closeTime":1538446938452,"high":0.6887,"low":0.6526,"latestPrice":0.6755,"latestSource":"Real
90
- time price","latestTime":"10:22:18 PM","latestUpdate":1538446938452,"latestVolume":8199018.18,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.6589,"change":0.0166,"changePercent":0.02519,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.6743,"bidSize":156.9,"askPrice":0.6756,"askSize":34.25},{"symbol":"NEOUSDT","companyName":"NEO
91
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":19.045,"openTime":1538360540352,"close":18.72519397,"closeTime":1538446940352,"high":19.158,"low":18.23,"latestPrice":18.709,"latestSource":"Real
92
- time price","latestTime":"10:22:20 PM","latestUpdate":1538446940352,"latestVolume":554115.864,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":19.018,"change":-0.336,"changePercent":-0.01764,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":18.699,"bidSize":1.066,"askPrice":18.712,"askSize":7.62},{"symbol":"VENUSDT","companyName":"VeChain
93
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":1.8132,"openTime":1532286918800,"close":1.8117292,"closeTime":1532373318800,"high":1.862,"low":1.7676,"latestPrice":1.8319,"latestSource":"Real
94
- time price","latestTime":"3:15:18 PM","latestUpdate":1532373318800,"latestVolume":1236219.26,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":1.8108,"change":0.0187,"changePercent":0.01031,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":null,"bidSize":null,"askPrice":null,"askSize":null},{"symbol":"XLMUSDT","companyName":"Stellar
95
- Lumens USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":0.26152,"openTime":1538360541234,"close":0.2595038,"closeTime":1538446941234,"high":0.26473,"low":0.2512,"latestPrice":0.25979,"latestSource":"Real
96
- time price","latestTime":"10:22:21 PM","latestUpdate":1538446941234,"latestVolume":41122879.3,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":0.26152,"change":-0.00173,"changePercent":-0.00662,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":0.25958,"bidSize":42.3,"askPrice":0.25982,"askSize":3515},{"symbol":"QTUMUSDT","companyName":"Qtum
97
- USD","primaryExchange":"crypto","sector":"cryptocurrency","calculationPrice":"realtime","open":3.899,"openTime":1538360541249,"close":3.83398024,"closeTime":1538446941249,"high":3.911,"low":3.73,"latestPrice":3.895,"latestSource":"Real
98
- time price","latestTime":"10:22:21 PM","latestUpdate":1538446941249,"latestVolume":179108.941,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":null,"delayedPriceTime":null,"extendedPrice":null,"extendedChange":null,"extendedChangePercent":null,"extendedPriceTime":null,"previousClose":3.891,"change":-0.004,"changePercent":-0.0010299999999999999,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":null,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":null,"peRatio":null,"week52High":null,"week52Low":null,"ytdChange":null,"bidPrice":3.884,"bidSize":107.05,"askPrice":3.897,"askSize":42.55}]'
99
- http_version:
100
- recorded_at: Tue, 02 Oct 2018 02:22:21 GMT
101
- recorded_with: VCR 4.0.0
@@ -1,64 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.iextrading.com/1.0/stock/market/news/last/1
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.14.0
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx
23
- Date:
24
- - Mon, 26 Mar 2018 21:44:56 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Content-Length:
28
- - '828'
29
- Connection:
30
- - keep-alive
31
- Set-Cookie:
32
- - ctoken=5784f139630b4048b4ae89c527e263ed; Domain=.iextrading.com; Path=/; Expires=Tue,
33
- 27 Mar 2018 09:44:56 GMT; Secure
34
- Content-Security-Policy:
35
- - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
- 'unsafe-inline'; font-src data:; connect-src 'self' https://auth.iextrading.com
37
- wss://iextrading.com wss://tops.iextrading.com; script-src 'self';
38
- X-Content-Security-Policy:
39
- - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
40
- 'unsafe-inline'; font-src data:; connect-src 'self' https://auth.iextrading.com
41
- wss://iextrading.com wss://tops.iextrading.com; script-src 'self';
42
- Frame-Options:
43
- - deny
44
- X-Frame-Options:
45
- - deny
46
- X-Content-Type-Options:
47
- - nosniff
48
- Strict-Transport-Security:
49
- - max-age=15768000
50
- Access-Control-Allow-Origin:
51
- - "*"
52
- Access-Control-Allow-Credentials:
53
- - 'true'
54
- Access-Control-Allow-Methods:
55
- - GET, OPTIONS
56
- Access-Control-Allow-Headers:
57
- - Origin, X-Requested-With, Content-Type, Accept
58
- body:
59
- encoding: ASCII-8BIT
60
- string: !binary |-
61
- W3siZGF0ZXRpbWUiOiIyMDE4LTAzLTI2VDE3OjM5OjAwLTA0OjAwIiwiaGVhZGxpbmUiOiJDb2hlbiAmIFN0ZWVycyBJbmZyYXN0cnVjdHVyZSBGdW5kLCBJbmMuIChVVEYpIE5vdGlmaWNhdGlvbiBvZiBTb3VyY2VzIG9mIERpc3RyaWJ1dGlvbiBVbmRlciBTZWN0aW9uIDE5KGEpIiwic291cmNlIjoiUFIgTmV3c3dpcmUiLCJ1cmwiOiJodHRwczovL2FwaS5pZXh0cmFkaW5nLmNvbS8xLjAvc3RvY2svbWFya2V0L2FydGljbGUvODUxNzMzNzgzMjIyOTY3NCIsInN1bW1hcnkiOiIgICAgICBORVcgWU9SSyAsICBNYXJjaCAyNiwgMjAxOCAgL1BSTmV3c3dpcmUvIC0tVGhpcyBwcmVzcyByZWxlYXNlIHByb3ZpZGVzIHNoYXJlaG9sZGVycyBvZiBDb2hlbiZhbXA7U3RlZXJzIEluZnJhc3RydWN0dXJlIEZ1bmQsIEluYy4gKE5ZU0U6IFVURikgKHRoZSBcIkZ1bmRcIikgd2l0aCBpbmZvcm1hdGlvbiByZWdhcmRpbmcgdGhlIHNvdXJjZXMgb2YgdGhlIGRpc3RyaWJ1dGlvbiB0byBiZSBwYWlkIG9uICBNYXJjaCAyOSwgMjAxOCAgYW5kIGN1bXVsYXRpdmUgZGlzdHJpYnV0aW9uc+KApiIsInJlbGF0ZWQiOiJBU1MxMDMxOSxBU1MxMDMxOTA0MixCYW5raW5nIGFuZCBGaW5hbmNlLEJhbmtpbmcsQ2FwaXRhbCBHYWlucyxDTlMsQ29tbW9kaXRpZXMsQ2FzaCBPciBTdG9jayBEaXZpZGVuZCxGaW5hbmNpYWwsRmluYW5jaWFsIGFuZCBCdXNpbmVzcyBTZXJ2aWNlcyxIT05HS09ORyxMT05ET04wMSxNYXJrZXQsTXV0dWFsIEZ1bmRzLE5hdGlvbmFsIE5ld3MsTmV3IFlvcmssTllTRTAwMDEsV2hvbGVzYWxlIGFuZCBSZXRhaWwsVE9LWU8wMDEsVVRGLFdBU0hJTkdUIn1d
62
- http_version:
63
- recorded_at: Mon, 26 Mar 2018 21:44:56 GMT
64
- recorded_with: VCR 4.0.0
@@ -1,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Resources::Crypto do
4
- context 'gets crypto information', vcr: { cassette_name: 'crypto' } do
5
- subject do
6
- IEX::Resources::Crypto.get
7
- end
8
- it 'retrieves real-time information' do
9
- expect(subject.first.ask_price).to eq 6617.99
10
- expect(subject.first.symbol).to eq 'BTCUSDT'
11
- expect(subject.first.company_name).to eq 'Bitcoin USD'
12
- expect(subject.first.primary_exchange).to eq 'crypto'
13
- expect(subject.first.sector).to eq 'cryptocurrency'
14
- expect(subject.first.calculation_price).to eq 'realtime'
15
- expect(subject.first.open).to eq 6645.76
16
- expect(subject.first.open_dollar).to eq '$6,645'
17
- expect(subject.first.open_time).to eq 1_538_360_540_423
18
- expect(subject.first.close).to eq 6595.49934953
19
- expect(subject.first.close_dollar).to eq '$6,595'
20
- expect(subject.first.close_time).to eq 1_538_446_940_423
21
- expect(subject.first.high).to eq 6663.1
22
- expect(subject.first.high_dollar).to eq '$6,663'
23
- expect(subject.first.low).to eq 6510
24
- expect(subject.first.low_dollar).to eq '$6,510'
25
- expect(subject.first.latest_price).to eq 6618.7
26
- expect(subject.first.latest_price_dollar).to eq '$6,618'
27
- expect(subject.first.latest_source).to eq 'Real time price'
28
- expect(subject.first.latest_time).to eq '10:22:20 PM'
29
- expect(subject.first.latest_update).to eq 1_538_446_940_423
30
- expect(subject.first.latest_volume).to eq 20_027.36393
31
- expect(subject.first.latest_volume_dollar).to eq '$20,027'
32
- expect(subject.first.iex_realtime_price).to eq nil
33
- expect(subject.first.iex_realtime_size).to eq nil
34
- expect(subject.first.iex_last_updated).to eq nil
35
- expect(subject.first.delayed_price).to eq nil
36
- expect(subject.first.delayed_price_time).to eq nil
37
- expect(subject.first.extended_change).to eq nil
38
- expect(subject.first.extended_change_percent).to eq nil
39
- expect(subject.first.extended_price_time).to eq nil
40
- expect(subject.first.previous_close).to eq 6645.76
41
- expect(subject.first.previous_close_dollar).to eq '$6,645'
42
- expect(subject.first.change).to eq -27.06
43
- expect(subject.first.change_percent).to eq -0.00407
44
- expect(subject.first.change_percent_s).to eq '-0.41%'
45
- expect(subject.first.iex_market_percent).to eq nil
46
- expect(subject.first.iex_volume).to eq nil
47
- expect(subject.first.avg_total_volume).to eq nil
48
- expect(subject.first.iex_bid_price).to eq nil
49
- expect(subject.first.iex_bid_size).to eq nil
50
- expect(subject.first.iex_ask_price).to eq nil
51
- expect(subject.first.iex_ask_size).to eq nil
52
- expect(subject.first.market_cap).to eq nil
53
- expect(subject.first.pe_ratio).to eq nil
54
- expect(subject.first.week52_high).to eq nil
55
- expect(subject.first.week52_high_dollar).to eq nil
56
- expect(subject.first.week52_low).to eq nil
57
- expect(subject.first.week52_low_dollar).to eq nil
58
- expect(subject.first.ytd_change).to eq nil
59
- expect(subject.first.bid_price).to eq 6613.16
60
- expect(subject.first.bid_size).to eq 2.166213
61
- expect(subject.first.ask_price).to eq 6617.99
62
- expect(subject.first.ask_size).to eq 0.264944
63
- end
64
- end
65
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Resources::Earnings do
4
- context 'known symbol' do
5
- context 'with defaults', vcr: { cassette_name: 'earnings/msft' } do
6
- subject do
7
- IEX::Resources::Earnings.get('MSFT')
8
- end
9
- let(:earnings) { subject.first }
10
- it 'retrieves earnings' do
11
- expect(subject.size).to eq 4
12
- expect(earnings.actual_eps).to eq 1.13
13
- expect(earnings.consensus_eps).to eq 1.07
14
- expect(earnings.estimated_eps).to eq 1.07
15
- expect(earnings.announce_time).to eq 'AMC'
16
- expect(earnings.number_of_estimates).to eq 14
17
- expect(earnings.eps_surprise_dollar).to eq 0.06
18
- expect(earnings.eps_report_date).to eq '2018-07-19'
19
- expect(earnings.fiscal_period).to eq 'Q4 2018'
20
- expect(earnings.fiscal_end_date).to eq '2018-06-30'
21
- expect(earnings.year_ago).to eq 0.98
22
- expect(earnings.year_ago_change_percent).to eq 0.15306122448979584
23
- expect(earnings.year_ago_change_percent_s).to eq '+15.31%'
24
- expect(earnings.estimated_change_percent).to eq 0.09183673469387764
25
- expect(earnings.estimated_change_percent_s).to eq '+9.18%'
26
- expect(earnings.symbol_id).to eq 4563
27
- end
28
- end
29
- end
30
- context 'invalid symbol', vcr: { cassette_name: 'earnings/invalid' } do
31
- subject do
32
- IEX::Resources::Earnings.get('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,94 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Resources::KeyStats do
4
- context 'general information', vcr: { cassette_name: 'key_stats/msft' } do
5
- subject do
6
- IEX::Resources::KeyStats.get('MSFT')
7
- end
8
- it 'retrieves a keyStats' do
9
- expect(subject.symbol).to eq 'MSFT'
10
- expect(subject.company_name).to eq 'Microsoft Corporation'
11
- expect(subject.market_cap).to eq 825_814_890_000
12
- expect(subject.market_cap_dollars).to eq '$825,814,890,000'
13
- expect(subject.beta).to eq 1.261768
14
- end
15
-
16
- it 'weekly stats' do
17
- expect(subject.week_52_high).to eq 111.15
18
- expect(subject.week_52_high_dollar).to eq '$111.15'
19
- expect(subject.week_52_low).to eq 71.28
20
- expect(subject.week_52_low_dollar).to eq '$71.28'
21
- expect(subject.week_52_change_dollar).to eq '$51.77'
22
- end
23
-
24
- it 'general stats' do
25
- expect(subject.short_interest).to eq 47_158_592
26
- expect(subject.short_date).to eq '2018-07-13'
27
- expect(subject.dividend_rate).to eq 1.68
28
- expect(subject.dividend_yield).to eq 1.5617738
29
- expect(subject.ex_dividend_date).to eq '2018-08-15 00:00:00.0'
30
- expect(subject.latest_eps).to eq 2.11
31
- expect(subject.latest_eps_date).to eq '2018-06-30'
32
- expect(subject.shares_outstanding).to eq 7_677_000_000
33
- expect(subject.float).to eq 7_217_387_757
34
- expect(subject.return_on_equity).to eq 20.82
35
- expect(subject.consensus_eps).to eq 0.86
36
- expect(subject.number_of_estimates).to eq 14
37
- expect(subject.eps_surprise_dollar).to eq nil
38
- expect(subject.eps_surprise_percent).to eq 11.6279
39
- expect(subject.eps_surprise_percent_s).to eq '+1162.79%'
40
- expect(subject.ebitda).to eq 23_558_000_000
41
- expect(subject.revenue).to eq 53_456_000_000
42
- expect(subject.revenue_dollar).to eq '$53,456,000,000'
43
- expect(subject.gross_profit).to eq 34_114_000_000
44
- expect(subject.gross_profit_dollar).to eq '$34,114,000,000'
45
- expect(subject.cash_dollar).to eq '$281,251,000,000'
46
- expect(subject.ttm_eps).to eq 3.51
47
- expect(subject.revenue_per_share).to eq 7
48
- expect(subject.revenue_per_employee).to eq 431_097
49
- expect(subject.pe_ratio_high).to eq 0
50
- expect(subject.pe_ratio_low).to eq 0
51
- expect(subject.return_on_assets).to eq 6.46
52
- expect(subject.return_on_capital).to eq nil
53
- expect(subject.profit_margin).to eq 15.1
54
- expect(subject.price_to_sales).to eq 7.393182
55
- expect(subject.price_to_sales_dollar).to eq '$7.39'
56
- expect(subject.price_to_book).to eq 10.73
57
- expect(subject.price_to_book_dollar).to eq '$10.73'
58
- expect(subject.day_200_moving_avg).to eq 91.99065
59
- expect(subject.day_50_moving_avg).to eq 102.2528
60
- expect(subject.institution_percent).to eq 75.1
61
- expect(subject.institution_percent_s).to eq '+7510.00%'
62
- expect(subject.insider_percent).to eq nil
63
- expect(subject.insider_percent_s).to eq nil
64
- expect(subject.short_ratio).to eq 1.7330703
65
- end
66
-
67
- it 'changes stats' do
68
- expect(subject.year_5_change_percent).to be 2.85141424991049
69
- expect(subject.year_5_change_percent_s).to eq '+285.14%'
70
- expect(subject.year_2_change_percent).to eq 0.9732002824884664
71
- expect(subject.year_2_change_percent_s).to eq '+97.32%'
72
- expect(subject.year_1_change_percent).to eq 0.5200287133805482
73
- expect(subject.year_1_change_percent_s).to eq '+52.00%'
74
- expect(subject.ytd_change_percent).to eq 0.2628699562098638
75
- expect(subject.month_6_change_percent).to eq 0.23345097958275707
76
- expect(subject.month_6_change_percent_s).to eq '+23.35%'
77
- expect(subject.month_3_change_percent).to eq 0.14846686026648437
78
- expect(subject.month_3_change_percent_s).to eq '+14.85%'
79
- expect(subject.month_1_change_percent).to eq 0.08601716304896513
80
- expect(subject.month_1_change_percent_s).to eq '+8.60%'
81
- expect(subject.day_5_change_percent).to eq 0.0010215453194652084 * -1
82
- expect(subject.day_5_change_percent_s).to eq '-0.10%'
83
- end
84
- end
85
-
86
- context 'invalid symbol', vcr: { cassette_name: 'key_stats/invalid' } do
87
- subject do
88
- IEX::Resources::KeyStats.get('INVALID')
89
- end
90
- it 'fails with SymbolNotFoundError' do
91
- expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
92
- end
93
- end
94
- end
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Resources::News do
4
- context 'known symbol' do
5
- context 'with defaults', vcr: { cassette_name: 'news/msft' } do
6
- subject do
7
- IEX::Resources::News.get('MSFT')
8
- end
9
- let(:news) { subject.first }
10
- it 'retrieves news' do
11
- expect(subject.size).to eq 10
12
- expect(news.datetime).to eq DateTime.parse('2018-03-26T15:09:52-04:00')
13
- expect(news.headline).to eq 'Smartsheet files for $100M IPO with growing losses'
14
- expect(news.related).to eq(['APPSOFTW', 'IPO', 'MSFT', 'NASDAQ01', 'SOF31165134', 'Computing and Information Technology'])
15
- end
16
- end
17
- context 'with range', vcr: { cassette_name: 'news/msft_7' } do
18
- subject do
19
- IEX::Resources::News.get('MSFT', 7)
20
- end
21
- it 'retrieves news' do
22
- expect(subject.size).to eq 7
23
- end
24
- end
25
- context 'market', vcr: { cassette_name: 'news/market' } do
26
- subject do
27
- IEX::Resources::News.get(:market, 1)
28
- end
29
- let(:news) { subject.first }
30
- it 'retrieves market news' do
31
- expect(subject.size).to eq 1
32
- expect(news.url).to eq 'https://api.iextrading.com/1.0/stock/market/article/8517337832229674'
33
- end
34
- end
35
- end
36
- context 'invalid symbol', vcr: { cassette_name: 'news/invalid' } do
37
- subject do
38
- IEX::Resources::News.get('INVALID')
39
- end
40
- it 'fails with SymbolNotFoundError' do
41
- expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
42
- end
43
- end
44
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Resources::Quote do
4
- context 'known symbol', vcr: { cassette_name: 'quote/msft' } do
5
- subject do
6
- IEX::Resources::Quote.get('MSFT')
7
- end
8
- it 'retrieves a quote' do
9
- expect(subject.symbol).to eq 'MSFT'
10
- expect(subject.primary_exchange).to eq 'Nasdaq Global Select'
11
- expect(subject.company_name).to eq 'Microsoft Corporation'
12
- expect(subject.market_cap).to eq 755_719_306_395
13
- end
14
- it 'coerces numbers' do
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
- expect(subject.week_52_low).to eq 68.02
19
- expect(subject.change_percent).to eq 0.00051
20
- expect(subject.change_percent_s).to eq '+0.05%'
21
- end
22
- it 'coerces times' do
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
- end
28
- end
29
-
30
- context 'invalid symbol', vcr: { cassette_name: 'quote/invalid' } do
31
- subject do
32
- IEX::Resources::Quote.get('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