xync-client 0.0.25.dev47__tar.gz → 0.0.25.dev50__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.
Files changed (89) hide show
  1. {xync_client-0.0.25.dev47/xync_client.egg-info → xync_client-0.0.25.dev50}/PKG-INFO +1 -1
  2. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/Ex.py +4 -1
  3. xync_client-0.0.25.dev47/xync_client/BingX/pyd.py → xync_client-0.0.25.dev50/xync_client/BingX/etype/ad.py +1 -32
  4. xync_client-0.0.25.dev50/xync_client/BingX/etype/pm.py +8 -0
  5. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/ex.py +36 -21
  6. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Bybit/ex.py +16 -1
  7. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/ex.py +8 -0
  8. xync_client-0.0.25.dev50/xync_client/KuCoin/etype/ad.py +49 -0
  9. xync_client-0.0.25.dev50/xync_client/KuCoin/etype/pm.py +8 -0
  10. xync_client-0.0.25.dev50/xync_client/KuCoin/ex.py +75 -0
  11. xync_client-0.0.25.dev47/xync_client/Okx/pyd.py → xync_client-0.0.25.dev50/xync_client/Okx/etype/ad.py +0 -11
  12. xync_client-0.0.25.dev50/xync_client/Okx/etype/pm.py +12 -0
  13. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Okx/ex.py +32 -20
  14. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/ex.py +21 -18
  15. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/pm_unifier.py +1 -8
  16. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/pyro.py +25 -7
  17. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50/xync_client.egg-info}/PKG-INFO +1 -1
  18. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client.egg-info/SOURCES.txt +7 -4
  19. xync_client-0.0.25.dev47/xync_client/BingX/test/main.py +0 -52
  20. xync_client-0.0.25.dev47/xync_client/KuCoin/pub.py +0 -47
  21. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/.env.sample +0 -0
  22. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/.gitignore +0 -0
  23. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/.pre-commit-config.yaml +0 -0
  24. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/README.md +0 -0
  25. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/makefile +0 -0
  26. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/pyproject.toml +0 -0
  27. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/setup.cfg +0 -0
  28. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/TestAgent.py +0 -0
  29. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/TestAsset.py +0 -0
  30. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/TestEx.py +0 -0
  31. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/TestOrder.py +0 -0
  32. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Binance/test_binance.py +0 -0
  33. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
  34. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
  35. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Gate/test_gate.py +0 -0
  36. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Htx/test_htx_p2p.py +0 -0
  37. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Wallet/test_agent.py +0 -0
  38. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/Wallet/test_ex.py +0 -0
  39. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/__init__.py +0 -0
  40. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/tests/_todo_refact/_test_ex.py +0 -0
  41. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/Agent.py +0 -0
  42. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/Asset.py +0 -0
  43. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/AuthTrait.py +0 -0
  44. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/Base.py +0 -0
  45. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/BaseTest.py +0 -0
  46. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/InAgent.py +0 -0
  47. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/Order.py +0 -0
  48. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Abc/types.py +0 -0
  49. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/__init__.py +0 -0
  50. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/binance_async.py +0 -0
  51. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/earn_api.py +0 -0
  52. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/ex.py +0 -0
  53. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/exceptions.py +0 -0
  54. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/sapi.py +0 -0
  55. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Binance/web_c2c.py +0 -0
  56. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/__init__.py +0 -0
  57. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/agent.py +0 -0
  58. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/base.py +0 -0
  59. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/req.mjs +0 -0
  60. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BingX/sign.js +0 -0
  61. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BitGet/__init__.py +0 -0
  62. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BitGet/agent.py +0 -0
  63. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BitGet/ex.py +0 -0
  64. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/BitGet/req.mjs +0 -0
  65. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Bybit/agent.py +0 -0
  66. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Bybit/web_earn.py +0 -0
  67. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Bybit/web_p2p.py +0 -0
  68. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Gate/ex.py +0 -0
  69. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Gate/premarket.py +0 -0
  70. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/agent.py +0 -0
  71. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/earn.py +0 -0
  72. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/etype/__init__.py +0 -0
  73. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/etype/ad.py +0 -0
  74. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/etype/cred.py +0 -0
  75. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/Htx/etype/pm.py +0 -0
  76. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/KuCoin/web.py +0 -0
  77. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/agent.py +0 -0
  78. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/asset.py +0 -0
  79. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/auth.py +0 -0
  80. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/inAgent.py +0 -0
  81. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/order.py +0 -0
  82. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/pyd.py +0 -0
  83. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/pyro.py +0 -0
  84. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/TgWallet/web.py +0 -0
  85. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/__init__.py +0 -0
  86. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client/loader.py +0 -0
  87. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client.egg-info/dependency_links.txt +0 -0
  88. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client.egg-info/requires.txt +0 -0
  89. {xync_client-0.0.25.dev47 → xync_client-0.0.25.dev50}/xync_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xync-client
3
- Version: 0.0.25.dev47
3
+ Version: 0.0.25.dev50
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/client
@@ -13,6 +13,8 @@ from xync_client.pm_unifier import PmUnifier, PmUni
13
13
 
14
14
 
15
15
  class BaseExClient(BaseClient):
16
+ unifier_class: type = PmUnifier
17
+
16
18
  @abstractmethod
17
19
  def pm_type_map(self, typ: models.Pmex) -> str: ...
18
20
 
@@ -86,6 +88,7 @@ class BaseExClient(BaseClient):
86
88
  if c.cur_id not in curs:
