| 1 | package Finance::GeniusTrader::TradeFilters::ShortOnly; | ||
| 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 | # Standards-Version: 1.0 | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use vars qw(@NAMES @ISA @DEFAULT_ARGS); | ||
| 11 | |||
| 12 | use Finance::GeniusTrader::TradeFilters; | ||
| 13 | |||
| 14 | @NAMES = ("ShortOnly"); | ||
| 15 | @ISA = qw(Finance::GeniusTrader::TradeFilters); | ||
| 16 | @DEFAULT_ARGS = (); | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | Finance::GeniusTrader::TradeFilters::ShortOnly - Only allow short trades | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This filter allows only short trades and reject long ones. This filter is | ||
| 25 | a must to find if a system perform better as a short only system than | ||
| 26 | either a long only or a long and short trading system. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | sub accept_trade { | ||
| 31 | my ($self, $order, $i, $calc, $portfolio) = @_; | ||
| 32 | |||
| 33 | if ($order->is_sell_order) { | ||
| 34 | return 1; | ||
| 35 | } else { | ||
| 36 | return 0; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; |