The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finance::GeniusTrader::Portfolio::Order - An order within the portfolio

DESCRIPTION

Internal structure

 {
    "order" => "B",         # Buy/Sell
    "type" => "L",          # Limited|Stop|APD|ATP|TR
    "code" => "13000",
    "quantity" => 100,
    "price" => "12.4",      # Main price
    "price2" => "12.6",     # Second limit (if needed)
    "source" => "Trend",    # Trading system that opened the position
                            # maybe "manual"
    "date" => "2001-07-01", # date of submission
    "validity" => "2001-07-02", # valable until this day
    "no_discard" => 1,      # don't remove the order automatically next day
    "id" => 123             # id automatically assigned when added to
                            # the portfolio
 }

Functions

$o = Finance::GeniusTrader::Portfolio::Order->new;
$o->set_sell_order()
$o->set_buy_order()
$o->is_sell_order()
$o->is_buy_order()
$o->set_type($type)
$o->get_type()

Manage the type of the order. Valid types are :

M

Market price

L

Limit

S

Stop

APD

A plage de déclenchement (french market only)

TR

Tout ou rien (french market)

ATP

A tout prix (french market)

$o->set_type_{limited,market_price,stop,stop_limited}()
$o->is_type_{limited,market_price,stop,stop_limited}()

Change/checks the type of the order.

$o->set_code($code)
$o->code()

Set/get the symbol of the traded share.

$o->set_quantity($quantity)
$o->quantity()

Set/get the quantity of shares.

$o->set_price($price)
$o->price()
$o->set_second_price($price)
$o->second_price()

Set/get the prices on the order.

$o->set_source($source)
$o->source()
$o->set_submission_date($date)
$o->submissiont_date()
$o->set_indicative_stop($price)
$o->indicative_stop()
$o->set_not_discardable()
$o->set_discardable()
$o->discardable()

A normal order has a validity of one period (ie one day usually). If you want to place an order that should be kept until it's executed (a close on target for example) you need to modify the order by calling this function on it.

$o->set_id($id)
$o->id()
$o->set_attribute($key, [ $value ]);
$o->has_attribute($key);
$o->attribute($key);
$o->delete_attribute($key);

An order can have "attributes" associated to keep track of its status in various strategies. has_attribute returns only true if the attribute exists (whatever its value is). attribute returns the attribute value if it exists or undef otherwise.

$o->set_timeframe($timeframe)
$o->timeframe()

Set and return the timeframe associated to this order.

$o->set_marged()
$o->set_not_marged()
$o->is_marged()

A marged order will not cost cash since the cash is "rented" until the position is closed.

$o->is_executed($calc, $i)

Returns the price of execution if the order has been executed. Otherwise returns 0.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 92:

Non-ASCII character seen before =encoding in 'déclenchement'. Assuming CP1252