Quant::Framework::Document - Binds data with Chronicle
Internal representation of persistend data. Do not create the class directly outside of Quant::Framework, although the usage of public fields outside of Quant::Framework is allowed.
The class is responsible for loading and storing data via Data::Chronicle. The data itself is a hash, which content is provided by users of the class (i.e. by CorporateActions).
# create new (transient / not-yet-persisted) Document my $document = Quant::Framework::Document->new( storage_accessor => $storage_accessor, symbol => 'frxUSDJPY', data => {}, for_date => Date::Utility->new, ); # persist document $document->save('currency'); # load document my $document2 = Quant::Framework::Document::load( $storage_accessor, 'currency', 'frxUSDJPY', Date::Utility->new, # optional )
Chronicle assessor
The date of document creation (Date::Utility)
Date::Utility
Hashref of data. Should be defined by the class, which uses Document. Currently the fields date and symbol are reserved.
date
symbol
The required namespace of document, e.g. 'corporate_actions'
The domain-specific name of document; e.g. "USAAPL" for corporate actions
my $recent_document = Quant::Framework::Document::load($storage_accessor, 'corporate_actions', "USAAPL"); my $event_date = Date::Utility->new('02-02-2016') my $historical_doc = Quant::Framework::Document::load($storage_accessor, 'corporate_actions', "USAAPL", $event_date);
Loads the document. If the argument for_date is ommitted, then loads the most recent document.
for_date
If document is not found, returns undef.
undef
$document->save;
Stores (persists) the document in Chronicle database.
To install Quant::Framework, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Quant::Framework
CPAN shell
perl -MCPAN -e shell install Quant::Framework
For more information on module installation, please visit the detailed CPAN module installation guide.