10 #ifndef STOCKMANAGER_H_
11 #define STOCKMANAGER_H_
24 #include "../utils/FullName.h"
25 #include "../utils/Utils.h"
47 typedef std::vector<Stock *>::iterator
it_stock;
48 typedef std::vector<Stock *>::const_iterator
cit_stock;
126 Stock*
Find(
const std::string & namestock)
const;
153 std::vector< int > param = std::vector<int>(),
Singleton class, stores all loaded stocks.
TCPServer * GetServer() const
"Clever" enumeration of the ListDataStock type : StockCSV, Volume, EMA, BOLL,...
bool GetStatus() const
Indicates if the singleton has been initialized or is still valide.
void SetServer(TCPServer *tcp)
StockManager()
Constructor and destructor private, called by getInstance.
Stock * Load(const std::string namestock, const ETime &tmscl, const Indicator &indic, std::vector< int > param=std::vector< int >(), Utils::firstlast_dates dates=Utils::get_fldate_default())
Load a specific ListDataStock.
Base Exception for Stock and StockManager, all src_cpp code.
void DeleteAllListDataFromTimeScale(const std::string &namestock, const ETime &tmscl)
Delete all listdata of a stock for a timescale.
static StockManager * getInstance(std::string new_path=".")
Get a singleton instance.
ListDataStockBase * GetListData(const std::string &fullname) const
Retrieve an instance of a ListDataStock.
SMSubject * GetSubject()
Get the subject instance.
void SetPath(std::string new_path)
set path during init, may be changed later also
void DeleteStock(const std::string namestock)
Delete a stock and all its content.
Main class to deal with one stock.
bool ActivateServer()
Activate the server, by default null in constructor.
static TCPServer * ftcp
owns a TCPServer, but inverse is true as well.
static bool status_sm
static boolean status
ETime
Enumeration for the different time representation, from instantaneous (INST) to year(YEAR) ...
static SMSubject * fsubject
owns a subject/observable for the observer pattern
it_stock GetItStock(const std::string &namestock)
Return iterator on the element.
StockManager & operator=(const StockManager &)
void SendDatadCSV(const std::string &message)
Extract info from the message coming from TCPServer, update the Lists and notify observers (GUIMainCo...
std::string GetPath() const
Use with RealTime to receive messages from python ServerPortfolio.
Stock * Find(const std::string &namestock) const
Retrieve an instance of a stock.
Exception to be used within stock_cpp.
std::vector< Stock * >::iterator it_stock
std::vector< Stock * >::const_iterator cit_stock
Abstract base class for the ListDataStock, for storing base pointers in vectors.
static void killInstance()
Delete the instance and allocated ressources.
static SUPPRESS_NOT_USED_WARN firstlast_dates get_fldate_default()
need to be static for using default argument in a function
static StockManager * fstockmanager
static instance
static std::string fpath
path of the data, set during singleton initialization
void DeleteAllListDataFromFrame(const std::string &frame_name)
Delete all data of a frame_name,i.e, CAC40_DAY just easy to use from GUI, just call DeleteAllListData...
general structure for dates in csv files
int AddStock(Stock *)
Add a stock to the stockmanager.
void PrintMap()
Print an user-friendly view of the StockManger content.
void DeleteListData(const std::string &fname)
Delete a specific ListDataStcok, just wrappers to Stock.
Derive from Subject class.
void InsertVec_Stock(Stock *)
Insert a vector.
std::vector< Stock * > vec_stock
vector of loaded Stock