13 #include "../utils/FullName.h"
14 #include "../utils/Utils.h"
61 typedef std::map<ETime, std::vector<ListDataStockBase *> >::iterator
it_map;
62 typedef std::map<ETime, std::vector<ListDataStockBase *> >::const_iterator
cit_map;
63 typedef std::vector<ListDataStockBase *>::iterator
it_listdata;
64 typedef std::vector<ListDataStockBase *>::const_iterator
cit_listdata;
102 const std::vector<int>& param = std::vector<int>() )
const ;
106 const std::vector<int>& param = std::vector<int>() );
182 int ComputeTA(
const ETime& tmscl,
const std::string& name_indic )
201 Stock(
const std::string iname,
const std::string isymbol,
const std::string ipath);
221 bool CheckLoaded(
const ETime& tmscl,
const Indicator& indic,
const std::vector<int>& param = std::vector<int>() )
const;
336 void WriteCSV(const
ETime tmscl,
bool opt_tmp= false ) const throw ( StockException );
348 int SaveCSV ( const
ETime tmscl,
bool opt_tmp =false ) const;
361 int Read_HeaderCSV(
ETime tmscl, Utils::firstlast_dates& dates ) const throw ( StockFileError );
378 throw ( StockFileError );
396 ETime tmscl,
bool opt_tmp = false ) throw ( StockFileError );
484 bool b_readfile = true );
530 int UpdateCSVFromWeb( const std::
string& source, Utils::firstlast_dates opt_dates = Utils::get_fldate_default() )
531 throw(StockException);
int SaveCSV(const ETime tmscl, bool opt_tmp=false) const
Save Historical data to file.
Specific, inherit from FileError from utils.
"Clever" enumeration of the ListDataStock type : StockCSV, Volume, EMA, BOLL,...
int UpdateCSVFromFile(const ETime tmscl)
Load the last historical data from the filesystem into a List in memory.
int UpdateCSVFromWeb(const std::string &source, Utils::firstlast_dates opt_dates=Utils::get_fldate_default())
Update data from the Python parser (and save into the filesystem).
void SetLDataFullName(ListDataStockBase *p_listdata) const
Function to complete the fullname of a listdatastock.
std::map< ETime, std::vector< ListDataStockBase * > >::iterator it_map
static int ReadLineHeader(const std::string &line, Utils::firstlast_dates &dates)
Extract dates from the header of the historic data files.
int LoadDictionary(std::string dict="")
Load the dictionary of Stock, see ServerPortfolio.
std::vector< ListDataStockBase * >::iterator it_listdata
const std::string path
File path for the data directory.
Base Exception for Stock and StockManager, all src_cpp code.
std::map< ETime, std::vector< ListDataStockBase * > >::const_iterator cit_map
bool IsEmpty() const
Test if some ListData are still present, whatever the timescale.
void UpdateAllTimeScale(const ETime tmscl, Utils::firstlast_dates opt_dates=Utils::get_fldate_default(), bool b_readfile=true)
Update all indicators of the given TimeScale.
Main class to deal with one stock.
int AddListDataToMap(const ETime &tmscl, ListDataStockBase *p_listdata)
Insert a ListDataStock to the map.
Wrapper/Adapter to the library ta-lib.
std::vector< ListDataStockBase * >::const_iterator cit_listdata
void DeleteListData(const ETime &tmscl, const Indicator &indic, std::vector< int > param=std::vector< int >())
Delete a list given the TimeScale, Indicator and param.
static void WriteLineHeader(const ETime &tmscl, const Utils::firstlast_dates &dates, std::ostringstream &ss_header)
Write the header in a stream.
ETime
Enumeration for the different time representation, from instantaneous (INST) to year(YEAR) ...
int Transform_TimeScale(const ETime &new_tmscl)
Transform history values dcsv or DAY to M5,M10..H1 or WEEK, MONTH..YEAR.
ListDataStockBase * GetListData(const ETime &tmscl, const Indicator &indic, const std::vector< int > param=std::vector< int >()) const
Get the ListDataStock from a TimeScale, Indicator and vector of parameters.
void LoadCSVData(const ETime &tmscl, Utils::firstlast_dates &dates)
Get Indicator::StockCSV or StockdCSV with the correct TimeScale Call functions to read and load data ...
std::string GetSymbol() const
void WriteCSV(const ETime tmscl, bool opt_tmp=false) const
Write historical data into files.
bool CheckLoaded(const ETime &tmscl) const
Stock()
Default constructor.
void MergeStock(const Stock *new_stock, bool)
Merge entries with an other stock.
unsigned int ReadCSV(const ETime tmscl, Utils::firstlast_dates dates=Utils::get_fldate_default())
Read DAY or INST file depending on the TimeScale.
std::string GetPathData()
int ComputeTA(const ETime &tmscl, const std::string &name_indic)
Compute an indicator using the TAlib library.
Exception to be used within stock_cpp.
static Indicator const StockCSV
std::string GetPath() const
Abstract base class for the ListDataStock, for storing base pointers in vectors.
void Updated(const ETime tmscl)
Return the last available date of historical data.
void DeleteAllListData(const ETime &tmscl)
Delete all data of the given TimeScale.
int TestwrapPython(std::string source)
TAlibAPI * p_talib
pointer to TA-lib API object, use a lazy initialization of the library
void PrintMapChrono(const unsigned int verbose=0) const
Print map content to the console.
Base class for exception coming from talibapi interface.
static SUPPRESS_NOT_USED_WARN firstlast_dates get_fldate_default()
need to be static for using default argument in a function
std::map< ETime, std::vector< ListDataStockBase * > > mapTime_ListData
map TimeScale : vector of ListDataStockBase pointers
static int Read_HeaderCSV_static(std::string namestock, ETime tmscl, Utils::firstlast_dates &dates)
Static version of Read_HeaderCSV.
int LoadListData(const ETime &tmscl, const Indicator &indic=Indicator::StockCSV, const std::vector< int > ¶m=std::vector< int >(), Utils::firstlast_dates dates=Utils::get_fldate_default())
Load or/and compute an indicator in the Stock.
cit_listdata GetItList(cit_map &it_m, const Indicator &indic, const std::vector< int > ¶m=std::vector< int >()) const
int Read_HeaderCSV(ETime tmscl, Utils::firstlast_dates &dates) const
Read the dates from the header file.
static int UpdateCSV_Inst(std::string namestock, DataStock &inst_value, DataStock &inst_volume, ETime tmscl, bool opt_tmp=false)
Update file with TimeScale INST.
int TestwrapPython2(std::string source)
general structure for dates in csv files
std::string symbol
symbol refers to the code, i.e., CAC40
std::string GetName() const
Abstract base class for all Data to be stored in ListDataStock.
std::string name
Name of the stock.