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

Class to handle share data. More...

Inheritance diagram for smm.objects.Share:

Public Member Functions

def createWatch
 Create a watch list entry (Watch object) releated to the current share.
def __str__
 Returns the content of this instance as string.
def is_watched
 Returns True if a related watch list entry exists.
def getPrefCurrency
 Returns the preferred currency of a share.
- Public Member Functions inherited from smm.objects.SMMBaseObject
def __init__
 Initialise the instance and set attributes optionally.
def __repr__
 Returns the representation of this object as string.
def update
 Update instance arguments.
def add2db
 Add an object to the database.

Static Public Member Functions

def get
 Query Share objects.
def getCount
 Returns the number of shares, fonds and others.

Public Attributes

 watch

Static Public Attributes

dictionary arguments
string psTopic = 'smm.share'
tuple id = Int(default=AutoReload, primary=True)
 Unique ID for each object.
tuple symbol = Unicode()
 Ticker symbol of the share.
tuple isin = Unicode()
 ISIN of the share.
tuple wkn = Unicode()
 WKN of the share.
tuple name = Unicode()
 Name of the company.
tuple currency_id = Int()
 ID of the referred Currency object.
tuple currency = Reference(currency_id, Currency.id)
 Preferred currency.
tuple exchange_id = Int()
 ID of the referred Exchange object.
tuple exchange = Reference(exchange_id, Exchange.id)
 Preferred exchange.
tuple kind
 Type of share.
tuple watch_id = Int()
 ID of the reffered watch list entry.
tuple watch = Reference(watch_id, 'Watch.id')
 Reference to the Watch list object
tuple source = Int()
 Primary data source.
tuple notes = Unicode()
 Additional notes to this share.
- Static Public Attributes inherited from smm.objects.SMMBaseObject
dictionary arguments
 Set of argument names for keyword arguments.
tuple encoding = sys.stdout.encodingorsys.getdefaultencoding()
 Encoding of all character strings.
 psTopic = None
 Publish Subscribe Topic for this class.

Static Private Attributes

string __storm_table__ = "t_share"
 Use given table to store all of this class inside.

Detailed Description

Class to handle share data.

Test:
tests.test_objects.TestObjects.test_Share_objects()

Member Function Documentation

def smm.objects.Share.__str__ (   self)

Returns the content of this instance as string.

References smm.objects.SMMBaseObject._encode(), smm.objects.Exchange.id, smm.objects.Currency.id, smm.objects.Share.id, smm.objects.Share.isin, smm.objects.Share.name, smm.objects.Exchange.symbol, smm.objects.Share.symbol, and smm.objects.Share.wkn.

Referenced by smm.objects.SMMBaseObject.__repr__().

Here is the call graph for this function:

Here is the caller graph for this function:

def smm.objects.Share.createWatch (   self,
  kwargs 
)

Create a watch list entry (Watch object) releated to the current share.

Parameters
selfThe object instance itself
kwargsSame like Watch.__init__(). The share parameter is set automatically.
Returns
False if a watch list entry is already referred, otherwise True.

References smm.objects.Share.watch.

def smm.objects.Share.get (   id = None,
  isin = None,
  symbol = None,
  wkn = None,
  index = None 
)
static

Query Share objects.

There are three ways for querying objects:

  • Querying by id, isin, symbol or wkn returns a Share object or None
  • Querying by kind returns all Share objects with the given kind
  • Querying without parameters to get all Share objects

The last way returns always a storm.store.ResultSet.

Parameters
idReturns a Share specified by id.
isinReturns a Share specified by isin.
symbolReturns a Share specified by symbol.
wknReturns a Share specified by wkn.
indexReturns a Indices
Sorting:
The result are unsorted
Test:
tests.test_objects.TestObjects.test_Share_get()
def smm.objects.Share.getCount (   fonds = False,
  index = False,
  other = False,
  share = False,
  total = False 
)
static

Returns the number of shares, fonds and others.

Parameters
fondsReturns the number of known fonds
indexReturns the number of known indexes
otherReturns the number of not catagorised instruments
shareReturns the number of known shares
totalReturns the number of instruments wihtout indexes
def smm.objects.Share.getPrefCurrency (   self)

Returns the preferred currency of a share.

The preferred currency is the currency of a current open Position or the currency stored at the share object.

None is returned if the currency can't determinate.

Returns
A smm.objects.Currency object or the default currency Euro

References smm.objects.Share.currency.

def smm.objects.Share.is_watched (   self)

Returns True if a related watch list entry exists.

Use this function only if you need an explicit True or False.

You can check the watch attribute directly as an alternative.

Or you can convert the watch attribute to a boolean value:

bool(share.watch)

References smm.objects.Share.watch.

Member Data Documentation

string smm.objects.Share.__storm_table__ = "t_share"
staticprivate

Use given table to store all of this class inside.

dictionary smm.objects.Share.arguments
static
Initial value:
{
'symbol': 'unicode',
'isin': 'unicode',
'wkn': 'unicode',
'name': 'unicode',
'currency': None,
'currency_id': None,
'exchange': None,
'exchange_id': None,
'kind': 'unicode',
'watch': None,
'watch_id': None,
'source': None,
'notes': 'unicode',
}
tuple smm.objects.Share.currency = Reference(currency_id, Currency.id)
static
tuple smm.objects.Share.currency_id = Int()
static

ID of the referred Currency object.

tuple smm.objects.Share.exchange = Reference(exchange_id, Exchange.id)
static

Preferred exchange.

Reference to the Exchange object

Referenced by smm.objects.DailyQuote.__str__().

tuple smm.objects.Share.exchange_id = Int()
static

ID of the referred Exchange object.

tuple smm.objects.Share.id = Int(default=AutoReload, primary=True)
static
tuple smm.objects.Share.isin = Unicode()
static

ISIN of the share.

Referenced by smm.objects.Share.__str__().

tuple smm.objects.Share.kind
static
Initial value:
Enum(map={u'share': 1, u'index': 2, u'fond': 3, u'etf': 4, \
u'warrant': 5, u'certificate': 6, u'bond': 7})

Type of share.

Adapt functions below after adding a new kind:

Referenced by smm.objects.Transaction._getDetails(), smm.objects.Transaction._setDetails(), and smm.objects.Transaction.getVolume().

tuple smm.objects.Share.name = Unicode()
static
tuple smm.objects.Share.notes = Unicode()
static

Additional notes to this share.

string smm.objects.Share.psTopic = 'smm.share'
static
tuple smm.objects.Share.source = Int()
static

Primary data source.

tuple smm.objects.Share.symbol = Unicode()
static

Ticker symbol of the share.

Referenced by smm.objects.Share.__str__().

tuple smm.objects.Share.watch = Reference(watch_id, 'Watch.id')
static
smm.objects.Share.watch
tuple smm.objects.Share.watch_id = Int()
static

ID of the reffered watch list entry.

tuple smm.objects.Share.wkn = Unicode()
static

WKN of the share.

Referenced by smm.objects.Share.__str__().


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