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

Share data tracker querying quotes using OnVista service. More...

Inheritance diagram for smm.quote.onvista.OnvistaFetchPlugin:

Public Member Functions

def getCurrent
 Obtain information from the data provider.
def searchURL
 Query OnVista for a detail page.
def getKind
 Determinate the share kind from the given url.

Static Public Attributes

int interface_version = 2
 Version number of the interface to access and convert the data.
string logger_name = 'smm.quote.onvista'
 Name of the instance logger.
string name = u'OnVista'
 Name of the data source.
int provider_id = 400
 Unique provider ID.
string dsep = u','
 Decimal separator for converting strings to decimal values.
string tsep = u'.'
 Thousands separator for converting strings to decimal values.
tuple mandatory_attributes
 Minimum set of attributes to be extract from the OnVista webpage.
list search_urls
 List of URLs to search a share.
tuple REC_DateTime
 Pre-compiled RE to extract date and time of a quote.
tuple REC_ISINText
 Pre-compiled RE to find the text "ISIN:".
tuple REC_ProductName
 Pre-compiled RE to find the product name.
tuple REC_VALUES
 Pre-compiled RE to extract the current value, the net change and the percentage change.
tuple REC_WKNText
 Pre-compiled RE to find the text "WKN:".
tuple REC_AMOUNT
 Pre-compiled RE to find amount and currency.

Private Member Functions

def _extractFondDetails
 Extract details of fonds from the given soup.
def _extractCertificateDetails
 Extract details of certificates from the given soup.

Static Private Attributes

list _specific_properties

Detailed Description

Share data tracker querying quotes using OnVista service.

Member Function Documentation

def smm.quote.onvista.OnvistaFetchPlugin._extractCertificateDetails (   self,
  stock,
  soup 
)
private

Extract details of certificates from the given soup.

See Also
getCurrent()

References smm.quote.base.FetchPluginBase.attr2decimal(), smm.quote.base.FetchPluginBase.getNextTagText(), smm.quote.onvista.OnvistaFetchPlugin.REC_ProductName, smm.quote.base.FetchPluginBase.timestamp2datetime(), and smm.quote.base.toUnicode().

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent().

Here is the call graph for this function:

Here is the caller graph for this function:

def smm.quote.onvista.OnvistaFetchPlugin._extractFondDetails (   self,
  stock,
  soup,
  currency 
)
private

Extract details of fonds from the given soup.

See Also
getCurrent()

References smm.quote.base.FetchPluginBase.attr2decimal(), smm.quote.base.FetchPluginBase.timestamp2datetime(), and smm.quote.base.toUnicode().

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent().

Here is the call graph for this function:

Here is the caller graph for this function:

def smm.quote.onvista.OnvistaFetchPlugin.getCurrent (   self,
  request 
)

Obtain information from the data provider.

Parameters
selfThe object instance itself
requestSee example
Example:
>>> import pprint
>>> pprint.pprint(request)
{u'LU0269579586': {'currency.code': u'EUR',
'share.isin': u'LU0269579586',
'share.wkn': u'A0LBQE'}}
>>> result = provider.getCurrent(request)
>>> pprint.pprint(result)
{u'LU0269579586': {'currency.code': u'EUR',
'errormsg': None,
'kind': u'fond',
'quote.datetime': datetime.datetime(2010, 5, 12, 10, 0),
'quote.nchange': Decimal("0.41"),
'quote.pchange': Decimal("0.0074"),
'quote.price': Decimal("55.74"),
'share.isin': u'LU0269579586',
'share.name': u'MERIDIO FUNDS - MERIDIO ARAB WORLD P',
'share.wkn': u'A0LBQE',
'source.id': 400,
'source.name': u'OnVista',
'success': True}}

References smm.quote.onvista.OnvistaFetchPlugin._extractCertificateDetails(), smm.quote.onvista.OnvistaFetchPlugin._extractFondDetails(), smm.quote.base.FetchPluginBase.getConnection(), smm.quote.onvista.OnvistaFetchPlugin.getKind(), smm.quote.base.FetchPluginBase.getNextTagText(), smm.quote.base.FetchPluginBase.getRemotePage(), smm.quote.base.FetchPluginBase.getSoup(), smm.quote.base.FetchPluginBase.initShareStruct(), smm.quote.onvista.OnvistaFetchPlugin.REC_ISINText, smm.quote.onvista.OnvistaFetchPlugin.REC_WKNText, smm.quote.onvista.OnvistaFetchPlugin.searchURL(), and smm.quote.base.toUnicode().

Here is the call graph for this function:

def smm.quote.onvista.OnvistaFetchPlugin.getKind (   self,
  url 
)

Determinate the share kind from the given url.

Parameters
selfThe object instance itself
urlURL
Returns
String with the determinated kind similar to Share.kind or search for URLs with search forms or None for unknown URLs.
Example:
>>> provider = smm.OnvistaFetchPlugin()
>>> provider.getKind(u'http://fonds.onvista.de/snapshot.html?ID_INSTRUMENT=7347385&SEARCH_VALUE=AT0000668264')
u'fond'
See Also
Share.kind and searchURL()

