Module YahooQuote :: Class Ticker
[show private | hide private]
[frames | no frames]

Class Ticker


Represents the prices of a single ticker symbol.

Works as a smart sequence, keyed by yyyymmdd numbers

The magic attribute 'now' fetches current prices
Method Summary
  __init__(self, market, symbol, index)
Create a Ticker class, which gets/caches/retrieves quotes for a single ticker symbol
  __getattr__(self, attr)
Intercept attribute 'now' to mean a fetch of present prices
  __getitem__(self, date)
Retrieves/creates a Quote object for this ticker's prices for a particular date
  __repr__(self)
  fetchHistory(self)
fetches this stock's entire history - you should only ever do this once, and thereafter, invoke Ticker.updateHistory to keep the history up to date
  getQuote(self)
Returns a Quote object for this stock
  updateHistory(self)
Updates this stock's history.

Class Variable Summary
str baseUrlHistory = 'http://ichart.finance.yahoo.com/table....
str baseUrlQuote = 'http://download.finance.yahoo.com/d/quot...

Method Details

__init__(self, market, symbol, index=None)
(Constructor)

Create a Ticker class, which gets/caches/retrieves quotes for a single ticker symbol

Treat objects of this class like an array, where you can get a single item (date) to return a Quote object for the symbol and date, or get a slice, to return a list of Quote objects for the date range.

Note - you shouldn't instantiate this class directly, but instead get an instance by indexing a Market object - see Market.__getitem__

__getattr__(self, attr)
(Qualification operator)

Intercept attribute 'now' to mean a fetch of present prices

__getitem__(self, date)
(Indexing operator)

Retrieves/creates a Quote object for this ticker's prices for a particular date

Note - if you give a date on which trading did not occur, this class will fetch quotes for surrounding days, and interpolate between them.

fetchHistory(self)

fetches this stock's entire history - you should only ever do this once, and thereafter, invoke Ticker.updateHistory to keep the history up to date

getQuote(self)

Returns a Quote object for this stock

updateHistory(self)

Updates this stock's history. You should not invoke this method unless you have invoked Ticker.fetchHistory at some time in the past.

Class Variable Details

baseUrlHistory

Type:
str
Value:
'http://ichart.finance.yahoo.com/table.csv'                            

baseUrlQuote

Type:
str
Value:
'http://download.finance.yahoo.com/d/quotes.csv'                       

Generated by Epydoc 2.1 on Mon Jun 25 22:42:21 2007 http://epydoc.sf.net