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.DailyQuote Class Reference

Class to handle quotes. More...

Inheritance diagram for smm.objects.DailyQuote:

Public Member Functions

def __str__ (self)
 Returns the content of this instance as string. 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 (date=None, id=None, share=None)
 Query DailyQuote objects. More...
 
def getCount ()
 Returns the number of daily quotes. More...
 
def getLast (share, currency=None)
 Returns the latest DailyQuote for a share. More...
 

Static Public Attributes

dictionary arguments
 
string psTopic = "smm.dailyquote"
 
 id = Int(default=AutoReload, primary=True)
 Unique ID for each object. More...
 
 share_id = Int()
 Property to store the ID of the referred Share object. More...
 
 share = Reference(share_id, Share.id)
 Reference to the Share object More...
 
 exchange_id = Int()
 Property to store the ID of the referred Exchange object. More...
 
 exchange = Reference(exchange_id, Exchange.id)
 Reference to the Exchange object More...
 
 currency_id = Int()
 Property to store the ID of the referred Currency object. More...
 
 currency = Reference(currency_id, Currency.id)
 Reference to the Currency object More...
 
 open = Decimal()
 Opening value of the share. More...
 
 close = Decimal()
 Closing value of the share. More...
 
 high = Decimal()
 Highest value of the day. More...
 
 low = Decimal()
 Lowest value of the day. More...
 
 date = Date()
 Day of quotation. More...
 
 volume = Int()
 Trade volume in shares. More...
 
 source = Int()
 Data source. More...
 
 event = Unicode()
 Event related to this quote. 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_dailyquote"
 Use given table to store all of this class inside. More...
 

Detailed Description

Class to handle quotes.

Note
This class handles daily quotes only. Another class will handle intraday quotes.
There is not field to track share splits as well as dividend currently.
Test:
tests.test_objects.TestObjects.test_DailyQuote_objects()

Member Function Documentation

◆ __str__()

def smm.objects.DailyQuote.__str__ (   self)

◆ get()

def smm.objects.DailyQuote.get (   date = None,
  id = None,
  share = None 
)
static

Query DailyQuote objects.

There are three ways for querying objects:

  • Querying by id returns a DailyQuote object or None
  • Query special entries described using share and/or date
  • Querying without parameters to get all DailyQuote objects

Querying with share and date returns an DailyQuote object or None.

The last two ways returns always a storm.store.ResultSet.

Parameters
idReturns a quote specified by the id.
shareReturns quotes specified by share.
dateReturns a quote specified by date.
Sorting:
The result is ordered ascending by date
Test:
tests.test_objects.TestObjects.test_DailyQuote_get()

◆ getCount()

def smm.objects.DailyQuote.getCount ( )
static

Returns the number of daily quotes.

◆ getLast()

def smm.objects.DailyQuote.getLast (   share,
  currency = None 
)
static

Returns the latest DailyQuote for a share.

Parameters
shareQuerying for this Share object
currencySpecify the currency for the DailyQuote
Test:
tests.test_objects.TestObjects.test_DailyQuote_getLast()

Member Data Documentation

◆ __storm_table__

string smm.objects.DailyQuote.__storm_table__ = "t_dailyquote"
staticprivate

Use given table to store all of this class inside.

◆ arguments

dictionary smm.objects.DailyQuote.arguments
static
Initial value:
= {
"share_id",
"share",
"exchange_id",
"exchange",
"currency_id",
"currency",
"open",
"close",
"high",
"low",
"date",
"volume",
"source",
"event",
}

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

◆ close

smm.objects.DailyQuote.close = Decimal()
static

Closing value of the share.

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

◆ currency

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

◆ currency_id

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

Property to store the ID of the referred Currency object.

◆ date

smm.objects.DailyQuote.date = Date()
static

◆ event

smm.objects.DailyQuote.event = Unicode()
static

Event related to this quote.

It's more like a note ...

Currently supported events:

  • split
    split:1:2
  • bid - bid price (German: Geldkurs)
  • ask - ask price (German: Briefkurs)

Adapt functions below to add a new event:

◆ exchange

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

Reference to the Exchange object

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

◆ exchange_id

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

Property to store the ID of the referred Exchange object.

◆ high

smm.objects.DailyQuote.high = Decimal()
static

Highest value of the day.

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

◆ id

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

◆ low

smm.objects.DailyQuote.low = Decimal()
static

Lowest value of the day.

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

◆ open

smm.objects.DailyQuote.open = Decimal()
static

◆ psTopic

string smm.objects.DailyQuote.psTopic = "smm.dailyquote"
static

◆ share

smm.objects.DailyQuote.share = Reference(share_id, Share.id)
static

◆ share_id

smm.objects.DailyQuote.share_id = Int()
static

Property to store the ID of the referred Share object.

◆ source

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

Data source.

◆ volume

smm.objects.DailyQuote.volume = Int()
static

Trade volume in shares.

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


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