summaryrefslogtreecommitdiff
path: root/wikifolio/model.py
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-11-22 19:33:30 +0100
committerYves Fischer <yvesf-git@xapek.org>2016-11-22 19:42:11 +0100
commit05fc177b2986556df92aa0f506b1a48ef964fe19 (patch)
tree0df953ef457ea220431b109c97225486d6111678 /wikifolio/model.py
parent413051037749da90f03055bcd305c82b1ee90afd (diff)
downloadwikifolio-rss-master.tar.gz
wikifolio-rss-master.zip
some refactoring before moving it to githubHEADmaster
Diffstat (limited to 'wikifolio/model.py')
-rw-r--r--wikifolio/model.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/wikifolio/model.py b/wikifolio/model.py
index ce8feba..658f8ef 100644
--- a/wikifolio/model.py
+++ b/wikifolio/model.py
@@ -1,7 +1,13 @@
BASE_URL = "https://www.wikifolio.com/de/de/wikifolio/"
-class Certificate:
+class _WithRepr:
+ def __repr__(self):
+ return "<{} {}".format(type(self).__name__,
+ " ".join(map(lambda kv: "{}={}".format(*kv), self.__dict__.items())))
+
+
+class Certificate(_WithRepr):
def __init__(self, name, guid, shortdesc, isin, trader):
self.name = name
self.guid = guid
@@ -12,12 +18,8 @@ class Certificate:
def make_url(self):
return BASE_URL + self.name
- def __repr__(self):
- return "<{} id={} shortdesc=\"{}\" isin={}>".format(
- self.__class__.__name__, self.guid, self.name, self.isin)
-
-class Comment:
+class Comment(_WithRepr):
def __init__(self, date, author, text, guid, link):
self.pubDate = date
self.author = author
@@ -26,9 +28,12 @@ class Comment:
self.link = link
-class Trade:
+class Trade(_WithRepr):
TYPE_KAUF = 'Quote Kauf'
TYPE_VERKAUF = 'Quote Verkauf'
+ TYPES_KAUF = ('Quote Kauf', 'Limit Kauf', 'Stop-Limit Kauf', 'Rückabwicklung Verkauf')
+ TYPES_VERKAUF = ('Quote Verkauf', 'Limit Verkauf', 'Stop-Limit Verkauf', 'Rückabwicklung Kauf')
+ STATUS_AUSGEFUEHRT = 'Ausgeführt'
def __init__(self, share_name, share_isin, typ, status, timestamp, quote, volume):
self.share_name = share_name
@@ -38,7 +43,3 @@ class Trade:
self.timestamp = timestamp
self.quote = quote
self.volume = volume
-
- def __repr__(self):
- return "<{} {}".format(type(self).__name__,
- " ".join(map(lambda kv: "{}={}".format(*kv), self.__dict__.items())))