-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
44 lines (38 loc) · 967 Bytes
/
models.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
from dataclasses import dataclass
from datetime import datetime
from bson import ObjectId
@dataclass
class Order:
_id: ObjectId
type: str
amount: float
price: float
condition: str
created_at: datetime
src_currency: str
dst_currency: str = "usdt"
status: str = "pending"
def to_dict(self):
return {
"type": self.type,
"amount": self.amount,
"price": self.price,
"condition": self.condition,
"status": self.status,
"created_at": self.created_at,
"src_currency": self.src_currency,
"dst_currency": self.dst_currency,
}
@dataclass
class Notification:
type: str
price: float
condition: str
currency: str
def to_dict(self):
return {
"type": self.type,
"price": self.price,
"condition": self.condition,
"currency": self.currency,
}