| 1 | package Finance::GeniusTrader::Brokers::Logitelnet; | ||
| 2 | |||
| 3 | # Copyright 2000-2002 Raphaƫl Hertzog, Fabien Fulhaber | ||
| 4 | # This file is distributed under the terms of the General Public License | ||
| 5 | # version 2 or (at your option) any later version. | ||
| 6 | |||
| 7 | # submitted by sam godbillot 26 nov 07 | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use vars qw(@NAMES @ISA); | ||
| 11 | |||
| 12 | use Finance::GeniusTrader::Brokers; | ||
| 13 | use Finance::GeniusTrader::Eval; | ||
| 14 | use Finance::GeniusTrader::Conf; | ||
| 15 | |||
| 16 | @NAMES = ("Logitelnet[#1]"); | ||
| 17 | @ISA = qw(Finance::GeniusTrader::Brokers); | ||
| 18 | |||
| 19 | =head1 Finance::GeniusTrader::Brokers::Logitelnet | ||
| 20 | |||
| 21 | =head2 Overview | ||
| 22 | |||
| 23 | This module will calculate all commissions and charges according to | ||
| 24 | Logitelnet (Societe Generale) rules | ||
| 25 | |||
| 26 | =head2 Calculation | ||
| 27 | |||
| 28 | 0.54% / order < 8000 Euros, 8.90 Euros minimum | ||
| 29 | 0.44% / 8000 <= order < 15000 Euros | ||
| 30 | 0.34 % / order up to 15000 Euros | ||
| 31 | |||
| 32 | =cut | ||
| 33 | sub new { | ||
| 34 | my $type = shift; | ||
| 35 | my $class = ref($type) || $type; | ||
| 36 | my $args = shift; | ||
| 37 | |||
| 38 | my $self = { 'args' => defined($args) ? $args : [] }; | ||
| 39 | |||
| 40 | return manage_object(\@NAMES, $self, $class, $self->{'args'}, ''); | ||
| 41 | } | ||
| 42 | |||
| 43 | =head2 $broker->calculate_order_commission($order) | ||
| 44 | |||
| 45 | Return the amount of money ask by the broker for the given order. | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | sub calculate_order_commission { | ||
| 50 | my ($self, $order) = @_; | ||
| 51 | my $investment; | ||
| 52 | my $TVA = (1 + 19.6 / 100); | ||
| 53 | my $commission = 0; | ||
| 54 | |||
| 55 | # Override $TVA if Brokers::TVA is already defined in the user | ||
| 56 | # configuration file | ||
| 57 | |||
| 58 | if (Finance::GeniusTrader::Conf::get("Brokers::TVA")) { | ||
| 59 | $TVA = (1 + Finance::GeniusTrader::Conf::get("Brokers::TVA") / 100); | ||
| 60 | } | ||
| 61 | |||
| 62 | if ( (defined($order->quantity) && $order->quantity) and (defined($order->price) && $order->price) ) { | ||
| 63 | $investment = $order->quantity * $order->price; | ||
| 64 | if ($investment < 8000) { | ||
| 65 | $commission = sprintf("%.2f", ($investment*0.0054 * $TVA)); | ||
| 66 | if ($commission < 8.9) { | ||
| 67 | $commission=8.9; | ||
| 68 | } | ||
| 69 | } | ||
| 70 | if ($investment <= 8000 and $investment < 15000) { | ||
| 71 | $commission = sprintf("%.2f", ($investment*0.0044 * $TVA)); | ||
| 72 | } | ||
| 73 | if ($investment < 100000 and $investment > 3000) { | ||
| 74 | $commission = sprintf("%.2f", ($investment*0.0034 * $TVA)); | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | # Add the "Impot de bourse" | ||
| 79 | my $impot_de_bourse; | ||
| 80 | if ($investment > 7830) { | ||
| 81 | if ($investment < 153000) { | ||
| 82 | $impot_de_bourse = ($investment-7830) * 0.30 / 100; | ||
| 83 | } | ||
| 84 | else { | ||
| 85 | $impot_de_bourse = ($investment-7830) * 0.15 / 100; | ||
| 86 | } | ||
| 87 | $commission += $impot_de_bourse; | ||
| 88 | } | ||
| 89 | |||
| 90 | return $commission if ($commission != 0);; | ||
| 91 | } | ||
| 92 | |||
| 93 | =head2 $broker->calculate_annual_account_charge($portfolio, $year) | ||
| 94 | |||
| 95 | Return the amount of money ask by the broker for the given year | ||
| 96 | according to the given portfolio. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | sub calculate_annual_account_charge { | ||
| 101 | my ($self, $portfolio, $year) = @_; | ||
| 102 | |||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | |||
| 106 | 1; |