ServerPortfolio
2.0
Python parsers and server
|
Derived parser class for retrieving divers data from the 'old' Yahoo API. More...
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | create_url |
Create the url according to the action and the stock(s). More... | |
def | parse |
Parser implementation for YahooCSV, action dependent. More... | |
def | parse_hp |
Specific parsing function to read a list of CSV, only daily values. More... | |
def | parse_div |
Specific parsing function for dividends/split. More... | |
def | parse_fund |
Parse fundamental data with old API, CSV data. More... | |
def | parse_dates_intro |
To get introduction date of a stock, (first available on Yahoo) and last available. 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 | |
e_action | |
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 | |
tuple | symbol = self.local_stock.keys() |
list | lastdate = self.local_stock[symbol] |
list | firstdate = self.local_stock[symbol] |
tuple | today = datetime.date.today() |
Static Private Attributes | |
string | __HISTORY_QUOTES_URL = "http://ichart.yahoo.com/table.csv?" |
string | __HISTORY_QUOTES_X_URL = "http://ichart.finance.yahoo.com/x?" |
string | __HISTORY_DATES_URL = "http://fr.finance.yahoo.com/q/hp?" |
string | __QUOTES_CSV_URL = "http://download.finance.yahoo.com/d/quotes.csv?" |
Derived parser class for retrieving divers data from the 'old' Yahoo API.
Implement actions:
Definition at line 38 of file YahooCSV.py.
def serverportfolio.Parsers.YahooCSV.YahooCSV.__init__ | ( | self, | |
e_action | |||
) |
Constructor.
action | enumeration of the EAction to perform |
Definition at line 69 of file YahooCSV.py.
def serverportfolio.Parsers.YahooCSV.YahooCSV.create_url | ( | self | ) |
Create the url according to the action and the stock(s).
Fundamental accepts multiple stocks.
Definition at line 82 of file YahooCSV.py.
References serverportfolio.Parsers.Abstract.AbstractParser.local_stock.
def serverportfolio.Parsers.YahooCSV.YahooCSV.parse | ( | self, | |
s | |||
) |
Parser implementation for YahooCSV, action dependent.
s | page return by web_query |
Definition at line 172 of file YahooCSV.py.
References serverportfolio.Parsers.Abstract.AbstractParser.e_action, serverportfolio.Parsers.Abstract.AbstractParser.list_return_data, serverportfolio.Parsers.YahooCSV.YahooCSV.parse_dates_intro(), serverportfolio.Parsers.YahooCSV.YahooCSV.parse_div(), serverportfolio.Parsers.YahooCSV.YahooCSV.parse_fund(), serverportfolio.Parsers.YahooCSV.YahooCSV.parse_hp(), and serverportfolio.Parsers.Abstract.AbstractParser.url.
def serverportfolio.Parsers.YahooCSV.YahooCSV.parse_dates_intro | ( | self, | |
html_page | |||
) |
To get introduction date of a stock, (first available on Yahoo) and last available.
need to make more test
html_page | returned by web_query |
Definition at line 406 of file YahooCSV.py.
References serverportfolio.Parsers.Abstract.AbstractParser.list_return_data.
Referenced by serverportfolio.Parsers.YahooCSV.YahooCSV.parse().
def serverportfolio.Parsers.YahooCSV.YahooCSV.parse_div | ( | self, | |
all_line | |||
) |
Specific parsing function for dividends/split.
Save data in dictionary template DivSplit.list_div, list_split
all_line | the page returned by web_query |
Definition at line 262 of file YahooCSV.py.
References serverportfolio.Parsers.Abstract.AbstractParser.list_return_data.
Referenced by serverportfolio.Parsers.YahooCSV.YahooCSV.parse().
def serverportfolio.Parsers.YahooCSV.YahooCSV.parse_fund | ( | self, | |
all_line | |||
) |
Parse fundamental data with old API, CSV data.
First implementation with fields specified in url, see Yahoo YQL for a better option.
Support call with multiple stocks, one line by stock
Name is also available for Info
List of data:
Definition at line 331 of file YahooCSV.py.
References serverportfolio.Parsers.Abstract.AbstractParser.get_symbol_from_code(), and serverportfolio.Parsers.Abstract.AbstractParser.list_return_data.
Referenced by serverportfolio.Parsers.YahooYQL.YahooYQL.parse(), and serverportfolio.Parsers.YahooCSV.YahooCSV.parse().
def serverportfolio.Parsers.YahooCSV.YahooCSV.parse_hp | ( | self, | |
all_line | |||
) |
Specific parsing function to read a list of CSV, only daily values.
To fit with design, must set a dict. Before never saved the listCSV only passed as argument keep a simple dictionary (first, last, error in data(to write), listCSV specific in self dictionary must be called dict_parser
all_line | the page returned by web_query |
Definition at line 211 of file YahooCSV.py.
Referenced by serverportfolio.Parsers.YahooCSV.YahooCSV.parse().
|
staticprivate |
Definition at line 62 of file YahooCSV.py.
|
staticprivate |
Definition at line 41 of file YahooCSV.py.
|
staticprivate |
Definition at line 53 of file YahooCSV.py.
|
staticprivate |
Definition at line 65 of file YahooCSV.py.
serverportfolio.Parsers.YahooCSV.YahooCSV.e_action |
Definition at line 90 of file YahooCSV.py.
Referenced by serverportfolio.UpdateStocks.UpdateStocks._set_parser(), serverportfolio.UpdateStocks.UpdateStocks._update_data(), and serverportfolio.UpdateStocks.UpdateStocks.get_string_data().
|
static |
Definition at line 133 of file YahooCSV.py.
|
static |
Definition at line 131 of file YahooCSV.py.
serverportfolio.Parsers.YahooCSV.YahooCSV.list_return_data |
Definition at line 247 of file YahooCSV.py.
serverportfolio.Parsers.YahooCSV.YahooCSV.logger |
Definition at line 74 of file YahooCSV.py.
Referenced by serverportfolio.Validation.ValidationTkHP.__init__(), and serverportfolio.SocketServer_Server.MyHandler_Parser.handle().
serverportfolio.Parsers.YahooCSV.YahooCSV.source |
Definition at line 77 of file YahooCSV.py.
Referenced by serverportfolio.Parsers.Abstract.AbstractParser.update_stock().
|
static |
Definition at line 127 of file YahooCSV.py.
Referenced by serverportfolio.Stock.Stock._add_instvalue_data(), serverportfolio.Stock.Stock._create_xml_action(), serverportfolio.Stock.Stock.last_CSV(), serverportfolio.Stock.Stock.print_stock(), serverportfolio.Stock.InvalidStock.print_stock(), serverportfolio.Stock.Stock.read_xml(), serverportfolio.Stock.Stock.save_hist_price(), serverportfolio.Stock.Stock.save_inst_value(), and serverportfolio.Stock.Stock.write_xml().
|
static |
Definition at line 140 of file YahooCSV.py.
serverportfolio.Parsers.YahooCSV.YahooCSV.url |
Definition at line 117 of file YahooCSV.py.
Referenced by serverportfolio.PortfolioException.ParserError.get_format_string(), and serverportfolio.PortfolioException.QueryError.get_format_string().