#include <FinancePreprocVMatrix.h>
Inheritance diagram for PLearn::FinancePreprocVMatrix:
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< string > | asset_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< string > | prices_tag |
tradable = 1 if volume>min_volume_threshold | |
TVec< int > | moving_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< int > | volume_index |
is the last day a last day of month? (default=false) | |
TVec< int > | price_index |
the indexes (in the vmat) of all the volume columns | |
TVec< int > | expiration_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. |
|
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 52 of file FinancePreprocVMatrix.h. Referenced by FinancePreprocVMatrix(). |
|
a row buffer for the getRow method
Definition at line 50 of file FinancePreprocVMatrix.cc. References inherited. |
|
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(). |
|
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(). |
|
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(). |
|
Declares this class' options.
Reimplemented from PLearn::VMatrix. Definition at line 130 of file FinancePreprocVMatrix.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
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(). |
|
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. |
|
Declares name and deepCopy methods.
|
|
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_(). |
|
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(). |
|
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(). |
|
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(). |
|
all the asset names
Definition at line 58 of file FinancePreprocVMatrix.h. Referenced by build_(), getNewRow(), and setVMFields(). |
|
the underlying vmat
Definition at line 57 of file FinancePreprocVMatrix.h. Referenced by build_(), getNewRow(), makeDeepCopyFromShallowCopy(), and setVMFields(). |
|
"volume" by default
Definition at line 66 of file FinancePreprocVMatrix.h. Referenced by build_(). |
|
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(). |
|
"Date" by default. Only used if add_last_day_of_month==true
Definition at line 67 of file FinancePreprocVMatrix.h. Referenced by build_(). |
|
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_(). |
|
"expiration-date" by default. Only used if add_rollover_info==true
Definition at line 68 of file FinancePreprocVMatrix.h. Referenced by build_(). |
|
the index of the expiration-date (related to the expiration_tag)
Definition at line 76 of file FinancePreprocVMatrix.h. Referenced by build_(), and getNewRow(). |
|
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(). |
|
add a column with '1' when the rollover occur (new expiration date)
Definition at line 62 of file FinancePreprocVMatrix.h. Referenced by getNewRow(). |
|
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(). |
|
the indexes (in the vmat) of all the volume columns
Definition at line 74 of file FinancePreprocVMatrix.h. Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy(). |
|
tradable = 1 if volume>min_volume_threshold
Definition at line 63 of file FinancePreprocVMatrix.h. Referenced by build_(), getNewRow(), makeDeepCopyFromShallowCopy(), and setVMFields(). |
|
the maximum value of moving_average_window
Definition at line 78 of file FinancePreprocVMatrix.h. Referenced by build_(), and getNewRow(). |
|
the position (date) of all rollover
Definition at line 79 of file FinancePreprocVMatrix.h. Referenced by getNewRow(). |
|
Definition at line 56 of file FinancePreprocVMatrix.h. Referenced by build_(), getNewRow(), and setVMFields(). |
|
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(). |
|
the window size of the moving average
Definition at line 65 of file FinancePreprocVMatrix.h. Referenced by build_(). |