NAME

GT::SystemManager - Manages trading systems


DESCRIPTION

A SystemManager is an entity interacting between a PortfolioManager, a Trading System (signals), TradeFilters, OrderFactory and CloseStrategy.

Filters can be applied to accept/refuse trades proposed by the trading system.

A system manager is not completely defined until all desired objects have been "linked" to it using all the add_* and set_* functions. When all those calls have been made, you should call finalize to let the manager know that you've finished setting it up. After that, the system manager can be identified with an unique (and quite long) name.

Later you'll be able to setup the same system manager by using setup_from_name($name).

my $sm = GT::SystemManager->new($system)

Create a new system manager used to control a trading system.

$sm->set_system($system)

Define the system that is managed.

$sm->system()

Return the system managed by this manager.

$manager->add_trade_filter()
$manager->delete_all_trade_filter()

Use a trade filter and remove all trade filters currently used.

$self->accept_trade($order, $i, $calc, $pf_manager)

Apply all the trade filters to the proposed tarde and return the result (accepted or not).

$self->send_buy_order($calc, $i, $pf_manager)
$self->send_sell_order($calc, $i, $pf_manager)

Those functions are called by the systems to launch an order. The SystemManager delegates this to an Order object. It will use the Order object given by set_default_order() or it will fallback to the order suggested by the system.

$self->set_order_factory($order_factory)

Defines which OrderFactory object will be used to send the orders.

$self->add_position_manager($close_strategy)
$self->delete_all_position_manager()

Add a position manager to the chain of position manager. A position manager is better known as "CloseStragegy".

$sm->manage_position($calc, $i, $position, $pf_manager)

Manages a open position with the current system.

$sm->position_opened($calc, $i, $position, $pf_manager)

Has to be called once a position has been opened and wants to be managed by this system manager.

$sm->get_indicative_stop($calc, $i, $order, $pf_manager)

Get an indicative stop level for the position that will be opened by this order.

$sm->precalculate_interval($calc, $i, $first, $last)
$sm->finalize()

Finalize the setup of the manager. Calculate its name. You can get its name afterward using $sm->get_name

$sm->get_name()

Return the name of the system.

$sm->setup_from_name($name)

Setup the system manager according to the name.

$sm->set_alias_name($name)
$sm->alias_name
my $sm = GT::SystemManager::get_registered_object($name)

Returns the system manager corresponding to this name.