line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Equity::Order::Execution; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Equity::Order::Execution - Represents a Single Execution of |
10
|
|
|
|
|
|
|
an Equity Order |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Finance::Robinhood; |
15
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new->login('user', 'pass'); |
16
|
|
|
|
|
|
|
my $orders = $rh->equity_orders(); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
for my $order ($orders->all) { |
19
|
|
|
|
|
|
|
grep{ CORE::say( $_->settlement_date) } @{$order->executions} and if $order->state eq 'filled'; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHOD |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _test__init { |
29
|
1
|
|
|
1
|
|
13491
|
my $rh = t::Utility::rh_instance(1); |
30
|
0
|
|
|
|
|
0
|
my $orders = $rh->equity_orders; |
31
|
0
|
|
|
|
|
0
|
my $order; |
32
|
0
|
|
|
|
|
0
|
do { |
33
|
0
|
|
|
|
|
0
|
$order = $orders->next; |
34
|
|
|
|
|
|
|
} while $order->state ne 'filled'; |
35
|
0
|
|
0
|
|
|
0
|
$order // skip_all('Failed to fine executied equity order'); |
36
|
0
|
|
|
|
|
0
|
my ($execution) = $order->executions; |
37
|
0
|
|
|
|
|
0
|
isa_ok($execution, __PACKAGE__); |
38
|
0
|
|
|
|
|
0
|
t::Utility::stash('ORDER', $order); # Store it for later |
39
|
0
|
|
|
|
|
0
|
t::Utility::stash('EXECUTION', $execution); # Store it for later |
40
|
|
|
|
|
|
|
} |
41
|
1
|
|
|
1
|
|
6
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
42
|
1
|
|
|
1
|
|
155
|
use Mojo::URL; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
43
|
1
|
|
|
1
|
|
52
|
use overload '""' => sub ($s, @) { $s->{url} }, fallback => 1; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
44
|
1
|
|
|
1
|
|
71
|
use Finance::Robinhood::Equity::Account; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
45
|
1
|
|
|
1
|
|
31
|
use Finance::Robinhood::Error; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
46
|
1
|
|
|
1
|
|
22
|
use Finance::Robinhood::Equity::Position; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _test_stringify { |
49
|
1
|
|
50
|
1
|
|
1898
|
t::Utility::stash('ORDER') // skip_all(); |
50
|
0
|
|
|
|
|
0
|
like(+t::Utility::stash('ORDER'), |
51
|
|
|
|
|
|
|
qr'https://api.robinhood.com/orders/.+/'); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
55
|
|
|
|
|
|
|
has ['id', 'price', 'quantity']; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 C |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
UUID used to identify this particular execution. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 C |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The price for this particular execution. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 C |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Number of shares for this particular execution. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns a Time::Moment object. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
1
|
0
|
sub timestamp ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
76
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{timestamp}); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _test_timestamp { |
80
|
1
|
|
50
|
1
|
|
1898
|
t::Utility::stash('EXECUTION') |
81
|
|
|
|
|
|
|
// skip_all('No order execution object in stash'); |
82
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('EXECUTION')->timestamp, 'Time::Moment'); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 C |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Returns a Time::Moment object. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
1
|
0
|
sub settlement_date($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
92
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{settlement_date} . 'T00:00:00Z'); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _test_settlement_date { |
96
|
1
|
|
50
|
1
|
|
2073
|
t::Utility::stash('EXECUTION') |
97
|
|
|
|
|
|
|
// skip_all('No order execution object in stash'); |
98
|
0
|
|
|
|
|
|
isa_ok(t::Utility::stash('EXECUTION')->settlement_date, 'Time::Moment'); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LEGAL |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
104
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
105
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
106
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
109
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
117
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
118
|
|
|
|
|
|
|
the L section. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |