Share and Money Management 0.18devel
Public Member Functions | Static Public Member Functions | 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 (self, **kwargs)
 Create a watch list entry (Watch object) related to the current share. More...
 
def __str__ (self)
 Returns the content of this instance as string. More...
 
def is_watched (self)
 Returns True if a related watch list entry exists. More...
 
def getPrefCurrency (self)
 Returns the preferred currency of a share. More...
 
- Public Member Functions inherited from smm.objects.SMMBaseObject
def __init__ (self, **kwargs)
 Initialise the instance and set attributes optionally. More...
 
def __repr__ (self)
 Returns the representation of this object as string. More...
 
def update (self, **kwargs)
 Update instance arguments. More...
 
def add2db (self)
 Add an object to the database. More...
 

Static Public Member Functions

def get (id=None, isin=None, symbol=None, wkn=None, index=None)
 Query Share objects. More...
 
def getCount (fonds=False, index=False, other=False, share=False, total=False)
 Returns the number of shares, fonds and others. More...
 

Static Public Attributes

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

Static Private Attributes

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

Detailed Description

Class to handle share data.

Test:
tests.test_objects.TestObjects.test_Share_objects()

Member Function Documentation

◆ __str__()

def smm.objects.Share.__str__ (   self)

◆ createWatch()

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

Create a watch list entry (Watch object) related 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.SMMBaseObject.add2db(), gui.panel.PanelWatchList.watch, and smm.objects.Share.watch.

Here is the call graph for this function:

◆ get()

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 an Indices
Sorting:
The result are unsorted
Test:
tests.test_objects.TestObjects.test_Share_get()

◆ getCount()

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 categorised instruments
shareReturns the number of known shares
totalReturns the number of instruments without indexes

◆ getPrefCurrency()

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 gui.dialogs.DlgTrade.currency, smm.objects.Share.currency, smm.objects.DailyQuote.currency, and smm.objects.Position.currency.

◆ is_watched()

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 gui.panel.PanelWatchList.watch, and smm.objects.Share.watch.

Member Data Documentation

◆ __storm_table__

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

Use given table to store all of this class inside.

◆ arguments

dictionary smm.objects.Share.arguments
static
Initial value:
= {
"symbol",
"isin",
"wkn",
"name",
"currency",
"currency_id",
"exchange",
"exchange_id",
"kind",
"watch",
"watch_id",
"source",
"notes",
}

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

◆ currency

smm.objects.Share.currency = Reference(currency_id, Currency.id)
static

◆ currency_id

smm.objects.Share.currency_id = Int()
static

ID of the referred Currency object.

◆ exchange

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

Preferred exchange.

Reference to the Exchange object

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

◆ exchange_id

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

ID of the referred Exchange object.

◆ id

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

◆ isin

smm.objects.Share.isin = Unicode()
static

ISIN of the share.

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

◆ kind

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

Type of share.

Adapt functions below after adding a new kind:

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

◆ name

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

◆ notes

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

Additional notes to this share.

◆ psTopic

string smm.objects.Share.psTopic = "smm.share"
static

◆ source

smm.objects.Share.source = Int()
static

Primary data source.

◆ symbol

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

Ticker symbol of the share.

Referenced by smm.objects.Exchange.__str__(), and smm.objects.Share.__str__().

◆ watch

smm.objects.Share.watch = Reference(watch_id, "Watch.id")
static

◆ watch_id

smm.objects.Share.watch_id = Int()
static

ID of the reffered watch list entry.

◆ wkn

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: