xync-client 0.0.43.dev4__tar.gz → 0.0.43.dev11__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.43.dev4/xync_client.egg-info → xync_client-0.0.43.dev11}/PKG-INFO +1 -1
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/TestAgent.py +2 -2
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/Ex.py +3 -1
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitGet/ex.py +2 -1
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/agent.py +69 -7
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/etype/ad.py +13 -8
- xync_client-0.0.43.dev11/xync_client/Bybit/etype/cred.py +60 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/agent.py +34 -5
- xync_client-0.0.43.dev11/xync_client/Htx/etype/test.py +33 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/ex.py +9 -1
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11/xync_client.egg-info}/PKG-INFO +1 -1
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client.egg-info/SOURCES.txt +2 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/.env.sample +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/.gitignore +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/README.md +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/makefile +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/pyproject.toml +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/setup.cfg +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/TestAsset.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/TestEx.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/TestOrder.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Binance/test_binance.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Gate/test_gate.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Wallet/test_agent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Wallet/test_ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/_test_ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/Asset.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/AuthTrait.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/BaseTest.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/InAgent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Abc/types.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/agent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/base.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/req.mjs +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BingX/sign.js +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitGet/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/BitPapa/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/InAgent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/etype/order.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Bybit/ws.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Gate/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Gate/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/etype/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/etype/cred.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Htx/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/KuCoin/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/KuCoin/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/KuCoin/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Mexc/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Mexc/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Mexc/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Okx/etype/ad.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Okx/etype/pm.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Pms/Volet/_todo_req/req.mjs +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Pms/Volet/_todo_req/req.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Pms/Volet/api.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Pms/Volet/volet.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/asset.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/auth.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/inAgent.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/pyd.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/__init__.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/loader.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/pm_unifier.py +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -33,9 +33,9 @@ class TestAgent(BaseTest):
|
|
|
33
33
|
# 26
|
|
34
34
|
async def test_cred_new(self, clients: list[tuple[BaseAgentClient, BaseAgentClient]]):
|
|
35
35
|
for maker, taker in clients:
|
|
36
|
-
pmcur = await Pmcur.filter(pm__pmexs__ex=taker.ex, cur__ticker="RUB", pm__norm="
|
|
36
|
+
pmcur = await Pmcur.filter(pm__pmexs__ex=taker.ex, cur__ticker="RUB", pm__norm="payeer").first()
|
|
37
37
|
cred = await Cred.create(person_id=taker.actor.person_id, name="Tst", detail="79990001234", pmcur=pmcur)
|
|
38
|
-
await cred.banks.add(await PmexBank.get(exid="mts"), await PmexBank.get(exid="sberbankru"))
|
|
38
|
+
# await cred.banks.add(await PmexBank.get(exid="mts"), await PmexBank.get(exid="sberbankru"))
|
|
39
39
|
cred_new: CredEx = await taker.cred_new(cred)
|
|
40
40
|
ok = isinstance(cred_new, CredEx)
|
|
41
41
|
t, _ = await TestEx.update_or_create({"ok": ok}, ex=taker.ex, action=ExAction.cred_new)
|
|
@@ -73,7 +73,9 @@ class BaseExClient(BaseClient):
|
|
|
73
73
|
return []
|
|
74
74
|
|
|
75
75
|
# Импорт Pm-ов (с Pmcur-, Pmex- и Pmcurex-ами) и валют (с Curex-ами) с биржи в бд
|
|
76
|
-
async def set_pmcurexs(self):
|
|
76
|
+
async def set_pmcurexs(self, cookies: dict = None):
|
|
77
|
+
if cookies:
|
|
78
|
+
self.session.cookie_jar.update_cookies(cookies)
|
|
77
79
|
# Curs
|
|
78
80
|
cur_pyds: dict[str, CurEx] = await self.curs()
|
|
79
81
|
curs: dict[int | str, models.Cur] = {
|
|
@@ -23,7 +23,8 @@ class ExClient(BaseExClient):
|
|
|
23
23
|
"Banque du Developpement Local BDL": "Banque de développement local (BDL)",
|
|
24
24
|
"ADCB Abu Dhabi Commercial Bank": "ADCB",
|
|
25
25
|
"BDO": "Banco De Oro (BDO)",
|
|
26
|
-
"Touch 'n Go": "Touch n Go"
|
|
26
|
+
"Touch 'n Go": "Touch n Go",
|
|
27
|
+
"LINE Bank by Hana Bank": "LINE Pay"
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
unifier_class = BitGetUnifier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from asyncio import run
|
|
1
|
+
from asyncio import run, sleep
|
|
2
2
|
from enum import IntEnum
|
|
3
|
-
from
|
|
3
|
+
from http.client import HTTPException
|
|
4
4
|
|
|
5
5
|
import pyotp
|
|
6
6
|
from bybit_p2p import P2P
|
|
@@ -12,7 +12,8 @@ from xync_schema.models import Cur, Actor
|
|
|
12
12
|
|
|
13
13
|
from xync_client.Abc.Agent import BaseAgentClient
|
|
14
14
|
from xync_client.Abc.types import BaseOrderReq
|
|
15
|
-
from xync_client.Bybit.etype.ad import AdPostRequest, AdUpdateRequest, AdDeleteRequest
|
|
15
|
+
from xync_client.Bybit.etype.ad import AdPostRequest, AdUpdateRequest, AdDeleteRequest, Ad
|
|
16
|
+
from xync_client.Bybit.etype.cred import CredEpyd
|
|
16
17
|
from xync_client.Bybit.etype.order import OrderRequest, PreOrderResp, OrderResp, CancelOrderReq
|
|
17
18
|
from xync_client.loader import PG_DSN
|
|
18
19
|
|
|
@@ -92,8 +93,42 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
92
93
|
return fiat
|
|
93
94
|
return list_methods[1]
|
|
94
95
|
|
|
95
|
-
def creds(self):
|
|
96
|
+
def creds(self) -> list[CredEpyd]:
|
|
96
97
|
data = self.api.get_user_payment_types()
|
|
98
|
+
if data["ret_code"] > 0:
|
|
99
|
+
return data
|
|
100
|
+
return [CredEpyd.model_validate(credex) for credex in data["result"]]
|
|
101
|
+
|
|
102
|
+
async def cred_epyd2db(self, cred: CredEpyd) -> models.CredEx:
|
|
103
|
+
if cred.paymentType not in (416,):
|
|
104
|
+
if not (
|
|
105
|
+
pmex := await models.Pmex.get_or_none(exid=cred.paymentType, ex=self.ex_client.ex).prefetch_related(
|
|
106
|
+
"pm__curs"
|
|
107
|
+
)
|
|
108
|
+
):
|
|
109
|
+
raise HTTPException(f"No Pmex {cred.paymentType} on ex#{self.ex_client.ex.name}", 404)
|
|
110
|
+
curs = cred.currencyBalance or {c.ticker for c in pmex.pm.curs}
|
|
111
|
+
if not (pmcurs := await models.Pmcur.filter(cur__ticker__in=curs, pm_id=pmex.pm_id)):
|
|
112
|
+
raise HTTPException(f"No Pmcur with cur#{cred.currencyBalance} and pm#{cred.paymentType}", 404)
|
|
113
|
+
if not (person := await models.Person.get_or_none(actors__exid=self.actor.exid)):
|
|
114
|
+
raise HTTPException(f"No Pmcur with cur#{cred.currencyBalance} and pm#{cred.paymentType}", 404)
|
|
115
|
+
dct = {
|
|
116
|
+
"pmcur_id": pmcurs[0].id,
|
|
117
|
+
"name": cred.paymentConfigVo.paymentName,
|
|
118
|
+
"person_id": person.id,
|
|
119
|
+
} # todo: WTD with multicur pms?
|
|
120
|
+
cred_in = models.Cred.validate(dct, False)
|
|
121
|
+
cred_db, _ = await models.Cred.update_or_create(**cred_in.df_unq())
|
|
122
|
+
credex_in = models.CredEx.validate({"exid": cred.paymentType, "cred_id": cred_db.id, "ex_id": self.ex.id})
|
|
123
|
+
credex_db, _ = await models.CredEx.update_or_create(**credex_in.df_unq())
|
|
124
|
+
return credex_db
|
|
125
|
+
|
|
126
|
+
# 25: Список реквизитов моих платежных методов
|
|
127
|
+
async def set_creds(self) -> list[models.CredEx]:
|
|
128
|
+
credexs_epyd: list[CredEpyd] = self.creds()
|
|
129
|
+
credexs: list[models.CredEx] = [await self.cred_epyd2db(f) for f in credexs_epyd]
|
|
130
|
+
return credexs
|
|
131
|
+
|
|
97
132
|
return data["result"] if data["ret_code"] == 0 else data
|
|
98
133
|
|
|
99
134
|
async def ott(self):
|
|
@@ -127,6 +162,12 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
127
162
|
res = await self._post("/fiat/otc/maker/work-config/switch", data)
|
|
128
163
|
return res
|
|
129
164
|
|
|
165
|
+
async def ads(self, coin: models.Coin, cur: models.Cur, is_sell: bool, pms: list[models.Pm]) -> list[Ad]:
|
|
166
|
+
coinex = await models.Coinex.get(ex=self.ex, coin=coin)
|
|
167
|
+
curex = await models.Curex.get(ex=self.ex, cur=cur)
|
|
168
|
+
pmexs = await models.Pmex.filter(ex=self.ex, pm_id__in=[pm.id for pm in pms])
|
|
169
|
+
return await self.ex_client.ads(coinex.exid, curex.exid, is_sell, [pmex.exid for pmex in pmexs])
|
|
170
|
+
|
|
130
171
|
def online_ads(self) -> str:
|
|
131
172
|
online = self._get("/fiat/otc/maker/work-config/get")
|
|
132
173
|
return online["result"]["workStatus"]
|
|
@@ -188,7 +229,8 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
188
229
|
return data["result"]["itemId"] if data["ret_code"] == 0 else data
|
|
189
230
|
|
|
190
231
|
def ad_upd(self, upd: AdUpdateRequest):
|
|
191
|
-
|
|
232
|
+
params = upd.model_dump()
|
|
233
|
+
data = self.api.update_ad(**params)
|
|
192
234
|
return data["result"] if data["ret_code"] == 0 else data
|
|
193
235
|
|
|
194
236
|
def get_security_token_update(self) -> str:
|
|
@@ -303,6 +345,18 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
303
345
|
},
|
|
304
346
|
)
|
|
305
347
|
|
|
348
|
+
async def battle(self, coin: models.Coin, cur: models.Cur, is_sell: bool, pms: list[models.Pm], place: int = 1):
|
|
349
|
+
while self.actor.person.user.status > 0:
|
|
350
|
+
ads: list[Ad] = await self.ads(coin, cur, is_sell, pms)
|
|
351
|
+
cur_plc = [i for i, ad in enumerate(ads) if int(ad.accountId) == self.actor.exid][0]
|
|
352
|
+
if cur_plc > place:
|
|
353
|
+
mad: Ad = ads[cur_plc]
|
|
354
|
+
mad.price = str(float(ads[place].price) - 0.01 * (-1) ** int(is_sell))
|
|
355
|
+
req = AdUpdateRequest.model_validate(mad.model_dump())
|
|
356
|
+
res = self.ad_upd(req)
|
|
357
|
+
print(res)
|
|
358
|
+
await sleep(5)
|
|
359
|
+
|
|
306
360
|
|
|
307
361
|
def listen(data: dict):
|
|
308
362
|
print(data)
|
|
@@ -310,16 +364,24 @@ def listen(data: dict):
|
|
|
310
364
|
|
|
311
365
|
async def main():
|
|
312
366
|
_ = await init_db(PG_DSN, models, True)
|
|
313
|
-
actor =
|
|
367
|
+
actor = (
|
|
368
|
+
await models.Actor.filter(ex_id=9, agent__isnull=False).prefetch_related("ex", "agent", "person__user").first()
|
|
369
|
+
)
|
|
314
370
|
cl: AgentClient = actor.client()
|
|
315
371
|
coin = await models.Coin.get(ticker="USDT")
|
|
372
|
+
cur = await models.Cur.get(ticker="RUB")
|
|
373
|
+
volet = await models.Pm.get(norm="volet")
|
|
374
|
+
# await cl.ex_client.set_pmcurexs(cookies=actor.agent.auth["cookies"]) 607 -> 629
|
|
375
|
+
await cl.set_creds()
|
|
376
|
+
await cl.battle(coin, cur, False, [volet], 1)
|
|
377
|
+
|
|
316
378
|
bor = BaseOrderReq(
|
|
317
379
|
ad_id="1861440060199632896",
|
|
318
380
|
# asset_amount=40,
|
|
319
381
|
fiat_amount=3000,
|
|
320
382
|
amount_is_fiat=True,
|
|
321
383
|
is_sell=False,
|
|
322
|
-
cur_exid=
|
|
384
|
+
cur_exid=cur.ticker,
|
|
323
385
|
coin_exid=coin.ticker,
|
|
324
386
|
coin_scale=coin.scale,
|
|
325
387
|
)
|
|
@@ -5,6 +5,12 @@ from xync_schema.types import BaseAd
|
|
|
5
5
|
from xync_client.Abc.types import BaseAdUpdate
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
class AdsReq(BaseModel):
|
|
9
|
+
tokenId: str
|
|
10
|
+
currencyId: str
|
|
11
|
+
side: Literal["0", "1"] # 0 покупка, # 1 продажа
|
|
12
|
+
|
|
13
|
+
|
|
8
14
|
class Currency(BaseModel):
|
|
9
15
|
currencyId: str
|
|
10
16
|
exchangeId: str
|
|
@@ -93,15 +99,14 @@ class Ad(BaseAd):
|
|
|
93
99
|
payments: List[str]
|
|
94
100
|
premium: str
|
|
95
101
|
price: str
|
|
96
|
-
priceType: int
|
|
102
|
+
priceType: Literal[0, 1] # 0 - fix rate, 1 - floating status: int
|
|
97
103
|
quantity: str
|
|
98
104
|
recentExecuteRate: int
|
|
99
105
|
recentOrderNum: int
|
|
100
106
|
recommend: bool
|
|
101
107
|
recommendTag: str
|
|
102
108
|
remark: str
|
|
103
|
-
side:
|
|
104
|
-
status: int
|
|
109
|
+
side: Literal[0, 1] # 0 - покупка, 1 - продажа
|
|
105
110
|
symbolInfo: SymbolInfo
|
|
106
111
|
tokenId: str
|
|
107
112
|
tokenName: str
|
|
@@ -118,22 +123,22 @@ class Ad(BaseAd):
|
|
|
118
123
|
class AdPostRequest(BaseModel):
|
|
119
124
|
tokenId: str
|
|
120
125
|
currencyId: str
|
|
121
|
-
side: Literal[
|
|
122
|
-
priceType: Literal[
|
|
126
|
+
side: Literal[0, 1] # 0 - покупка, 1 - продажа
|
|
127
|
+
priceType: Literal[0, 1] # 0 - fix rate, 1 - floating
|
|
123
128
|
premium: str
|
|
124
129
|
price: str
|
|
125
130
|
minAmount: str
|
|
126
131
|
maxAmount: str
|
|
127
132
|
remark: str
|
|
128
|
-
tradingPreferenceSet:
|
|
133
|
+
tradingPreferenceSet: TradingPreferenceSet
|
|
129
134
|
paymentIds: list[str]
|
|
130
135
|
quantity: str
|
|
131
|
-
paymentPeriod:
|
|
136
|
+
paymentPeriod: int
|
|
132
137
|
itemType: str
|
|
133
138
|
|
|
134
139
|
|
|
135
140
|
class AdUpdateRequest(AdPostRequest, BaseAdUpdate):
|
|
136
|
-
actionType: Literal["MODIFY", "ACTIVE"]
|
|
141
|
+
actionType: Literal["MODIFY", "ACTIVE"] = "MODIFY"
|
|
137
142
|
|
|
138
143
|
|
|
139
144
|
class AdDeleteRequest(BaseModel):
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from xync_client.Abc.types import CredExOut
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PaymentItem(BaseModel):
|
|
9
|
+
view: bool
|
|
10
|
+
name: str
|
|
11
|
+
label: str
|
|
12
|
+
placeholder: str
|
|
13
|
+
type: str
|
|
14
|
+
maxLength: str
|
|
15
|
+
required: bool
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PaymentConfigVo(BaseModel):
|
|
19
|
+
paymentType: str
|
|
20
|
+
checkType: int
|
|
21
|
+
sort: int
|
|
22
|
+
paymentName: str
|
|
23
|
+
addTips: str
|
|
24
|
+
itemTips: str
|
|
25
|
+
online: Literal[0, 1] # Non-balance coin purchase (0 Offline), balance coin purchase (1 Online)
|
|
26
|
+
items: list[PaymentItem]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CredEpyd(CredExOut):
|
|
30
|
+
id: str # int
|
|
31
|
+
realName: str
|
|
32
|
+
paymentType: int # int
|
|
33
|
+
bankName: str
|
|
34
|
+
branchName: str
|
|
35
|
+
accountNo: str
|
|
36
|
+
qrcode: str
|
|
37
|
+
visible: int
|
|
38
|
+
payMessage: str
|
|
39
|
+
firstName: str
|
|
40
|
+
lastName: str
|
|
41
|
+
secondLastName: str
|
|
42
|
+
clabe: str
|
|
43
|
+
debitCardNumber: str
|
|
44
|
+
mobile: str
|
|
45
|
+
businessName: str
|
|
46
|
+
concept: str
|
|
47
|
+
online: str
|
|
48
|
+
countNo: str
|
|
49
|
+
paymentExt1: str
|
|
50
|
+
paymentExt2: str
|
|
51
|
+
paymentExt3: str
|
|
52
|
+
paymentExt4: str
|
|
53
|
+
paymentExt5: str
|
|
54
|
+
paymentExt6: str
|
|
55
|
+
paymentTemplateVersion: int
|
|
56
|
+
hasPaymentTemplateChanged: bool
|
|
57
|
+
paymentConfigVo: PaymentConfigVo
|
|
58
|
+
realNameVerified: bool
|
|
59
|
+
channel: str
|
|
60
|
+
currencyBalance: list[str]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from x_client.aiohttp import Client
|
|
2
2
|
from xync_schema.enums import AdStatus, PmType, OrderStatus
|
|
3
|
-
from xync_schema.models import Pm, Coin, Cur, Ad,
|
|
4
|
-
from xync_schema.pydantic import FiatNew
|
|
3
|
+
from xync_schema.models import Pm, Coin, Cur, Ad, Order
|
|
5
4
|
|
|
6
5
|
from xync_client.Abc.Agent import BaseAgentClient
|
|
6
|
+
from xync_client.Htx.etype import test
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
url_ads_req = "https://otc-cf.huobi.com/v1/data/trade-market"
|
|
9
10
|
url_ads_web = "https://www.huobi.com/en-us/fiat-crypto/trade/"
|
|
@@ -17,7 +18,13 @@ class Public(Client):
|
|
|
17
18
|
url_ads_web = "https://www.huobi.com/en-us/fiat-crypto/trade/"
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class
|
|
21
|
+
class AgentClient(BaseAgentClient):
|
|
22
|
+
async def creds(self) -> list[test.CredEpyd]:
|
|
23
|
+
resp = await self._get("/-/x/otc/v1/user/receipt-account")
|
|
24
|
+
return [test.CredEpyd(**cred) for cred in resp["data"]]
|
|
25
|
+
|
|
26
|
+
async def cred_del(self, cred_id: int) -> int: ...
|
|
27
|
+
|
|
21
28
|
# 0
|
|
22
29
|
async def get_orders(
|
|
23
30
|
self, stauts: OrderStatus = OrderStatus.created, coin: Coin = None, cur: Cur = None, is_sell: bool = None
|
|
@@ -30,8 +37,8 @@ class Private(BaseAgentClient):
|
|
|
30
37
|
async def my_fiats(self, cur: Cur = None) -> list[dict]:
|
|
31
38
|
pass
|
|
32
39
|
|
|
33
|
-
async def fiat_new(self, fiat: FiatNew) -> Fiat.pyd():
|
|
34
|
-
|
|
40
|
+
# async def fiat_new(self, fiat: FiatNew) -> Fiat.pyd():
|
|
41
|
+
# pass
|
|
35
42
|
|
|
36
43
|
async def fiat_upd(self, detail: str = None, typ: PmType = None) -> bool:
|
|
37
44
|
pass
|
|
@@ -114,3 +121,25 @@ class Private(BaseAgentClient):
|
|
|
114
121
|
url_my_ad = "https://www.huobi.com/-/x/otc/v1/otc/trade/" # + id
|
|
115
122
|
url_my_bals = "https://www.huobi.com/-/x/otc/v1/capital/balance"
|
|
116
123
|
url_paccs = "https://www.huobi.com/-/x/otc/v1/user/receipt-account"
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
async def _test():
|
|
127
|
+
from x_model import init_db
|
|
128
|
+
from xync_client.loader import PG_DSN
|
|
129
|
+
from xync_schema import models
|
|
130
|
+
|
|
131
|
+
_ = await init_db(PG_DSN, models, True)
|
|
132
|
+
actor = (
|
|
133
|
+
await models.Actor.filter(ex_id=15, agent__isnull=False).prefetch_related("ex", "agent", "person__user").first()
|
|
134
|
+
)
|
|
135
|
+
cl: AgentClient = actor.client()
|
|
136
|
+
await cl.creds()
|
|
137
|
+
await models.Coin.get(ticker="USDT")
|
|
138
|
+
await models.Cur.get(ticker="RUB")
|
|
139
|
+
await cl.close()
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if __name__ == "__main__":
|
|
143
|
+
from asyncio import run
|
|
144
|
+
|
|
145
|
+
run(_test())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from typing import List, Optional, Dict, Any
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
from xync_client.Abc.types import CredExOut
|
|
4
|
+
|
|
5
|
+
class ModelField(BaseModel):
|
|
6
|
+
fieldId: str
|
|
7
|
+
name: str
|
|
8
|
+
fieldType: str
|
|
9
|
+
index: int
|
|
10
|
+
maxLength: int
|
|
11
|
+
required: bool
|
|
12
|
+
copyable: bool
|
|
13
|
+
remindWord: str
|
|
14
|
+
valueType: str
|
|
15
|
+
value: str
|
|
16
|
+
|
|
17
|
+
class CredEpyd(CredExOut):
|
|
18
|
+
id: int
|
|
19
|
+
uid: int
|
|
20
|
+
userName: str
|
|
21
|
+
bankType: int
|
|
22
|
+
bankNumber: str
|
|
23
|
+
bankName: str
|
|
24
|
+
bankAddress: Optional[str] = None
|
|
25
|
+
qrCode: Optional[str] = None
|
|
26
|
+
isShow: int
|
|
27
|
+
buyingEnable: bool
|
|
28
|
+
sellingEnable: bool
|
|
29
|
+
disabledCurrencyList: List[int]
|
|
30
|
+
modelFields: str
|
|
31
|
+
modelFieldsList: List[ModelField]
|
|
32
|
+
color: str
|
|
33
|
+
payMethodName: str
|
|
@@ -19,9 +19,17 @@ from xync_client.loader import PG_DSN
|
|
|
19
19
|
from xync_client.Abc.Ex import BaseExClient
|
|
20
20
|
from xync_client.Abc.Base import MapOfIdsList
|
|
21
21
|
from xync_client.TgWallet.auth import AuthClient
|
|
22
|
-
|
|
22
|
+
from xync_client.pm_unifier import PmUnifier
|
|
23
23
|
|
|
24
24
|
class ExClient(BaseExClient, AuthClient):
|
|
25
|
+
class TgWalletUnifier(PmUnifier):
|
|
26
|
+
pm_map = {
|
|
27
|
+
"Rabbit LINE Pay": "LINE Pay"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
unifier_class = TgWalletUnifier
|
|
31
|
+
|
|
32
|
+
|
|
25
33
|
def __init__(self, ex: models.Ex, actor: models.Actor = None):
|
|
26
34
|
if actor:
|
|
27
35
|
self.actor = actor
|
|
@@ -64,6 +64,7 @@ xync_client/Bybit/web_earn.py
|
|
|
64
64
|
xync_client/Bybit/web_p2p.py
|
|
65
65
|
xync_client/Bybit/ws.py
|
|
66
66
|
xync_client/Bybit/etype/ad.py
|
|
67
|
+
xync_client/Bybit/etype/cred.py
|
|
67
68
|
xync_client/Bybit/etype/order.py
|
|
68
69
|
xync_client/Gate/ex.py
|
|
69
70
|
xync_client/Gate/premarket.py
|
|
@@ -75,6 +76,7 @@ xync_client/Htx/etype/__init__.py
|
|
|
75
76
|
xync_client/Htx/etype/ad.py
|
|
76
77
|
xync_client/Htx/etype/cred.py
|
|
77
78
|
xync_client/Htx/etype/pm.py
|
|
79
|
+
xync_client/Htx/etype/test.py
|
|
78
80
|
xync_client/KuCoin/ex.py
|
|
79
81
|
xync_client/KuCoin/web.py
|
|
80
82
|
xync_client/KuCoin/etype/ad.py
|
|
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.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Binance/test_binance.py
RENAMED
|
File without changes
|
|
File without changes
|
{xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/tests/_todo_refact/Bybit/test_bybit_p2p.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/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
|
{xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client/Pms/Volet/_todo_req/req.mjs
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
|
{xync_client-0.0.43.dev4 → xync_client-0.0.43.dev11}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|