line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Forex::Cost; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls forex |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Forex::Cost - Represents a Forex Positio's Cost Basis |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Finance::Robinhood; |
14
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# TODO |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.92_001'; |
21
|
1
|
|
|
1
|
|
4131
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
22
|
1
|
|
|
1
|
|
221
|
use Mojo::URL; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
7
|
|
23
|
1
|
|
|
1
|
|
28
|
use Finance::Robinhood::Forex::Currency; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _test__init { |
26
|
1
|
|
|
1
|
|
8144
|
my $rh = t::Utility::rh_instance(1); |
27
|
0
|
|
|
|
|
0
|
my ($cost) = $rh->forex_holdings->current->cost_bases; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
0
|
|
|
0
|
$cost // skip_all('No cost basis found'); |
30
|
0
|
|
|
|
|
0
|
isa_ok( $cost, __PACKAGE__ ); |
31
|
0
|
|
|
|
|
0
|
t::Utility::stash( 'COST_BASIS', $cost ); # Store it for later |
32
|
|
|
|
|
|
|
} |
33
|
1
|
|
|
1
|
|
193
|
use overload '""' => sub ( $s, @ ) { $s->{id} }, fallback => 1; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _test_stringify { |
36
|
1
|
|
50
|
1
|
|
1887
|
t::Utility::stash('COST_BASIS') // skip_all(); |
37
|
0
|
|
|
|
|
0
|
like( |
38
|
|
|
|
|
|
|
+t::Utility::stash('COST_BASIS'), |
39
|
|
|
|
|
|
|
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 |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 METHODS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 C |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 C |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 C |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 C |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 C |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has [ |
74
|
|
|
|
|
|
|
'direct_quantity', 'direct_cost_basis', 'intraday_cost_basis', 'intraday_quantity', |
75
|
|
|
|
|
|
|
'marked_quantity', 'marked_cost_basis' |
76
|
|
|
|
|
|
|
]; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 C |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns a Finance::Robinhood::Forex::Currency object. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
1
|
0
|
sub currency ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
85
|
0
|
|
|
|
|
0
|
$s->_rh->forex_currency_by_id( $s->{currency_id} ); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _test_currency { |
89
|
1
|
|
50
|
1
|
|
1940
|
t::Utility::stash('COST_BASIS') // skip_all(); |
90
|
0
|
|
|
|
|
|
isa_ok( t::Utility::stash('COST_BASIS')->currency, 'Finance::Robinhood::Forex::Currency' ); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 LEGAL |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
96
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
97
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
98
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
101
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
109
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
110
|
|
|
|
|
|
|
the L section. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |