xync-client 0.0.8.dev4__tar.gz → 0.0.8.dev15__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.8.dev4/xync_client.egg-info → xync_client-0.0.8.dev15}/PKG-INFO +1 -1
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Abc/Ex.py +1 -1
- xync_client-0.0.8.dev15/xync_client/BitGet/ex.py +79 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15/xync_client.egg-info}/PKG-INFO +1 -1
- xync_client-0.0.8.dev4/xync_client/BitGet/ex.py +0 -46
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/.env.sample +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/.gitignore +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/README.md +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/makefile +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/pyproject.toml +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/setup.cfg +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/Binance/test_binance.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/Gate/test_gate.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/__init__.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/tests/test_abc.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Gate/pub.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Htx/ex.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/KuCoin/pub.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/Okx/pub.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/TgWallet/ex.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/__init__.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client/loader.py +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client.egg-info/SOURCES.txt +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.8.dev4 → xync_client-0.0.8.dev15}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -44,7 +44,7 @@ class ExClient(Client):
|
|
|
44
44
|
# 24: Список объяв по (buy/sell, cur, coin, pm)
|
|
45
45
|
@abstractmethod
|
|
46
46
|
async def ads(
|
|
47
|
-
self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str] = None
|
|
47
|
+
self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None
|
|
48
48
|
) -> list[dict]: ... # [ad]
|
|
49
49
|
|
|
50
50
|
def _pmnorm(self, s: str, idtf: str = None) -> str:
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from asyncio import run
|
|
2
|
+
|
|
3
|
+
from x_model import init_db
|
|
4
|
+
from xync_schema import models
|
|
5
|
+
from xync_schema.models import Cur, Ex
|
|
6
|
+
|
|
7
|
+
from xync_client.Abc.Ex import ExClient
|
|
8
|
+
from xync_client.loader import PG_DSN
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Client(ExClient):
|
|
12
|
+
async def curs(self) -> dict[str, str]:
|
|
13
|
+
curs = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["fiatInfoRespList"]
|
|
14
|
+
return {cur["fiatCode"]: cur["fiatCode"] for cur in curs}
|
|
15
|
+
|
|
16
|
+
async def coins(self, cur: Cur = None) -> dict[str, str]:
|
|
17
|
+
coins = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["coinInfoRespList"]
|
|
18
|
+
return {coin["coinCode"]: coin["coinCode"] for coin in coins}
|
|
19
|
+
|
|
20
|
+
async def pms(self, cur: Cur = None) -> dict[int, dict]:
|
|
21
|
+
curs = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["fiatInfoRespList"]
|
|
22
|
+
pmcurs = {cur["fiatCode"]: cur["paymethodInfo"] for cur in curs}
|
|
23
|
+
pp = {}
|
|
24
|
+
[
|
|
25
|
+
[pp.update({p["paymethodId"]: {"name": p["paymethodName"], "logo": p.get("iconUrl")}}) for p in ps]
|
|
26
|
+
for ps in pmcurs.values()
|
|
27
|
+
]
|
|
28
|
+
return pp
|
|
29
|
+
|
|
30
|
+
async def ads(self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[int] = None) -> list[dict]:
|
|
31
|
+
slots = (
|
|
32
|
+
await self._post(
|
|
33
|
+
"/v1/p2p/pub/adv/queryAdvList",
|
|
34
|
+
data={
|
|
35
|
+
"side": 2 if is_sell else 1,
|
|
36
|
+
"pageNo": 1,
|
|
37
|
+
"pageSize": 3,
|
|
38
|
+
"coinCode": coin_exid,
|
|
39
|
+
"fiatCode": cur_exid,
|
|
40
|
+
"languageType": 6,
|
|
41
|
+
"paymethodId": pm_exids[0] if pm_exids else None,
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
)["data"]["dataList"]
|
|
45
|
+
result = []
|
|
46
|
+
for slot in slots:
|
|
47
|
+
result.append(
|
|
48
|
+
{
|
|
49
|
+
"price": float(slot["priceValue"]),
|
|
50
|
+
"minFiat": float(slot["minAmount"]),
|
|
51
|
+
"maxFiat": float(min(slot["maxAmount"], slot["amount"])),
|
|
52
|
+
"user": int(slot["userId"]) if slot["userId"] else None,
|
|
53
|
+
"pms": [int(pay_method["paymethodId"]) for pay_method in slot["paymethodInfo"]],
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
async def cur_pms_map(self) -> dict[str, list[int]]:
|
|
59
|
+
curs = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["fiatInfoRespList"]
|
|
60
|
+
return {
|
|
61
|
+
cur["fiatCode"]: [int(pay_method["paymethodId"]) for pay_method in cur["paymethodInfo"]] for cur in curs
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async def main():
|
|
66
|
+
_ = await init_db(PG_DSN, models, True)
|
|
67
|
+
bg = await Ex.get(name="BitGet")
|
|
68
|
+
cl = Client(bg)
|
|
69
|
+
await cl.curs()
|
|
70
|
+
await cl.coins()
|
|
71
|
+
await cl.ads("BTC", "RUB", True, [1, 289, 375])
|
|
72
|
+
await cl.pms()
|
|
73
|
+
await cl.cur_pms_map()
|
|
74
|
+
await cl.set_pmcurexs()
|
|
75
|
+
await cl.set_coinexs()
|
|
76
|
+
await cl.close()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
run(main())
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
from asyncio import run
|
|
2
|
-
|
|
3
|
-
from x_model import init_db
|
|
4
|
-
from xync_schema import models
|
|
5
|
-
from xync_schema.models import Coin, Cur, Pm, Ad, Ex, Curex
|
|
6
|
-
|
|
7
|
-
from xync_client.Abc.Ex import ExClient
|
|
8
|
-
from xync_client.loader import PG_DSN
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Client(ExClient):
|
|
12
|
-
async def curs(self) -> list[Cur]:
|
|
13
|
-
curs = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["fiatInfoRespList"]
|
|
14
|
-
curs = [(await Cur.update_or_create(ticker=cur["fiatCode"]))[0] for cur in curs]
|
|
15
|
-
curexs = [Curex(cur=c, ex=self.ex) for c in curs]
|
|
16
|
-
await Curex.bulk_create(curexs, ignore_conflicts=True)
|
|
17
|
-
return curs
|
|
18
|
-
|
|
19
|
-
async def coins(self, cur: Cur = None) -> list[Coin]:
|
|
20
|
-
coins = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["coinInfoRespList"]
|
|
21
|
-
coins = [(await Coin.update_or_create(ticker=c["coinCode"]))[0] for c in coins]
|
|
22
|
-
[await c.exs.add(self.ex) for c in coins]
|
|
23
|
-
return coins
|
|
24
|
-
|
|
25
|
-
async def pms(self, cur: Cur = None) -> list[Pm]:
|
|
26
|
-
curs = (await self._post("/v1/p2p/pub/currency/queryAllCoinAndFiat"))["data"]["fiatInfoRespList"]
|
|
27
|
-
pmcurs = {cur["fiatCode"]: cur["paymethodInfo"] for cur in curs}
|
|
28
|
-
pp = {}
|
|
29
|
-
[[pp.update({p["paymethodId"]: p["paymethodName"]}) for p in ps] for ps in pmcurs.values()]
|
|
30
|
-
return pp
|
|
31
|
-
|
|
32
|
-
async def ads(self, coin: Coin, cur: Cur, is_sell: bool, pms: list[Pm] = None) -> list[Ad]:
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
async def main():
|
|
37
|
-
_ = await init_db(PG_DSN, models, True)
|
|
38
|
-
bg = await Ex.get(name="BitGet")
|
|
39
|
-
cl = Client(bg)
|
|
40
|
-
# await cl.curs()
|
|
41
|
-
# await cl.coins()
|
|
42
|
-
await cl.pms()
|
|
43
|
-
await cl.close()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
run(main())
|
|
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.8.dev4 → xync_client-0.0.8.dev15}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|