stock_quote_cli 1.0.1 → 1.1.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 +4 -4
- data/.rspec +1 -1
- data/README.md +32 -17
- data/VERSION +1 -1
- data/demo.gif +0 -0
- data/lib/stock_quote_cli.rb +4 -18
- data/lib/stock_quote_cli/api.rb +23 -0
- data/lib/stock_quote_cli/cli.rb +119 -159
- data/lib/stock_quote_cli/text.rb +23 -0
- data/lib/stock_quote_cli/version.rb +3 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/stock_quote_cli_spec.rb +2 -12
- data/stock_quote_cli.gemspec +6 -6
- metadata +7 -9
- data/.document +0 -5
- data/LICENSE.txt +0 -20
- data/example.png +0 -0
- data/lib/stock_quote_cli/history.rb +0 -11
- data/lib/stock_quote_cli/quote.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2f026e810d56e1c1a4569ae66aeb3c7f213b4ad
|
4
|
+
data.tar.gz: 3d9e0f96f63cce57cdb204bf777a7aa876ce6da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c066ddaf42915093992312c1e195e40d909747b439603e09b01330cde76659f6938e91ee5550542e24733657098864e5aced7d32345c0b7609cb403c30483a4
|
7
|
+
data.tar.gz: 354bf7d6f24d5cf8362c888c0ab56a5c207ac0d693a18b7e91c0f4958aa6e55159b158dea7b30754cd4a57bf60215a8f496613e95f1eb8c25248f9bd66e61826
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color
|
1
|
+
--color --format documentation
|
data/README.md
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
Stock Quote CLI
|
2
|
-
===============
|
1
|
+
## Stock Quote CLI
|
3
2
|
|
4
3
|
[](https://travis-ci.org/tbloncar/stock_quote_cli)
|
5
4
|
|
6
|
-
### Description
|
7
|
-
|
8
5
|
Stock Quote CLI is a Ruby gem that provides a command-line interface for fetching stock information from Yahoo!. It relies on the [stock_quote gem](https://github.com/tyrauber/stock_quote) for fetching real-time and historical data.
|
9
6
|
|
10
|
-

|
11
8
|
|
12
9
|
Update: Due to Google's sunsetting of iGoogle (and the associated endpoint from
|
13
10
|
which the stock_quote gem once fetched its data), the stock_quote gem has moved
|
@@ -16,11 +13,13 @@ the awesomely quick changes.
|
|
16
13
|
|
17
14
|
### Installation
|
18
15
|
|
19
|
-
|
16
|
+
With Ruby installed, run the following:
|
20
17
|
|
21
|
-
|
18
|
+
```
|
19
|
+
gem install stock_quote_cli
|
20
|
+
```
|
22
21
|
|
23
|
-
### Usage
|
22
|
+
### Usage
|
24
23
|
|
25
24
|
You can use Stock Quote CLI to fetch real-time attributes of multiple stocks. Use the `stock` command in tandem with any of the available subcommands and stock symbols to fetch the relevant attribute(s).
|
26
25
|
|
@@ -28,41 +27,55 @@ You can use Stock Quote CLI to fetch real-time attributes of multiple stocks. Us
|
|
28
27
|
|
29
28
|
Get the latest price for the specified stock(s).
|
30
29
|
|
31
|
-
|
30
|
+
```
|
31
|
+
stock last goog yhoo aapl
|
32
|
+
```
|
32
33
|
|
33
34
|
#### Open Price
|
34
35
|
|
35
36
|
Get the opening price for the specified stock(s) on the current day (or last trading day).
|
36
37
|
|
37
|
-
|
38
|
+
```
|
39
|
+
stock open znga
|
40
|
+
```
|
38
41
|
|
39
42
|
#### Previous Closing Price
|
40
43
|
|
41
44
|
Get the closing price for the specified stock(s) on the previous trading day.
|
42
45
|
|
43
|
-
|
46
|
+
```
|
47
|
+
stock yclose amzn nflx
|
48
|
+
```
|
44
49
|
|
45
50
|
#### High Price
|
46
51
|
|
47
52
|
Get the high price for the specified stock(s) on the current day (or last trading day).
|
48
53
|
|
49
|
-
|
54
|
+
```
|
55
|
+
stock high lnkd
|
56
|
+
```
|
50
57
|
|
51
58
|
#### Low Price
|
52
59
|
|
53
60
|
Get the low price for the specified stock(s) on the current day (or last trading day).
|
54
61
|
|
55
|
-
|
62
|
+
```
|
63
|
+
stock low msft dell
|
64
|
+
```
|
56
65
|
|
57
66
|
#### Historical Data
|
58
67
|
|
59
68
|
Get historical data for a single stock. The default range is 14 days. The default value is the closing price. These can be specified using the `range` (aliased to `-r`) and `value` (aliased to `-v`) options, respectively.
|
60
69
|
|
61
|
-
|
70
|
+
```
|
71
|
+
stock history fb
|
72
|
+
```
|
62
73
|
|
63
74
|
The `range` (`-r`) option takes an integer. Use this to specify the number of trading days for which you'd like data.
|
64
75
|
|
65
|
-
|
76
|
+
```
|
77
|
+
stock history -r 15 fb
|
78
|
+
```
|
66
79
|
|
67
80
|
The `value` (`-v`) option takes a string. Use this to specify the price value that you'd like to see in the output. You can choose from the following:
|
68
81
|
|
@@ -74,11 +87,13 @@ The `value` (`-v`) option takes a string. Use this to specify the price value th
|
|
74
87
|
|
75
88
|
Below, we fetch the high price for the Facebook stock for the past 15 days.
|
76
89
|
|
77
|
-
|
90
|
+
```
|
91
|
+
stock history -r 15 -v high fb
|
92
|
+
```
|
78
93
|
|
79
94
|
### License
|
80
95
|
|
81
|
-
Copyright (c)
|
96
|
+
Copyright (c) 2016 Travis Loncar
|
82
97
|
|
83
98
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
|
84
99
|
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/demo.gif
ADDED
Binary file
|
data/lib/stock_quote_cli.rb
CHANGED
@@ -1,18 +1,4 @@
|
|
1
|
-
require "stock_quote_cli/
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class << self
|
6
|
-
# color methods from https://github.com/pierot/stockery/blob/master/lib/stockery.rb
|
7
|
-
def red(str); color(str, "\e[31m"); end
|
8
|
-
def green(str); color(str, "\e[1m\e[32m"); end
|
9
|
-
def yellow(str); color(str, "\e[0;33m"); end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def color(text, color_code)
|
14
|
-
"#{color_code}#{text}\e[0m"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
1
|
+
require "stock_quote_cli/version"
|
2
|
+
require "stock_quote_cli/api"
|
3
|
+
require "stock_quote_cli/text"
|
4
|
+
require "stock_quote_cli/cli"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "stock_quote"
|
2
|
+
|
3
|
+
module StockQuoteCLI
|
4
|
+
class API
|
5
|
+
def self.stock_history(symbol, range)
|
6
|
+
end_date = Date.today
|
7
|
+
start_date = end_date - range
|
8
|
+
StockQuote::Stock.history(symbol, start_date, end_date)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.stocks_info(symbols)
|
12
|
+
[] + StockQuote::Stock.quote(symbols.join(", "))
|
13
|
+
end
|
14
|
+
|
15
|
+
class StockQuote::Stock
|
16
|
+
private
|
17
|
+
|
18
|
+
def to_ary
|
19
|
+
[] << self
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/stock_quote_cli/cli.rb
CHANGED
@@ -1,164 +1,124 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "stock_quote"
|
3
|
-
require "stock_quote_cli/quote"
|
4
|
-
require "stock_quote_cli/history"
|
5
3
|
|
6
4
|
module StockQuoteCLI
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
def format_price(price)
|
129
|
-
"$#{price.number_with_commas}"
|
130
|
-
end
|
131
|
-
|
132
|
-
def format_volume(volume)
|
133
|
-
"#{volume.number_with_commas} shares"
|
134
|
-
end
|
135
|
-
|
136
|
-
def format_title(method_name, symbol)
|
137
|
-
"#{TextHelpers.yellow(method_name.upcase)} data for".rjust(38) + ": #{TextHelpers.yellow(symbol.upcase)}"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
class Numeric
|
143
|
-
def number_with_commas
|
144
|
-
split_on_dot = to_s.split("\.")
|
145
|
-
whole = split_on_dot[0]
|
146
|
-
decimal = split_on_dot[1] || ""
|
147
|
-
char_array = whole.reverse.split(//)
|
148
|
-
whole_with_commas = char_array.each_with_index.map do |char, i|
|
149
|
-
if char_array.size > 3 && i % 3 == 0 && i > 0
|
150
|
-
"#{char},"
|
151
|
-
else
|
152
|
-
char
|
153
|
-
end
|
154
|
-
end.reverse.join("")
|
155
|
-
if decimal.size == 1
|
156
|
-
decimal = "#{decimal}0"
|
157
|
-
end
|
158
|
-
unless decimal == "" || decimal == "00"
|
159
|
-
"#{whole_with_commas}.#{decimal}"
|
160
|
-
else
|
161
|
-
"#{whole_with_commas}"
|
162
|
-
end
|
163
|
-
end
|
5
|
+
class CLI < Thor
|
6
|
+
desc "last SYMBOL [SYMBOL...]", "get day's LAST stock price for SYMBOL"
|
7
|
+
def last(*symbols)
|
8
|
+
output_info(symbols, :last_trade_price_only)
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "high SYMBOL [SYMBOL...]", "get day's HIGH stock price for SYMBOL"
|
12
|
+
def high(*symbols)
|
13
|
+
output_info(symbols, :days_high)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "low SYMBOL [SYMBOL...]", "get day's LOW stock price for SYMBOL"
|
17
|
+
def low(*symbols)
|
18
|
+
output_info(symbols, :days_low)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "change SYMBOL [SYMBOL...]", "get day's CHANGE in stock price for SYMBOL"
|
22
|
+
def change(*symbols)
|
23
|
+
output_info(symbols, :change)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "open SYMBOL [SYMBOL...]", "get day's OPEN stock price for SYMBOL"
|
27
|
+
def open(*symbols)
|
28
|
+
output_info(symbols, :open)
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "pclose SYMBOL [SYMBOL...]", "get previous closing (PCLOSE) stock price for SYMBOL"
|
32
|
+
def pclose(*symbols)
|
33
|
+
output_info(symbols, :previous_close)
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "volume SYMBOL [SYMBOL...]", "get share VOLUME for SYMBOL"
|
37
|
+
def volume(*symbols)
|
38
|
+
output_info(symbols, :volume)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "history SYMBOL", "get HISTORY of stock price for SYMBOL"
|
42
|
+
method_option "range", aliases: "-r", type: :numeric, default: 14, desc: "Specify the number of trading days for which to return stock price information."
|
43
|
+
method_option "value", aliases: "-v", type: :string, default: "close", desc: "Specify the stock price value to retrieve for each date."
|
44
|
+
def history(symbol)
|
45
|
+
history = API.stock_history(symbol, options['range'])
|
46
|
+
output_stock_history(history, options['value'], symbol)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def output_info(symbols, vname)
|
52
|
+
stocks = API.stocks_info(symbols)
|
53
|
+
output_stocks_info(stocks, vname)
|
54
|
+
end
|
55
|
+
|
56
|
+
def output_stocks_info(stocks, vname)
|
57
|
+
puts
|
58
|
+
stocks.each do |quote|
|
59
|
+
# Ensure that quote object has data. If not,
|
60
|
+
# it probably represents an invalid symbol.
|
61
|
+
if quote.open
|
62
|
+
company = format_company(quote.name)
|
63
|
+
if vname == :volume
|
64
|
+
puts "#{company}: #{format_volume(quote.volume)}"
|
65
|
+
else
|
66
|
+
puts "#{company}: #{format_price(quote.send(vname))}"
|
67
|
+
end
|
68
|
+
else
|
69
|
+
output_bad_symbol_message(quote.symbol)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
puts
|
73
|
+
end
|
74
|
+
|
75
|
+
def output_stock_history(history, vname, symbol)
|
76
|
+
return output_bad_symbol_message(symbol) if history.is_a?(StockQuote::NoDataForStockError)
|
77
|
+
|
78
|
+
voptions = %w[open high low close volume]
|
79
|
+
if voptions.include?(vname)
|
80
|
+
puts "\n#{format_title(vname, symbol)}\n"
|
81
|
+
history.each do |quote|
|
82
|
+
date = format_date(quote.date.to_s)
|
83
|
+
if vname == "volume"
|
84
|
+
puts "#{date}: #{format_volume(quote.send(vname))}"
|
85
|
+
else
|
86
|
+
puts "#{date}: #{format_price(quote.send(vname))}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
else
|
90
|
+
output_bad_vname_message(vname)
|
91
|
+
end
|
92
|
+
puts
|
93
|
+
end
|
94
|
+
|
95
|
+
def output_bad_symbol_message(symbol)
|
96
|
+
puts Text.red("No data available for symbol: #{symbol.upcase}".rjust(28))
|
97
|
+
end
|
98
|
+
|
99
|
+
def output_bad_vname_message(vname)
|
100
|
+
puts Text.red("#{'Invalid value:'.rjust(28)} #{vname}")
|
101
|
+
end
|
102
|
+
|
103
|
+
def format_company(company)
|
104
|
+
Text.green(company).rjust(40)
|
105
|
+
end
|
106
|
+
|
107
|
+
def format_date(date)
|
108
|
+
Text.green(date).rjust(40)
|
109
|
+
end
|
110
|
+
|
111
|
+
def format_price(price)
|
112
|
+
"$#{Text.number_with_commas(price)}"
|
113
|
+
end
|
114
|
+
|
115
|
+
def format_volume(volume)
|
116
|
+
"#{Text.number_with_commas(volume.to_i)} shares"
|
117
|
+
end
|
118
|
+
|
119
|
+
def format_title(vname, symbol)
|
120
|
+
"#{Text.yellow(vname.upcase)} data for:".rjust(39) +
|
121
|
+
" #{Text.yellow(symbol.upcase)}\n"
|
122
|
+
end
|
123
|
+
end
|
164
124
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module StockQuoteCLI
|
2
|
+
class Text
|
3
|
+
class << self
|
4
|
+
# color methods from https://github.com/pierot/stockery/blob/master/lib/stockery.rb
|
5
|
+
def red(str); color(str, "\e[31m"); end
|
6
|
+
def green(str); color(str, "\e[1m\e[32m"); end
|
7
|
+
def yellow(str); color(str, "\e[0;33m"); end
|
8
|
+
|
9
|
+
def number_with_commas(n)
|
10
|
+
int, dec = n.to_s.split(".")
|
11
|
+
int.chars.reverse.each_slice(3).reduce("") { |m, s|
|
12
|
+
m + s.join + (s.size == 3 ? "," : "")
|
13
|
+
}.reverse.gsub(/^,/, '') + (dec ? ".#{dec}" : "")
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def color(text, color_code)
|
19
|
+
"#{color_code}#{text}\e[0m"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
module StockQuoteCLI
|
4
|
-
|
4
|
+
describe CLI do
|
5
5
|
let(:cli) { CLI }
|
6
6
|
|
7
|
-
it 'should exist' do
|
8
|
-
subject.should be_true
|
9
|
-
end
|
10
|
-
|
11
7
|
context 'history' do
|
12
8
|
it 'should accept a history method' do
|
13
9
|
$stdout.should_receive(:puts).at_least(10).times
|
@@ -19,11 +15,5 @@ module StockQuoteCLI
|
|
19
15
|
cli.start(["history", "-r", "20", "fb"])
|
20
16
|
end
|
21
17
|
end
|
22
|
-
|
23
|
-
context 'last' do
|
24
|
-
it 'should accept one argument' do
|
25
|
-
subject.stub(:last) { nil }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
18
|
+
end
|
29
19
|
end
|
data/stock_quote_cli.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Travis Loncar"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2016-01-01"
|
15
15
|
s.description = "A Ruby gem that provides a command-line interface for fetching stock information."
|
16
16
|
s.email = "loncar.travis@gmail.com"
|
17
17
|
s.executables = ["stock"]
|
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
"README.md"
|
21
21
|
]
|
22
22
|
s.files = [
|
23
|
-
".document",
|
24
23
|
".rspec",
|
25
24
|
".travis.yml",
|
26
25
|
"Gemfile",
|
@@ -30,18 +29,19 @@ Gem::Specification.new do |s|
|
|
30
29
|
"Rakefile",
|
31
30
|
"VERSION",
|
32
31
|
"bin/stock",
|
33
|
-
"
|
32
|
+
"demo.gif",
|
34
33
|
"lib/stock_quote_cli.rb",
|
34
|
+
"lib/stock_quote_cli/api.rb",
|
35
35
|
"lib/stock_quote_cli/cli.rb",
|
36
|
-
"lib/stock_quote_cli/
|
37
|
-
"lib/stock_quote_cli/
|
36
|
+
"lib/stock_quote_cli/text.rb",
|
37
|
+
"lib/stock_quote_cli/version.rb",
|
38
38
|
"spec/spec_helper.rb",
|
39
39
|
"spec/stock_quote_cli_spec.rb",
|
40
40
|
"stock_quote_cli.gemspec"
|
41
41
|
]
|
42
42
|
s.homepage = "http://github.com/tbloncar/stock_quote_cli"
|
43
43
|
s.licenses = ["MIT"]
|
44
|
-
s.rubygems_version = "2.4.
|
44
|
+
s.rubygems_version = "2.4.8"
|
45
45
|
s.summary = "A Ruby gem that provides a command-line interface for fetching stock information."
|
46
46
|
|
47
47
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stock_quote_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Loncar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -129,24 +129,22 @@ executables:
|
|
129
129
|
- stock
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files:
|
132
|
-
- LICENSE.txt
|
133
132
|
- README.md
|
134
133
|
files:
|
135
|
-
- ".document"
|
136
134
|
- ".rspec"
|
137
135
|
- ".travis.yml"
|
138
136
|
- Gemfile
|
139
137
|
- Gemfile.lock
|
140
|
-
- LICENSE.txt
|
141
138
|
- README.md
|
142
139
|
- Rakefile
|
143
140
|
- VERSION
|
144
141
|
- bin/stock
|
145
|
-
-
|
142
|
+
- demo.gif
|
146
143
|
- lib/stock_quote_cli.rb
|
144
|
+
- lib/stock_quote_cli/api.rb
|
147
145
|
- lib/stock_quote_cli/cli.rb
|
148
|
-
- lib/stock_quote_cli/
|
149
|
-
- lib/stock_quote_cli/
|
146
|
+
- lib/stock_quote_cli/text.rb
|
147
|
+
- lib/stock_quote_cli/version.rb
|
150
148
|
- spec/spec_helper.rb
|
151
149
|
- spec/stock_quote_cli_spec.rb
|
152
150
|
- stock_quote_cli.gemspec
|
@@ -170,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
168
|
version: '0'
|
171
169
|
requirements: []
|
172
170
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.4.
|
171
|
+
rubygems_version: 2.4.8
|
174
172
|
signing_key:
|
175
173
|
specification_version: 4
|
176
174
|
summary: A Ruby gem that provides a command-line interface for fetching stock information.
|
data/.document
DELETED
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Travis Loncar
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/example.png
DELETED
Binary file
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module StockQuoteCLI
|
2
|
-
module Quote
|
3
|
-
private
|
4
|
-
|
5
|
-
def stocks(symbol, symbols)
|
6
|
-
symbol_string = symbol_string(symbol, symbols)
|
7
|
-
get_stocks(symbol_string)
|
8
|
-
end
|
9
|
-
|
10
|
-
def symbol_string(symbol, symbols)
|
11
|
-
symbols.unshift(symbol).join(", ")
|
12
|
-
end
|
13
|
-
|
14
|
-
def get_stocks(symbol_string)
|
15
|
-
[] + StockQuote::Stock.quote(symbol_string)
|
16
|
-
end
|
17
|
-
|
18
|
-
class StockQuote::Stock
|
19
|
-
private
|
20
|
-
|
21
|
-
def to_ary
|
22
|
-
[] << self
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|