xync-client 0.0.11.dev30__tar.gz → 0.0.11.dev33__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.11.dev30/xync_client.egg-info → xync_client-0.0.11.dev33}/PKG-INFO +1 -1
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/TestEx.py +7 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/Agent.py +4 -4
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/Auth.py +8 -3
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/Ex.py +1 -1
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Bybit/ex.py +2 -4
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/ex.py +27 -16
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33/xync_client.egg-info}/PKG-INFO +1 -1
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/.env.sample +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/.gitignore +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/README.md +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/makefile +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/pyproject.toml +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/setup.cfg +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/AgentTest.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/OrderTest.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Binance/test_binance.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Gate/test_gate.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Wallet/test_agent.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Wallet/test_ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/__init__.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/_test_ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/BaseTest.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/__init__.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/base.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/req.mjs +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/sign.js +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BingX/test/main.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BitGet/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Bybit/agent.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Gate/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Htx/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/KuCoin/pub.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/auth.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/__init__.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client/loader.py +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client.egg-info/SOURCES.txt +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -55,6 +55,13 @@ class TestEx(BaseTest):
|
|
|
55
55
|
logging.info(f"{client.ex.name}:{ExAction.coins.name} - ok")
|
|
56
56
|
|
|
57
57
|
# 23
|
|
58
|
+
async def test_pairs(self, clients: list[BaseExClient]):
|
|
59
|
+
for client in clients:
|
|
60
|
+
pairs: MapOfIdsList = await client.pairs()
|
|
61
|
+
ok = self.is_map_of_ids(pairs)
|
|
62
|
+
t, _ = await ExTest.update_or_create({"ok": ok}, ex=client.ex, action=ExAction.pairs)
|
|
63
|
+
assert t.ok, "No coins"
|
|
64
|
+
logging.info(f"{client.ex.name}:{ExAction.pairs.name} - ok")
|
|
58
65
|
|
|
59
66
|
# 24
|
|
60
67
|
async def test_ads(self, clients: list[BaseExClient]):
|
|
@@ -32,7 +32,7 @@ class BaseAgentClient(BaseAuthClient):
|
|
|
32
32
|
|
|
33
33
|
# 27: Редактирование
|
|
34
34
|
@abstractmethod
|
|
35
|
-
async def fiat_upd(self, fiat_id: int, detail: str, name: str = None) ->
|
|
35
|
+
async def fiat_upd(self, fiat_id: int, detail: str, name: str = None) -> Fiat.pyd(): ...
|
|
36
36
|
|
|
37
37
|
# 28: Удаление
|
|
38
38
|
@abstractmethod
|
|
@@ -41,7 +41,7 @@ class BaseAgentClient(BaseAuthClient):
|
|
|
41
41
|
# # # Ad
|
|
42
42
|
# 29: Список моих ad
|
|
43
43
|
@abstractmethod
|
|
44
|
-
async def my_ads(self) ->
|
|
44
|
+
async def my_ads(self) -> ListOfDicts: ...
|
|
45
45
|
|
|
46
46
|
# 30: Создание ad:
|
|
47
47
|
@abstractmethod
|
|
@@ -57,7 +57,7 @@ class BaseAgentClient(BaseAuthClient):
|
|
|
57
57
|
details: str = None,
|
|
58
58
|
autoreply: str = None,
|
|
59
59
|
status: AdStatus = AdStatus.active,
|
|
60
|
-
) -> Ad: ...
|
|
60
|
+
) -> Ad.pyd(): ...
|
|
61
61
|
|
|
62
62
|
# 31: Редактирование
|
|
63
63
|
@abstractmethod
|
|
@@ -70,7 +70,7 @@ class BaseAgentClient(BaseAuthClient):
|
|
|
70
70
|
details: str = None,
|
|
71
71
|
autoreply: str = None,
|
|
72
72
|
status: AdStatus = None,
|
|
73
|
-
) ->
|
|
73
|
+
) -> Ad.pyd(): ...
|
|
74
74
|
|
|
75
75
|
# 32: Удаление
|
|
76
76
|
@abstractmethod
|
|
@@ -28,12 +28,17 @@ class BaseAuthClient(BaseClient):
|
|
|
28
28
|
auth_hdrs: dict[str, str] = await self._get_auth_hdrs()
|
|
29
29
|
self.session.headers.update(auth_hdrs)
|
|
30
30
|
|
|
31
|
-
async def
|
|
31
|
+
async def _post(self, url: str, data: dict = None, data_key: str = None):
|
|
32
|
+
dt = {"json" if isinstance(data, dict) else "data": data}
|
|
33
|
+
resp = await self.session.post(url, **dt, headers=self._prehook(data))
|
|
34
|
+
return await self._proc(resp, data_key, data)
|
|
35
|
+
|
|
36
|
+
async def _proc(self, resp: ClientResponse, data_key: str = None, body: dict | str = None) -> dict | str:
|
|
32
37
|
try:
|
|
33
|
-
return await super()._proc(resp)
|
|
38
|
+
return await super()._proc(resp, data_key)
|
|
34
39
|
except HttpProcessingError as e:
|
|
35
40
|
if e.code == 401:
|
|
36
41
|
logging.warning(e)
|
|
37
42
|
await self.login()
|
|
38
|
-
res = await self.meth[resp.method](resp.url.path,
|
|
43
|
+
res = await self.meth[resp.method](resp.url.path, body, data_key=data_key)
|
|
39
44
|
return res
|
|
@@ -49,7 +49,7 @@ class ExClient(BaseExClient): # Bybit client
|
|
|
49
49
|
return {c: c for c in cc}
|
|
50
50
|
|
|
51
51
|
# 23: Список пар валюта/монет
|
|
52
|
-
async def pairs(self) ->
|
|
52
|
+
async def pairs(self) -> MapOfIdsList:
|
|
53
53
|
config = await self._get_config()
|
|
54
54
|
cc: dict[str, set[str]] = {}
|
|
55
55
|
for c in config["symbols"]:
|
|
@@ -57,9 +57,7 @@ class ExClient(BaseExClient): # Bybit client
|
|
|
57
57
|
return cc
|
|
58
58
|
|
|
59
59
|
# 24: Список объяв по (buy/sell, cur, coin, pm)
|
|
60
|
-
async def ads(
|
|
61
|
-
self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
|
|
62
|
-
) -> ListOfDicts:
|
|
60
|
+
async def ads(self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None) -> ListOfDicts:
|
|
63
61
|
data = {
|
|
64
62
|
"userId": "",
|
|
65
63
|
"tokenId": coin_exid,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from xync_client.Abc.Base import FlatDict
|
|
1
|
+
from xync_client.Abc.Base import FlatDict, DictOfDicts, MapOfIdsList, ListOfDicts
|
|
2
2
|
from xync_client.TgWallet.auth import AuthClient
|
|
3
3
|
|
|
4
4
|
from xync_schema.models import Pm
|
|
@@ -7,37 +7,48 @@ from xync_client.Abc.Ex import BaseExClient
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class ExClient(BaseExClient, AuthClient):
|
|
10
|
-
|
|
10
|
+
# 19: Список поддерживаемых валют тейкера
|
|
11
|
+
async def curs(self) -> FlatDict:
|
|
11
12
|
coins_curs = await self._post("/p2p/public-api/v2/currency/all-supported")
|
|
12
13
|
return {c["code"]: c["code"] for c in coins_curs["data"]["fiat"]}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
async def coins(self) -> FlatDict:
|
|
16
|
-
coins_curs = await self._post("/p2p/public-api/v2/currency/all-supported")
|
|
17
|
-
return {c["code"]: c["code"] for c in coins_curs["data"]["crypto"]}
|
|
18
|
-
|
|
19
|
-
async def _pms(self, cur: str = "RUB") -> dict[str, dict]:
|
|
15
|
+
async def _pms(self, cur: str) -> dict[str, dict]:
|
|
20
16
|
pms = await self._post("/p2p/public-api/v3/payment-details/get-methods/by-currency-code", {"currencyCode": cur})
|
|
21
17
|
return {pm["code"]: {"name": pm["nameEng"]} for pm in pms["data"]}
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
# 20: Список платежных методов
|
|
20
|
+
async def pms(self, _cur: str = None) -> DictOfDicts:
|
|
24
21
|
pms = {}
|
|
25
22
|
for cur in await self.curs():
|
|
26
23
|
for k, pm in (await self._pms(cur)).items():
|
|
27
24
|
pms.update({k: pm})
|
|
28
25
|
return pms
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
# 21: Список платежных методов по каждой валюте
|
|
28
|
+
async def cur_pms_map(self) -> MapOfIdsList:
|
|
31
29
|
return {cur: list(await self._pms(cur)) for cur in await self.curs()}
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
# 22: Список торгуемых монет (с ограничениям по валютам, если есть)
|
|
32
|
+
async def coins(self) -> FlatDict:
|
|
33
|
+
coins_curs = await self._post("/p2p/public-api/v2/currency/all-supported")
|
|
34
|
+
return {c["code"]: c["code"] for c in coins_curs["data"]["crypto"]}
|
|
35
|
+
|
|
36
|
+
# 23: Список пар валюта/монет
|
|
37
|
+
async def pairs(self) -> MapOfIdsList:
|
|
38
|
+
coins = await self.coins()
|
|
39
|
+
curs = await self.curs()
|
|
40
|
+
pairs = {cur: set(coins.values()) for cur in curs.values()}
|
|
41
|
+
return pairs
|
|
42
|
+
|
|
43
|
+
# 24: Список объяв по (buy/sell, cur, coin, pm)
|
|
44
|
+
async def ads(self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None) -> ListOfDicts:
|
|
34
45
|
params = {
|
|
35
|
-
"baseCurrencyCode":
|
|
36
|
-
"quoteCurrencyCode":
|
|
46
|
+
"baseCurrencyCode": coin_exid,
|
|
47
|
+
"quoteCurrencyCode": cur_exid,
|
|
37
48
|
"offerType": "SALE" if is_sell else "PURCHASE",
|
|
38
49
|
"offset": 0,
|
|
39
|
-
"limit":
|
|
40
|
-
#
|
|
50
|
+
"limit": 100,
|
|
51
|
+
# "merchantVerified": "TRUSTED"
|
|
41
52
|
}
|
|
42
|
-
ads = await self._post("/p2p/public-api/v2/offer/depth-of-market/", params)
|
|
53
|
+
ads = await self._post("/p2p/public-api/v2/offer/depth-of-market/", params, 'data')
|
|
43
54
|
return ads
|
|
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.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Binance/test_binance.py
RENAMED
|
File without changes
|
{xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Bybit/test_bybit.py
RENAMED
|
File without changes
|
{xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Bybit/test_bybit_p2p.py
RENAMED
|
File without changes
|
|
File without changes
|
{xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/tests/_todo_refact/Htx/test_htx_p2p.py
RENAMED
|
File without changes
|
{xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/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
|
{xync_client-0.0.11.dev30 → xync_client-0.0.11.dev33}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|