ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
ListDataStock_Utils Namespace Reference

utilities functions for ListDataStock templates More...

Functions

template<template< class > class Policy1, template< class > class Policy2, template< class > class Policy3, template< class > class Policy4>
int TransformTimeScale (const ETime new_tmscl, const ListDataStock< DataCSV, Policy1 > &list_csv_in, const ListDataStock< SimpleData, Policy2 > &list_vol_in, ListDataStock< DataCSV, Policy3 > &list_csv_out, ListDataStock< SimpleData, Policy4 > &list_vol_out)
 Transform StockCSV and Volume from M5 into a StockCSV with larger TimeScale, typical DAY to WEEK, DAY to MONTH. More...
 
template<template< class > class Policy1, template< class > class Policy2, template< class > class Policy3, template< class > class Policy4>
int TransformTimeScale (const ETime new_tmscl, const ListDataStock< SimpleData, Policy1 > &list_csv_in, const ListDataStock< SimpleData, Policy2 > &list_vol_in, ListDataStock< DataCSV, Policy3 > &list_csv_out, ListDataStock< SimpleData, Policy4 > &list_vol_out)
 Transform instantaneous data (StockInst) to StockCSV with TimeScale M5, M10 or H1. More...
 

Detailed Description

utilities functions for ListDataStock templates

Function Documentation

template<template< class > class Policy1, template< class > class Policy2, template< class > class Policy3, template< class > class Policy4>
int ListDataStock_Utils::TransformTimeScale ( const ETime  new_tmscl,
const ListDataStock< DataCSV, Policy1 > &  list_csv_in,
const ListDataStock< SimpleData, Policy2 > &  list_vol_in,
ListDataStock< DataCSV, Policy3 > &  list_csv_out,
ListDataStock< SimpleData, Policy4 > &  list_vol_out 
)

Transform StockCSV and Volume from M5 into a StockCSV with larger TimeScale, typical DAY to WEEK, DAY to MONTH.

Return a list of DataCSV for values in candlesticks and a list of SimpleData for the volume
Because volume is always loaded with the values, it is transformed at the same time by default
Other indicators must be recomputed
Types of the data is enforced, but they can have any chronological policy

Precondition
Size of the input lists must be equal, error return 1
TimeScale of the input must be identical, error return 1
Postcondition
Size of the output lists are equal, capacity is reduced by an use of Swap
TimeScale and Indicator of the output files are overwritten if incorrect in input (with warning)
Dates as data members of the base class of the output are updated
Note
It is possible to transform from any TimeScale (new_tmscl >= ETime::M5) to an other (see unit-test),
but the library uses only DAY to more.
In using WEEK intermediates, the results cannot be reproduced (do not account when month changes).
If WEEK is used, a warning is printed on the console but the processing continues.
Parameters
new_tmsclnew TimeScale to transform to, must be >= ETime::WEEK
list_csv_ininput list of type DataCSV
list_vol_ininput list for volume of type SimpleData
list_csv_outoutput list with candlesticks
list_vol_outoutput list with volume
Returns
0 if process is complete, 1 if problem (wrong TimeScale, wrong size in entry)

Definition at line 535 of file ListDataStock_timpl.h.

References ListDataStock< T, PolicyChronologic >::AddData(), DataCSV::AdditionData(), DataStock::GetDate(), DataStock::GetDateTm(), ListDataStockBase::GetName(), DataCSV::GetOpen(), ListDataStock< T, PolicyChronologic >::GetSize(), ListDataStockBase::GetTimeScale(), SimpleData::GetValue(), H1, M10, M30, M5, ShortName::MakeShortName(), MONTH, NO_CHRONO, ListDataStock< T, PolicyChronologic >::NoChronologicAt(), not_a_time, ListDataStock< T, PolicyChronologic >::Order(), ListDataStock< T, PolicyChronologic >::Reserve(), ListDataStock< T, PolicyChronologic >::SetDates(), ListDataStockBase::SetName(), ListDataStockBase::SetTimeScale(), Indicator::StockCSV, ListDataStock< T, PolicyChronologic >::Swap(), TRIM, Indicator::Volume, WEEK, and YEAR.

Referenced by Stock::Transform_TimeScale().

Here is the call graph for this function:

Here is the caller graph for this function:

template<template< class > class Policy1, template< class > class Policy2, template< class > class Policy3, template< class > class Policy4>
int ListDataStock_Utils::TransformTimeScale ( const ETime  new_tmscl,
const ListDataStock< SimpleData, Policy1 > &  list_csv_in,
const ListDataStock< SimpleData, Policy2 > &  list_vol_in,
ListDataStock< DataCSV, Policy3 > &  list_csv_out,
ListDataStock< SimpleData, Policy4 > &  list_vol_out 
)

Transform instantaneous data (StockInst) to StockCSV with TimeScale M5, M10 or H1.

Return always lists of DataCSV for the data, SimpleData for the volume
Identical than previous, except the first input list is of type SimpleData (Indicator::Inst)

Precondition
Size and TimeScale of the input lists must be equal, error return 1
new_tmscl TimeScale must be inferior to ETime::DAY, error return 1
Postcondition
Size of the output lists are equal, but capacity is not reduced in this case, may add more data
TimeScale and Indicator of the output files are overwritten if incorrect in input (with warning)
Dates as data members of the base class of the output are updated
Parameters
new_tmsclTimeScale to transform to, e.g., ETime::M30
list_csv_ininput list of type SimpleData
list_vol_ininput list for volume of type SimpleData
list_csv_outoutput list with the candlesticks
list_vol_outoutput list with volume
Returns
0 if process is complete, 1 if problem

Definition at line 845 of file ListDataStock_timpl.h.

References ListDataStock< T, PolicyChronologic >::AddData(), DAY, DataStock::GetDate(), DataStock::GetDateTm(), ListDataStockBase::GetName(), ListDataStock< T, PolicyChronologic >::GetSize(), ListDataStockBase::GetTimeScale(), SimpleData::GetValue(), H1, INST, M10, M30, M5, ShortName::MakeShortName(), NO_CHRONO, ListDataStock< T, PolicyChronologic >::NoChronologicAt(), not_a_time, ListDataStock< T, PolicyChronologic >::Order(), ListDataStock< T, PolicyChronologic >::Reserve(), ListDataStock< T, PolicyChronologic >::SetDates(), ListDataStockBase::SetName(), ListDataStockBase::SetTimeScale(), Indicator::StockCSV, and Indicator::Volume.

Here is the call graph for this function: