xync-db 0.3.2__tar.gz → 0.4.1__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_db-0.3.2 → xync_db-0.4.1}/PKG-INFO +1 -1
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/models/__init__.py +20 -6
- {xync_db-0.3.2 → xync_db-0.4.1}/.gitignore +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/README.md +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/pyproject.toml +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/config.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/enums.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/exceptions.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/graph.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/i18n.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/logo.png +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/CLAUDE.md +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0001_initial.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0002_triggers.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0003_files_seed.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0004_all_seed.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0005_credex_del.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/0006_credex_orphan.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/seed/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/seed/a_actor_seed.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/models/CLAUDE.md +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/py.typed +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/shared.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/__init__.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/actor.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/ad.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/common.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/cred.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/order.py +0 -0
- {xync_db-0.3.2 → xync_db-0.4.1}/src/xync_db/typs/db/pm.py +0 -0
|
@@ -1000,6 +1000,20 @@ class Agent(Model, TsTrait):
|
|
|
1000
1000
|
dct = {coin_id: round(amount * 10 ** -(s := scales[coin_id]), s) for coin_id, amount in dct.items()}
|
|
1001
1001
|
return dct[coin_id] if coin_id else dct
|
|
1002
1002
|
|
|
1003
|
+
@classmethod
|
|
1004
|
+
async def confirm_trade(cls, agent_id: int, confirm: bool) -> None:
|
|
1005
|
+
"""Ответ владельца на вопрос «включить торговлю?» (Notifier.trade_confirm, заданный при выходе
|
|
1006
|
+
агента в listen). Зовут из web-контроллера и бот-колбэка — единый эмиттер канала
|
|
1007
|
+
`agents_trade_confirm`, который резолвит ждущий 30с future в хендлере листенера api
|
|
1008
|
+
(handlers.agents.agents_trade_confirm). На `True` хендлер включает торговлю на бирже
|
|
1009
|
+
(acl.ads_switch(True)), иначе снимает listen-бит. Через pg_notify (как CredEx.orphan_del), чтобы
|
|
1010
|
+
и web-, и bot-зона не дублировали полезную нагрузку, а ответ попадал в единый листенер api —
|
|
1011
|
+
там живут и future, и agent-клиент."""
|
|
1012
|
+
await connections.get("default").execute_query(
|
|
1013
|
+
"SELECT pg_notify('agents_trade_confirm', jsonb_build_array($1::int, $2::bool)::varchar)",
|
|
1014
|
+
[agent_id, confirm],
|
|
1015
|
+
)
|
|
1016
|
+
|
|
1003
1017
|
@classmethod
|
|
1004
1018
|
async def upsert(
|
|
1005
1019
|
cls, exid: int, host: str, auth: dict, exp: int, rname: str, nick: str, email: str
|
|
@@ -1303,18 +1317,18 @@ class MyAd(Model): # Road
|
|
|
1303
1317
|
)
|
|
1304
1318
|
|
|
1305
1319
|
@classmethod
|
|
1306
|
-
async def
|
|
1307
|
-
"""ad_id активных hot-объяв share-hex
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1320
|
+
async def unshared_ad_ids(cls, agent_id: int, hex_ex_ids: list[int] = SHARE_HEX_EX_IDS) -> list[int]:
|
|
1321
|
+
"""ad_id активных hot-объяв ДАННОГО агента-мейкера на share-hex-бирже без MyAd.hex (не зашарены →
|
|
1322
|
+
скрыты от тейкеров get_hot_ads'ом). Для адресного уведомления ВЛАДЕЛЬЦА (не админа), когда его
|
|
1323
|
+
торговля на бирже выключена и он отказался её включать (handlers.agents.share_or_ask).
|
|
1324
|
+
Раньше тут был глобальный старт-алибат `unshared_hot_ad_ids` всем — его слал админу бот на старте."""
|
|
1311
1325
|
return (
|
|
1312
1326
|
await cls.filter(
|
|
1313
1327
|
hex__isnull=True,
|
|
1314
1328
|
ad__status=AdStatus.active,
|
|
1315
1329
|
ad__maker__ex_id__in=hex_ex_ids,
|
|
1330
|
+
ad__maker__agent__id=agent_id,
|
|
1316
1331
|
credexs__cred__ovr_pm_id=0,
|
|
1317
|
-
ad__maker__agent__status__in=[AgentStatus.listen, AgentStatus.race_listen], # listen-бит (& 2)
|
|
1318
1332
|
)
|
|
1319
1333
|
.distinct()
|
|
1320
1334
|
.values_list("ad_id", flat=True)
|
|
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
|