ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Static Public Member Functions | Protected Member Functions | Private Attributes
TAlibAPI Class Reference

Wrapper/Adapter to the library ta-lib. More...

#include <TAlibAPI.h>

Collaboration diagram for TAlibAPI:
Collaboration graph
[legend]

Data Structures

class  TAResource
 

Public Member Functions

Constructor, destructor
 TAlibAPI ()
 Default constructor. More...
 
virtual ~TAlibAPI ()
 Destructor. More...
 
Number of shared_ptr managing TAResource, mainly for unit-tests
long UseCount ()
 Wrapper to shared_ptr::use_count() return number of shared_ptr associated to private data member res_ptr. More...
 
TAResourceShrpGet ()
 return the pointer to TAResource. More...
 
Public interface for running the computation of an indicator with ta-lib
bool Compute (const ETime tmscl, const Indicator new_indic, const std::vector< int > &vec_param, const std::vector< ListDataStockBase * > &vec_ldata_in, ListDataStockBase *ldata_out) const throw (TALibException)
 Compute an indicator. More...
 

Static Public Member Functions

static void GetListFunctions ()
 

Protected Member Functions

int ComputeMA (float **arraydata_c_in, unsigned int size_input, std::string str_label, int param, double **arraydata_c_out, int &offset_begin, int &out_nb_data) const
 Compute Moving Averges : SMA, EMA, WMA. More...
 
int ComputeMACD (float **arraydata_c_in, unsigned int size_input, std::string str_label, std::vector< int > params, double **arraydata_c_out, unsigned int nb_array_out, int &offset_begin, int &out_nb_data) const
 Compute others indicators : MACD, AD, RSI, STOCHF. More...
 

Private Attributes

std::shared_ptr< TAResourceres_ptr
 Shared pointer to the unique TAResource. More...
 

Detailed Description

Wrapper/Adapter to the library ta-lib.

The class is owned by a Stock, through Stock::p_talib.
Responsible of the library initialization with a lazy initialization
ListDataStock must be transformed into C array before calling the library, order of data is also important

Definition at line 74 of file TAlibAPI.h.

Constructor & Destructor Documentation

TAlibAPI::TAlibAPI ( )

Default constructor.

Definition at line 18 of file TAlibAPI.cpp.

TAlibAPI::~TAlibAPI ( )
virtual

Destructor.

Definition at line 31 of file TAlibAPI.cpp.

Member Function Documentation

bool TAlibAPI::Compute ( const ETime  tmscl,
const Indicator  new_indic,
const std::vector< int > &  vec_param,
const std::vector< ListDataStockBase * > &  vec_ldata_in,
ListDataStockBase ldata_out 
) const
throw (TALibException
)

Compute an indicator.

Parameters
new_indicIndicator to compute
vec_paramparameter(s) for the indicator
vec_ldata_invector containing the ListDataStock used as input
ldata_outListDataStock as output
Returns
status
Exceptions
(TALibException)

Definition at line 138 of file TAlibAPI.cpp.

References Indicator::AD, TimeScale::as_uint(), Indicator::BOLL, CHRONO, EDS::CLOSE, ListDataStockBase::GetCArray(), ListDataStockBase::GetSize(), EDS::HIGH, INST, EDS::LOW, Indicator::MACD, Indicator::RSI, and Indicator::STOCHF.

Here is the call graph for this function:

int TAlibAPI::ComputeMA ( float **  arraydata_c_in,
unsigned int  size_input,
std::string  str_label,
int  param,
double **  arraydata_c_out,
int &  offset_begin,
int &  out_nb_data 
) const
protected

Compute Moving Averges : SMA, EMA, WMA.

Parameters
arraydata_c_ininput array for the computation [nb_indicator][size_input]
size_inputnumber of data in input
str_labellabel of the indicator: SMA, EMA, WMA
paramthe parameter for computing the moving average
arraydata_c_outresults stored in this array, filled with out_nb_data
offset_beginwhat is the shift with the input data
out_nb_datanumber of data in output, <= size_input
Returns
status 0 ok, 1 error

Definition at line 373 of file TAlibAPI.cpp.

int TAlibAPI::ComputeMACD ( float **  arraydata_c_in,
unsigned int  size_input,
std::string  str_label,
std::vector< int >  params,
double **  arraydata_c_out,
unsigned int  nb_array_out,
int &  offset_begin,
int &  out_nb_data 
) const
protected

Compute others indicators : MACD, AD, RSI, STOCHF.

Parameters
arraydata_c_inC-array of input data [nb_indic,size_input]
size_inputnumber of data in input
str_labellabel of the indicator: MACD, RSI,...
paramsinput parameters for computing the indicators, between 1 and 4
arraydata_c_outC-array of output data
nb_array_outnumber of output arrays
offset_beginwhat is the shift with the input data
out_nb_datanumber of data in output, <= size_input
Returns
status 0 ok, 1 error

Definition at line 426 of file TAlibAPI.cpp.

void TAlibAPI::GetListFunctions ( )
static

Definition at line 521 of file TAlibAPI.cpp.

TAResource* TAlibAPI::ShrpGet ( )
inline

return the pointer to TAResource.

Returns
shared_ptr associated TAResource

Definition at line 156 of file TAlibAPI.h.

References res_ptr.

long TAlibAPI::UseCount ( )
inline

Wrapper to shared_ptr::use_count() return number of shared_ptr associated to private data member res_ptr.

Definition at line 152 of file TAlibAPI.h.

References res_ptr.

Field Documentation

std::shared_ptr<TAResource> TAlibAPI::res_ptr
private

Shared pointer to the unique TAResource.

Definition at line 181 of file TAlibAPI.h.

Referenced by ShrpGet(), and UseCount().


The documentation for this class was generated from the following files: