summaryrefslogtreecommitdiff
path: root/wikifolio/model.py
blob: 658f8ef6a8ab596b4ba911233d1f03ffdb05b119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
BASE_URL = "https://www.wikifolio.com/de/de/wikifolio/"


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
        self.shortdesc = shortdesc
        self.isin = isin
        self.trader = trader

    def make_url(self):
        return BASE_URL + self.name


class Comment(_WithRepr):
    def __init__(self, date, author, text, guid, link):
        self.pubDate = date
        self.author = author
        self.description = text
        self.guid = guid
        self.link = link


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
        self.share_isin = share_isin
        self.typ = typ
        self.status = status
        self.timestamp = timestamp
        self.quote = quote
        self.volume = volume