| 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_003'; |
|
25
|
1
|
|
|
1
|
|
7
|
use Mojo::Base-base, -signatures; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
26
|
1
|
|
|
1
|
|
152
|
use Mojo::URL; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
14
|
|
|
27
|
1
|
|
|
1
|
|
435
|
use Time::Moment; |
|
|
1
|
|
|
|
|
1392
|
|
|
|
1
|
|
|
|
|
33
|
|
|
28
|
1
|
|
|
1
|
|
6
|
use Finance::Robinhood::Equity::Instrument; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _test__init { |
|
31
|
1
|
|
|
1
|
|
11985
|
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 ['adjusted_previous_close', 'ask_price', |
|
93
|
|
|
|
|
|
|
'ask_size', 'bid_price', |
|
94
|
|
|
|
|
|
|
'bid_size', 'has_traded', |
|
95
|
|
|
|
|
|
|
'last_extended_hours_trade_price', 'last_trade_price', |
|
96
|
|
|
|
|
|
|
'last_trade_price_source', 'previous_close', |
|
97
|
|
|
|
|
|
|
'symbol', 'trading_halted' |
|
98
|
|
|
|
|
|
|
]; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 C |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$quote->previous_close_date(); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns a Time::Moment object. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
0
|
1
|
0
|
sub previous_close_date ($s) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
109
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{previous_close_date} . 'T16:30:00-05:00'); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _test_previous_close_date { |
|
113
|
1
|
|
50
|
1
|
|
2257
|
t::Utility::stash('QUOTE') // skip_all(); |
|
114
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('QUOTE')->previous_close_date(), 'Time::Moment'); |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 C |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$quote->updated_at(); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns a Time::Moment object. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
|
|
0
|
1
|
0
|
sub updated_at ($s) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
126
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{updated_at}); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub _test_updated_at { |
|
130
|
1
|
|
50
|
1
|
|
1869
|
t::Utility::stash('QUOTE') // skip_all(); |
|
131
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('QUOTE')->updated_at(), 'Time::Moment'); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 C |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
my $instrument = $quote->instrument(); |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Loops back to a Finance::Robinhood::Equity::Instrument object. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
0
|
1
|
0
|
sub instrument ($s) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
143
|
0
|
|
|
|
|
0
|
my $res = $s->_rh->_get($s->{instrument}); |
|
144
|
|
|
|
|
|
|
$res->is_success |
|
145
|
|
|
|
|
|
|
? Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh, |
|
146
|
0
|
0
|
|
|
|
0
|
%{$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
|
|
1993
|
t::Utility::stash('QUOTE') // skip_all(); |
|
153
|
0
|
|
|
|
|
|
isa_ok(t::Utility::stash('QUOTE')->instrument(), |
|
154
|
|
|
|
|
|
|
'Finance::Robinhood::Equity::Instrument'); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 LEGAL |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
|
160
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
|
161
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
|
162
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
|
165
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 LICENSE |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
|
172
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
|
173
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
|
174
|
|
|
|
|
|
|
the L section. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 AUTHOR |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; |