Share and Money Management  0.16
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
smm.quote.yahoo.YahooCSVFetchPlugin Class Reference

Share data tracker querying Yahoo finance data. More...

Inheritance diagram for smm.quote.yahoo.YahooCSVFetchPlugin:

Public Member Functions

def __init__ (self)
 
def getCurrent (self, request)
 Obtain information from the data provider. More...
 

Public Attributes

 properties
 

Static Public Attributes

list field_symbols
 Yahoo encoded property names. More...
 
list field_names
 Property names. More...
 
tuple yahoo2smm
 Mapping of Yahoo properties to SMM properties. More...
 
list decimal_properties
 Decimal values. More...
 
list unicode_properties
 Unicode values. More...
 
int interface_version = 2
 Version number of the interface to access and convert the data. More...
 
string logger_name = 'smm.quote.yahoocsv'
 Name of the instance logger. More...
 
string name = u'Yahoo Finance CSV'
 Name of the data source. More...
 
int provider_id = 100
 Unique provider ID. More...
 
string provider_url = "http://download.finance.yahoo.com/d/quotes.csv"
 URL to query the data. More...
 
string dsep = u','
 Decimal separator for converting strings to decimal values. More...
 
 tsep = None
 Thousands separator for converting strings to decimal values. More...
 
- Static Public Attributes inherited from smm.quote.base.FetchPluginBase
list properties = []
 List of supported properties. More...
 
bool check_robotfile = True
 Check and respect the robots.txt file. More...
 
string encoding = 'ascii'
 Default encoding of all returned strings. More...
 
int interface_version = 2
 Version number of the interface to access and convert the data. More...
 
string logger_name = 'smm.quote.base'
 Name of the instance logger. More...
 
string name = 'Override in derivated class!'
 Name of the data source. More...
 
 provider_id = None
 Unique provider ID. More...
 
string dsep = u','
 Decimal separator for converting strings to decimal values. More...
 
 tsep = None
 Thousands separator for converting strings to decimal values. More...
 
int max_retries = 3
 Number of retries for temporary connection errors. More...
 
string user_agent = 'Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'
 Define a own user agent string. More...
 

Detailed Description

Share data tracker querying Yahoo finance data.

This tracker uses the Yahoo CSV API.

Constructor & Destructor Documentation

◆ __init__()

def smm.quote.yahoo.YahooCSVFetchPlugin.__init__ (   self)

Member Function Documentation

◆ getCurrent()

def smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent (   self,
  request 
)

Obtain information from the data provider.

Parameters
selfThe object instance itself
requestSee example
Example:
>>> import pprint
>>> pprint.pprint(request)
{u'DE0005003404': {'exchange.symbol': u'DE',
'share.isin': u'DE0005003404',
'share.symbol': u'ADS',
'share.wkn': u'500340'}}
>>> result = provider.getCurrent(request)
>>> pprint.pprint(result)
{u'DE0005003404': {'currency.code': 'EUR',
'errormsg': None,
'exchange.symbol': u'DE',
'quote.ask': Decimal("41.745"),
'quote.bid': Decimal("41.70"),
'quote.datetime': datetime.datetime(2010, 5, 14, 11, 35),
'quote.high': Decimal("43.83"),
'quote.low': Decimal("41.585"),
'quote.nchange': Decimal("-2.095"),
'quote.open': Decimal("43.67"),
'quote.pchange': Decimal("-0.0477"),
'quote.price': Decimal("41.82"),
'quote.volume': Decimal("4260280"),
'share.name': 'ADIDAS',
'share.symbol': 'ADS.DE',
'source.id': 100,
'source.name': u'Yahoo Finance CSV',
'success': True}}

References smm.quote.yahoo.YahooCSVFetchPlugin.decimal_properties, smm.quote.yahoo.YahooCSVFetchPlugin.field_names, smm.quote.yahoo.YahooCSVFetchPlugin.field_symbols, smm.quote.raiffeisen.RaiffeisenFetchPlugin.provider_url, smm.quote.yahoo.YahooCSVFetchPlugin.provider_url, smm.quote.base.toUnicode(), smm.quote.yahoo.YahooCSVFetchPlugin.unicode_properties, and smm.quote.yahoo.YahooCSVFetchPlugin.yahoo2smm.

Here is the call graph for this function:

Member Data Documentation

◆ decimal_properties

list smm.quote.yahoo.YahooCSVFetchPlugin.decimal_properties
static
Initial value:
= ['ask', 'bid', 'high', 'last', 'low', 'net', 'open',
'p_change', 'volume']

Decimal values.

Those returned values will be converted into decimal.Decimal values

Note
Convert only valued needed by SMM.
See also
yahoo2smm

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent(), and smm.quote.yahoo.YahooWebFetchPlugin.getCurrent().

◆ dsep

string smm.quote.yahoo.YahooCSVFetchPlugin.dsep = u','
static

Decimal separator for converting strings to decimal values.

See also
attr2decimal()
tsep

◆ field_names

list smm.quote.yahoo.YahooCSVFetchPlugin.field_names
static
Initial value:
= ['symbol', 'name', 'last', 'date', 'time', 'net',
'p_change', 'volume', 'bid', 'ask', 'close', 'open',
'day_range', 'year_range', 'eps', 'pe', 'div_date',
'div', 'div_yield', 'cap', 'ex_div', 'avg_vol',
'currency']

Property names.

A symbol correspondes with the symbol listed at the same position in field_symbols.

See also
field_symbols
Yahoo Symbols

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.__init__(), and smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent().

◆ field_symbols

list smm.quote.yahoo.YahooCSVFetchPlugin.field_symbols
static
Initial value:
= ['s', 'n', 'l1', 'd1', 't1', 'c1', 'p2', 'v', 'b', 'a',
'p', 'o', 'm', 'w', 'e', 'r', 'r1', 'd', 'y', 'j1', 'q',
'a2', 'c4']

Yahoo encoded property names.

A property correspondes with the name listed at the same position in field_names.

See also
field_names
Yahoo Symbols

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent().

◆ interface_version

int smm.quote.yahoo.YahooCSVFetchPlugin.interface_version = 2
static

Version number of the interface to access and convert the data.

◆ logger_name

string smm.quote.yahoo.YahooCSVFetchPlugin.logger_name = 'smm.quote.yahoocsv'
static

Name of the instance logger.

◆ name

string smm.quote.yahoo.YahooCSVFetchPlugin.name = u'Yahoo Finance CSV'
static

Name of the data source.

◆ properties

smm.quote.yahoo.YahooCSVFetchPlugin.properties

◆ provider_id

int smm.quote.yahoo.YahooCSVFetchPlugin.provider_id = 100
static

Unique provider ID.

◆ provider_url

string smm.quote.yahoo.YahooCSVFetchPlugin.provider_url = "http://download.finance.yahoo.com/d/quotes.csv"
static

URL to query the data.

Note
We don't use the european Yahoo server, because we've got wrong / incomplete data

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent(), and smm.quote.yahoo.YahooWebFetchPlugin.getCurrent().

◆ tsep

smm.quote.yahoo.YahooCSVFetchPlugin.tsep = None
static

Thousands separator for converting strings to decimal values.

See also
attr2decimal()
dsep

◆ unicode_properties

list smm.quote.yahoo.YahooCSVFetchPlugin.unicode_properties
static
Initial value:
= ['currency.code', 'exchange.symbol',
'share.name', 'share.symbol']

Unicode values.

Those returned values will be converted into Unicode values

Note
Convert only valued needed by SMM.
See also
yahoo2smm

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent().

◆ yahoo2smm

tuple smm.quote.yahoo.YahooCSVFetchPlugin.yahoo2smm
static
Initial value:
= (
('currency', 'currency.code'),
('errormsg', 'errormsg'),
('exchange.symbol', 'exchange.symbol'),
('ask', 'quote.ask'),
('bid', 'quote.bid'),
('quote.datetime', 'quote.datetime'),
('high', 'quote.high'),
('low', 'quote.low'),
('net', 'quote.nchange'),
('open', 'quote.open'),
('p_change', 'quote.pchange'),
('last', 'quote.price'),
('volume', 'quote.volume'),
('name', 'share.name'),
('symbol', 'share.symbol'),
('success', 'success'),
)

Mapping of Yahoo properties to SMM properties.

Referenced by smm.quote.yahoo.YahooCSVFetchPlugin.getCurrent().


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