ServerPortfolio  2.0
Python parsers and server
 All Classes Namespaces Files Functions Variables Properties Pages
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
serverportfolio.Parsers.YahooYQL.YahooYQL Class Reference

Use the Yahoo YQL API. More...

Inheritance diagram for serverportfolio.Parsers.YahooYQL.YahooYQL:
Inheritance graph
[legend]
Collaboration diagram for serverportfolio.Parsers.YahooYQL.YahooYQL:
Collaboration graph
[legend]

Public Member Functions

def __init__
 Constructor. More...
 
def create_url
 Create the URL from a sql query. More...
 
def create_url_test
 Only for testing, take a full sql query as input(hard-coded in main section) More...
 
def parse
 Parse YQL request, always XML format. More...
 
def parse_info
 Parse XML for info action To get Industry,Sector and Name, this function is called 2 times by run_parser_info()
. More...
 
def parse_fund
 Extract fundamental data from the XML root element. More...
 
def run_parser_info
 Specific call to get Info. 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
 
 option_post
 
- 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
 

Private Member Functions

def _fill_dict_from_xml
 Fill a dictionary template from the tags in the XML. More...
 
def _format_symbols_url
 

Static Private Attributes

string __YQL_PUBLIC_URL = 'https://query.yahooapis.com/v1/public/yql?q='
 

Detailed Description

Use the Yahoo YQL API.

Definition at line 49 of file YahooYQL.py.

Constructor & Destructor Documentation

def serverportfolio.Parsers.YahooYQL.YahooYQL.__init__ (   self,
  e_action 
)

Constructor.

Parameters
e_actionEAction to perform

Definition at line 56 of file YahooYQL.py.

Member Function Documentation

def serverportfolio.Parsers.YahooYQL.YahooYQL._fill_dict_from_xml (   self,
  stock_xml,
  dict_stock 
)
private

Fill a dictionary template from the tags in the XML.

All unknown entries are stored in an 'other' sub-dictionary.

Parameters
stock_xmllxml element as input
dict_stockdictionary to be filled as output

Definition at line 314 of file YahooYQL.py.

Referenced by serverportfolio.Parsers.YahooYQL.YahooYQL.parse_fund().

Here is the caller graph for this function:

def serverportfolio.Parsers.YahooYQL.YahooYQL._format_symbols_url (   self)
private
def serverportfolio.Parsers.YahooYQL.YahooYQL.create_url (   self)

Create the URL from a sql query.

table (quote/quotes/stocks/.. defined in the query) all YQL queries accept multi-stocks ? seems yes

Definition at line 68 of file YahooYQL.py.

References serverportfolio.Parsers.Abstract.AbstractParser.e_action, and serverportfolio.Parsers.Abstract.AbstractParser.local_stock.

def serverportfolio.Parsers.YahooYQL.YahooYQL.create_url_test (   self,
  sql_query 
)

Only for testing, take a full sql query as input(hard-coded in main section)

Parameters
sqlstring query

Definition at line 96 of file YahooYQL.py.

References serverportfolio.Parsers.YahooYQL.YahooYQL.__YQL_PUBLIC_URL, serverportfolio.Parsers.YahooYQL.clean_query(), and serverportfolio.Parsers.Abstract.AbstractParser.url.

Here is the call graph for this function:

def serverportfolio.Parsers.YahooYQL.YahooYQL.parse (   self,
  s 
)

Parse YQL request, always XML format.

Name of the fields are available in the XML output.

Parameters
spage retrived by web_query

Definition at line 113 of file YahooYQL.py.

References serverportfolio.Parsers.Abstract.AbstractParser.e_action, serverportfolio.Parsers.YahooYQL.YahooYQL.parse_fund(), serverportfolio.Parsers.YahooCSV.YahooCSV.parse_fund(), and serverportfolio.Parsers.Abstract.AbstractParser.url.

Here is the call graph for this function:

def serverportfolio.Parsers.YahooYQL.YahooYQL.parse_fund (   self,
  root 
)

Extract fundamental data from the XML root element.

Parameters
rootXML root element

Definition at line 192 of file YahooYQL.py.

References serverportfolio.Parsers.YahooYQL.YahooYQL._fill_dict_from_xml(), serverportfolio.Parsers.Abstract.AbstractParser.get_symbol_from_code(), and serverportfolio.Parsers.Abstract.AbstractParser.list_return_data.

Referenced by serverportfolio.Parsers.YahooYQL.YahooYQL.parse().

Here is the call graph for this function:

Here is the caller graph for this function:

def serverportfolio.Parsers.YahooYQL.YahooYQL.parse_info (   self,
  s 
)

Parse XML for info action To get Industry,Sector and Name, this function is called 2 times by run_parser_info()
.

Warning
not fully working, table for yahoo.finance.stocks deprecated !
Parameters
spage retrieved by web_query

Definition at line 140 of file YahooYQL.py.

References serverportfolio.Parsers.Abstract.AbstractParser.list_return_data.

def serverportfolio.Parsers.YahooYQL.YahooYQL.run_parser_info (   self,
  stock,
  option_post = None 
)

Specific call to get Info.

This version should be called at the place of run_parser only in the case of the EAction.Info with YahooYQL.
Two parsing are needed to fill the template.

Parameters
stocklist of stock symbol(s)

Definition at line 225 of file YahooYQL.py.

Member Data Documentation

string serverportfolio.Parsers.YahooYQL.YahooYQL.__YQL_PUBLIC_URL = 'https://query.yahooapis.com/v1/public/yql?q='
staticprivate
serverportfolio.Parsers.YahooYQL.YahooYQL.e_action
serverportfolio.Parsers.YahooYQL.YahooYQL.list_return_data

Definition at line 146 of file YahooYQL.py.

serverportfolio.Parsers.YahooYQL.YahooYQL.logger
serverportfolio.Parsers.YahooYQL.YahooYQL.option_post

Definition at line 229 of file YahooYQL.py.

serverportfolio.Parsers.YahooYQL.YahooYQL.source
serverportfolio.Parsers.YahooYQL.YahooYQL.url

The documentation for this class was generated from the following file: