« blib/lib/Finance/Bank/SentinelBenefits/Csv401kConverter/SymbolMap.pm
↑ Summary
blib/lib/Finance/Bank/SentinelBenefits/Csv401kConverter/Line.pm »
| 1 | package Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser; | ||
| 2 | $Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser::VERSION = '1.2'; | ||
| 3 | use Modern::Perl '2015'; | ||
| 4 | use feature 'signatures'; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 | Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser - Reveses sides on lines | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | =head1 VERSION | ||
| 15 | |||
| 16 | version 1.2 | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | my $reverser = Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser->new(); | ||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | my $side = $reverser->flip('Buy'); | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | #$side eq 'Sell' | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | This class represents one transaction, whether a contribution or | ||
| 35 | a company match, and tells you the security, the price, quantity, | ||
| 36 | total money, etc. It doesn't have any smarts, but serves as an | ||
| 37 | immutable internal data structure. | ||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | use Moose; | ||
| 44 | |||
| 45 | use Finance::Bank::SentinelBenefits::Csv401kConverter::Types; | ||
| 46 | |||
| 47 | =head1 METHODS | ||
| 48 | |||
| 49 | =head2 p->flip($side) | ||
| 50 | |||
| 51 | Turns buys into sells, dividends into shorts, etc | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | sub flip($self, $side){ | ||
| 56 | |||
| 57 | # $line->side() eq 'Buy' ? 'ShtSell' : 'Buy' | ||
| 58 | |||
| 59 | return $side eq 'Buy' ? 'ShtSell' | ||
| 60 | : $side eq 'ReinvDiv' ? 'ShtSell' | ||
| 61 | : 'Buy'; | ||
| 62 | } | ||
| 63 | |||
| 64 | no Moose; | ||
| 65 | |||
| 66 | __PACKAGE__->meta->make_immutable; | ||
| 67 | |||
| 68 | |||
| 69 | =head1 LICENSE AND COPYRIGHT | ||
| 70 | |||
| 71 | Copyright 2009-2023 David Solimano | ||
| 72 | This file is part of Finance::Bank::SentinelBenefits::Csv401kConverter | ||
| 73 | |||
| 74 | Finance::Bank::SentinelBenefits::Csv401kConverter is free software: you can redistribute it and/or modify | ||
| 75 | it under the terms of the GNU General Public License as published by | ||
| 76 | the Free Software Foundation, either version 3 of the License, or | ||
| 77 | (at your option) any later version. | ||
| 78 | |||
| 79 | Finance::Bank::SentinelBenefits::Csv401kConverter is distributed in the hope that it will be useful, | ||
| 80 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 81 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 82 | GNU General Public License for more details. | ||
| 83 | |||
| 84 | You should have received a copy of the GNU General Public License | ||
| 85 | along with Finance::Bank::SentinelBenefits::Csv401kConverter. If not, see <http://www.gnu.org/licenses/>. | ||
| 86 | |||
| 87 | =cut |