line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Equity::Quote; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Equity::Quote - Represents Quote Data for a Single Equity |
10
|
|
|
|
|
|
|
Instrument |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Finance::Robinhood; |
15
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
16
|
|
|
|
|
|
|
my $instruments = $rh->instruments(); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
for my $instrument ($instruments->all) { |
19
|
|
|
|
|
|
|
CORE::say $instrument->quote->last_trade_price; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.92_001'; |
25
|
1
|
|
|
1
|
|
6
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
26
|
1
|
|
|
1
|
|
180
|
use Mojo::URL; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
27
|
1
|
|
|
1
|
|
500
|
use Time::Moment; |
|
1
|
|
|
|
|
1506
|
|
|
1
|
|
|
|
|
36
|
|
28
|
1
|
|
|
1
|
|
7
|
use Finance::Robinhood::Equity::Instrument; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _test__init { |
31
|
1
|
|
|
1
|
|
11309
|
my $rh = t::Utility::rh_instance(1); |
32
|
0
|
|
|
|
|
0
|
my $quote = $rh->equity_instrument_by_symbol('MSFT')->quote(); |
33
|
0
|
|
|
|
|
0
|
isa_ok( $quote, __PACKAGE__ ); |
34
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'QUOTE', $quote ); # Store it for later |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 C |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 C |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Delayed ask price. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 C |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Delayed ask size. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 C |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Delayed bid price. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Delayed bid size. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 C |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Boolean value... no idea what this means yet. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 C |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Last pre- or after-hours trading price. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 C |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 C |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Which venue provided the last trade price. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 C |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The price at the most recent close. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 C |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The ticker symbol of the instrument related to this quote data. See |
84
|
|
|
|
|
|
|
C to be given the instrument object itself. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 C |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Returns a boolean value; true if trading is halted. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has [ |
93
|
|
|
|
|
|
|
'adjusted_previous_close', 'ask_price', |
94
|
|
|
|
|
|
|
'ask_size', 'bid_price', |
95
|
|
|
|
|
|
|
'bid_size', 'has_traded', |
96
|
|
|
|
|
|
|
'last_extended_hours_trade_price', 'last_trade_price', |
97
|
|
|
|
|
|
|
'last_trade_price_source', 'previous_close', |
98
|
|
|
|
|
|
|
'symbol', 'trading_halted' |
99
|
|
|
|
|
|
|
]; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 C |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
$quote->previous_close_date(); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns a Time::Moment object. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
0
|
1
|
0
|
sub previous_close_date ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
110
|
0
|
|
|
|
|
0
|
Time::Moment->from_string( $s->{previous_close_date} . 'T16:30:00-05:00' ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub _test_previous_close_date { |
114
|
1
|
|
50
|
1
|
|
1883
|
t::Utility::stash('QUOTE') // skip_all(); |
115
|
0
|
|
|
|
|
0
|
isa_ok( t::Utility::stash('QUOTE')->previous_close_date(), 'Time::Moment' ); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 C |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
$quote->updated_at(); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns a Time::Moment object. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
0
|
1
|
0
|
sub updated_at ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
127
|
0
|
|
|
|
|
0
|
Time::Moment->from_string( $s->{updated_at} ); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _test_updated_at { |
131
|
1
|
|
50
|
1
|
|
1857
|
t::Utility::stash('QUOTE') // skip_all(); |
132
|
0
|
|
|
|
|
0
|
isa_ok( t::Utility::stash('QUOTE')->updated_at(), 'Time::Moment' ); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 C |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
my $instrument = $quote->instrument(); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Loops back to a Finance::Robinhood::Equity::Instrument object. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
0
|
1
|
0
|
sub instrument ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
144
|
0
|
|
|
|
|
0
|
my $res = $s->_rh->_get( $s->{instrument} ); |
145
|
|
|
|
|
|
|
$res->is_success |
146
|
0
|
0
|
|
|
|
0
|
? Finance::Robinhood::Equity::Instrument->new( _rh => $s->_rh, %{ $res->json } ) |
|
0
|
0
|
|
|
|
0
|
|
147
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
148
|
|
|
|
|
|
|
$res->is_server_error ? ( details => $res->message ) : $res->json ); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub _test_instrument { |
152
|
1
|
|
50
|
1
|
|
1935
|
t::Utility::stash('QUOTE') // skip_all(); |
153
|
0
|
|
|
|
|
|
isa_ok( t::Utility::stash('QUOTE')->instrument(), 'Finance::Robinhood::Equity::Instrument' ); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 LEGAL |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
159
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
160
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
161
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
164
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 LICENSE |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
171
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
172
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
173
|
|
|
|
|
|
|
the L section. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |