NAME

Quant::Framework::CorporateAction

DESCRIPTION

Represents the corporate actions data of an underlying from database. Create new unpersistent CorporateAction can be done via:

my $ca = Quant::Framework::CorporateAction::create($storage_accessor, 'QWER', Date::Utility->new);

Obviously, it will have empty actions hash

$ca->actions; # empty hashref by default

Corporate actions can be persisted (stored in Chronicle) via save method

$ca->save;

Load persisted actions can be done via:

my $ca = Quant::Framework::CorporateAction::load($storage_accessor, 'QWER', Date::Utility->new);

It will return undef if there are no presisted actions in Chronicle. The date can be ommitted, than, it will try to load the most recent (last) corporate actions, i.e.

my $ca = Quant::Framework::CorporateAction::load($storage_accessor, 'QWER');

To update actions, the update method should be invoked, with appropriate structure, i.e.

my $ca = $ca->update({
  "62799500" => {
     "monitor_date" => "2014-02-07T06:00:07Z",
     "type" => "ACQUIS",
     "monitor" => 1,
     "description" =>  "Acquisition",
     "effective_date" =>  "15-Jul-14",
     "flag" => "N",
}, Date::Utility->new);

The update in scalar context will return new unpersisted Corporate object. You have to presist it via save method.

In the list context it will return new unpersisted Corporate object, and two hasref for new and cancelled action.

ATTRIBUTES

document

The document, which actually incorporates all data. Can be used to get the date of corporate actions, e.g.:

$corporate_actions->document->recorded_date

SUBROUTINES

create ($storage_accessor, $symbol, $for_date)

my $corp_actions = Quant::Framework::CorporateAction::crate($storage_accessor, "USAAPL", Date::Utility->new)

Creates a new unsaved corporate actions.

load ($storage_accessor, $symbol, $for_date)

my $corp_actions = Quant::Framework::CorporateAction::load($storage_accessor, "USAAPL", Date::Utility->new)

Loads the corporate actions for the specified symbol at the specified date. The date can be omitted, then it loads the most recent corporate actions.

Might return undef, if no actions exists in Chronicle

save

$corp_actions->save;

Stores corporate actions in chronicle.

update($actions, $date);

my $new_corp_actions = $corp_actions->update({
   "32799500" => {
       "monitor_date" => "2015-02-07T06:00:07Z",
       "type" => "DIV",
       "monitor" => 1,
       "description" =>  "Divided Stocks",
       "effective_date" =>  "15-Jul-15",
       "flag" => "N"
   },
}, Date::Utility->new)
$new_corp_actions->save;

Takes the existing actions, applies "diff" of actions in Bloomberg format (i.e. adds new actions, or cancels exising ones), and returns new unpersisted (non-saved) CorporateAction object.

You have to invoke save method to persist new corporate actions in Chronicle.

The $date argument in mandatory.

actions

my $actions = $corp_actions->actions;

Returns hashref of actions in Bloomberg format. If there are no actions, the empty hashref is returned.