-
Notifications
You must be signed in to change notification settings - Fork 1
/
mycoin.py
88 lines (56 loc) · 1.63 KB
/
mycoin.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/python3
from mybinance import Binance
from myindicators import Indicators
class Coin():
"""Coin's data class
Returns:
object -- contains coin's name, wallet
and indicators such as MACD, bollinger bands, ect..
"""
def __init__(self, name, wallet):
self.__name = name
self.__coins = wallet
self.indicators = None
def __del__(self):
"""Class's destructor
"""
print("%s: %.8f" % (self.__name, self.__coins))
def __str__(self):
"""Overriding str's method
Returns:
str --
"""
return "%s: %.8f coin(s)" % (self.__name, self.__coins)
def get_name(self):
"""Name's getter
Returns:
str -- name of the coin
"""
return (self.__name)
def get_coin(self):
"""Wallet's getter
Returns:
int -- Wallet of a coin
"""
return (self.__coins)
def set_coins(self, coins):
"""Wallet's setter
Arguments:
coins {int} -- Wallet of a coin
"""
self.__coins = coins
def set_indicators(self, data):
"""Init indicators's class
Run the class for the first time
Arguments:
data {Dataframe} -- Coin's data
"""
self.indicators = Indicators(self.__name, data)
self.indicators.run()
def update_indicators(self, data):
""" Update indicators's class with new data
Arguments:
data {Dataframe} -- Coin's data
"""
self.indicators.data = data
self.indicators.run()