Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::FinancePreprocVMatrix Class Reference

#include <FinancePreprocVMatrix.h>

Inheritance diagram for PLearn::FinancePreprocVMatrix:

Inheritance graph
[legend]
Collaboration diagram for PLearn::FinancePreprocVMatrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FinancePreprocVMatrix ()
 a row buffer for the getRow method

 FinancePreprocVMatrix (VMat vm, TVec< string > the_asset_names, bool add_tradable_info=true, bool add_last_day=false, bool add_moving_average_stats=false, bool add_roll_over_info=false, int threshold=20, TVec< string > the_price_tags=TVec< string >(), TVec< int > moving_average_window_length=TVec< int >(), string the_volume_tag="volume:level", string the_date_tag="Date", string the_expiration_tag="expiration-date", int the_last_day_cutoff=0, bool last_date_is_a_last_day=false)
 Simple constructor: takes as input only the underlying matrix, the number of assets and the threshold on the volume.

virtual void build ()
 Should call simply inherited::build(), then this class's build_().

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.

 PLEARN_DECLARE_OBJECT (FinancePreprocVMatrix)
 Declares name and deepCopy methods.


Public Attributes

VMat underlying
TVec< stringasset_name
 the underlying vmat

bool add_tradable
 all the asset names

bool add_last_day_of_month
 do we include the information telling if this day is tradable or not

bool add_moving_average
 do we include the information about the last tradable day of the month

bool add_rollover_info
 do we include the moving average statistics on the price_tag indexes

int min_volume_threshold
 add a column with '1' when the rollover occur (new expiration date)

TVec< stringprices_tag
 tradable = 1 if volume>min_volume_threshold

TVec< intmoving_average_window
 all the price tags on which we want to compute the moving average (e.g. close:level)

string volume_tag
 the window size of the moving average

string date_tag
 "volume" by default

string expiration_tag
 "Date" by default. Only used if add_last_day_of_month==true

int last_day_cutoff
 "expiration-date" by default. Only used if add_rollover_info==true

bool last_date_is_last_day
 0 by default (last day of month). Set last_day=15 to simulate last_day_of_month as the 15 of each month


Protected Member Functions

void setVMFields ()
virtual void getNewRow (int i, const Vec &v) const
 This is the only method requiring implementation in subclasses.


Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Protected Attributes

TVec< intvolume_index
 is the last day a last day of month? (default=false)

TVec< intprice_index
 the indexes (in the vmat) of all the volume columns

TVec< intexpiration_index
 the indexes of all the prices on which we want to compute some stats

Vec last_day_of_month_index
 the index of the expiration-date (related to the expiration_tag)

int max_moving_average_window
 the index of all the last tradable day of the month, base on the date column of the underlying matrix

TVec< TVec< int > > rollover_date
 the maximum value of moving_average_window

Vec row_buffer
 the position (date) of all rollover


Private Types

typedef RowBufferedVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

typedef RowBufferedVMatrix PLearn::FinancePreprocVMatrix::inherited [private]
 

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 52 of file FinancePreprocVMatrix.h.

Referenced by FinancePreprocVMatrix().


Constructor & Destructor Documentation

PLearn::FinancePreprocVMatrix::FinancePreprocVMatrix  ) 
 

a row buffer for the getRow method

Definition at line 50 of file FinancePreprocVMatrix.cc.

References inherited.

PLearn::FinancePreprocVMatrix::FinancePreprocVMatrix VMat  vm,
TVec< string the_asset_names,
bool  add_tradable_info = true,
bool  add_last_day = false,
bool  add_moving_average_stats = false,
bool  add_roll_over_info = false,
int  threshold = 20,
TVec< string the_price_tags = TVecstring >(),
TVec< int moving_average_window_length = TVecint >(),
string  the_volume_tag = "volume:level",
string  the_date_tag = "Date",
string  the_expiration_tag = "expiration-date",
int  the_last_day_cutoff = 0,
bool  last_date_is_a_last_day = false
 

