xync-client 0.0.141__py3-none-any.whl → 0.0.156.dev18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xync_client/Abc/AdLoader.py +5 -0
- xync_client/Abc/Agent.py +354 -8
- xync_client/Abc/Ex.py +432 -25
- xync_client/Abc/HasAbotUid.py +10 -0
- xync_client/Abc/InAgent.py +0 -11
- xync_client/Abc/PmAgent.py +34 -26
- xync_client/Abc/xtype.py +57 -3
- xync_client/Bybit/InAgent.py +233 -409
- xync_client/Bybit/agent.py +844 -777
- xync_client/Bybit/etype/__init__.py +0 -0
- xync_client/Bybit/etype/ad.py +54 -86
- xync_client/Bybit/etype/cred.py +29 -9
- xync_client/Bybit/etype/order.py +75 -103
- xync_client/Bybit/ex.py +35 -48
- xync_client/Gmail/__init__.py +119 -98
- xync_client/Htx/agent.py +213 -40
- xync_client/Htx/etype/ad.py +40 -16
- xync_client/Htx/etype/order.py +194 -0
- xync_client/Htx/ex.py +17 -19
- xync_client/Mexc/agent.py +268 -0
- xync_client/Mexc/api.py +1255 -0
- xync_client/Mexc/etype/ad.py +52 -1
- xync_client/Mexc/etype/order.py +354 -0
- xync_client/Mexc/ex.py +34 -22
- xync_client/Okx/1.py +14 -0
- xync_client/Okx/agent.py +39 -0
- xync_client/Okx/ex.py +8 -8
- xync_client/Pms/Payeer/agent.py +396 -0
- xync_client/Pms/Payeer/login.py +1 -59
- xync_client/Pms/Payeer/trade.py +58 -0
- xync_client/Pms/Volet/__init__.py +82 -63
- xync_client/Pms/Volet/api.py +5 -4
- xync_client/loader.py +2 -0
- xync_client/pm_unifier.py +1 -1
- {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/METADATA +5 -1
- {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/RECORD +38 -29
- xync_client/Pms/Payeer/__init__.py +0 -253
- xync_client/Pms/Payeer/api.py +0 -25
- {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/WHEEL +0 -0
- {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/top_level.txt +0 -0
xync_client/Abc/xtype.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseModel, model_validator
|
|
3
|
+
from pydantic import BaseModel, model_validator, model_serializer
|
|
4
4
|
from x_model.types import BaseUpd
|
|
5
5
|
from xync_schema.enums import PmType
|
|
6
|
-
from xync_schema.models import Country, Pm, Ex
|
|
6
|
+
from xync_schema.models import Country, Pm, Ex, CredEx
|
|
7
7
|
from xync_schema.xtype import PmExBank
|
|
8
8
|
|
|
9
9
|
from xync_client.pm_unifier import PmUni
|
|
@@ -14,6 +14,28 @@ FlatDict = dict[int | str, str]
|
|
|
14
14
|
MapOfIdsList = dict[int | str, list[int | str]]
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
class RemapBase(BaseModel):
|
|
18
|
+
# Переопределяешь это в наследнике:
|
|
19
|
+
_remap: dict[str, dict] = {}
|
|
20
|
+
|
|
21
|
+
@model_validator(mode="before")
|
|
22
|
+
def _map_in(cls, data):
|
|
23
|
+
data = dict(data)
|
|
24
|
+
for field, mapping in cls._remap.items():
|
|
25
|
+
if field in data:
|
|
26
|
+
data[field] = mapping.get(data[field], data[field])
|
|
27
|
+
return data
|
|
28
|
+
|
|
29
|
+
@model_serializer
|
|
30
|
+
def _map_out(self):
|
|
31
|
+
data = self.__dict__.copy()
|
|
32
|
+
for field, mapping in self._remap.items():
|
|
33
|
+
reverse = {v: k for k, v in mapping.items()}
|
|
34
|
+
if field in data:
|
|
35
|
+
data[field] = reverse.get(data[field], data[field])
|
|
36
|
+
return data
|
|
37
|
+
|
|
38
|
+
|
|
17
39
|
class PmTrait:
|
|
18
40
|
typ: PmType | None = None
|
|
19
41
|
logo: str | None = None
|
|
@@ -53,7 +75,9 @@ class BaseOrderReq(BaseModel):
|
|
|
53
75
|
asset_amount: float | None = None
|
|
54
76
|
fiat_amount: float | None = None
|
|
55
77
|
|
|
56
|
-
|
|
78
|
+
pmex_exid: str = None # int
|
|
79
|
+
|
|
80
|
+
# todo: mv from base to special ex class
|
|
57
81
|
amount_is_fiat: bool = True
|
|
58
82
|
is_sell: bool = None
|
|
59
83
|
cur_exid: int | str = None
|
|
@@ -106,3 +130,33 @@ class BaseCad(BaseAdUpdate):
|
|
|
106
130
|
side: Literal[0, 1] # 0 - покупка, 1 - продажа
|
|
107
131
|
tokenId: str
|
|
108
132
|
userId: str
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class GetAds(BaseModel):
|
|
136
|
+
coin_id: int | str
|
|
137
|
+
cur_id: int | str
|
|
138
|
+
is_sell: bool
|
|
139
|
+
pm_ids: list[int | str] = []
|
|
140
|
+
amount: int | None = None
|
|
141
|
+
vm_only: bool = False
|
|
142
|
+
limit: int = 20
|
|
143
|
+
page: int = 1
|
|
144
|
+
# todo: add?
|
|
145
|
+
# canTrade: bool = False
|
|
146
|
+
# userId: str = "" # int
|
|
147
|
+
# verificationFilter
|
|
148
|
+
kwargs: dict = {}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class AdUpd(BaseAdUpdate, GetAds):
|
|
152
|
+
price: float
|
|
153
|
+
pm_ids: list[int | str]
|
|
154
|
+
amount: float
|
|
155
|
+
max_amount: float | None = None
|
|
156
|
+
premium: float | None = None
|
|
157
|
+
credexs: list[CredEx] | None = None
|
|
158
|
+
quantity: float | None = None
|
|
159
|
+
cond: str | None = None
|
|
160
|
+
|
|
161
|
+
class Config:
|
|
162
|
+
arbitrary_types_allowed = True
|