ServerPortfolio
2.0
Python parsers and server
|
Specific parser for querying the Boursorama website, only for instantaneous data. More...
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | create_url |
Create the url with the code of the stock. More... | |
def | parse |
Parse the html page, specific to instantaneous values. More... | |
Public Member Functions inherited from serverportfolio.Parsers.Abstract.AbstractParser | |
def | __init__ |
Constructor. More... | |
def | create_url |
Store links to stocks to update, dictionary 'symbol' : Stock object. More... | |
def | parse |
Parse the text file (html, CSV,...) More... | |
def | run_parser |
Main function to call for running the parser. More... | |
def | clean |
Reset internal data members after a parsing. More... | |
def | store_stock_copy |
Make a local copy of the Stock objects (linked of the original in DictionaryStocks in fact) into a local dictionary. More... | |
def | update_stock |
Update the local stocks with the new retrieved data. More... | |
def | get_symbol_from_code |
Retrieve the symbol (or Stock) from the code_yahoo or code_bourso. More... | |
Public Attributes | |
logger | |
source | |
url | |
list_return_data | |
Public Attributes inherited from serverportfolio.Parsers.Abstract.AbstractParser | |
url | |
save url, useful for reporting errors and exceptions More... | |
e_action | |
enumeration (EAction) of the type of query to perform More... | |
option_post | |
local_stock | |
list_return_data | |
Static Public Attributes | |
dictionary | dict_record |
Make the correspondence between the html page and the template InstValue. More... | |
Private Member Functions | |
def | _extract_data |
Extract the instantaneous values from the main lxml etree table. More... | |
def | _extract_data_generic |
Generic version to parse values, extract the last text() from a td entry. More... | |
def | _extract_number |
General function to extract all numbers ( price, volume...) More... | |
def | _extract_data_value |
Specific to extract the value and the state of the stock (OPEN/CLOSED). More... | |
def | _extract_data_dernier |
Specific to get the date and time of the dernier echange. More... | |
Static Private Attributes | |
string | __INSTVALUE_STOCK_URL = "http://www.boursorama.com/cours.phtml?symbole=" |
url format for boursorama, to complete with code_bourso More... | |
Specific parser for querying the Boursorama website, only for instantaneous data.
Parse HTML Page of Boursorama: last value, volume, highest, lowest of the day, OPEN or CLOSED state...
Definition at line 29 of file Parser_Bourso.py.
def serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.__init__ | ( | self, | |
action | |||
) |
Constructor.
e_action | EAction to perform, only InstValue with Boursorama |
Definition at line 48 of file Parser_Bourso.py.
|
private |
Extract the instantaneous values from the main lxml etree table.
name | of the data to extract, defined in self.dict_record |
table | etree table containing all data |
dict_inst_value | template to fill |
Definition at line 131 of file Parser_Bourso.py.
References serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_dernier(), serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_generic(), serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_value(), and serverportfolio.Parsers.Abstract.AbstractParser.local_stock.
|
private |
Specific to get the date and time of the dernier echange.
table | of instantaneous values extracted by xpath |
Definition at line 247 of file Parser_Bourso.py.
References serverportfolio.Parsers.Abstract.AbstractParser.url.
Referenced by serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data().
|
private |
Generic version to parse values, extract the last text() from a td entry.
Volume not present with devise, throw an exception and fill with default 0, nan (??)
name | of the td entry to extract |
table | of instantaneous values extracted by xpath |
Definition at line 178 of file Parser_Bourso.py.
References serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_number(), and serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.dict_record.
Referenced by serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data().
|
private |
Specific to extract the value and the state of the stock (OPEN/CLOSED).
table | of instantaneous values extracted by xpath |
Definition at line 222 of file Parser_Bourso.py.
References serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_number().
Referenced by serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data().
|
private |
General function to extract all numbers ( price, volume...)
line | string in input |
Definition at line 211 of file Parser_Bourso.py.
Referenced by serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_generic(), and serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_value().
def serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.create_url | ( | self | ) |
Create the url with the code of the stock.
Assert that only one Stock is provided in input (Parser dependent)
Definition at line 56 of file Parser_Bourso.py.
References serverportfolio.Parsers.Abstract.AbstractParser.local_stock.
def serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.parse | ( | self, | |
html_page | |||
) |
Parse the html page, specific to instantaneous values.
Extract data from the complete html page to self.list_return_data (list not created, only one stock)
html_page | the html page returned by UtilsParsers.web_query |
Definition at line 77 of file Parser_Bourso.py.
|
staticprivate |
url format for boursorama, to complete with code_bourso
Definition at line 44 of file Parser_Bourso.py.
|
static |
Make the correspondence between the html page and the template InstValue.
0/1, could use for a exact matching or contains function
Definition at line 33 of file Parser_Bourso.py.
Referenced by serverportfolio.Parsers.Parser_Bourso.Parser_Bourso._extract_data_generic().
serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.list_return_data |
Definition at line 82 of file Parser_Bourso.py.
serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.logger |
Definition at line 50 of file Parser_Bourso.py.
Referenced by serverportfolio.Validation.ValidationTkHP.__init__(), and serverportfolio.SocketServer_Server.MyHandler_Parser.handle().
serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.source |
Definition at line 52 of file Parser_Bourso.py.
Referenced by serverportfolio.Parsers.Abstract.AbstractParser.update_stock().
serverportfolio.Parsers.Parser_Bourso.Parser_Bourso.url |
Definition at line 67 of file Parser_Bourso.py.
Referenced by serverportfolio.PortfolioException.ParserError.get_format_string(), and serverportfolio.PortfolioException.QueryError.get_format_string().