line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Grizzly::Command::quote; |
2
|
2
|
|
|
2
|
|
1275
|
use Grizzly -command; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
20
|
|
3
|
2
|
|
|
2
|
|
592
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use Finance::Quote; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
99
|
|
7
|
2
|
|
|
2
|
|
13
|
use Grizzly::Progress::Bar; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
791
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $q = Finance::Quote->new("YahooJSON"); |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
1
|
0
|
sub abstract { "display stock quote" } |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
0
|
sub description { "Display the stock quote information." } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub validate_args { |
16
|
3
|
|
|
3
|
1
|
5229073
|
my ( $self, $opt, $args ) = @_; |
17
|
3
|
100
|
|
|
|
28
|
$self->usage_error("Need a symbol args") unless @$args; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub execute { |
21
|
2
|
|
|
2
|
1
|
12
|
my ( $self, $opt, $args ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
6
|
quote_info(@$args); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub quote_info { |
27
|
2
|
|
|
2
|
0
|
6
|
my ($symbol) = @_; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
20
|
my %quote = $q->yahoo_json($symbol); |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
301954
|
Grizzly::Progress::Bar->progressbar(); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $name = $quote{ $symbol, "name" }; |
34
|
0
|
|
|
|
|
|
my $date = $quote{ $symbol, "date" }; |
35
|
0
|
|
|
|
|
|
my $last_price = $quote{ $symbol, "last" }; |
36
|
0
|
|
|
|
|
|
my $open = $quote{ $symbol, "open" }; |
37
|
0
|
|
|
|
|
|
my $high = $quote{ $symbol, "high" }; |
38
|
0
|
|
|
|
|
|
my $low = $quote{ $symbol, "low" }; |
39
|
0
|
|
|
|
|
|
my $close = $quote{ $symbol, "close" }; |
40
|
0
|
|
|
|
|
|
my $div_yield = $quote{ $symbol, "div_yield" }; |
41
|
0
|
|
|
|
|
|
my $pe = $quote{ $symbol, "pe" }; |
42
|
0
|
|
|
|
|
|
my $eps = $quote{ $symbol, "eps" }; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
unless ($name) { |
45
|
0
|
|
|
|
|
|
$name = $symbol; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
0
|
|
|
|
|
unless ($date) { |
48
|
0
|
|
|
|
|
|
$date = 'n/a'; |
49
|
|
|
|
|
|
|
} |
50
|
0
|
0
|
|
|
|
|
unless ($last_price) { |
51
|
0
|
|
|
|
|
|
$last_price = 'n/a'; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
0
|
|
|
|
|
unless ($open) { |
54
|
0
|
|
|
|
|
|
$open = 'n/a'; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
0
|
|
|
|
|
unless ($high) { |
57
|
0
|
|
|
|
|
|
$high = 'n/a'; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
0
|
|
|
|
|
unless ($low) { |
60
|
0
|
|
|
|
|
|
$low = 'n/a'; |
61
|
|
|
|
|
|
|
} |
62
|
0
|
0
|
|
|
|
|
unless ($close) { |
63
|
0
|
|
|
|
|
|
$close = 'n/a'; |
64
|
|
|
|
|
|
|
} |
65
|
0
|
0
|
|
|
|
|
unless ($div_yield) { |
66
|
0
|
|
|
|
|
|
$div_yield = 'n/a'; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
0
|
|
|
|
|
unless ($pe) { |
69
|
0
|
|
|
|
|
|
$pe = 'n/a'; |
70
|
|
|
|
|
|
|
} |
71
|
0
|
0
|
|
|
|
|
unless ($eps) { |
72
|
0
|
|
|
|
|
|
$eps = 'n/a'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
print <<EOF,; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Grizzly - Stock Quote Analysis |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Company: ========== $name |
80
|
|
|
|
|
|
|
Date: ============= $date |
81
|
|
|
|
|
|
|
Latest Price: ===== $last_price |
82
|
|
|
|
|
|
|
Open: ============= $open |
83
|
|
|
|
|
|
|
High: ============= $high |
84
|
|
|
|
|
|
|
Low: ============== $low |
85
|
|
|
|
|
|
|
Previous Close: === $close |
86
|
|
|
|
|
|
|
Dividend Yield: === $div_yield |
87
|
|
|
|
|
|
|
P/E Ratio: ======== $pe |
88
|
|
|
|
|
|
|
EPS: ============== $eps |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
EOF |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding UTF-8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Grizzly::Command::quote |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 VERSION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
version 0.102 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
grizzly quote [stock symbol] |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 DESCRIPTION |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Grizzly will output the stock quote of the inputted tickers symbol. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 NAME |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Grizzly::Command::quote |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Nobunaga. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
MIT License |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is Copyright (c) 2021 by Nobunaga. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software, licensed under: |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The MIT (X11) License |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |