Share and Money Management 0.18devel
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 (self, request)
 Obtain information from the data provider. More...
 
def searchURL (self, key)
 Query OnVista for a detail page. More...
 
def getKind (self, url)
 Determinate the share kind from the given url. More...
 

Static Public Attributes

int interface_version = 2
 Version number of the interface to access and convert the data. More...
 
string logger_name = "smm.quote.onvista"
 Name of the instance logger. More...
 
string name = "OnVista"
 Name of the data source. More...
 
int provider_id = 400
 Unique provider ID. More...
 
string dsep = ","
 Decimal separator for converting strings to decimal values. More...
 
string tsep = "."
 Thousands separator for converting strings to decimal values. More...
 
dictionary mandatory_attributes
 Minimum set of attributes to be extract from the OnVista webpage. More...
 
list search_urls
 List of URLs to search a share. More...
 
 REC_DateTime
 Pre-compiled RE to extract date and time of a quote. More...
 
 REC_CERT_EXCHANGE
 Pre-compiled RE to extract the name of the exchange for certificates. More...
 
 REC_ISINText = re.compile(r"^\s*ISIN:\s*$")
 Pre-compiled RE to find the text "ISIN:". More...
 
 REC_WKNText = re.compile(r"^\s*WKN:\s*$")
 Pre-compiled RE to find the text "WKN:". More...
 
 REC_WARRANT_AMOUNT
 Pre-compiled RE to find amount and currency for Warrants. 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...
 
bool active = True
 Set False to deactivate a plugin. 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 = ","
 Decimal separator for converting strings to decimal values. More...
 
 tsep = None
 Thousands separator for converting strings to decimal values. More...
 
 logger = None
 Instance logger. More...
 
int max_retries = 3
 Number of retries for temporary connection errors. More...
 
tuple user_agent
 Define an own user agent string. More...
 

Private Member Functions

def _extractDetailsDesign2017 (self, stock, soup, currency)
 Extract details of fonds from the given soup. More...
 
def _extractWarrantDetails (self, stock, soup, currency)
 
def _extractCertificateDetails (self, stock, soup)
 Extract details of certificates from the given soup. More...
 
def _extractTime (self, stock, soup, regex=REC_DateTime)
 Extract the quotation timestamp. More...
 

Static Private Attributes

list _specific_properties
 

Detailed Description

Share data tracker querying quotes using OnVista service.

Member Function Documentation

◆ _extractCertificateDetails()

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

Extract details of certificates from the given soup.

Parameters
stockShare dict
soupA BeautifulSoup instance
See also
getCurrent()

References smm.quote.base.FetchPluginBase.logger, and smm.quote.onvista.OnvistaFetchPlugin.REC_CERT_EXCHANGE.

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

Here is the caller graph for this function:

◆ _extractDetailsDesign2017()

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

Extract details of fonds from the given soup.

Parameters
stockShare dict
soupA BeautifulSoup instance
currencyCode of the requested currency
See also
getCurrent()

References smm.quote.onvista.OnvistaFetchPlugin._extractTime(), smm.quote.base.FetchPluginBase.logger, and smm.quote.onvista.OnvistaFetchPlugin.REC_WARRANT_AMOUNT.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _extractTime()

def smm.quote.onvista.OnvistaFetchPlugin._extractTime (   self,
  stock,
  soup,
  regex = REC_DateTime 
)
private

Extract the quotation timestamp.

Parameters
stockShare dict
soupA bs4.Tag or bs4.NavigableString instance or None if nothing found in soup
regexRegular expression to extract data and exchange name, default is REC_DateTime.

References smm.quote.base.FetchPluginBase.logger.

Referenced by smm.quote.onvista.OnvistaFetchPlugin._extractDetailsDesign2017(), and smm.quote.onvista.OnvistaFetchPlugin._extractWarrantDetails().

Here is the caller graph for this function:

◆ _extractWarrantDetails()

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

References smm.quote.onvista.OnvistaFetchPlugin._extractTime(), smm.quote.base.FetchPluginBase.logger, and smm.quote.onvista.OnvistaFetchPlugin.REC_WARRANT_AMOUNT.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrent()

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}}
Share data tracker querying quotes using OnVista service.
Definition: onvista.py:43

References smm.quote.onvista.OnvistaFetchPlugin._extractCertificateDetails(), smm.quote.onvista.OnvistaFetchPlugin._extractDetailsDesign2017(), smm.quote.onvista.OnvistaFetchPlugin._extractWarrantDetails(), smm.quote.onvista.OnvistaFetchPlugin.getKind(), smm.quote.base.FetchPluginBase.logger, smm.quote.onvista.OnvistaFetchPlugin.mandatory_attributes, smm.quote.onvista.OnvistaFetchPlugin.REC_ISINText, smm.quote.onvista.OnvistaFetchPlugin.REC_WKNText, and smm.quote.onvista.OnvistaFetchPlugin.searchURL().

Here is the call graph for this function:

◆ getKind()

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 determined kind similar to Share.kind or search for URLs with search forms or None for unknown URLs.
Example:
>>> 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.FetchPluginBase.logger.

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

Here is the caller graph for this function:

◆ searchURL()

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.searchURL('AT0000668264')
'http://fonds.onvista.de/snapshot.html?ID_INSTRUMENT=7347385&SEARCH_VALUE=AT0000668264'
See also
search_urls and getKind()

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

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

◆ _specific_properties

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",
]

◆ dsep

string smm.quote.onvista.OnvistaFetchPlugin.dsep = ","
static

Decimal separator for converting strings to decimal values.

See also
attr2decimal()
tsep

◆ interface_version

int smm.quote.onvista.OnvistaFetchPlugin.interface_version = 2
static

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

◆ logger_name

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

Name of the instance logger.

◆ mandatory_attributes

dictionary smm.quote.onvista.OnvistaFetchPlugin.mandatory_attributes
static
Initial value:
= {
"share.name",
"share.wkn",
"share.isin",
"quote.datetime",
"quote.price",
"currency.code",
}

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

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

◆ name

string smm.quote.onvista.OnvistaFetchPlugin.name = "OnVista"
static

◆ provider_id

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

Unique provider ID.

◆ REC_CERT_EXCHANGE

smm.quote.onvista.OnvistaFetchPlugin.REC_CERT_EXCHANGE
static
Initial value:
= re.compile(
r"^Realtime "
r"\‍("
r"("
r"(?P<name>[\w -]+) - Zertifikate" # exchange name
r"|"
r"Emittentenkurs Deutschland"
r")"
r"\‍) $",
re.UNICODE,
)

Pre-compiled RE to extract the name of the exchange for certificates.

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

◆ REC_DateTime

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.

◆ REC_ISINText

smm.quote.onvista.OnvistaFetchPlugin.REC_ISINText = re.compile(r"^\s*ISIN:\s*$")
static

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

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

◆ REC_WARRANT_AMOUNT

smm.quote.onvista.OnvistaFetchPlugin.REC_WARRANT_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*" # optional spaces
r"(?P<currency>[A-Z]+)" # currency code
r"\s*$" # optional tailing spaces
)

Pre-compiled RE to find amount and currency for Warrants.

Referenced by smm.quote.onvista.OnvistaFetchPlugin._extractDetailsDesign2017(), and smm.quote.onvista.OnvistaFetchPlugin._extractWarrantDetails().

◆ REC_WKNText

smm.quote.onvista.OnvistaFetchPlugin.REC_WKNText = re.compile(r"^\s*WKN:\s*$")
static

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

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

◆ search_urls

list smm.quote.onvista.OnvistaFetchPlugin.search_urls
static
Initial value:
= [
"http://www.onvista.de/suche.html?SEARCH_VALUE=%(key)s&SELECTED_TOOL=ALL_TOOLS",
"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().

◆ tsep

string smm.quote.onvista.OnvistaFetchPlugin.tsep = "."
static

Thousands separator for converting strings to decimal values.

See also
attr2decimal()
dsep

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