Share and Money Management 0.18devel
|
Base class for all database related classes. More...
Public Member Functions | |
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 Attributes | |
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... | |
Private Member Functions | |
def | _toDecimal (self, value) |
Convert any value into a decimal.Decimal value. More... | |
def | _setAttrs (self, ignoreEmpty, **kwargs) |
Update arguments (really) More... | |
def | _remove (self) |
Remove current object from database store. More... | |
Base class for all database related classes.
def smm.objects.SMMBaseObject.__init__ | ( | self, | |
** | kwargs | ||
) |
Initialise the instance and set attributes optionally.
This constructor creates a new object, without checking the store whether an object exists. Use the get* functions to check the store first and creates on object later.
Call add2db() to store a new created instance in the database.
Empty keyword arguments will be ignored.
Reimplemented in smm.objects.Transaction, and smm.objects.Watch.
References smm.objects.SMMBaseObject._setAttrs(), smm.objects.SMMBaseObject.psTopic, smm.objects.Exchange.psTopic, smm.objects.Currency.psTopic, smm.objects.Share.psTopic, smm.objects.DailyQuote.psTopic, smm.objects.Transaction.psTopic, smm.objects.Watch.psTopic, and smm.objects.Position.psTopic.
def smm.objects.SMMBaseObject.__repr__ | ( | self | ) |
Returns the representation of this object as string.
References smm.objects.Exchange.__str__(), smm.objects.Currency.__str__(), smm.objects.Share.__str__(), smm.objects.DailyQuote.__str__(), smm.objects.Transaction.__str__(), smm.objects.Watch.__str__(), smm.objects.Position.__str__(), smm.objects.Config.__str__(), and smm.objects.SMMBaseObject.id.
|
private |
Remove current object from database store.
References smm.objects.SMMBaseObject.id, smm.objects.Exchange.id, smm.objects.Currency.id, smm.objects.Share.id, smm.objects.DailyQuote.id, smm.objects.Transaction.id, smm.objects.Watch.id, smm.objects.Position.id, smm.objects.SMMBaseObject.psTopic, smm.objects.Exchange.psTopic, smm.objects.Currency.psTopic, smm.objects.Share.psTopic, smm.objects.DailyQuote.psTopic, smm.objects.Transaction.psTopic, smm.objects.Watch.psTopic, and smm.objects.Position.psTopic.
Referenced by smm.objects.Transaction.remove(), and smm.objects.Watch.remove().
|
private |
Update arguments (really)
Empty unicode strings will be set to None
and trailing whitespaces will be removed.
ValueError | For unknown arguments |
self | The object instance itself |
ignoreEmpty | Ignore attributes that are None or an empty string |
kwargs | Keyword arguments |
References smm.objects.SMMBaseObject._toDecimal(), smm.objects.SMMBaseObject.arguments, smm.objects.Exchange.arguments, smm.objects.Currency.arguments, smm.objects.Share.arguments, smm.objects.DailyQuote.arguments, smm.objects.Transaction.arguments, smm.objects.Watch.arguments, smm.objects.Position.arguments, and smm.objects.Config.arguments.
Referenced by smm.objects.SMMBaseObject.__init__(), and smm.objects.SMMBaseObject.update().
|
private |
Convert any value into a decimal.Decimal value.
self | The object instance itself |
value | The value |
Referenced by smm.objects.SMMBaseObject._setAttrs().
def smm.objects.SMMBaseObject.add2db | ( | self | ) |
Add an object to the database.
Referenced by smm.objects.Share.createWatch().
def smm.objects.SMMBaseObject.update | ( | self, | |
** | kwargs | ||
) |
Update instance arguments.
Empty keyword arguments are processed. It means that single data will be deleted from the database.
References smm.objects.SMMBaseObject._setAttrs(), smm.objects.SMMBaseObject.psTopic, smm.objects.Exchange.psTopic, smm.objects.Currency.psTopic, smm.objects.Share.psTopic, smm.objects.DailyQuote.psTopic, smm.objects.Transaction.psTopic, smm.objects.Watch.psTopic, and smm.objects.Position.psTopic.
Referenced by smm.objects.Transaction._setDetails(), and smm.objects.Watch.remove().
|
static |
Set of argument names for keyword arguments.
It should contain all attributes to store in the database.
The primary key argument (mostly id
) shouldn't be part of this set, because this argument will be set by the Storm framework.
Attributes decimal
will be converted to the specified type automatically.
Referenced by smm.objects.SMMBaseObject._setAttrs().
|
static |
Encoding of all character strings.
The default_encoding
is used to convert character strings into unicode strings
|
static |
Unique ID for each object.
Referenced by smm.objects.SMMBaseObject.__repr__(), smm.objects.Exchange.__str__(), smm.objects.Currency.__str__(), smm.objects.Share.__str__(), smm.objects.DailyQuote.__str__(), smm.objects.Transaction.__str__(), smm.objects.Watch.__str__(), smm.objects.Position.__str__(), smm.objects.SMMBaseObject._remove(), and smm.objects.Transaction.getVolume().
|
static |
Publish Subscribe Topic for this class.
Referenced by smm.objects.SMMBaseObject.__init__(), smm.objects.SMMBaseObject._remove(), and smm.objects.SMMBaseObject.update().