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

Derived parser class for retrieving divers data from the 'old' Yahoo API. More...

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

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?"
 

Detailed Description

Derived parser class for retrieving divers data from the 'old' Yahoo API.

Implement actions:

Definition at line 38 of file YahooCSV.py.

Constructor & Destructor Documentation

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

Constructor.

Parameters
actionenumeration of the EAction to perform

Definition at line 69 of file YahooCSV.py.

Member Function Documentation

def serverportfolio.Parsers.YahooCSV.YahooCSV.create_url (   self)

Create the url according to the action and the stock(s).

Fundamental accepts multiple stocks.

Todo:
Check day, with HistPrice before use day+1 but very dangerous, now C++ should deal with overlap

Definition at line 82 of file YahooCSV.py.

References serverportfolio.Parsers.Abstract.AbstractParser.local_stock.

def serverportfolio.Parsers.YahooCSV.YahooCSV.parse (   self,
  s 
)
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

Parameters
html_pagereturned 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().

Here is the caller graph for this function:

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

Parameters
all_linethe 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().

Here is the caller graph for this function:

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:

  • symbol(s),name(n),Ask,MarketCapitalization(j1),SharesOwned(s1),DividendYield(d0), BVPS(b4),PriceBook(p6),PER(r0),PEG(r5), new added e1 for error in code

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
all_linethe page returned by web_query

Definition at line 211 of file YahooCSV.py.

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

Here is the caller graph for this function:

Member Data Documentation

string serverportfolio.Parsers.YahooCSV.YahooCSV.__HISTORY_DATES_URL = "http://fr.finance.yahoo.com/q/hp?"
staticprivate

Definition at line 62 of file YahooCSV.py.

string serverportfolio.Parsers.YahooCSV.YahooCSV.__HISTORY_QUOTES_URL = "http://ichart.yahoo.com/table.csv?"
staticprivate

Definition at line 41 of file YahooCSV.py.

string serverportfolio.Parsers.YahooCSV.YahooCSV.__HISTORY_QUOTES_X_URL = "http://ichart.finance.yahoo.com/x?"
staticprivate

Definition at line 53 of file YahooCSV.py.

string serverportfolio.Parsers.YahooCSV.YahooCSV.__QUOTES_CSV_URL = "http://download.finance.yahoo.com/d/quotes.csv?"
staticprivate

Definition at line 65 of file YahooCSV.py.

serverportfolio.Parsers.YahooCSV.YahooCSV.e_action
list serverportfolio.Parsers.YahooCSV.YahooCSV.firstdate = self.local_stock[symbol]
static

Definition at line 133 of file YahooCSV.py.

list serverportfolio.Parsers.YahooCSV.YahooCSV.lastdate = self.local_stock[symbol]
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
serverportfolio.Parsers.YahooCSV.YahooCSV.source
tuple serverportfolio.Parsers.YahooCSV.YahooCSV.symbol = self.local_stock.keys()
static
tuple serverportfolio.Parsers.YahooCSV.YahooCSV.today = datetime.date.today()
static

Definition at line 140 of file YahooCSV.py.

serverportfolio.Parsers.YahooCSV.YahooCSV.url

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