ROOT_Application
2.0
C++ Core modules and GUIStock
|
Source file for the library wrapPyStock.so imported by the python modules to access Stock functions. More...
#include <python2.7/Python.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <vector>
#include "Stock.h"
#include "ListDataStock.h"
Go to the source code of this file.
Macros | |
#define | Python_for_stock |
Functions | |
int | helloworld (int x) |
long int | wrapLastCSVUpdate (const char *symbol, bool btest) |
Get last date available from file. More... | |
static PyObject * | wrap_LastCSVUpdate (PyObject *, PyObject *args) |
Get last date available from file (only DAY at this stage). More... | |
int | wrapUpdateCSV (const char *symbol, std::vector< DataCSV > &new_csv, std::vector< SimpleData > &new_vol, bool btest) |
Uses to add data from yahoo (DAY) for StockCSV and Volume. More... | |
static PyObject * | wrap_hello (PyObject *, PyObject *args) |
static PyObject * | wrap_UpdateCSV (PyObject *, PyObject *args) |
Python wrapper to Stock::wrapUpdateCSV(). More... | |
static PyObject * | wrap_SaveInst (PyObject *, PyObject *args) |
Save instantaneous data into file. More... | |
PyMODINIT_FUNC | initwrapPyStock (void) |
Variables | |
static PyObject * | WrapError |
static PyMethodDef | WrapMethods [] |
Source file for the library wrapPyStock.so imported by the python modules to access Stock functions.
wrapper to functions:
Not a API to Stock.
Ideally Python should have equivalent python functions to be able to be used without this module.
Last Changed
Definition in file wrapPyStock.cpp.
#define Python_for_stock |
Definition at line 16 of file wrapPyStock.cpp.
int helloworld | ( | int | x | ) |
Definition at line 33 of file wrapPyStock.cpp.
Referenced by wrap_hello().
PyMODINIT_FUNC initwrapPyStock | ( | void | ) |
Definition at line 419 of file wrapPyStock.cpp.
References WrapError, and WrapMethods.
|
static |
Definition at line 190 of file wrapPyStock.cpp.
References helloworld().
|
static |
Get last date available from file (only DAY at this stage).
Called by python: wrapPyStock.LastCSVUpdate()
Call from python:
date_time = wrapPyStock.LastCSVUpdate( self.symbol, GlobalDicts.TEST_MODE )
symbol name, symbol of the stock
boolean true will read file from data_test directory, false from data
Definition at line 97 of file wrapPyStock.cpp.
References wrapLastCSVUpdate().
|
static |
Save instantaneous data into file.
The data are written in the format defined by C++, the header is also correctly updated.
Updated file : historical/SYMBOL.INST.csv
Call wrapSaveInst( symbol, [date,value], bool_test )
args | : symbol, data consists of [date,value], boolean tmp will uodate the file in data_test directory |
Definition at line 325 of file wrapPyStock.cpp.
References INST, Utils::PATH_DATA_TEST, SimpleData::SetData(), Utils::SetPathData(), and Stock::UpdateCSV_Inst().
|
static |
Python wrapper to Stock::wrapUpdateCSV().
wrap_UpdateCVS(symbol,list_data)
Call need symbol and a list of DataCVS
include volume in data, will be split in the function list_data format = [ [date,op,pl,mo,cl,vol],[date,op,..] ]
Definition at line 207 of file wrapPyStock.cpp.
References SimpleData::SetData(), DataCSV::SetData(), and wrapUpdateCSV().
long int wrapLastCSVUpdate | ( | const char * | symbol, |
bool | btest | ||
) |
Get last date available from file.
Here pure C++, called by wrap_LastCSVUpdate which translate python argument and return
Create a stock, call stock::LastCSVUpdate and delete it at the end
Now call static function, read only ETime::DAY, need to extend ?
symbol | name of the stock |
btest | boolean variable to read data in data_test/historical and write in data_test/historical_tmp |
Definition at line 56 of file wrapPyStock.cpp.
References DAY, Utils::get_fldate_default(), Utils::firstlast_dates::last, Utils::PATH_DATA_TEST, Stock::Read_HeaderCSV_static(), and Utils::SetPathData().
Referenced by wrap_LastCSVUpdate().
int wrapUpdateCSV | ( | const char * | symbol, |
std::vector< DataCSV > & | new_csv, | ||
std::vector< SimpleData > & | new_vol, | ||
bool | btest | ||
) |
Uses to add data from yahoo (DAY) for StockCSV and Volume.
From Yahoo we get historical data in DAY, want to save permanently.
Boursorama Inst data, python adds by itself / send to the server, could also call a function of Stock test version, write complete data in tmp subdirectory.
writing data with option, directly in /csv
check the order of the data and consistent with ListDataStock
symbol | of the stock, given by dictstocks.txt |
new_csv,new_vol | vector with new data |
test | if test in true, read data from data_test, writes output data_test/historical_tmp |
Definition at line 137 of file wrapPyStock.cpp.
References Stock::AddListDataToMap(), DAY, NO_CHRONO, ListDataStock< T, PolicyChronologic >::Order(), Utils::PATH_DATA_TEST, ListDataStock< T, PolicyChronologic >::PrintData(), Stock::PrintMapChrono(), Stock::SaveCSV(), ListDataStock< T, PolicyChronologic >::SetDates(), and Utils::SetPathData().
Referenced by wrap_UpdateCSV().
|
static |
Definition at line 401 of file wrapPyStock.cpp.
Referenced by initwrapPyStock().
|
static |
Definition at line 406 of file wrapPyStock.cpp.
Referenced by initwrapPyStock().