xync-client 0.0.11.dev15__tar.gz → 0.0.11.dev18__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.dev15/xync_client.egg-info → xync_client-0.0.11.dev18}/PKG-INFO +1 -1
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/TestEx.py +2 -1
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/ex.py +2 -1
- xync_client-0.0.11.dev18/xync_client/Bybit/ex.py +64 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Gate/ex.py +24 -19
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Htx/ex.py +1 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18/xync_client.egg-info}/PKG-INFO +1 -1
- xync_client-0.0.11.dev15/xync_client/Bybit/ex.py +0 -58
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/.env.sample +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/.gitignore +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/README.md +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/makefile +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/pyproject.toml +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/setup.cfg +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Abc/AgentTest.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Abc/BaseTest.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Abc/OrderTest.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Binance/test_binance.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Gate/test_gate.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/__init__.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/tests/_test_ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Abc/Auth.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Abc/Ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/__init__.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/base.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/req.mjs +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/sign.js +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BingX/test/main.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BitGet/ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Bybit/agent.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/KuCoin/pub.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/auth.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/ex.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/__init__.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client/loader.py +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client.egg-info/SOURCES.txt +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.11.dev15 → xync_client-0.0.11.dev18}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -31,7 +31,8 @@ class TestEx(BaseTest):
|
|
|
31
31
|
async def test_curs(self, clients: list[BaseExClient]):
|
|
32
32
|
for client in clients:
|
|
33
33
|
curs: FlatDict = await client.curs()
|
|
34
|
-
|
|
34
|
+
ok = self.is_flat_dict(curs)
|
|
35
|
+
t, _ = await ExTest.update_or_create({"ok": ok}, ex=client.ex, action=ExAction.curs)
|
|
35
36
|
assert t.ok, "No curs"
|
|
36
37
|
logging.info(f"{client.ex.name}:{ExAction.pms.name} - ok")
|
|
37
38
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from enum import IntEnum
|
|
3
|
+
|
|
4
|
+
from xync_client.Abc.Base import ListOfDicts, MapOfIdsList, DictOfDicts, FlatDict
|
|
5
|
+
from xync_client.Abc.Ex import BaseExClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AdsStatus(IntEnum):
|
|
9
|
+
REST = 0
|
|
10
|
+
WORKING = 1
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ExClient(BaseExClient): # Bybit client
|
|
14
|
+
host = "api2.bybit.com"
|
|
15
|
+
headers = {"cookie": ";"} # rewrite token for public methods
|
|
16
|
+
|
|
17
|
+
async def _get_config(self):
|
|
18
|
+
resp = await self._get("/fiat/p2p/config/initial")
|
|
19
|
+
return resp["result"] # todo: tokens, pairs, ...
|
|
20
|
+
|
|
21
|
+
# 20: Список всех платежных методов на бирже
|
|
22
|
+
async def pms(self) -> DictOfDicts:
|
|
23
|
+
pms = await self._post("/fiat/otc/configuration/queryAllPaymentList/")
|
|
24
|
+
pms = pms["result"]["paymentConfigVo"]
|
|
25
|
+
return {
|
|
26
|
+
pm["paymentType"]: {
|
|
27
|
+
"name": pm["paymentName"],
|
|
28
|
+
}
|
|
29
|
+
for pm in pms
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# 21: Список поддерживаемых валют
|
|
33
|
+
async def curs(self) -> FlatDict:
|
|
34
|
+
config = await self._get_config()
|
|
35
|
+
return {c["id"]: c["currencyId"] for c in config["symbols"]}
|
|
36
|
+
|
|
37
|
+
# 22: Список платежных методов по каждой валюте
|
|
38
|
+
async def cur_pms_map(self) -> MapOfIdsList:
|
|
39
|
+
pms = await self._post("/fiat/otc/configuration/queryAllPaymentList/")
|
|
40
|
+
return json.loads(pms["result"]["currencyPaymentIdMap"])
|
|
41
|
+
|
|
42
|
+
# 23: Список торгуемых монет (с ограничениям по валютам, если есть)
|
|
43
|
+
async def coins(self) -> FlatDict:
|
|
44
|
+
coins = await self._get("/spot/api/basic/symbol_list")
|
|
45
|
+
return coins
|
|
46
|
+
|
|
47
|
+
# 24: Список объяв по (buy/sell, cur, coin, pm)
|
|
48
|
+
async def ads(
|
|
49
|
+
self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
|
|
50
|
+
) -> ListOfDicts:
|
|
51
|
+
data = {
|
|
52
|
+
"userId": "",
|
|
53
|
+
"tokenId": coin_exid,
|
|
54
|
+
"currencyId": cur_exid,
|
|
55
|
+
"payment": pm_exids or [],
|
|
56
|
+
"side": "0" if is_sell else "1",
|
|
57
|
+
"size": "10",
|
|
58
|
+
"page": "1",
|
|
59
|
+
"amount": str(amount) if amount else "",
|
|
60
|
+
"authMaker": False,
|
|
61
|
+
"canTrade": False,
|
|
62
|
+
}
|
|
63
|
+
ads = await self._post("/fiat/otc/item/online/", data)
|
|
64
|
+
return ads["result"]["items"]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import re
|
|
2
|
-
from asyncio import run
|
|
2
|
+
from asyncio import run, sleep
|
|
3
3
|
from json import JSONDecoder
|
|
4
4
|
|
|
5
5
|
from bs4 import BeautifulSoup, Script
|
|
6
6
|
from x_model import init_db
|
|
7
7
|
from xync_schema import models
|
|
8
|
-
from xync_schema.models import Coin, Cur, Pm, Ad, Ex
|
|
8
|
+
from xync_schema.models import Coin, Cur, Pm, Ad, Ex
|
|
9
9
|
|
|
10
|
-
from xync_client.Abc.Base import MapOfIdsList
|
|
10
|
+
from xync_client.Abc.Base import MapOfIdsList, DictOfDicts, FlatDict
|
|
11
11
|
from xync_client.Abc.Ex import BaseExClient
|
|
12
12
|
from xync_client.loader import PG_DSN
|
|
13
13
|
|
|
@@ -16,19 +16,19 @@ class ExClient(BaseExClient):
|
|
|
16
16
|
async def cur_pms_map(self) -> MapOfIdsList:
|
|
17
17
|
pass
|
|
18
18
|
|
|
19
|
-
async def curs(self) ->
|
|
19
|
+
async def curs(self) -> FlatDict:
|
|
20
20
|
curs = await self._post("/json_svr/buy_crypto_fiat_setting")
|
|
21
|
-
curs = [cur["fiat"] for cur in curs if cur["p2p"]
|
|
22
|
-
curexs = [Curex(cur=c, ex=self.ex) for c in curs]
|
|
23
|
-
await Curex.bulk_create(curexs, ignore_conflicts=True)
|
|
21
|
+
curs = {cur["fiat"]: cur["fiat"] for cur in curs["datas"] if cur["p2p"]}
|
|
24
22
|
return curs
|
|
25
23
|
|
|
26
24
|
async def coins(self, cur: Cur = None) -> list[Coin]: ...
|
|
27
25
|
|
|
28
|
-
async def pms(self, cur: Cur = None) ->
|
|
26
|
+
async def pms(self, cur: Cur = None) -> DictOfDicts:
|
|
27
|
+
await sleep(1)
|
|
29
28
|
doc = await self._get("/p2p")
|
|
29
|
+
await sleep(1)
|
|
30
30
|
soup = BeautifulSoup(doc, "html.parser")
|
|
31
|
-
script: Script = soup.body.find_all("script")[
|
|
31
|
+
script: Script = soup.body.find_all("script")[17] # 17-th not stable
|
|
32
32
|
strng = (
|
|
33
33
|
script.get_text(strip=True)
|
|
34
34
|
.replace("\n", "")
|
|
@@ -43,15 +43,19 @@ class ExClient(BaseExClient):
|
|
|
43
43
|
pattern = r"payment_settings:\s{1}(\{.*?\}),paymentIdMap:"
|
|
44
44
|
match = re.search(pattern, strng.replace(",}", "}").replace(",]", "]"), re.DOTALL)
|
|
45
45
|
res = match.group(1)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
for
|
|
46
|
+
pms = JSONDecoder(strict=False).decode(res)
|
|
47
|
+
return {
|
|
48
|
+
pm["index"]: {"name": pm["pay_name"], "logo": pm["image"], "identifier": idf, "type_": pm["base_type"]}
|
|
49
|
+
for idf, pm in pms.items()
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
# pmcurs = {
|
|
52
|
+
# cur.ticker: (await self._get("/v3/c2c/configs/receipt/templates", {"quoteCurrency": cur.ticker}))["data"]
|
|
53
|
+
# for cur in await self.curs()
|
|
54
|
+
# }
|
|
55
|
+
# pp = {}
|
|
56
|
+
# [[pp.update({p["paymentMethod"]: p["paymentMethodDescription"]}) for p in ps] for ps in pmcurs.values()]
|
|
57
|
+
# pp = {k: v for k, v in sorted(pp.items(), key=lambda x: x[0])}
|
|
58
|
+
# return pp
|
|
55
59
|
|
|
56
60
|
async def ads(self, coin: Coin, cur: Cur, is_sell: bool, pms: list[Pm] = None) -> list[Ad]:
|
|
57
61
|
pass
|
|
@@ -61,9 +65,10 @@ async def main():
|
|
|
61
65
|
_ = await init_db(PG_DSN, models, True)
|
|
62
66
|
bg = await Ex.get(name="Gate")
|
|
63
67
|
cl = ExClient(bg)
|
|
64
|
-
|
|
68
|
+
await cl.curs()
|
|
65
69
|
# await cl.coins()
|
|
66
|
-
await cl.pms()
|
|
70
|
+
pms = await cl.pms()
|
|
71
|
+
print(pms)
|
|
67
72
|
|
|
68
73
|
|
|
69
74
|
if __name__ == "__main__":
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from enum import IntEnum
|
|
2
|
-
|
|
3
|
-
from xync_client.Abc.Base import ListOfDicts, MapOfIdsList
|
|
4
|
-
from xync_client.Abc.Ex import BaseExClient
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AdsStatus(IntEnum):
|
|
8
|
-
REST = 0
|
|
9
|
-
WORKING = 1
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class ExClient(BaseExClient): # Bybit client
|
|
13
|
-
host = "api2.bybit.com"
|
|
14
|
-
headers = {"cookie": ";"} # rewrite token for public methods
|
|
15
|
-
|
|
16
|
-
""" PUBLIC METHS """
|
|
17
|
-
|
|
18
|
-
async def get_ads(
|
|
19
|
-
self, coin: str, cur: str, sell: bool = False, amount: int = None, payment: list[str] = None
|
|
20
|
-
) -> list:
|
|
21
|
-
data = {
|
|
22
|
-
"userId": "",
|
|
23
|
-
"tokenId": coin,
|
|
24
|
-
"currencyId": cur,
|
|
25
|
-
"payment": payment or [],
|
|
26
|
-
"side": "0" if sell else "1",
|
|
27
|
-
"size": "10",
|
|
28
|
-
"page": "1",
|
|
29
|
-
"amount": str(amount) if amount else "",
|
|
30
|
-
"authMaker": False,
|
|
31
|
-
"canTrade": False,
|
|
32
|
-
}
|
|
33
|
-
ads = await self._post("/fiat/otc/item/online/", data)
|
|
34
|
-
return ads["result"]["items"]
|
|
35
|
-
|
|
36
|
-
async def get_config(self):
|
|
37
|
-
resp = await self._get("/fiat/p2p/config/initial")
|
|
38
|
-
return resp["result"] # todo: tokens, pairs, ...
|
|
39
|
-
|
|
40
|
-
async def curs(self):
|
|
41
|
-
config = await self.get_config()
|
|
42
|
-
return config["symbols"]
|
|
43
|
-
|
|
44
|
-
async def coins(self):
|
|
45
|
-
coins = await self._get("/spot/api/basic/symbol_list")
|
|
46
|
-
return coins
|
|
47
|
-
|
|
48
|
-
async def pms(self):
|
|
49
|
-
pms = await self._post("/fiat/otc/configuration/queryAllPaymentList/")
|
|
50
|
-
return pms
|
|
51
|
-
|
|
52
|
-
""" Private METHs"""
|
|
53
|
-
|
|
54
|
-
async def cur_pms_map(self) -> MapOfIdsList:
|
|
55
|
-
pass
|
|
56
|
-
|
|
57
|
-
async def ads(self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None) -> ListOfDicts:
|
|
58
|
-
pass
|
|
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.11.dev15 → xync_client-0.0.11.dev18}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|