summaryrefslogtreecommitdiff
path: root/wikifolio/model.py
blob: ce8febac99b926aed2a80143f7af115e2755af23 (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
BASE_URL = "https://www.wikifolio.com/de/de/wikifolio/"


class Certificate:
    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

    def __repr__(self):
        return "<{} id={} shortdesc=\"{}\" isin={}>".format(
                self.__class__.__name__, self.guid, self.name, self.isin)


class Comment:
    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:
    TYPE_KAUF = 'Quote Kauf'
    TYPE_VERKAUF = 'Quote Verkauf'

    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

    def __repr__(self):
        return "<{} {}".format(type(self).__name__,
                " ".join(map(lambda kv: "{}={}".format(*kv), self.__dict__.items())))