References smm.quote.base.toUnicode().

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent(), and smm.quote.onvista.OnvistaFetchPlugin.searchURL().

Here is the call graph for this function:

Here is the caller graph for this function:

def smm.quote.onvista.OnvistaFetchPlugin.searchURL (   self,
  key 
)

Query OnVista for a detail page.

Parameters
selfThe object instance itself
keyISIN or WKN to search (Unicode)
Returns
The found URL or None on error
Example:
>>> provider = smm.OnvistaFetchPlugin()
>>> provider.searchURL('AT0000668264')
'http://fonds.onvista.de/snapshot.html?ID_INSTRUMENT=7347385&SEARCH_VALUE=AT0000668264'
See Also
search_urls and getKind()

References smm.quote.base.FetchPluginBase.getConnection(), smm.quote.onvista.OnvistaFetchPlugin.getKind(), smm.quote.onvista.OnvistaFetchPlugin.search_urls, and smm.quote.base.toUnicode().

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

list smm.quote.onvista.OnvistaFetchPlugin._specific_properties
staticprivate
Initial value:
['currency.code', 'exchange.name', 'share.isin',
'share.name', 'quote.nchange', 'quote.pchange', 'quote.price', 'share.wkn', ]
string smm.quote.onvista.OnvistaFetchPlugin.dsep = u','
static

Decimal separator for converting strings to decimal values.

See Also
attr2decimal()
tsep
int smm.quote.onvista.OnvistaFetchPlugin.interface_version = 2
static

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

string smm.quote.onvista.OnvistaFetchPlugin.logger_name = 'smm.quote.onvista'
static

Name of the instance logger.

tuple smm.quote.onvista.OnvistaFetchPlugin.mandatory_attributes
static
Initial value:
set(['share.name', 'share.wkn', 'share.isin', 'quote.datetime', 'quote.price', \
'currency.code', ])

Minimum set of attributes to be extract from the OnVista webpage.

string smm.quote.onvista.OnvistaFetchPlugin.name = u'OnVista'
static

Name of the data source.

int smm.quote.onvista.OnvistaFetchPlugin.provider_id = 400
static

Unique provider ID.

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_AMOUNT
static
Initial value:
re.compile(
r'^'
r'\s*' # optional leading spaces
r'(?P<value>[0-9\.]+,[0-9]+)' # value e.g. 1.1223,03
r'\s+' # mandatory spaces
r'(?P<currency>[A-Z]+)' # currency code
r'\s*$' # optional tailing spaces
)

Pre-compiled RE to find amount and currency.

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_DateTime
static
Initial value:
re.compile(
r'.*'
r'(?P<date>[0-9]{2}\.[0-9]{2}\.[0-9]{4}'
r',\s?'
r'[0-9]{2}:[0-9]{2}:[0-9]{2}'
r')'
r'.*'
)

Pre-compiled RE to extract date and time of a quote.

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_ISINText
static
Initial value:
re.compile(
r'^\s*ISIN:\s*$'
)

Pre-compiled RE to find the text "ISIN:".

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent().

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_ProductName
static
Initial value:
re.compile(
r'^\s*Produktname:\s*$'
)

Pre-compiled RE to find the product name.

Referenced by smm.quote.onvista.OnvistaFetchPlugin._extractCertificateDetails().

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_VALUES
static
Initial value:
re.compile(
r'^'
r'(?P<value>[0-9]+,[0-9]+)' # value
r'\s+'
r'\('
r'(?P<nchange>[-+]?([0-9]+,[0-9]+|n\.a\.))' # net change
r'\s?\/\s?'
r'(?P<pchange>[-+]?([0-9]+,[0-9]+%|n\.a\.))' # net change
r'\)$',
re.VERBOSE
)

Pre-compiled RE to extract the current value, the net change and the percentage change.

tuple smm.quote.onvista.OnvistaFetchPlugin.REC_WKNText
static
Initial value:
re.compile(
r'^\s*WKN:\s*$'
)

Pre-compiled RE to find the text "WKN:".

Referenced by smm.quote.onvista.OnvistaFetchPlugin.getCurrent().

list smm.quote.onvista.OnvistaFetchPlugin.search_urls
static
Initial value:
[
u'http://www.onvista.de/suche.html?SEARCH_VALUE=%(key)s&SELECTED_TOOL=ALL_TOOLS',
u'http://www.onvista.de/fonds/suche.html?SEARCH_VALUE=%(key)s',
]

List of URLs to search a share.

Element order: general (first) to most special (last).

Be aware of derivated products because the search for products could return derivated products to.

See Also
searchURL()

Referenced by smm.quote.onvista.OnvistaFetchPlugin.searchURL().

string smm.quote.onvista.OnvistaFetchPlugin.tsep = u'.'
static

Thousands separator for converting strings to decimal values.

See Also
attr2decimal()
dsep

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