87
89
  cur, _ = await models.Cur.get_or_create(ticker=cur_map[c.cur_id])
88
90
  c.cur_id = cur.id
91
+ c.cur_id = curs[c.cur_id].id
89
92
  # Country preparing
90
93
  # countries = sorted(
91
94
  # (c for c in countries if c.code not in (999, 9999, 441624, 999999)), key=lambda x: x.name
@@ -124,7 +127,7 @@ class BaseExClient(BaseClient):
124
127
  pms: dict[int | str, models.Pm] = dict({})
125
128
  prev = 0, "", "" # id, normd-name, orig-name
126
129
  cntrs = [c.lower() for c in await models.Country.all().values_list("name", flat=True)]
127
- uni = PmUnifier(cntrs)
130
+ uni = self.unifier_class(cntrs)
128
131
  for k, pm in pms_epyds.items():
129
132
  pmu: PmUni = uni(pm.name)
130
133
  country = await models.Country.get(name__iexact=cnt) if (cnt := pmu.country) else None
@@ -3,37 +3,6 @@ from typing import List
3
3
  from xync_schema.types import BaseAd
4
4
 
5
5
 
6
- class User(BaseModel):
7
- nickname: str
8
- avatar: str
9
- phone: bool
10
- email: bool
11
- # payMethods: dict
12
-
13
-
14
- class AvailableVolume(BaseModel):
15
- tradeUSDTNum30: float
16
-
17
-
18
- class Price(BaseModel):
19
- asset: str
20
- fiat: str
21
- value: str
22
-
23
-
24
- class OrderLimitsIn(BaseModel):
25
- minAmount: str
26
- maxAmount: str
27
-
28
-
29
- class PmEpyd(BaseModel):
30
- id: int
31
- name: str
32
- mainColor: str
33
- icon: str
34
- number: int
35
-
36
-
37
6
  class UserPaymentMethod(BaseModel):
38
7
  id: int
39
8
  paymentMethodId: int
@@ -91,4 +60,4 @@ class Ad(BaseAd):
91
60
  merchantKycType: int
92
61
  merchantVerificationType: int
93
62
  isUserMatchCondition: bool
94
- notMatchConditionReason: str
63
+ notMatchConditionReason: str
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+ class PmE(BaseModel):
4
+ id: int
5
+ name: str
6
+ mainColor: str
7
+ icon: str
8
+ number: int
@@ -3,23 +3,30 @@ from asyncio import run
3
3
  from x_model import init_db
4
4
  from xync_schema import models
5
5
  from xync_schema.models import Ex
6
- from xync_schema.types import CurEx, CoinEx
6
+ from xync_schema import types
7
7
 
8
8
  from xync_client.Abc.Ex import BaseExClient
9
- from xync_client.Abc.types import PmEx
10
9
  from xync_client.BingX.base import BaseBingXClient
11
10
  from xync_client.loader import PG_DSN
12
11
  from xync_client.Abc.Base import MapOfIdsList
13
- from xync_client.BingX.pyd import PmEpyd, Ad
12
+ from xync_client.BingX.etype import ad, pm
13
+ from xync_client.Abc.types import PmEx
14
+ from xync_client.pm_unifier import PmUnifier
14
15
 
15
16
 
16
17
  class ExClient(BaseExClient, BaseBingXClient):
18
+ class BingUnifier(PmUnifier):
19
+ pm_map = {
20
+ "СБП": "SBP",
21
+ }
22
+
23
+ unifier_class = BingUnifier
17
24
  headers: dict[str, str] = {
18
25
  "accept": "application/json, text/plain, */*",
19
26
  "accept-language": "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
20
27
  "app_version": "9.0.5",
21
28
  "device_id": "ccfb6d50-b63b-11ef-b31f-ef1f76f67c4e",
22
- "lang": "ru-RU",
29
+ "lang": "en",
23
30
  "platformid": "30",
24
31
  "device_brand": "Linux_Chrome_131.0.0.0",
25
32
  "sec-ch-ua": '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
@@ -27,47 +34,48 @@ class ExClient(BaseExClient, BaseBingXClient):
27
34
  "x-requested-with": "XMLHttpRequest",
28
35
  }
29
36
 
30
- async def _pms(self, cur) -> list[PmEpyd]:
37
+ async def _pms(self, cur) -> list[pm.PmE]:
31
38
  pms = await self._get("/api/c2c/v1/advert/payment/list", params={"fiat": cur})
32
- return [PmEpyd(**pm) for pm in pms["data"]["paymentMethodList"]]
39
+ return [pm.PmE(**_pm) for _pm in pms["data"]["paymentMethodList"]]
33
40
 
34
41
  # 19: Список всех платежных методов на бирже
35
- async def pms(self, cur: str = None) -> dict[int, PmEx]:
42
+ async def pms(self, cur: str = None) -> dict[int | str, PmEx]:
36
43
  all_pms = {}
37
- for cur in await self.curs():
44
+ for cur in (await self.curs()).values():
38
45
  pms = await self._pms(cur.ticker)
39
- for pm in pms:
40
- all_pms[pm.id] = PmEx(id=pm.id, name=pm.name, logo=pm.icon)
46
+ for p in pms:
47
+ all_pms[p.id] = PmEx(exid=p.id, name=p.name, logo=p.icon)
41
48
  return all_pms
42
49
 
43
50
  # 20: Список поддерживаемых валют на BingX
44
- async def curs(self) -> list[CurEx]: # {cur.exid: cur.ticker}
51
+ async def curs(self) -> list[types.CurEx]: # {cur.exid: cur.ticker}
45
52
  params = {
46
53
  "type": "1",
47
54
  "asset": "USDT",
48
55
  "coinType": "2",
49
56
  }
50
57
  curs = await self._get("/api/c2c/v1/common/supportCoins", params=params)
51
- return [CurEx(exid=cur["id"], ticker=cur["name"]) for cur in curs["data"]["coins"]]
58
+ return {cur["name"]: types.CurEx(exid=cur["id"], ticker=cur["name"]) for cur in curs["data"]["coins"]}
52
59
 
53
60
  # 21: cur_pms_map на BingX
54
61
  async def cur_pms_map(self) -> MapOfIdsList:
55
- return {cur.ticker: [pm.id for pm in await self._pms(cur.ticker)] for cur in await self.curs()}
62
+ return {cur.exid: [pm.id for pm in await self._pms(cur.ticker)] for cur in (await self.curs()).values()}
56
63
 
57
64
  # 22: Монеты на BingX
58
- async def coins(self) -> list[CoinEx]:
59
- return [CoinEx(exid="1", ticker="USDT")]
65
+ async def coins(self) -> list[types.CoinEx]:
66
+ return {"USDT": types.CoinEx(exid="1", ticker="USDT")}
60
67
 
61
68
  # 23: Список пар валюта/монет
62
69
  async def pairs(self) -> MapOfIdsList:
63
- coins = await self.coins()
64
- curs = await self.curs()
65
- return {cur.ticker: set(c.ticker for c in coins) for cur in curs}
70
+ coins = (await self.coins()).keys()
71
+ curs = (await self.curs()).keys()
72
+ p = {cur: {c for c in coins} for cur in curs}
73
+ return p, p
66
74
 
67
75
  # 24: ads
68
76
  async def ads(
69
77
  self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
70
- ) -> list[Ad]:
78
+ ) -> list[ad.Ad]:
71
79
  params = {
72
80
  "type": 1,
73
81
  "fiat": cur_exid,
@@ -79,14 +87,21 @@ class ExClient(BaseExClient, BaseBingXClient):
79
87
  }
80
88
 
81
89
  ads = await self._get("/api/c2c/v1/advert/list", params=params)
82
- return [Ad(**ad) for ad in ads["data"]["dataList"]]
90
+ return [ad.Ad(**ad) for ad in ads["data"]["dataList"]]
83
91
 
84
92
 
85
93
  async def main():
86
94
  _ = await init_db(PG_DSN, models, True)
87
95
  bg = await Ex.get(name="BingX")
88
96
  cl = ExClient(bg)
89
- _ads = await cl.ads("USDT", "RUB", False)
97
+ await cl.set_coinexs()
98
+ await cl.set_pmcurexs()
99
+ # _curs = await cl.curs()
100
+ # _coins = await cl.coins()
101
+ # _pairs = await cl.pairs()
102
+ # _pms = await cl.pms("EUR")
103
+ # _pms_map = await cl.cur_pms_map()
104
+ # _ads = await cl.ads("USDT", "RUB", False)
90
105
  await cl.close()
91
106
 
92
107
 
@@ -4,6 +4,7 @@ from xync_schema.models import Cur
4
4
 
5
5
  from xync_client.Abc.Base import ListOfDicts, MapOfIdsList, DictOfDicts, FlatDict
6
6
  from xync_client.Abc.Ex import BaseExClient
7
+ from xync_client.pm_unifier import PmUnifier
7
8
 
8
9
 
9
10
  class AdsStatus(IntEnum):
@@ -12,8 +13,20 @@ class AdsStatus(IntEnum):
12
13
 
13
14
 
14
15
  class ExClient(BaseExClient): # Bybit client
16
+ class BybitUnifier(PmUnifier):
17
+ pm_map = {
18
+ "Local Bank (R-Green)": "Sberbank",
19
+ "Local Bank (S-Green)": "Sberbank",
20
+ "Local Card (Red)": "Alfa-Bank",
21
+ "Local Card (Yellow)": "T-Bank",
22
+ "Local Card M-redTS": "MTS-bank",
23
+ "Local Card-Green": "Sberbank",
24
+ "Local Card-Yellow": "T-Bank",
25
+ }
26
+
15
27
  host = "api2.bybit.com"
16
28
  headers = {"cookie": ";"} # rewrite token for public methods
29
+ unifier_class = BybitUnifier
17
30
 
18
31
  async def _get_config(self):
19
32
  resp = await self._get("/fiat/p2p/config/initial")
@@ -57,7 +70,9 @@ class ExClient(BaseExClient): # Bybit client
57
70
  return cc
58
71
 
59
72
  # 24: Список объяв по (buy/sell, cur, coin, pm)
60
- async def ads(self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None) -> ListOfDicts:
73
+ async def ads(
74
+ self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
75
+ ) -> ListOfDicts:
61
76
  data = {
62
77
  "userId": "",
63
78
  "tokenId": coin_exid,
@@ -11,9 +11,17 @@ from xync_client.Abc.Ex import BaseExClient
11
11
  from xync_client.Abc.types import PmEx
12
12
  from xync_client.Htx.etype import pm, Country, ad
13
13
  from xync_client.loader import PG_DSN
14
+ from xync_client.pm_unifier import PmUnifier
14
15
 
15
16
 
16
17
  class ExClient(BaseExClient):
18
+ class BingUnifier(PmUnifier):
19
+ pm_map = {
20
+ "SBP - Fast Bank Transfer": "SBP",
21
+ }
22
+
23
+ unifier_class = BingUnifier
24
+
17
25
  def pm_type_map(self, typ: models.Pmex) -> str:
18
26
  pass
19
27
 
@@ -0,0 +1,49 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import List, Optional
3
+
4
+ class AdPayType(BaseModel):
5
+ id: str
6
+ bankName: Optional[str] = None
7
+ payTypeCode: str
8
+ payQrcodePic: Optional[str] = None
9
+ payTypeNumber: Optional[str] = None
10
+ subBranch: Optional[str] = None
11
+ reservedFields: Optional[str] = None
12
+
13
+ class Ad(BaseModel):
14
+ id: str
15
+ side: str
16
+ legal: str
17
+ currency: str
18
+ currencyQuantity: str
19
+ currencyBalanceQuantity: str
20
+ premium: str
21
+ status: str
22
+ limitPrice: Optional[str] = None
23
+ floatPrice: str
24
+ limitMinQuote: str
25
+ limitMaxQuote: str
26
+ adPayTypes: List[AdPayType]
27
+ remarks: str
28
+ needKyc: str
29
+ nickName: str
30
+ showLetter: str
31
+ lastActiveTime: int
32
+ lastActiveDesc: str
33
+ lastActiveStatus: str
34
+ priceType: str
35
+ portraitURL: Optional[str] = None
36
+ displayStatus: str
37
+ kycLevel: int
38
+ tradeTimeLimit: int
39
+ updatedAt: int
40
+ goldMerchants: int
41
+ foxKingMerchants: int
42
+ adTarget: int
43
+ dealOrderNum: str
44
+ dealOrderRate: str
45
+ userId: str
46
+ tradeLimitTip: Optional[str] = None
47
+ opponentBalanceLimit: str
48
+ blackStatus: int
49
+ self: bool
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class PmE(BaseModel):
5
+ legal: str
6
+ payTypeId: str
7
+ payTypeCode: str
8
+ payTypeName: str
@@ -0,0 +1,75 @@
1
+ from asyncio import run
2
+
3
+ from x_model import init_db
4
+ from xync_schema import models
5
+ from xync_schema import types
6
+
7
+ from xync_client.Abc.Base import MapOfIdsList
8
+ from xync_client.Abc.Ex import BaseExClient
9
+ from xync_client.loader import PG_DSN
10
+ from xync_client.KuCoin.etype import pm, ad
11
+ from xync_client.Abc.types import PmEx
12
+
13
+
14
+ class ExClient(BaseExClient):
15
+ async def _pms(self, cur) -> list[pm.PmE]:
16
+ params = {
17
+ 'legal': cur,
18
+ 'lang': 'ru_RU',
19
+ }
20
+ pms = await self._get("/_api/otc/legal/payTypes", params=params)
21
+ return [pm.PmE(**_pm) for _pm in pms["data"]]
22
+
23
+ async def curs(self) -> list[types.CurEx]:
24
+ curs = (await self._get("/_api/otc/dictionary/getData", {"type": "LEGAL"}))["data"]
25
+ return {
26
+ cur["typeCode"]:types.CurEx(exid=cur["id"], ticker=cur["typeCode"]) for cur in curs
27
+ }
28
+
29
+ async def pms(self, cur: models.Cur = None) -> dict[int | str, PmEx]:
30
+ all_pms = {}
31
+ for cur_obj in (await self.curs()).values():
32
+ pms = await self._pms(cur_obj.ticker)
33
+ for pm in pms:
34
+ all_pms[pm.payTypeId] = PmEx(exid=pm.payTypeId, name=pm.payTypeName)
35
+ return all_pms
36
+
37
+ async def cur_pms_map(self) -> MapOfIdsList:
38
+ return {cur.exid: [pm.payTypeId for pm in await self._pms(cur.ticker)] for cur in (await self.curs()).values()}
39
+
40
+ async def coins(self) -> list[types.CoinEx]:
41
+ all_coins = {}
42
+ for cur in (await self.curs()).keys():
43
+ params = {
44
+ 'legal': cur,
45
+ 'lang': 'ru_RU',
46
+ }
47
+ coins = await self._get("/_api/otc/symbol/support", params=params)
48
+ for coin in coins["data"]:
49
+ all_coins[coin["currency"]] = types.CoinEx(exid=coin["currencyPrecision"] ,ticker=coin["currency"])
50
+ return all_coins
51
+
52
+ async def pairs(self) -> MapOfIdsList:
53
+ coins = (await self.coins()).keys()
54
+ curs = (await self.curs()).keys()
55
+ b = {cur: {c for c in coins} for cur in curs}
56
+ s = {cur: {c for c in coins} for cur in curs}
57
+ return s, b
58
+
59
+ async def ads(
60
+ self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
61
+ ) -> list[ad.Ad]:
62
+ pass
63
+
64
+
65
+ async def main():
66
+ _ = await init_db(PG_DSN, models, True)
67
+ bg = await Ex.get(name="KuCoin")
68
+ cl = ExClient(bg)
69
+ # await cl.curs()
70
+ # await cl.coins()
71
+ await cl.pms()
72
+
73
+
74
+ if __name__ == "__main__":
75
+ run(main())
@@ -3,17 +3,6 @@ from typing import List, Optional
3
3
  from xync_schema.types import BaseAd
4
4
 
5
5
 
6
- class PmE(BaseModel):
7
- fieldJson: list
8
- instantSettlePayment: bool
9
- mainColor: str
10
- mostUsed: bool
11
- needVerification: bool
12
- paymentMethod: str
13
- paymentMethodDescription: str
14
- transferSpeed: int
15
-
16
-
17
6
  class PromoBadgeInfoVo(BaseModel):
18
7
  badgeList: List[str]
19
8
 
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class PmE(BaseModel):
5
+ fieldJson: list
6
+ instantSettlePayment: bool
7
+ mainColor: str
8
+ mostUsed: bool
9
+ needVerification: bool
10
+ paymentMethod: str
11
+ paymentMethodDescription: str
12
+ transferSpeed: int
@@ -7,50 +7,62 @@ from xync_schema import types
7
7
  from xync_client.Abc.Base import MapOfIdsList
8
8
  from xync_client.Abc.Ex import BaseExClient
9
9
  from xync_client.loader import PG_DSN
10
- from xync_client.Okx.pyd import PmE, Ads, Ad
11
-
10
+ from xync_client.Okx.etype import ad, pm
11
+ from xync_client.Abc.types import PmEx
12
12
 
13
13
  class ExClient(BaseExClient):
14
- async def _pms(self, cur) -> list[PmE]:
14
+ async def _pms(self, cur) -> list[pm.PmE]:
15
15
  params = {
16
16
  "quoteCurrency": f"{cur}",
17
17
  "needField": "false",
18
18
  }
19
19
  pms = await self._get("/v3/c2c/configs/receipt/templates", params=params)
20
- return [PmE(**pm) for pm in pms["data"]]
20
+ return [pm.PmE(**_pm) for _pm in pms["data"]]
21
21
 
22
22
  # 19: Список поддерживаемых валют тейкера
23
- async def curs(self) -> list[types.CurE]: # {cur.exid: cur.ticker}
23
+ async def curs(self) -> list[types.CurEx]: # {cur.exid: cur.ticker}
24
24
  curs = await self._get("/v3/users/common/list/currencies")
25
- return [types.CurE(exid=cur["currencyId"], ticker=cur["displayName"]) for cur in curs["data"]]
25
+ return {
26
+ cur["displayName"]: types.CurEx(exid=cur["currencyId"],ticker=cur["displayName"])
27
+ for cur in curs["data"]
28
+ }
26
29
 
27
30
  # 20: Список платежных методов
28
- async def pms(self, cur: models.Cur = None) -> dict[int | str, types.Pm]: # {pm.exid: pm}
31
+ async def pms(self, cur: models.Cur = None) -> dict[int | str, PmEx]: # {pm.exid: pm}
29
32
  all_pms = {}
30
- for cur in await self.curs():
31
- pms = await self._pms(cur.ticker)
33
+ for cur_obj in (await self.curs()).values():
34
+ pms = await self._pms(cur_obj.ticker)
32
35
  for pm in pms:
33
- all_pms[pm.transferSpeed] = types.Pm(name=pm.paymentMethod)
36
+ all_pms[pm.transferSpeed] = PmEx(exid=pm.transferSpeed, name=pm.paymentMethod)
34
37
  return all_pms
35
38
 
36
39
  # 21: Список платежных методов по каждой валюте
37
40
  async def cur_pms_map(self) -> MapOfIdsList: # {cur.exid: [pm.exid]}
38
- return {cur.ticker: [pm.paymentMethod for pm in await self._pms(cur.ticker)] for cur in await self.curs()}
41
+ return {cur.exid: [pm.paymentMethod for pm in await self._pms(cur.ticker)] for cur in (await self.curs()).values()}
39
42
 
40
43
  # 22: Список торгуемых монет (с ограничениям по валютам, если есть)
41
- async def coins(self) -> list[types.CoinE]: # {coin.exid: coin.ticker}
42
- ...
44
+ async def coins(self) -> list[types.CoinEx]: # {coin.exid: coin.ticker}
45
+ for cur in (await self.curs()).keys():
46
+ params = {
47
+ 'type': '1',
48
+ 'quote': cur,
49
+ 'side': 'buy'
50
+ }
51
+ coins = await self._get("/v3/c2c/currency/pairs", params=params)
52
+ return {coin["baseCurrency"]: types.CoinEx(exid=coin["baseCurrencyId"], ticker=coin["baseCurrency"]) for coin in coins["data"]}
43
53
 
44
54
  # 23: Список пар валюта/монет
45
55
  async def pairs(self) -> MapOfIdsList:
46
- coins = await self.coins()
47
- curs = await self.curs()
48
- return {cur.ticker: set(c.ticker for c in coins) for cur in curs}
56
+ coins = (await self.coins()).keys()
57
+ curs = (await self.curs()).keys()
58
+ b = {cur: {c for c in coins} for cur in curs}
59
+ s = {cur: {c for c in coins} for cur in curs}
60
+ return s, b
49
61
 
50
62
  # 24: Список объяв по (buy/sell, cur, coin, pm)
51
63
  async def ads(
52
64
  self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
53
- ) -> list[Ads]: # {ad.id: ad}
65
+ ) -> list[ad.Ads]: # {ad.id: ad}
54
66
  params = {
55
67
  "side": "sell",
56
68
  "paymentMethod": "all",
@@ -64,16 +76,16 @@ class ExClient(BaseExClient):
64
76
  "numberPerPage": "5",
65
77
  }
66
78
  ads = await self._get("/v3/c2c/tradingOrders/getMarketplaceAdsPrelogin", params=params)
67
- return [Ads(**ad) for ad in ads["data"]["sell"]]
79
+ return [ad.Ads(**ad) for ad in ads["data"]["sell"]]
68
80
 
69
81
  # 42: Чужая объява по id
70
- async def ad(self, ad_id: int) -> Ad:
82
+ async def ad(self, ad_id: int) -> ad.Ad:
71
83
  params = {
72
84
  "publicUserId": "f81434eb2a",
73
85
  "t": f"{ad_id}",
74
86
  }
75
87
  ad = await self._get("/v3/c2c/merchant/liteProfile", params=params)
76
- return Ad(**ad)
88
+ return ad.Ad(**ad)
77
89
 
78
90
 
79
91
  async def main():
@@ -1,8 +1,9 @@
1
- from asyncio import run
1
+ from asyncio import run, sleep
2
2
 
3
3
  from x_model import init_db
4
4
  from xync_schema import types
5
5
  from xync_schema import models
6
+ from xync_schema.types import AdBuyIn
6
7
 
7
8
  from xync_client.Abc.types import PmEx
8
9
  from xync_client.TgWallet.pyd import (
@@ -25,6 +26,7 @@ class ExClient(BaseExClient, AuthClient):
25
26
  super().__init__(ex) # BaseExClient
26
27
 
27
28
  def pm_type_map(self, pm: models.Pm) -> str:
29
+ # todo: no pm.name
28
30
  return "V2" if pm.name.startswith("SBP") else "V1"
29
31
 
30
32
  # 00: todo: min-max for cur and coin ad amount, order, fee ..
@@ -91,7 +93,8 @@ class ExClient(BaseExClient, AuthClient):
91
93
  # 42: Чужая объява по id
92
94
  async def ad(self, ad_id: int) -> _TakerOne:
93
95
  ad = await self._post("/p2p/public-api/v2/offer/get", {"offerId": ad_id})
94
- ad: dict = ad["data"]
96
+ if not (ad := ad.get("data")):
97
+ return ad
95
98
  model = OneAdTakerMakerSale if ad["type"] == "SALE" else OneAdTakerBuy
96
99
  return model(**ad)
97
100
 
@@ -142,10 +145,10 @@ async def _test():
142
145
  await init_db(PG_DSN, models, True)
143
146
  tgex = await models.Ex.get(name="TgWallet")
144
147
  cl: ExClient = tgex.client()
145
- # await cl.pms()
146
- # await cl.pairs()
147
- # await cl.set_pmcurexs()
148
- # await cl.set_coinexs()
148
+ await cl.pms()
149
+ await cl.pairs()
150
+ await cl.set_pmcurexs()
151
+ await cl.set_coinexs()
149
152
 
150
153
  # # # SALE # # #
151
154
  # get ads list
@@ -155,12 +158,12 @@ async def _test():
155
158
  # list items save
156
159
  _ads_db = [await cl.ad_pydin2db(adi) for adi in ads_pydin]
157
160
 
158
- # # get ad fulls
159
- # ads_pyd: list[_TakerOne] = [await cl.ad(ad.id) for ad in ads]
160
- # # prepare ad fulls for saving
161
- # ads_pydin: list[AdBuyPydIn] = [await cl.ad_taker_epyd2pydin(adp) for adp in ads_pyd]
162
- # # full ones save
163
- # _ads_db = [await cl.ad_pydin2db(adi) for adi in ads_pydin]
161
+ # get ad fulls
162
+ ads_pyd: list[_TakerOne] = [await cl.ad(ad.exid) for ad in ads]
163
+ # prepare ad fulls for saving
164
+ ads_pydin: list[AdBuyIn] = [await cl.ad_taker_epyd2pydin(adp) for adp in ads_pyd]
165
+ # full ones save
166
+ _ads_db = [await sleep(0.1, await cl.ad_pydin2db(adi)) for adi in ads_pydin]
164
167
 
165
168
  # # # BUY # # #
166
169
  # get ads list
@@ -170,12 +173,12 @@ async def _test():
170
173
  # list items save
171
174
  _ads_db = [await cl.ad_pydin2db(adi) for adi in ads_pydin]
172
175
 
173
- # # get ad fulls
174
- # ads_pyd = [await cl.ad(ad.id) for ad in ads]
175
- # # prepare ad fulls for saving
176
- # ads_pydin: list[AdBuyPydIn] = [await cl.ad_taker_epyd2pydin(adp) for adp in ads_pyd]
177
- # # full ones save
178
- # _ads_db = [await cl.ad_pydin2db(adi) for adi in ads_pydin]
176
+ # get ad fulls
177
+ ads_pyd = [await cl.ad(ad.exid) for ad in ads]
178
+ # prepare ad fulls for saving
179
+ ads_pydin: list[AdBuyIn] = [await cl.ad_taker_epyd2pydin(adp) for adp in ads_pyd]
180
+ # full ones save
181
+ _ads_db = [await cl.ad_pydin2db(adi) for adi in ads_pydin]
179
182
 
180
183
  await cl.close()
181
184
 
@@ -16,14 +16,7 @@ class PmUnifier:
16
16
 
17
17
  pm_map: dict[str, str] = {
18
18
  "Юmoney": "YooMoney",
19
- # "Local Bank (R-Green)": "Sberbank",
20
- # "Local Bank (S-Green)": "Sberbank",
21
- # "Local Card (Red)": "Alfa-Bank",
22
- # "Local Card (Yellow)": "Tinkoff",
23
- # "Local Card M-redTS": "MTS-bank",
24
- # "Local Card-Green": "Sberbank",
25
- # "Local Card-Yellow": "Tinkoff",
26
- # "GTB Bank (Guarantee Trust Bank)": "GTBank",
19
+ "GTB Bank (Guarantee Trust Bank)": "GTBank",
27
20
  }
28
21
  re_bank = [
29
22
  r"^bank (?!of )|bank$",
@@ -1,23 +1,32 @@
1
+ import io
1
2
  from asyncio import run
3
+ from os.path import dirname
4
+
5
+ import requests
6
+ from PIL import Image
7
+ from PIL.ImageEnhance import Brightness
2
8
  from pyrogram import Client
3
9
  from pyrogram.errors import UserNotParticipant
4
- from pyrogram.raw.functions.channels import ToggleForum
5
- from pyrogram.raw.types import InputChannel
6
10
  from pyrogram.types import ChatPrivileges, Chat
7
- from src.loader import PG_DSN
8
- from tg_auth import UserStatus
9
11
  from x_model import init_db
12
+ from xync_schema.enums import UserStatus
13
+
10
14
  from xync_client.loader import TG_API_ID, TG_API_HASH
11
15
  from xync_schema import models
12
16
  from xync_schema.models import Agent
13
17
 
14
18
  max_privs = ChatPrivileges(
15
- # can_manage_chat=True, 3 default
19
+ can_manage_chat=True, # default
16
20
  can_delete_messages=True,
21
+ can_delete_stories=True, # Channels only
17
22
  can_manage_video_chats=True, # Groups and supergroups only
18
23
  can_restrict_members=True,
19
24
  can_promote_members=True,
20
25
  can_change_info=True,
26
+ can_post_messages=True, # Channels only
27
+ can_post_stories=True, # Channels only
28
+ can_edit_messages=True, # Channels only
29
+ can_edit_stories=True, # Channels only
21
30
  can_invite_users=True,
22
31
  can_pin_messages=True, # Groups and supergroups only
23
32
  can_manage_topics=True, # Supergroups only
@@ -27,7 +36,7 @@ max_privs = ChatPrivileges(
27
36
 
28
37
  class PyroClient:
29
38
  def __init__(self, agent: Agent):
30
- self.app: Client = Client(str(agent.user_id), TG_API_ID, TG_API_HASH, session_string=agent.auth["sess"])
39
+ self.app: Client = Client(str(agent.actor.user_id), TG_API_ID, TG_API_HASH, session_string=agent.auth["sess"])
31
40
 
32
41
  async def create_orders_forum(self, uid: int) -> tuple[int, bool]:
33
42
  async with self.app as app:
@@ -53,7 +62,7 @@ class PyroClient:
53
62
  async def main():
54
63
  _ = await init_db(PG_DSN, models, True)
55
64
  agent = await Agent.filter(
56
- actor__ex__name="TgWallet", auth__isnull=False, user__status__gt=UserStatus.RESTRICTED
65
+ actor__ex__name="TgWallet", auth__isnull=False, user__status__gt=UserStatus.SLEEP
57
66
  ).first() # .order_by("-user__created_forums__count")
58
67
  pcl = PyroClient(agent)
59
68
  res = await pcl.create_orders_forum("cryrub")
@@ -67,3 +76,12 @@ if __name__ == "__main__":
67
76
  load_dotenv()
68
77
  PG_DSN = f"postgres://{env('POSTGRES_USER')}:{env('POSTGRES_PASSWORD')}@{env('POSTGRES_HOST', 'xyncdbs')}:{env('POSTGRES_PORT', 5432)}/{env('POSTGRES_DB', env('POSTGRES_USER'))}"
69
78
  run(main())
79
+
80
+
81
+ def ava(url: str) -> bytes:
82
+ byts = requests.get(url).content
83
+ jpg = Image.open(io.BytesIO(byts)).convert('RGBA')
84
+ jpg = Brightness(jpg).enhance(0.5)
85
+ png = Image.open(dirname(__file__) + '/xico.png')
86
+ jpg.paste(png, (0, 0, 320, 320), mask=png)
87
+ return jpg.tobytes()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xync-client
3
- Version: 0.0.25.dev47
3
+ Version: 0.0.25.dev50
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/client
@@ -46,10 +46,10 @@ xync_client/BingX/__init__.py
46
46
  xync_client/BingX/agent.py
47
47
  xync_client/BingX/base.py
48
48
  xync_client/BingX/ex.py
49
- xync_client/BingX/pyd.py
50
49
  xync_client/BingX/req.mjs
51
50
  xync_client/BingX/sign.js
52
- xync_client/BingX/test/main.py
51
+ xync_client/BingX/etype/ad.py
52
+ xync_client/BingX/etype/pm.py
53
53
  xync_client/BitGet/__init__.py
54
54
  xync_client/BitGet/agent.py
55
55
  xync_client/BitGet/ex.py
@@ -67,10 +67,13 @@ xync_client/Htx/etype/__init__.py
67
67
  xync_client/Htx/etype/ad.py
68
68
  xync_client/Htx/etype/cred.py
69
69
  xync_client/Htx/etype/pm.py
70
- xync_client/KuCoin/pub.py
70
+ xync_client/KuCoin/ex.py
71
71
  xync_client/KuCoin/web.py
72
+ xync_client/KuCoin/etype/ad.py
73
+ xync_client/KuCoin/etype/pm.py
72
74
  xync_client/Okx/ex.py
73
- xync_client/Okx/pyd.py
75
+ xync_client/Okx/etype/ad.py
76
+ xync_client/Okx/etype/pm.py
74
77
  xync_client/TgWallet/agent.py
75
78
  xync_client/TgWallet/asset.py
76
79
  xync_client/TgWallet/auth.py
@@ -1,52 +0,0 @@
1
- import requests
2
-
3
- cookies = {
4
- '__cf_bm': 'YkMbbTCO0X3QoR62nKzJi70V6SfgSUGKz5WZaTYYMd4-1738247827-1.0.1.1-HlJG9k3o1QEgRBTjxdFUDE4RTiW3IlnlghrNzBl2xbEKEEW7UhLW66FN_cZg5q6RAN2eH5o68h9i0GCsGxS4wA',
5
- }
6
-
7
- headers = {
8
- 'accept': 'application/json, text/plain, */*',
9
- 'accept-language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
10
- 'app_version': '9.2.15',
11
- 'appid': '30004',
12
- 'appsiteid': '0',
13
- 'authorization': 'Bearer eyJicyI6MCwiYWlkIjoxMDAwOSwicGlkIjoiMzAiLCJzaWQiOiJhM2JmYWE4MzFiOWUxYzc5MGJjYjBkYmNjMjM3YTFmMiIsImFsZyI6IkhTNTEyIn0.eyJzdWIiOiIxMzc5MzM1NzcyNDUxNDk1OTQxIiwiZXhwIjoxNzM4Njc5ODM5LCJqdGkiOiIxZGZmYjNhOC02ZjU1LTQ0OTYtOWZhNi02NDQ5ODdjNjQ0MDMifQ.t51lrJYfjCd-N9iLjB7It47ku6imK-cchk42QPIWf5IrUjsuI1PsX6OWLvvFkoIw5uucuSlNQrlcbuFRPz5ngA',
14
- 'channel': 'official',
15
- 'content-type': 'application/json',
16
- # 'cookie': '__cf_bm=YkMbbTCO0X3QoR62nKzJi70V6SfgSUGKz5WZaTYYMd4-1738247827-1.0.1.1-HlJG9k3o1QEgRBTjxdFUDE4RTiW3IlnlghrNzBl2xbEKEEW7UhLW66FN_cZg5q6RAN2eH5o68h9i0GCsGxS4wA',
17
- 'device_brand': 'Linux_Chrome_132.0.0.0',
18
- 'device_id': '6f76e02b64ba4a078a331eb5c323913b',
19
- 'lang': 'ru-RU',
20
- 'mainappid': '10009',
21
- 'origin': 'https://bingx.paycat.com',
22
- 'platformid': '30',
23
- 'priority': 'u=1, i',
24
- 'referer': 'https://bingx.paycat.com/',
25
- 'reg_channel': 'official',
26
- 'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
27
- 'sec-ch-ua-mobile': '?0',
28
- 'sec-ch-ua-platform': '"Linux"',
29
- 'sec-fetch-dest': 'empty',
30
- 'sec-fetch-mode': 'cors',
31
- 'sec-fetch-site': 'cross-site',
32
- 'sign': '3CEFB4B1B8B7FF82080D092FB1D68F3B7DC5E91FAFB3CD885636FAB9889FD3A3',
33
- 'timestamp': '1738247933539',
34
- 'timezone': '3',
35
- 'traceid': 'e2f42528383e4bc095151a9f501f57fd',
36
- 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
37
- 'x-requested-with': 'XMLHttpRequest',
38
- }
39
-
40
- json_data = {
41
- 'advertNo': '1383430032238764040',
42
- 'asset': 'USDT',
43
- 'fiat': 'RUB',
44
- 'type': 1,
45
- 'userPrice': 103,
46
- 'areaType': 2,
47
- 'amount': '500',
48
- 'paymentMethodId': 110,
49
- }
50
-
51
- response = requests.post('https://api-app.qq-os.com/api/c2c/v1/order/create', cookies=cookies, headers=headers, json=json_data)
52
- print(response.text)
@@ -1,47 +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.Base import MapOfIdsList
8
- from xync_client.Abc.Ex import BaseExClient
9
- from xync_client.loader import PG_DSN
10
-
11
-
12
- class ExClient(BaseExClient):
13
- async def cur_pms_map(self) -> MapOfIdsList:
14
- pass
15
-
16
- async def curs(self) -> list[Cur]:
17
- curs = (await self._get("/_api/otc/dictionary/getData", {"type": "LEGAL"}))["data"]
18
- curs = [(await Cur.update_or_create(ticker=cur["typeCode"]))[0] for cur in curs]
19
- curexs = [Curex(cur=c, ex=self.ex) for c in curs]
20
- await Curex.bulk_create(curexs, ignore_conflicts=True)
21
- return curs
22
-
23
- async def coins(self, cur: Cur = None) -> list[Coin]: ...
24
-
25
- async def pms(self, cur: Cur = None) -> list[Pm]:
26
- pmcurs = {
27
- cur.ticker: (await self._get("/_api/otc/legal/payTypes", {"legal": cur.ticker}))["data"]
28
- for cur in await self.curs()
29
- }
30
- pp = {}
31
- [[pp.update({p["payTypeCode"]: p["payTypeName"]}) for p in ps] for ps in pmcurs.values()]
32
- return pp
33
-
34
- async def ads(self, coin: Coin, cur: Cur, is_sell: bool, pms: list[Pm] = None) -> list[Ad]:
35
- pass
36
-
37
-
38
- async def main():
39
- _ = await init_db(PG_DSN, models, True)
40
- bg = await Ex.get(name="KuCoin")
41
- cl = ExClient(bg)
42
- # await cl.curs()
43
- # await cl.coins()
44
- await cl.pms()
45
-
46
-
47
- run(main())