-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrove.py
115 lines (104 loc) · 4.16 KB
/
trove.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from datetime import datetime, timedelta, UTC
class TroveTime:
@property
def now(self):
return (datetime.now(UTC) - timedelta(hours=11)).replace(microsecond=0)
def get_luxion_rotations(self):
first = datetime(2017, 12, 15, 11, tzinfo=UTC)
elapsed = (self.now - first).total_seconds()
length = 60 * 60 * 24 * 3 # 3 days
cycle = 60 * 60 * 24 * 14 # 14 days
completed = int(elapsed // cycle)
luxion_rotations = {}
luxion_rotations["history"] = [
{
"index": i,
"start": int(first.timestamp() + cycle * i),
"end": int(first.timestamp() + cycle * i + length),
}
for i in range(completed)
]
luxion_rotations["current"] = {
"index": completed,
"start": int(first.timestamp() + cycle * completed),
"end": int(first.timestamp() + cycle * completed + length),
}
luxion_rotations["next"] = {
"index": completed + 1,
"start": int(first.timestamp() + cycle * (completed + 1)),
"end": int(first.timestamp() + cycle * (completed + 1) + length),
}
return luxion_rotations
def get_corruxion_rotations(self):
first = datetime(2020, 12, 4, 11, tzinfo=UTC)
elapsed = (self.now - first).total_seconds()
length = 60 * 60 * 24 * 3 # 3 days
cycle = 60 * 60 * 24 * 14 # 14 days
completed = int(elapsed // cycle)
corruxion_rotations = {}
corruxion_rotations["history"] = [
{
"index": i,
"start": int(first.timestamp() + cycle * i),
"end": int(first.timestamp() + cycle * i + length),
}
for i in range(completed)
]
corruxion_rotations["current"] = {
"index": completed,
"start": int(first.timestamp() + cycle * completed),
"end": int(first.timestamp() + cycle * completed + length),
}
corruxion_rotations["next"] = {
"index": completed + 1,
"start": int(first.timestamp() + cycle * (completed + 1)),
"end": int(first.timestamp() + cycle * (completed + 1) + length),
}
return corruxion_rotations
def get_fluxion_rotations(self):
first = datetime(2023, 7, 18, 11, tzinfo=UTC)
elapsed = (self.now - first).total_seconds()
length = 60 * 60 * 24 * 3 # 3 days
split = 60 * 60 * 24 * 7 # 7 days
cycle = 60 * 60 * 24 * 14 # 14 days
completed = int(elapsed // cycle)
fluxion_rotations = {}
fluxion_rotations["history"] = [
{
"index": i,
"vote_phase": {
"start": int(first.timestamp() + cycle * i),
"end": int(first.timestamp() + cycle * i + length),
},
"buy_phase": {
"start": int(first.timestamp() + cycle * i + split),
"end": int(first.timestamp() + cycle * i + length + split),
},
}
for i in range(completed)
]
fluxion_rotations["current"] = {
"index": completed,
"vote_phase": {
"start": int(first.timestamp() + cycle * completed),
"end": int(first.timestamp() + cycle * completed + length),
},
"buy_phase": {
"start": int(first.timestamp() + cycle * completed + split),
"end": int(first.timestamp() + cycle * completed + length + split),
},
}
fluxion_rotations["next"] = {
"index": completed + 1,
"vote_phase": {
"start": int(first.timestamp() + cycle * (completed + 1)),
"end": int(first.timestamp() + cycle * (completed + 1) + length),
},
"buy_phase": {
"start": int(first.timestamp() + cycle * (completed + 1) + split),
"end": int(
first.timestamp() + cycle * (completed + 1) + length + split
),
},
}
return fluxion_rotations