line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Forex::Order::Execution; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Forex::Order::Execution - Represents a Single Forex Order |
10
|
|
|
|
|
|
|
Execution |
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
|
|
8
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
23
|
1
|
|
|
1
|
|
193
|
use Mojo::URL; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _test__init { |
26
|
1
|
|
|
1
|
|
13494
|
my $rh = t::Utility::rh_instance(1); |
27
|
0
|
|
|
|
|
0
|
my $orders = $rh->forex_orders; |
28
|
0
|
|
|
|
|
0
|
my $order; |
29
|
0
|
|
|
|
|
0
|
while ($orders->has_next) { |
30
|
0
|
0
|
|
|
|
0
|
if ($orders->next->state eq 'filled') { |
31
|
0
|
|
|
|
|
0
|
$order = $orders->current; |
32
|
0
|
|
|
|
|
0
|
last; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
0
|
|
|
0
|
$order // skip_all('Cannot find a forex order to test against'); |
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
|
|
238
|
use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _test_stringify { |
44
|
1
|
|
50
|
1
|
|
1988
|
t::Utility::stash('EXECUTION') // skip_all(); |
45
|
0
|
|
|
|
|
0
|
like(+t::Utility::stash('EXECUTION'), |
46
|
|
|
|
|
|
|
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 |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
51
|
|
|
|
|
|
|
has ['effective_price', 'id', 'quantity']; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 C |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns a dollar amount. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns a UUID. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 C |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Returns the amount of currency. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
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
|
|
1925
|
t::Utility::stash('EXECUTION') |
81
|
|
|
|
|
|
|
// skip_all('No order execution object in stash'); |
82
|
0
|
|
|
|
|
|
isa_ok(t::Utility::stash('EXECUTION')->timestamp, 'Time::Moment'); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 LEGAL |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
88
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
89
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
90
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
93
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
100
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
101
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
102
|
|
|
|
|
|
|
the L section. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |