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_002'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _test__init { |
29
|
1
|
|
|
1
|
|
13425
|
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
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
my ($execution) = $order->executions; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
isa_ok( $execution, __PACKAGE__ ); |
40
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'ORDER', $order ); # Store it for later |
41
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'EXECUTION', $execution ); # Store it for later |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
1
|
|
7
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
44
|
1
|
|
|
1
|
|
185
|
use Mojo::URL; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
15
|
|
45
|
1
|
|
|
1
|
|
87
|
use overload '""' => sub ( $s, @ ) { $s->{url} }, fallback => 1; |
|
1
|
|
|
0
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
46
|
1
|
|
|
1
|
|
82
|
use Finance::Robinhood::Equity::Account; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
47
|
1
|
|
|
1
|
|
26
|
use Finance::Robinhood::Error; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
5
|
|
48
|
1
|
|
|
1
|
|
35
|
use Finance::Robinhood::Equity::Position; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _test_stringify { |
51
|
1
|
|
50
|
1
|
|
1881
|
t::Utility::stash('ORDER') // skip_all(); |
52
|
0
|
|
|
|
|
0
|
like( +t::Utility::stash('ORDER'), qr'https://api.robinhood.com/orders/.+/' ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
56
|
|
|
|
|
|
|
has [ 'id', 'price', 'quantity' ]; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
UUID used to identify this particular execution. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 C |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The price for this particular execution. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Number of shares for this particular execution. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 C |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns a Time::Moment object. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
1
|
0
|
sub timestamp ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
77
|
0
|
|
|
|
|
0
|
Time::Moment->from_string( $s->{timestamp} ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _test_timestamp { |
81
|
1
|
|
50
|
1
|
|
1897
|
t::Utility::stash('EXECUTION') // 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
|
|
2093
|
t::Utility::stash('EXECUTION') // skip_all('No order execution object in stash'); |
97
|
0
|
|
|
|
|
|
isa_ok( t::Utility::stash('EXECUTION')->settlement_date, 'Time::Moment' ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 LEGAL |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
103
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
104
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
105
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
108
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
115
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
116
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
117
|
|
|
|
|
|
|
the L section. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |