xync-client 0.0.25.dev68__tar.gz → 0.0.25.dev69__tar.gz
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-0.0.25.dev68/xync_client.egg-info → xync_client-0.0.25.dev69}/PKG-INFO +1 -1
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/TestEx.py +5 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/Ex.py +5 -8
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BitGet/ex.py +1 -1
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/etype/ad.py +1 -1
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/ex.py +29 -15
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69/xync_client.egg-info}/PKG-INFO +1 -1
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/.env.sample +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/.gitignore +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/README.md +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/makefile +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/pyproject.toml +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/setup.cfg +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/TestAgent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/TestAsset.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/TestOrder.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Binance/test_binance.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Gate/test_gate.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Wallet/test_agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Wallet/test_ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/_test_ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/Asset.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/AuthTrait.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/BaseTest.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/InAgent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Abc/types.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/base.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/etype/ad.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/etype/pm.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/req.mjs +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BingX/sign.js +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Bybit/agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Bybit/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Gate/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/etype/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/etype/cred.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Htx/etype/pm.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/KuCoin/etype/ad.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/KuCoin/etype/pm.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/KuCoin/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Okx/etype/ad.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Okx/etype/pm.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/asset.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/auth.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/ex.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/inAgent.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/pyd.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/__init__.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/loader.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/pm_unifier.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client/pyro.py +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client.egg-info/SOURCES.txt +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -75,6 +75,11 @@ class TestEx(BaseTest):
|
|
|
75
75
|
coin = list(pairs[0][cur])[0]
|
|
76
76
|
ads: list[BaseAd] = await client.ads(coin, cur, False)
|
|
77
77
|
ok = self.is_list_of_objects(ads, BaseAd)
|
|
78
|
+
if not ok: # if no coin buys for this cur, try next cur
|
|
79
|
+
for coen in list(pairs[0][cur])[1:]:
|
|
80
|
+
ads: list[BaseAd] = await client.ads(coen, cur, False)
|
|
81
|
+
if ok := self.is_list_of_objects(ads, BaseAd):
|
|
82
|
+
break
|
|
78
83
|
t, _ = await ExTest.update_or_create({"ok": ok}, ex=client.ex, action=ExAction.ads)
|
|
79
84
|
assert t.ok, "No ads"
|
|
80
85
|
logging.info(f"{client.ex.name}: {ExAction.ads.name} - ok")
|
|
@@ -13,6 +13,7 @@ from xync_client.pm_unifier import PmUnifier, PmUni
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class BaseExClient(BaseClient):
|
|
16
|
+
cur_map: dict[int, str] = {}
|
|
16
17
|
unifier_class: type = PmUnifier
|
|
17
18
|
|
|
18
19
|
@abstractmethod
|
|
@@ -66,8 +67,8 @@ class BaseExClient(BaseClient):
|
|
|
66
67
|
# Curs
|
|
67
68
|
cur_pyds: dict[str, CurEx] = await self.curs()
|
|
68
69
|
curs: dict[int | str, models.Cur] = {
|
|
69
|
-
|
|
70
|
-
for
|
|
70
|
+
exid: (await models.Cur.update_or_create({"rate": cur_pyd.rate}, ticker=cur_pyd.ticker))[0]
|
|
71
|
+
for exid, cur_pyd in cur_pyds.items()
|
|
71
72
|
}
|
|
72
73
|
curexs = [
|
|
73
74
|
models.Curex(**c.model_dump(exclude_none=True), cur=curs[c.exid], ex=self.ex) for c in cur_pyds.values()
|
|
@@ -79,14 +80,10 @@ class BaseExClient(BaseClient):
|
|
|
79
80
|
|
|
80
81
|
countries = await self.countries()
|
|
81
82
|
|
|
82
|
-
cur_map = {
|
|
83
|
-
172: "CNY",
|
|
84
|
-
8: "KRW",
|
|
85
|
-
25: "MMK",
|
|
86
|
-
}
|
|
87
83
|
for c in countries:
|
|
88
84
|
if c.cur_id not in curs:
|
|
89
|
-
cur, _ = await models.Cur.get_or_create(ticker=cur_map[c.cur_id])
|
|
85
|
+
cur, _ = await models.Cur.get_or_create(ticker=self.cur_map[c.cur_id])
|
|
86
|
+
curs[cur.id] = cur
|
|
90
87
|
c.cur_id = cur.id
|
|
91
88
|
c.cur_id = curs[c.cur_id].id
|
|
92
89
|
# Country preparing
|
|
@@ -21,8 +21,15 @@ class ExClient(BaseExClient):
|
|
|
21
21
|
"SBP - Fast Bank Transfer": "SBP",
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
cur_map = {
|
|
25
|
+
# 1: "CNY",
|
|
26
|
+
8: "KRW",
|
|
27
|
+
25: "MMK",
|
|
28
|
+
}
|
|
24
29
|
unifier_class = BingUnifier
|
|
25
30
|
|
|
31
|
+
_data: dict = {}
|
|
32
|
+
|
|
26
33
|
def pm_type_map(self, typ: models.Pmex) -> str:
|
|
27
34
|
pass
|
|
28
35
|
|
|
@@ -73,7 +80,7 @@ class ExClient(BaseExClient):
|
|
|
73
80
|
5: PmType.IFSC,
|
|
74
81
|
}
|
|
75
82
|
|
|
76
|
-
pms: list[pm.Resp] = [convert(p, pm.Resp) for p in (await self.
|
|
83
|
+
pms: list[pm.Resp] = [convert(p, pm.Resp) for p in (await self.data)["payMethod"]]
|
|
77
84
|
|
|
78
85
|
pmsd = {
|
|
79
86
|
p.payMethodId: PmEx(
|
|
@@ -90,7 +97,7 @@ class ExClient(BaseExClient):
|
|
|
90
97
|
# 21: Get all: currency,pay,allCountry,coin
|
|
91
98
|
async def curs(self) -> dict[int, types.CurEx]:
|
|
92
99
|
self.session.headers["client-type"] = "web"
|
|
93
|
-
curs: list[dict] = (await self.
|
|
100
|
+
curs: list[dict] = (await self.data)["currency"]
|
|
94
101
|
cmap: dict[str, int] = {c["nameShort"]: c["currencyId"] for c in curs}
|
|
95
102
|
res = (await self._get("/-/x/otc/v1/trade/fast/config/list?side=sell&tradeMode=c2c_simple"))["data"]
|
|
96
103
|
cursd: dict[str, float] = {}
|
|
@@ -101,53 +108,60 @@ class ExClient(BaseExClient):
|
|
|
101
108
|
|
|
102
109
|
# 22: Список платежных методов по каждой валюте
|
|
103
110
|
async def cur_pms_map(self) -> dict[int, set[int]]:
|
|
104
|
-
res = await self.
|
|
111
|
+
res = await self.data
|
|
105
112
|
wrong_pms = {4, 34, 498, 548, 20009, 20010} # , 212, 239, 363 # these ids not exist in pms
|
|
106
113
|
return {c["currencyId"]: set(c["supportPayments"]) - wrong_pms for c in res["currency"] if c["supportPayments"]}
|
|
107
114
|
|
|
108
115
|
# 23: Список торгуемых монет
|
|
109
116
|
async def coins(self) -> dict[int, types.CoinEx]:
|
|
110
117
|
self.session.headers["client-type"] = "web"
|
|
111
|
-
coins: list[dict] = (await self.
|
|
112
|
-
cmap: dict[str, int] = {c["coinCode"]: c["coinId"] for c in coins}
|
|
118
|
+
coins: list[dict] = (await self.data)["coin"]
|
|
113
119
|
res = (await self._get("/-/x/otc/v1/trade/fast/config/list?side=buy&tradeMode=c2c_simple"))["data"]
|
|
114
120
|
coinsl: list[str] = [c["cryptoAsset"]["name"] for c in res]
|
|
115
|
-
return {
|
|
121
|
+
return {
|
|
122
|
+
c["coinId"]: types.CoinEx(exid=c["coinId"], ticker=c["coinCode"], scale=c["showPrecision"])
|
|
123
|
+
for c in coins
|
|
124
|
+
if c["coinCode"] in coinsl
|
|
125
|
+
}
|
|
116
126
|
|
|
117
127
|
# 99: Страны
|
|
118
128
|
async def countries(self) -> list[Country]:
|
|
119
129
|
cmap = {
|
|
120
130
|
"Kazakstan": "Kazakhstan",
|
|
121
131
|
}
|
|
122
|
-
res = await self.
|
|
132
|
+
res = await self.data
|
|
123
133
|
cts = [
|
|
124
134
|
Country(
|
|
125
135
|
id=c["countryId"],
|
|
126
136
|
code=c["code"],
|
|
127
137
|
name=cmap.get(ct := name[:-1] if (name := c["name"].split(",")[0]).endswith(".") else name, ct),
|
|
128
138
|
short=c["appShort"],
|
|
129
|
-
cur_id=c["currencyId"],
|
|
139
|
+
cur_id=c["currencyId"] if c["currencyId"] != 1 else 172,
|
|
130
140
|
)
|
|
131
141
|
for c in res["country"]
|
|
132
142
|
]
|
|
133
143
|
return cts
|
|
134
144
|
|
|
135
145
|
# Get all: currency,pay,allCountry,coin
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
@property
|
|
147
|
+
async def data(self) -> (dict, dict, dict, dict):
|
|
148
|
+
self._data = (
|
|
149
|
+
self._data or (await self._get("/-/x/otc/v1/data/config-list?type=currency,pay,coin,allCountry"))["data"]
|
|
150
|
+
)
|
|
151
|
+
return self._data
|
|
141
152
|
|
|
142
153
|
|
|
143
154
|
async def main():
|
|
144
155
|
_ = await init_db(PG_DSN, models, True)
|
|
145
156
|
ex = await Ex.get(name="Htx")
|
|
146
157
|
cl = ExClient(ex)
|
|
147
|
-
await cl.
|
|
148
|
-
await cl.pms()
|
|
158
|
+
_ads = await cl.ads(2, 11, True)
|
|
149
159
|
await cl.set_pmcurexs()
|
|
150
160
|
await cl.set_coinexs()
|
|
161
|
+
_cr = await cl.curs()
|
|
162
|
+
_cn = await cl.coins()
|
|
163
|
+
await cl.set_pairs()
|
|
164
|
+
_pms = await cl.pms()
|
|
151
165
|
await cl.close()
|
|
152
166
|
|
|
153
167
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Binance/test_binance.py
RENAMED
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Bybit/test_bybit.py
RENAMED
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Bybit/test_bybit_p2p.py
RENAMED
|
File without changes
|
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Htx/test_htx_p2p.py
RENAMED
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/tests/_todo_refact/Wallet/test_agent.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xync_client-0.0.25.dev68 → xync_client-0.0.25.dev69}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|