ROOT_Application
2.0
C++ Core modules and GUIStock
|
Wrapper/Adapter to the library ta-lib. More...
#include <TAlibAPI.h>
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... | |
TAResource * | ShrpGet () |
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< TAResource > | res_ptr |
Shared pointer to the unique TAResource. More... | |
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.
TAlibAPI::TAlibAPI | ( | ) |
Default constructor.
Definition at line 18 of file TAlibAPI.cpp.
|
virtual |
Destructor.
Definition at line 31 of file TAlibAPI.cpp.
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.
new_indic | Indicator to compute |
vec_param | parameter(s) for the indicator |
vec_ldata_in | vector containing the ListDataStock used as input |
ldata_out | ListDataStock as output |
(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.
|
protected |
Compute Moving Averges : SMA, EMA, WMA.
arraydata_c_in | input array for the computation [nb_indicator][size_input] |
size_input | number of data in input |
str_label | label of the indicator: SMA, EMA, WMA |
param | the parameter for computing the moving average |
arraydata_c_out | results stored in this array, filled with out_nb_data |
offset_begin | what is the shift with the input data |
out_nb_data | number of data in output, <= size_input |
Definition at line 373 of file TAlibAPI.cpp.
|
protected |
Compute others indicators : MACD, AD, RSI, STOCHF.
arraydata_c_in | C-array of input data [nb_indic,size_input] |
size_input | number of data in input |
str_label | label of the indicator: MACD, RSI,... |
params | input parameters for computing the indicators, between 1 and 4 |
arraydata_c_out | C-array of output data |
nb_array_out | number of output arrays |
offset_begin | what is the shift with the input data |
out_nb_data | number of data in output, <= size_input |
Definition at line 426 of file TAlibAPI.cpp.
|
static |
Definition at line 521 of file TAlibAPI.cpp.
|
inline |
return the pointer to TAResource.
Definition at line 156 of file TAlibAPI.h.
References res_ptr.
|
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.
|
private |
Shared pointer to the unique TAResource.
Definition at line 181 of file TAlibAPI.h.
Referenced by ShrpGet(), and UseCount().