Simple constructor: takes as input only the underlying matrix, the number of assets and the threshold on the volume.

Definition at line 55 of file FinancePreprocVMatrix.cc.

References build().


Member Function Documentation

void PLearn::FinancePreprocVMatrix::build  )  [virtual]
 

Should call simply inherited::build(), then this class's build_().

This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::VMatrix.

Definition at line 305 of file FinancePreprocVMatrix.cc.

References build_().

Referenced by FinancePreprocVMatrix().

void PLearn::FinancePreprocVMatrix::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 217 of file FinancePreprocVMatrix.cc.

References add_last_day_of_month, add_moving_average, add_rollover_info, add_tradable, PLearn::TVec< TVec< int > >::append(), PLearn::TVec< T >::append(), asset_name, date_tag, expiration_index, expiration_tag, PLearn::is_missing(), k, last_date_is_last_day, last_day_cutoff, last_day_of_month_index, PLearn::VMat::length(), PLearn::max(), max_moving_average_window, PLearn::PDate::month, moving_average_window, price_index, prices_tag, PLearn::TVec< TVec< int > >::resize(), PLearn::TVec< int >::resize(), rollover_date, PLearn::VMatrix::saveFieldInfos(), setVMFields(), PLearn::TVec< int >::size(), PLearn::TVec< string >::size(), underlying, volume_index, volume_tag, and PLearn::VMat::width().

Referenced by build().

void PLearn::FinancePreprocVMatrix::declareOptions OptionList ol  )  [static, protected]
 

Declares this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 130 of file FinancePreprocVMatrix.cc.

References PLearn::declareOption(), and PLearn::OptionList.

void PLearn::FinancePreprocVMatrix::getNewRow int  i,
const Vec v
const [protected, virtual]
 

This is the only method requiring implementation in subclasses.

Implements PLearn::RowBufferedVMatrix.

Definition at line 76 of file FinancePreprocVMatrix.cc.

References add_last_day_of_month, add_moving_average, add_rollover_info, add_tradable, asset_name, PLearn::TVec< T >::contains(), PLearn::TVec< TVec< int > >::find(), PLearn::is_missing(), k, last_day_of_month_index, PLearn::TVec< T >::length(), PLearn::TVec< string >::length(), MAX, max_moving_average_window, PLearn::mean(), MIN, min_volume_threshold, moving_average_window, price_index, prices_tag, rollover_date, row_buffer, PLearn::TVec< int >::size(), PLearn::TVec< string >::size(), PLearn::TVec< T >::subVec(), underlying, PLearn::Vec, volume_index, and PLearn::VMat::width().

void PLearn::FinancePreprocVMatrix::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 311 of file FinancePreprocVMatrix.cc.

References asset_name, PLearn::deepCopyField(), expiration_index, moving_average_window, price_index, prices_tag, and volume_index.

PLearn::FinancePreprocVMatrix::PLEARN_DECLARE_OBJECT FinancePreprocVMatrix   ) 
 

Declares name and deepCopy methods.

void PLearn::FinancePreprocVMatrix::setVMFields  )  [protected]
 

Definition at line 172 of file FinancePreprocVMatrix.cc.

References add_last_day_of_month, add_moving_average, add_rollover_info, add_tradable, asset_name, k, moving_average_window, prices_tag, PLearn::TVec< int >::size(), PLearn::TVec< string >::size(), PLearn::TVec< T >::size(), PLearn::tostring(), underlying, and PLearn::VMat::width().

Referenced by build_().


Member Data Documentation

bool PLearn::FinancePreprocVMatrix::add_last_day_of_month
 

do we include the information telling if this day is tradable or not

Definition at line 59 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and setVMFields().

bool PLearn::FinancePreprocVMatrix::add_moving_average
 

do we include the information about the last tradable day of the month

Definition at line 60 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and setVMFields().

bool PLearn::FinancePreprocVMatrix::add_rollover_info
 

