-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathaccount.py
120 lines (92 loc) · 2.92 KB
/
account.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
116
117
118
119
120
from datetime import datetime, date
from enum import Enum
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
class OverviewRequest(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
json_encoders={date: lambda v: v.strftime("%d/%m/%Y") if v else None},
)
from_date: date
to_date: date
class CashMovements(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
)
balance: dict | None = Field(default=None)
change: float | None = Field(default=None)
currency: str | None = Field(default=None)
date: datetime | None = Field(default=None)
description: str | None = Field(default=None)
id: int | None = Field(default=None)
product_id: int | None = Field(default=None)
type: str | None = Field(default=None)
value_date: datetime | None = Field(default=None)
class AccountOverview(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
)
cash_movements: list[CashMovements] | None = Field(default=None)
class OverviewWrapper(BaseModel):
data: AccountOverview
class Format(str, Enum):
CSV = "csv"
HTML = "html"
PDF = "pdf"
XLS = "xls"
class ReportRequest(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
json_encoders={date: lambda v: v.strftime("%d/%m/%Y") if v else None},
)
country: str
lang: str
format: Format = Field(default=Format.CSV)
from_date: date
to_date: date
int_account: int | None = Field(default=None)
session_id: str | None = Field(default=None)
class Report(BaseModel):
content: str
format: Format
class UpdateOption(str, Enum):
ALERTS = "alerts"
CASH_FUNDS = "cashFunds"
HISTORICAL_ORDERS = "historicalOrders"
ORDERS = "orders"
PORTFOLIO = "portfolio"
TOTAL_PORTFOLIO = "totalPortfolio"
TRANSACTIONS = "transactions"
class UpdateRequest(BaseModel):
option: UpdateOption
last_updated: int = Field(default=0)
class AccountUpdate(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
extra="allow",
populate_by_name=True,
)
alerts: dict | None = Field(default=None)
cash_funds: dict | None = Field(default=None)
historical_orders: dict | None = Field(default=None)
orders: dict | None = Field(default=None)
portfolio: dict | None = Field(default=None)
total_portfolio: dict | None = Field(default=None)
transactions: dict | None = Field(default=None)
class UpcomingPayments(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
extra="allow",
populate_by_name=True,
)
ca_id: str
product: str
description: str
currency: str
amount: str
amount_in_base_curr: str
pay_date: str