| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Finance::Robinhood::Forex::Watchlist; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Forex::Watchlist - Represents a Single Forex/Crypto |
|
10
|
|
|
|
|
|
|
Watchlist |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Finance::Robinhood; |
|
15
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# TODO |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
|
22
|
1
|
|
|
1
|
|
3867
|
use Mojo::Base-base, -signatures; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
10
|
|
|
23
|
1
|
|
|
1
|
|
265
|
use Mojo::URL; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
24
|
1
|
|
|
1
|
|
29
|
use Time::Moment; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
147
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _test__init { |
|
27
|
1
|
|
|
1
|
|
8381
|
my $rh = t::Utility::rh_instance(1); |
|
28
|
0
|
|
|
|
|
0
|
my $watchlist = $rh->forex_watchlists->current; |
|
29
|
0
|
|
|
|
|
0
|
isa_ok($watchlist, __PACKAGE__); |
|
30
|
0
|
|
|
|
|
0
|
t::Utility::stash('WATCHLIST', $watchlist); # Store it for later |
|
31
|
|
|
|
|
|
|
} |
|
32
|
1
|
|
|
1
|
|
10
|
use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1; |
|
|
1
|
|
|
0
|
|
2
|
|
|
|
1
|
|
|
|
|
12
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _test_stringify { |
|
35
|
1
|
|
50
|
1
|
|
1864
|
t::Utility::stash('WATCHLIST') // skip_all(); |
|
36
|
0
|
|
|
|
|
0
|
like(+t::Utility::stash('WATCHLIST'), |
|
37
|
|
|
|
|
|
|
qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 C |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Returns a Time::Moment object. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 C |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns a UUID. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 C |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 C |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns a Time::Moment object. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has ['id', 'name']; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
0
|
sub created_at ($s) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
66
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{created_at}); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _test_created_at { |
|
70
|
1
|
|
50
|
1
|
|
2037
|
t::Utility::stash('WATCHLIST') // skip_all(); |
|
71
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('WATCHLIST')->created_at, 'Time::Moment'); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
0
|
sub updated_at ($s) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
75
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{updated_at}); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _test_updated_at { |
|
79
|
1
|
|
50
|
1
|
|
1887
|
t::Utility::stash('WATCHLIST') // skip_all(); |
|
80
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('WATCHLIST')->updated_at, 'Time::Moment'); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 C |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$watchlist->pair_ids( ) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Returns a list of UUIDs. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$watchlist->pair_ids( |
|
90
|
|
|
|
|
|
|
"76637d50-c702-4ed1-bcb5-5b0732a81f48", |
|
91
|
|
|
|
|
|
|
"3d961844-d360-45fc-989b-f6fca761d511" ); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Updates the watchlist with a list of currency pairs. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
0
|
1
|
0
|
sub pair_ids ($s, @ids) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
98
|
0
|
0
|
|
|
|
0
|
return $s->{pair_ids} if !@ids; |
|
99
|
|
|
|
|
|
|
my $res |
|
100
|
|
|
|
|
|
|
= $s->_rh->_patch( |
|
101
|
0
|
|
|
|
|
0
|
'https://nummus.robinhood.com/watchlists/' . $s->{id} . '/', |
|
102
|
|
|
|
|
|
|
pair_ids => @ids); |
|
103
|
|
|
|
|
|
|
return $_[0] |
|
104
|
|
|
|
|
|
|
= Finance::Robinhood::Forex::Watchlist->new(_rh => $s->_rh, |
|
105
|
0
|
0
|
|
|
|
0
|
%{$res->json} |
|
|
0
|
|
|
|
|
0
|
|
|
106
|
|
|
|
|
|
|
) if $res->is_success; |
|
107
|
0
|
0
|
|
|
|
0
|
Finance::Robinhood::Error->new( |
|
108
|
|
|
|
|
|
|
$res->is_server_error ? (details => $res->message) : $res->json); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _test_pair_ids { |
|
112
|
1
|
|
50
|
1
|
|
1944
|
t::Utility::stash('WATCHLIST') // skip_all(); |
|
113
|
0
|
|
|
|
|
|
my @ids = t::Utility::stash('WATCHLIST')->pair_ids; |
|
114
|
0
|
|
|
|
|
|
ok(t::Utility::stash('WATCHLIST')->pair_ids(reverse @ids)); |
|
115
|
0
|
|
|
|
|
|
is(t::Utility::stash('WATCHLIST')->pair_ids(), reverse @ids); |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 LEGAL |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
|
121
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
|
122
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
|
123
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
|
126
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 LICENSE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
|
133
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
|
134
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
|
135
|
|
|
|
|
|
|
the L section. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; |