do we include the moving average statistics on the price_tag indexes

Definition at line 61 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and setVMFields().

bool PLearn::FinancePreprocVMatrix::add_tradable
 

all the asset names

Definition at line 58 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and setVMFields().

TVec<string> PLearn::FinancePreprocVMatrix::asset_name
 

the underlying vmat

Definition at line 57 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), makeDeepCopyFromShallowCopy(), and setVMFields().

string PLearn::FinancePreprocVMatrix::date_tag
 

"volume" by default

Definition at line 66 of file FinancePreprocVMatrix.h.

Referenced by build_().

TVec<int> PLearn::FinancePreprocVMatrix::expiration_index [protected]
 

the indexes of all the prices on which we want to compute some stats

Definition at line 75 of file FinancePreprocVMatrix.h.

Referenced by build_(), and makeDeepCopyFromShallowCopy().

string PLearn::FinancePreprocVMatrix::expiration_tag
 

"Date" by default. Only used if add_last_day_of_month==true

Definition at line 67 of file FinancePreprocVMatrix.h.

Referenced by build_().

bool PLearn::FinancePreprocVMatrix::last_date_is_last_day
 

0 by default (last day of month). Set last_day=15 to simulate last_day_of_month as the 15 of each month

Definition at line 69 of file FinancePreprocVMatrix.h.

Referenced by build_().

int PLearn::FinancePreprocVMatrix::last_day_cutoff
 

"expiration-date" by default. Only used if add_rollover_info==true

Definition at line 68 of file FinancePreprocVMatrix.h.

Referenced by build_().

Vec PLearn::FinancePreprocVMatrix::last_day_of_month_index [protected]
 

the index of the expiration-date (related to the expiration_tag)

Definition at line 76 of file FinancePreprocVMatrix.h.

Referenced by build_(), and getNewRow().

int PLearn::FinancePreprocVMatrix::max_moving_average_window [protected]
 

the index of all the last tradable day of the month, base on the date column of the underlying matrix

Definition at line 77 of file FinancePreprocVMatrix.h.

Referenced by build_(), and getNewRow().

int PLearn::FinancePreprocVMatrix::min_volume_threshold
 

add a column with '1' when the rollover occur (new expiration date)

Definition at line 62 of file FinancePreprocVMatrix.h.

Referenced by getNewRow().

TVec<int> PLearn::FinancePreprocVMatrix::moving_average_window
 

all the price tags on which we want to compute the moving average (e.g. close:level)

Definition at line 64 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), makeDeepCopyFromShallowCopy(), and setVMFields().

TVec<int> PLearn::FinancePreprocVMatrix::price_index [protected]
 

the indexes (in the vmat) of all the volume columns

Definition at line 74 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy().

TVec<string> PLearn::FinancePreprocVMatrix::prices_tag
 

tradable = 1 if volume>min_volume_threshold

Definition at line 63 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), makeDeepCopyFromShallowCopy(), and setVMFields().

TVec< TVec<int> > PLearn::FinancePreprocVMatrix::rollover_date [protected]
 

the maximum value of moving_average_window

Definition at line 78 of file FinancePreprocVMatrix.h.

Referenced by build_(), and getNewRow().

Vec PLearn::FinancePreprocVMatrix::row_buffer [protected]
 

the position (date) of all rollover

Definition at line 79 of file FinancePreprocVMatrix.h.

Referenced by getNewRow().

VMat PLearn::FinancePreprocVMatrix::underlying
 

Definition at line 56 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and setVMFields().

TVec<int> PLearn::FinancePreprocVMatrix::volume_index [protected]
 

is the last day a last day of month? (default=false)

Definition at line 73 of file FinancePreprocVMatrix.h.

Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy().

string PLearn::FinancePreprocVMatrix::volume_tag
 

the window size of the moving average

Definition at line 65 of file FinancePreprocVMatrix.h.

Referenced by build_().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:26:16 2004 for PLearn by doxygen 1.3.7