ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Function using Python/C++ interface

Group all functions and methods using the Python C++ API. More...

Update the List(s)

int Stock::UpdateCSVFromWeb (const std::string &source, Utils::firstlast_dates opt_dates=Utils::get_fldate_default()) throw (StockException)
 Update data from the Python parser (and save into the filesystem). More...
 

Python embedded functions, access ServerPortfolio classes and methods

int Stock::LoadDictionary (std::string dict="")
 Load the dictionary of Stock, see ServerPortfolio. More...
 
int Stock::TestwrapPython (std::string source)
 
int Stock::TestwrapPython2 (std::string source)
 

Detailed Description

Group all functions and methods using the Python C++ API.

Can add more infos in details

Function Documentation

int Stock::LoadDictionary ( std::string  dict = "")

Load the dictionary of Stock, see ServerPortfolio.

int Stock::UpdateStocks() { std::cout << "Entry Parser UpdateStocks in StockwrapParser.cpp" << std::endl; Py_Initialize(); PyRun_SimpleString("from ParserStocks import ParserStocks\n" "import DictStocks_Parser\n" "parserstocks = ParserStocks( 'CAC40', 'Yahoo_CSV' )\n" "parserstocks.myparser._SetCodeYahoo('^FCHI')\n" "dict_stocks=DictStocks_Parser.Init()\n" "retour = parserstocks.UpdateCSV()\n"); Py_Finalize(); std::cout << "Exit Parser UpdateStocks" << std::endl; return 0; }

Load module DictionaryStocks and call its constructor
To call after PyInitialze() ( to check, seems logic ) name of the txt file, now use default only

Parameters
dictname of the dictionary
Returns
status, 0 for ok, -1 for error

Definition at line 51 of file StockwrapPyParser.cpp.

int Stock::TestwrapPython ( std::string  source)

Definition at line 468 of file StockwrapPyParser.cpp.

int Stock::TestwrapPython2 ( std::string  source)

Definition at line 524 of file StockwrapPyParser.cpp.

int Stock::UpdateCSVFromWeb ( const std::string &  source,
Utils::firstlast_dates  opt_dates = Utils::get_fldate_default() 
)
throw (StockException
)

Update data from the Python parser (and save into the filesystem).

Note
Only Yahoo is implemented now, apply to daily data. To extend to Bourso.

Normal use case : Get missing daily data, call Yahoo and then save to file.

Precondition
If the List is already loaded in Stock, the last data must be => Header.last (else return -1)
Postcondition
Should not loose any data in loading new data and saving to file.
Parameters
sourcewhich website to use "Yahoo" (or "Boursorama" other function can combine later?)
opt_datesoptional, limit the range of the data to retrieve, default [last data(header or memory)+1, today]
Returns
number of new data added to the list, 0 means nothing new , -1 CANNOT_UPDATE
Exceptions
StockPythonExceptionin case of problem in loading modules

Definition at line 114 of file StockwrapPyParser.cpp.

References DAY, Utils::firstlast_dates::first, Utils::get_fldate_default(), GetListDataFromPyList(), ListDataStock< T, PolicyChronologic >::GetSize(), Utils::firstlast_dates::last, NO_CHRONO, ListDataStock< T, PolicyChronologic >::Order(), ListDataStock< T, PolicyChronologic >::SetDates(), Indicator::StockCSV, and Utils::Time_tToString().

Referenced by Stock::UpdateAllTimeScale(), and TransDateBox::Valid().

Here is the call graph for this function:

Here is the caller graph for this function: