| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# ABSTRACT: Gets a stock quote for the given symbol |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Grizzly -command; |
|
5
|
2
|
|
|
2
|
|
1335
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
20
|
|
|
6
|
2
|
|
|
2
|
|
611
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
34
|
|
|
7
|
2
|
|
|
2
|
|
10
|
|
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
75
|
|
|
8
|
|
|
|
|
|
|
use Finance::Quote; |
|
9
|
2
|
|
|
2
|
|
13
|
use Grizzly::Progress::Bar; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
71
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use Term::ANSIColor; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
61
|
|
|
11
|
2
|
|
|
2
|
|
13
|
|
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
826
|
|
|
12
|
|
|
|
|
|
|
my $q = Finance::Quote->new("YahooJSON"); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
1
|
0
|
|
|
16
|
|
|
|
|
|
|
my ( $self, $opt, $args ) = @_; |
|
17
|
0
|
|
|
0
|
1
|
0
|
$self->usage_error("Need a symbol args") unless @$args; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
1
|
4488156
|
my ( $self, $opt, $args ) = @_; |
|
21
|
3
|
100
|
|
|
|
18
|
|
|
22
|
|
|
|
|
|
|
quote_info(@$args); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
1
|
11
|
my ($symbol) = @_; |
|
26
|
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
4
|
my %quote = $q->yahoo_json($symbol); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Grizzly::Progress::Bar->progressbar(); |
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
0
|
4
|
my $name = $quote{ $symbol, "name" }; |
|
32
|
|
|
|
|
|
|
my $date = $quote{ $symbol, "date" }; |
|
33
|
2
|
|
|
|
|
30
|
my $last_price = $quote{ $symbol, "last" }; |
|
34
|
|
|
|
|
|
|
my $open = $quote{ $symbol, "open" }; |
|
35
|
2
|
|
|
|
|
298427
|
my $high = $quote{ $symbol, "high" }; |
|
36
|
|
|
|
|
|
|
my $low = $quote{ $symbol, "low" }; |
|
37
|
0
|
|
|
|
|
|
my $close = $quote{ $symbol, "close" }; |
|
38
|
0
|
|
|
|
|
|
my $div_yield = $quote{ $symbol, "div_yield" }; |
|
39
|
0
|
|
|
|
|
|
my $pe = $quote{ $symbol, "pe" }; |
|
40
|
0
|
|
|
|
|
|
my $eps = $quote{ $symbol, "eps" }; |
|
41
|
0
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
unless ($name) { |
|
43
|
0
|
|
|
|
|
|
$name = $symbol; |
|
44
|
0
|
|
|
|
|
|
} |
|
45
|
0
|
|
|
|
|
|
unless ($date) { |
|
46
|
0
|
|
|
|
|
|
$date = 'n/a'; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
0
|
0
|
|
|
|
|
unless ($last_price) { |
|
49
|
0
|
|
|
|
|
|
$last_price = 'n/a'; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
0
|
0
|
|
|
|
|
unless ($open) { |
|
52
|
0
|
|
|
|
|
|
$open = 'n/a'; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
0
|
0
|
|
|
|
|
unless ($high) { |
|
55
|
0
|
|
|
|
|
|
$high = 'n/a'; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
0
|
|
|
|
|
unless ($low) { |
|
58
|
0
|
|
|
|
|
|
$low = 'n/a'; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
0
|
0
|
|
|
|
|
unless ($close) { |
|
61
|
0
|
|
|
|
|
|
$close = 'n/a'; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
0
|
0
|
|
|
|
|
unless ($div_yield) { |
|
64
|
0
|
|
|
|
|
|
$div_yield = 'n/a'; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
0
|
0
|
|
|
|
|
unless ($pe) { |
|
67
|
0
|
|
|
|
|
|
$pe = 'n/a'; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
0
|
0
|
|
|
|
|
unless ($eps) { |
|
70
|
0
|
|
|
|
|
|
$eps = 'n/a'; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
0
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $title = colored( "Grizzly - Stock Quote Analysis", "blue" ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
print <<EOF,; |
|
76
|
0
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$title |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
Company: ========== $name |
|
80
|
|
|
|
|
|
|
Date: ============= $date |
|
81
|
0
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding UTF-8 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Grizzly::Command::quote - Gets a stock quote for the given symbol |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 VERSION |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
version 0.104 |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
grizzly quote [stock symbol] |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Grizzly will output the stock quote of the inputted tickers symbol. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 NAME |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Grizzly::Command::quote |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Nobunaga. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
MIT License |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Nobunaga. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software, licensed under: |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The MIT (X11) License |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |