line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Search; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Search - Represents Search Results |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Text::Wrap qw[wrap]; |
14
|
|
|
|
|
|
|
use Finance::Robinhood; |
15
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $search = $rh->search('shoes'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.92_001'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _test__init { |
27
|
1
|
|
|
1
|
|
12226
|
my $rh = t::Utility::rh_instance(1); |
28
|
0
|
|
|
|
|
0
|
my $msft = $rh->search('microsoft'); |
29
|
0
|
|
|
|
|
0
|
my $btc = $rh->search('bitcoin'); |
30
|
0
|
|
|
|
|
0
|
my $tag = $rh->search('New on Robinhood'); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
isa_ok( $msft, __PACKAGE__ ); |
33
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'MSFT', $msft ); # Store it for later |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
isa_ok( $btc, __PACKAGE__ ); |
36
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'BTC', $btc ); # Store it for later |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
isa_ok( $tag, __PACKAGE__ ); |
39
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'TAG', $tag ); # Store it for later |
40
|
|
|
|
|
|
|
} |
41
|
1
|
|
|
1
|
|
8
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
42
|
1
|
|
|
1
|
|
280
|
use Mojo::URL; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
32
|
use Finance::Robinhood::Equity::Tag; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
45
|
1
|
|
|
1
|
|
486
|
use Finance::Robinhood::Forex::Pair; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
46
|
1
|
|
|
1
|
|
41
|
use Finance::Robinhood::Equity::Instrument; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 C |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
If available, this will return a list of Finance::Robinhood::Forex::Pair |
53
|
|
|
|
|
|
|
objects. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
0
|
sub forex_pairs ( $s ) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
map { Finance::Robinhood::Forex::Pair->new( _rh => $s->_rh, %$_ ) } @{ $s->{currency_pairs} }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _test_forex_pairs { |
62
|
1
|
|
50
|
1
|
|
1875
|
t::Utility::stash('BTC') // skip_all(); |
63
|
0
|
|
|
|
|
0
|
my ($btc_usd) = t::Utility::stash('BTC')->forex_pairs; |
64
|
0
|
|
|
|
|
0
|
isa_ok( $btc_usd, 'Finance::Robinhood::Forex::Pair' ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 C |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
If available, this will return a list of Finance::Robinhood::Equity::Instrument |
70
|
|
|
|
|
|
|
objects. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
2
|
1
|
2251
|
sub equity_instruments ( $s ) { |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
75
|
2
|
|
|
|
|
6
|
map { Finance::Robinhood::Equity::Instrument->new( _rh => $s->_rh, %$_ ) } |
76
|
2
|
|
|
|
|
3
|
@{ $s->{instruments} }; |
|
2
|
|
|
|
|
6
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _test_equity_instruments { |
80
|
1
|
|
50
|
1
|
|
1955
|
t::Utility::stash('MSFT') // skip_all(); |
81
|
0
|
|
|
|
|
0
|
my ($instrument) = t::Utility::stash('MSFT')->equity_instruments; |
82
|
0
|
|
|
|
|
0
|
isa_ok( |
83
|
|
|
|
|
|
|
$instrument, |
84
|
|
|
|
|
|
|
'Finance::Robinhood::Equity::Instrument' |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 C |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
If available, this will return a list of Finance::Robinhood::Equity::Tag |
91
|
|
|
|
|
|
|
objects. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
0
|
1
|
0
|
sub tags ( $s ) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
97
|
0
|
|
|
|
|
0
|
map { Finance::Robinhood::Equity::Tag->new( _rh => $s->_rh, %$_ ) } @{ $s->{tags} }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _test_tags { |
101
|
1
|
|
50
|
1
|
|
1845
|
t::Utility::stash('TAG') // skip_all(); |
102
|
0
|
|
|
|
|
|
my ($tag) = t::Utility::stash('TAG')->tags; |
103
|
0
|
|
|
|
|
|
isa_ok( $tag, 'Finance::Robinhood::Equity::Tag' ); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 LEGAL |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
109
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
110
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
111
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
114
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 LICENSE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
121
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
122
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
123
|
|
|
|
|
|
|
the L section. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |