xync-client 0.0.43.dev11__tar.gz → 0.0.43.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.43.dev11/xync_client.egg-info → xync_client-0.0.43.dev15}/PKG-INFO +1 -1
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/Ex.py +6 -1
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/ex.py +1 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitGet/ex.py +8 -15
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/agent.py +75 -20
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/ex.py +6 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Gate/ex.py +5 -1
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/ex.py +1 -4
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/volet.py +23 -9
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/ex.py +2 -4
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/pm_unifier.py +4 -2
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15/xync_client.egg-info}/PKG-INFO +1 -1
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/.env.sample +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/.gitignore +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/README.md +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/makefile +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/pyproject.toml +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/setup.cfg +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/TestAgent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/TestAsset.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/TestEx.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/TestOrder.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Binance/test_binance.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Gate/test_gate.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Wallet/test_agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Wallet/test_ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/_test_ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/Asset.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/AuthTrait.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/BaseTest.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/InAgent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Abc/types.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/base.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/req.mjs +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BingX/sign.js +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitGet/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/BitPapa/ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/InAgent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/etype/cred.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/etype/order.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Bybit/ws.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Gate/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/etype/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/etype/cred.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Htx/etype/test.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/KuCoin/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/KuCoin/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/KuCoin/ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Mexc/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Mexc/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Mexc/ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Okx/etype/ad.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Okx/etype/pm.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/_todo_req/req.mjs +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/_todo_req/req.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/api.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/asset.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/auth.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/inAgent.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/pyd.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/__init__.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/loader.py +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client.egg-info/SOURCES.txt +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client.egg-info/requires.txt +0 -0
- {xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ from aiohttp import ClientSession
|
|
|
7
7
|
from msgspec import Struct
|
|
8
8
|
from tortoise.exceptions import MultipleObjectsReturned, IntegrityError
|
|
9
9
|
from xync_schema import models
|
|
10
|
-
from xync_schema.enums import FileType
|
|
10
|
+
from xync_schema.enums import FileType, df_curs
|
|
11
11
|
from xync_schema.types import CurEx, CoinEx, BaseAd, BaseAdIn
|
|
12
12
|
|
|
13
13
|
from xync_client.Abc.Base import BaseClient, MapOfIdsList
|
|
@@ -163,11 +163,16 @@ class BaseExClient(BaseClient):
|
|
|
163
163
|
await models.Pmex.update_or_create({"pm": pm_}, ex=self.ex, exid=k, name=pmex.name)
|
|
164
164
|
else:
|
|
165
165
|
pmin = models.Pm.validate({**pmu.model_dump(), "country_id": country_id, "typ": pmex.typ})
|
|
166
|
+
if c := df_curs.get(pmu.norm):
|
|
167
|
+
pmin.df_cur_id = curs[c].id
|
|
166
168
|
try:
|
|
167
169
|
pms[k], _ = await models.Pm.update_or_create(**pmin.df_unq())
|
|
168
170
|
except (MultipleObjectsReturned, IntegrityError) as e:
|
|
169
171
|
raise e
|
|
170
172
|
prev = k, pmu.norm, pmex.name, pmu.country
|
|
173
|
+
await models.Pmcur.update_or_create(
|
|
174
|
+
cur=await models.Cur.get(ticker="THB"), pm=await models.Pm.get(norm="cash in person")
|
|
175
|
+
)
|
|
171
176
|
|
|
172
177
|
# Pmexs
|
|
173
178
|
pbot = PyroClient(bot)
|
|
@@ -18,6 +18,7 @@ class ExClient(BaseExClient, BaseBingXClient):
|
|
|
18
18
|
class BingUnifier(PmUnifier):
|
|
19
19
|
pm_map = {
|
|
20
20
|
"СБП": "SBP",
|
|
21
|
+
"Tinkoff Bank": "T-Bank",
|
|
21
22
|
"Transfer with Specific Bank": "Transfers with specific bank",
|
|
22
23
|
"Al-Rafidain Qi Services": "Al-Rafidain QiServices",
|
|
23
24
|
}
|
|
@@ -24,25 +24,18 @@ class ExClient(BaseExClient):
|
|
|
24
24
|
"ADCB Abu Dhabi Commercial Bank": "ADCB",
|
|
25
25
|
"BDO": "Banco De Oro (BDO)",
|
|
26
26
|
"Touch 'n Go": "Touch n Go",
|
|
27
|
-
"
|
|
27
|
+
"Local Card-Yellow": "T-Bank",
|
|
28
|
+
"Tinkoff": "T-Bank",
|
|
29
|
+
"Local Card M-redTS": "MTS-bank",
|
|
30
|
+
"Local Card-Green": "Sberbank",
|
|
31
|
+
"LINE Bank by Hana Bank": "LINE Pay",
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
unifier_class = BitGetUnifier
|
|
31
35
|
_data: dict = {}
|
|
32
36
|
|
|
33
37
|
headers = {
|
|
34
|
-
"
|
|
35
|
-
"content-type": "application/json;charset=UTF-8",
|
|
36
|
-
"deviceid": "883e1394d8a2278418b6f02804df16c4",
|
|
37
|
-
"devicelanguage": "ru_RU",
|
|
38
|
-
"gaclientid": "2005612572.1744132981",
|
|
39
|
-
"securitynew": "true",
|
|
40
|
-
"terminalcode": "534488ac72b9b87c3ba87725387639ac",
|
|
41
|
-
"terminaltype": "1",
|
|
42
|
-
"timezone": "GMT+03:00",
|
|
43
|
-
"tm": "1744133012568",
|
|
44
|
-
"uhti": "w17441330126555b55e2d8627",
|
|
45
|
-
"usenewpwdversion": "true",
|
|
38
|
+
"referer": "https://www.bitget.com/ru/p2p-trade",
|
|
46
39
|
}
|
|
47
40
|
|
|
48
41
|
async def _coin_cur_pms(self, trying: int = 0) -> dict:
|
|
@@ -53,7 +46,7 @@ class ExClient(BaseExClient):
|
|
|
53
46
|
"node",
|
|
54
47
|
dirname(__file__) + "/req.mjs",
|
|
55
48
|
"pub/currency/queryAllCoinAndFiat",
|
|
56
|
-
"
|
|
49
|
+
'{"languageType":6}',
|
|
57
50
|
json.dumps(self.headers, separators=(",", ":")),
|
|
58
51
|
],
|
|
59
52
|
stdout=subprocess.PIPE,
|
|
@@ -137,7 +130,7 @@ async def main():
|
|
|
137
130
|
_ = await init_db(PG_DSN, models, True)
|
|
138
131
|
bg = await Ex.get(name="BitGet")
|
|
139
132
|
cl = ExClient(bg)
|
|
140
|
-
_ads = await cl.ads("ETH", "PHP", False)
|
|
133
|
+
# _ads = await cl.ads("ETH", "PHP", False)
|
|
141
134
|
await cl.curs()
|
|
142
135
|
await cl.coins()
|
|
143
136
|
await cl.pms()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from asyncio import run, sleep
|
|
1
|
+
from asyncio import run, sleep, gather
|
|
2
2
|
from enum import IntEnum
|
|
3
3
|
from http.client import HTTPException
|
|
4
|
+
from math import floor
|
|
5
|
+
from typing import Literal
|
|
4
6
|
|
|
5
7
|
import pyotp
|
|
6
8
|
from bybit_p2p import P2P
|
|
@@ -107,19 +109,31 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
107
109
|
)
|
|
108
110
|
):
|
|
109
111
|
raise HTTPException(f"No Pmex {cred.paymentType} on ex#{self.ex_client.ex.name}", 404)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
if cred_old := await models.Cred.get_or_none(credexs__exid=cred.id, credexs__ex=self.ex).prefetch_related(
|
|
113
|
+
"pmcur"
|
|
114
|
+
):
|
|
115
|
+
cur_id = cred_old.pmcur.cur_id
|
|
116
|
+
else: # is new Cred
|
|
117
|
+
cur_id = (
|
|
118
|
+
pmex.pm.df_cur_id
|
|
119
|
+
or (pmex.pm.country_id and await pmex.pm.country.cur_id)
|
|
120
|
+
or (cred.currencyBalance and await models.Cur.get_or_none(ticker=cred.currencyBalance[0]))
|
|
121
|
+
or (0 < len(pmex.pm.curs) < 20 and pmex.pm.curs[-1].id)
|
|
122
|
+
)
|
|
123
|
+
if not cur_id:
|
|
124
|
+
raise Exception(f"Set default cur for {pmex.name}")
|
|
125
|
+
if not (pmcur := await models.Pmcur.get_or_none(cur_id=cur_id, pm_id=pmex.pm_id)):
|
|
114
126
|
raise HTTPException(f"No Pmcur with cur#{cred.currencyBalance} and pm#{cred.paymentType}", 404)
|
|
115
127
|
dct = {
|
|
116
|
-
"pmcur_id":
|
|
128
|
+
"pmcur_id": pmcur.id,
|
|
117
129
|
"name": cred.paymentConfigVo.paymentName,
|
|
118
|
-
"person_id":
|
|
130
|
+
"person_id": self.actor.person_id,
|
|
131
|
+
"detail": cred.accountNo,
|
|
132
|
+
"extra": cred.branchName or cred.bankName,
|
|
119
133
|
} # todo: WTD with multicur pms?
|
|
120
134
|
cred_in = models.Cred.validate(dct, False)
|
|
121
135
|
cred_db, _ = await models.Cred.update_or_create(**cred_in.df_unq())
|
|
122
|
-
credex_in = models.CredEx.validate({"exid": cred.
|
|
136
|
+
credex_in = models.CredEx.validate({"exid": cred.id, "cred_id": cred_db.id, "ex_id": self.ex.id})
|
|
123
137
|
credex_db, _ = await models.CredEx.update_or_create(**credex_in.df_unq())
|
|
124
138
|
return credex_db
|
|
125
139
|
|
|
@@ -129,8 +143,6 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
129
143
|
credexs: list[models.CredEx] = [await self.cred_epyd2db(f) for f in credexs_epyd]
|
|
130
144
|
return credexs
|
|
131
145
|
|
|
132
|
-
return data["result"] if data["ret_code"] == 0 else data
|
|
133
|
-
|
|
134
146
|
async def ott(self):
|
|
135
147
|
t = await self._post("/user/private/ott")
|
|
136
148
|
return t
|
|
@@ -345,17 +357,55 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
345
357
|
},
|
|
346
358
|
)
|
|
347
359
|
|
|
348
|
-
async def battle(
|
|
360
|
+
async def battle(
|
|
361
|
+
self,
|
|
362
|
+
coin: models.Coin,
|
|
363
|
+
cur: models.Cur,
|
|
364
|
+
is_sell: bool,
|
|
365
|
+
pms: list[models.Pm],
|
|
366
|
+
amount: float,
|
|
367
|
+
ceil: float,
|
|
368
|
+
place: int = 1,
|
|
369
|
+
):
|
|
370
|
+
k = (-1) ** int(is_sell)
|
|
371
|
+
pays: list[str] = []
|
|
349
372
|
while self.actor.person.user.status > 0:
|
|
350
373
|
ads: list[Ad] = await self.ads(coin, cur, is_sell, pms)
|
|
374
|
+
idiot_maker_filter(ads, ceil, k)
|
|
351
375
|
cur_plc = [i for i, ad in enumerate(ads) if int(ad.accountId) == self.actor.exid][0]
|
|
352
376
|
if cur_plc > place:
|
|
353
|
-
|
|
354
|
-
mad
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
377
|
+
cad: Ad = ads[place]
|
|
378
|
+
mad: Ad = ads.pop(cur_plc)
|
|
379
|
+
if not pays: # cached
|
|
380
|
+
pays += await models.CredEx.filter(
|
|
381
|
+
cred__pmcur__pm__pmexs__exid__in=mad.payments, cred__pmcur__pm__pmexs__ex_id=self.ex.id
|
|
382
|
+
).values_list("exid", flat=True)
|
|
383
|
+
cprice = float(cad.price)
|
|
384
|
+
if (cprice - ceil) * k > 0:
|
|
385
|
+
rprice = cprice
|
|
386
|
+
else:
|
|
387
|
+
rprice = float(ads[cur_plc].price)
|
|
388
|
+
step = 0.01 if cad.recentExecuteRate > mad.recentExecuteRate else 0
|
|
389
|
+
mew_price = str(round(rprice - k * step, cur.scale))
|
|
390
|
+
if mad.price == mew_price:
|
|
391
|
+
print(end="V" if is_sell else "A", flush=True)
|
|
392
|
+
await sleep(2)
|
|
393
|
+
continue
|
|
394
|
+
mad.price = mew_price
|
|
395
|
+
mad.quantity = str(floor(amount))
|
|
396
|
+
req = AdUpdateRequest.model_validate({**mad.model_dump(), "paymentIds": [str(p) for p in pays]})
|
|
397
|
+
_res = self.ad_upd(req)
|
|
398
|
+
print("-" if is_sell else "+", end=req.price, flush=True)
|
|
399
|
+
else:
|
|
400
|
+
print(end="v" if is_sell else "^", flush=True)
|
|
401
|
+
await sleep(3)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def idiot_maker_filter(ads: list[Ad], ceil: float, k: Literal[-1, 1]):
|
|
405
|
+
# игнорим ads с ценами >+5% моего страховочного потолка
|
|
406
|
+
if (ceil * (1 - k * 0.04) - float(ads[0].price)) * k > 0:
|
|
407
|
+
ads.pop(0)
|
|
408
|
+
idiot_maker_filter(ads, ceil, k)
|
|
359
409
|
|
|
360
410
|
|
|
361
411
|
def listen(data: dict):
|
|
@@ -368,12 +418,17 @@ async def main():
|
|
|
368
418
|
await models.Actor.filter(ex_id=9, agent__isnull=False).prefetch_related("ex", "agent", "person__user").first()
|
|
369
419
|
)
|
|
370
420
|
cl: AgentClient = actor.client()
|
|
421
|
+
# await cl.ex_client.set_pmcurexs(cookies=actor.agent.auth["cookies"]) # 607 -> 629
|
|
371
422
|
coin = await models.Coin.get(ticker="USDT")
|
|
372
423
|
cur = await models.Cur.get(ticker="RUB")
|
|
373
424
|
volet = await models.Pm.get(norm="volet")
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
await cl.
|
|
425
|
+
asset = await models.Asset.filter(addr__actor=actor, addr__coin=coin).first()
|
|
426
|
+
asset.free - (asset.freeze or 0) - (asset.lock or 0)
|
|
427
|
+
# await cl.set_creds()
|
|
428
|
+
await gather(
|
|
429
|
+
cl.battle(coin, cur, False, [volet], 235, 86.9, 0),
|
|
430
|
+
cl.battle(coin, cur, True, [volet], 65, 82.1, 0),
|
|
431
|
+
)
|
|
377
432
|
|
|
378
433
|
bor = BaseOrderReq(
|
|
379
434
|
ad_id="1861440060199632896",
|
|
@@ -19,10 +19,16 @@ class ExClient(BaseExClient): # Bybit client
|
|
|
19
19
|
"Local Bank (R-Green)": "Sberbank",
|
|
20
20
|
"Local Bank (S-Green)": "Sberbank",
|
|
21
21
|
"Local Card (Red)": "Alfa-Bank",
|
|
22
|
+
"Local Card(Red)": "Alfa-Bank",
|
|
22
23
|
"Local Card (Yellow)": "T-Bank",
|
|
24
|
+
"Local Card(Yellow)": "T-Bank",
|
|
23
25
|
"Local Card M-redTS": "MTS-bank",
|
|
24
26
|
"Local Card-Green": "Sberbank",
|
|
27
|
+
"Local Bank(S-Green)": "Sberbank",
|
|
28
|
+
"Local Card(Green)": "Sberbank",
|
|
29
|
+
"Local Bank(R-Green)": "Sberbank",
|
|
25
30
|
"Local Card-Yellow": "T-Bank",
|
|
31
|
+
"Tinkoff": "T-Bank",
|
|
26
32
|
"Banque de développement local (BDL)": "Banque de développement local (BDL)",
|
|
27
33
|
"Al-Rajhi Bank": "Al Rajhi Bank",
|
|
28
34
|
"BDO": "Banco De Oro (BDO)",
|
|
@@ -21,7 +21,11 @@ from xync_client.pm_unifier import PmUnifier
|
|
|
21
21
|
class ExClient(BaseExClient):
|
|
22
22
|
class GateUnifier(PmUnifier):
|
|
23
23
|
pm_map = {
|
|
24
|
-
"SBP - Fast Bank Transfer": "SBP"
|
|
24
|
+
"SBP - Fast Bank Transfer": "SBP",
|
|
25
|
+
"Local Card (Yellow)": "T-Bank",
|
|
26
|
+
"Local Bank (R-Green)": "Sberbank",
|
|
27
|
+
"Local Bank (S-Green)": "Sberbank",
|
|
28
|
+
"Local Card (Red)": "Alfa-bank",
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
unifier_class = GateUnifier
|
|
@@ -17,10 +17,7 @@ from xync_client.pm_unifier import PmUnifier
|
|
|
17
17
|
|
|
18
18
|
class ExClient(BaseExClient):
|
|
19
19
|
class HtxUnifier(PmUnifier):
|
|
20
|
-
pm_map = {
|
|
21
|
-
"SBP - Fast Bank Transfer": "SBP",
|
|
22
|
-
"Sovkombank": "Sovcombank"
|
|
23
|
-
}
|
|
20
|
+
pm_map = {"SBP - Fast Bank Transfer": "SBP", "Tinkoff": "T-Bank", "Sovkombank": "Sovcombank"}
|
|
24
21
|
|
|
25
22
|
cur_map = {
|
|
26
23
|
# 1: "CNY",
|
|
@@ -79,7 +79,7 @@ class VoletAgent:
|
|
|
79
79
|
browser = await playwright.chromium.launch(
|
|
80
80
|
channel="chrome",
|
|
81
81
|
headless=not headed,
|
|
82
|
-
timeout=
|
|
82
|
+
timeout=5000,
|
|
83
83
|
args=[
|
|
84
84
|
"--disable-blink-features=AutomationControlled",
|
|
85
85
|
"--no-sandbox",
|
|
@@ -89,12 +89,12 @@ class VoletAgent:
|
|
|
89
89
|
"--start-maximized",
|
|
90
90
|
],
|
|
91
91
|
)
|
|
92
|
-
context = await browser.new_context(storage_state=self.agent.auth.get("state", {}), locale="en
|
|
93
|
-
context.set_default_navigation_timeout(
|
|
94
|
-
context.set_default_timeout(
|
|
92
|
+
context = await browser.new_context(storage_state=self.agent.auth.get("state", {}), locale="en")
|
|
93
|
+
context.set_default_navigation_timeout(15000)
|
|
94
|
+
context.set_default_timeout(12000)
|
|
95
95
|
self.page = await context.new_page()
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
await self.gmail_page()
|
|
98
98
|
await self.go(Pages.HOME)
|
|
99
99
|
if self.page.url == Pages.LOGIN:
|
|
100
100
|
await self.login()
|
|
@@ -159,16 +159,30 @@ class VoletAgent:
|
|
|
159
159
|
gp = await self.page.context.new_page()
|
|
160
160
|
await gp.goto(Pages.GMH, timeout=20000)
|
|
161
161
|
if not gp.url.startswith(Pages.GMH):
|
|
162
|
+
# ваще с 0 заходим
|
|
163
|
+
if await (
|
|
164
|
+
sgn_btn := gp.locator(
|
|
165
|
+
'header a[href^="https://accounts.google.com/AccountChooser/signinchooser"]:visible',
|
|
166
|
+
has_text="sign in",
|
|
167
|
+
)
|
|
168
|
+
).count():
|
|
169
|
+
await sgn_btn.click()
|
|
162
170
|
# если надо выбрать акк
|
|
163
|
-
|
|
171
|
+
lang = await gp.get_attribute("html", "lang")
|
|
172
|
+
sgn = {
|
|
173
|
+
"ru": "Выберите аккаунт",
|
|
174
|
+
"en": "Choose an account",
|
|
175
|
+
}
|
|
176
|
+
if await gp.locator("h1#headingText", has_text=sgn[lang]).count():
|
|
164
177
|
await gp.locator("li").first.click()
|
|
165
|
-
# если
|
|
178
|
+
# если предлагает залогиниться
|
|
166
179
|
elif await gp.locator("h1#headingText", has_text="Sign In").count():
|
|
167
180
|
await gp.fill("input[type=email]", self.agent.user.gmail_auth["login"])
|
|
168
181
|
await gp.locator("button", has_text="Next").click()
|
|
169
182
|
# осталось ввести пороль:
|
|
170
183
|
await gp.fill("input[type=password]", self.agent.user.gmail_auth["password"])
|
|
171
|
-
|
|
184
|
+
nxt = {"ru": "Далее", "en": "Next"}
|
|
185
|
+
await gp.locator("button", has_text=nxt[lang]).click()
|
|
172
186
|
await report(self.uid, await gp.screenshot(), "Аппрувни гмейл, у тебя 1.5 минуты", False)
|
|
173
187
|
await gp.wait_for_url(lambda u: u.startswith(Pages.GMH), timeout=90 * 1000) # убеждаемся что мы в почте
|
|
174
188
|
self.gpage = gp
|
|
@@ -234,7 +248,7 @@ async def _test(uid: int, dest: str, amount):
|
|
|
234
248
|
_ = await init_db(PG_DSN, models, True)
|
|
235
249
|
va = VoletAgent(uid)
|
|
236
250
|
try:
|
|
237
|
-
await va.start()
|
|
251
|
+
await va.start(True)
|
|
238
252
|
await va.send(dest, amount)
|
|
239
253
|
await va.wait_for_payments()
|
|
240
254
|
except TimeoutError as te:
|
|
@@ -21,15 +21,13 @@ 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
25
|
class ExClient(BaseExClient, AuthClient):
|
|
25
26
|
class TgWalletUnifier(PmUnifier):
|
|
26
|
-
pm_map = {
|
|
27
|
-
"Rabbit LINE Pay": "LINE Pay"
|
|
28
|
-
}
|
|
27
|
+
pm_map = {"Rabbit LINE Pay": "LINE Pay", "T-Bank (ex. Tinkoff)": "T-Bank"}
|
|
29
28
|
|
|
30
29
|
unifier_class = TgWalletUnifier
|
|
31
30
|
|
|
32
|
-
|
|
33
31
|
def __init__(self, ex: models.Ex, actor: models.Actor = None):
|
|
34
32
|
if actor:
|
|
35
33
|
self.actor = actor
|
|
@@ -14,10 +14,11 @@ class PmUni(BaseModel):
|
|
|
14
14
|
class PmUnifier:
|
|
15
15
|
pms: dict[str, PmUni] = {} # {origin: normalized}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
"Ю
|
|
17
|
+
base_pm_map: dict[str, str] = {
|
|
18
|
+
"ЮMoney": "YooMoney",
|
|
19
19
|
"GTB Bank (Guarantee Trust Bank)": "GTBank",
|
|
20
20
|
}
|
|
21
|
+
pm_map: dict[str, str] = {}
|
|
21
22
|
re_bank = [
|
|
22
23
|
r"^bank (?!of )|bank$",
|
|
23
24
|
r" banka$",
|
|
@@ -60,6 +61,7 @@ class PmUnifier:
|
|
|
60
61
|
rms = ":`'’′"
|
|
61
62
|
|
|
62
63
|
def __init__(self, countries: list[str]):
|
|
64
|
+
self.pm_map = self.base_pm_map | self.pm_map
|
|
63
65
|
self.cts = countries
|
|
64
66
|
|
|
65
67
|
def countries(self, name: str):
|
|
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.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Binance/test_binance.py
RENAMED
|
File without changes
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Bybit/test_bybit.py
RENAMED
|
File without changes
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Bybit/test_bybit_p2p.py
RENAMED
|
File without changes
|
|
File without changes
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/tests/_todo_refact/Htx/test_htx_p2p.py
RENAMED
|
File without changes
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/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.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/_todo_req/req.mjs
RENAMED
|
File without changes
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client/Pms/Volet/_todo_req/req.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
|
{xync_client-0.0.43.dev11 → xync_client-0.0.43.dev15}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|