xync-db 0.3.0__tar.gz → 0.3.2__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.0 → xync_db-0.3.2}/PKG-INFO +1 -1
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0005_credex_del.py +0 -2
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/models/__init__.py +28 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/.gitignore +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/README.md +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/pyproject.toml +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/config.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/enums.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/exceptions.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/graph.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/i18n.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/logo.png +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/CLAUDE.md +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0001_initial.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0002_triggers.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0003_files_seed.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0004_all_seed.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/0006_credex_orphan.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/seed/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/seed/a_actor_seed.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/models/CLAUDE.md +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/py.typed +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/shared.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/__init__.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/actor.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/ad.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/common.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/cred.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/order.py +0 -0
- {xync_db-0.3.0 → xync_db-0.3.2}/src/xync_db/typs/db/pm.py +0 -0
|
@@ -97,6 +97,11 @@ from xync_db.typs import HotAd, HotAds, OrderResult
|
|
|
97
97
|
# both are stubbed out until the porting cleanup decides their final shape.
|
|
98
98
|
# from xync_db.typs.db import AdNewFlatRaw
|
|
99
99
|
|
|
100
|
+
# ex_id бирж с share-hex: у их объяв обязателен MyAd.hex, иначе url-кнопку на объяву не построить, поэтому
|
|
101
|
+
# незашаренные объявы этих бирж прячем из выдачи тейкеру / алертим админу. Пока только Bybit (4); единственное
|
|
102
|
+
# место смены — на случай добавления других share-бирж.
|
|
103
|
+
SHARE_HEX_EX_IDS = [4]
|
|
104
|
+
|
|
100
105
|
|
|
101
106
|
class Country(BaseCountry):
|
|
102
107
|
cur: ForeignKeyRelation[Cur] = ForeignKeyField("models.Cur", "countries", on_update=CASCADE)
|
|
@@ -676,6 +681,11 @@ class User(TgUser, TsTrait):
|
|
|
676
681
|
) -> tuple[list[MyAd], list[MyAd], dict[int, float], dict[int, dict[int, int]]]:
|
|
677
682
|
owner = {"ad__maker__person__user_id": self.id} if mine else {"ad__maker__person__user_id__not": self.id}
|
|
678
683
|
adq = MyAd.hot_mads_query(ex_ids).filter(**owner)
|
|
684
|
+
if not mine:
|
|
685
|
+
# тейкеру прячем незашаренные объявы share-hex-бирж (hex IS NULL AND ex∈SHARE_HEX_EX_IDS): без
|
|
686
|
+
# share-hex url-кнопку не построить. Сужено до этих бирж, чтобы не зацепить hot-биржи без share-hex.
|
|
687
|
+
# Свои (mine, страница settings) оставляем — их видно для шеринга.
|
|
688
|
+
adq = adq.exclude(hex__isnull=True, ad__maker__ex_id__in=SHARE_HEX_EX_IDS)
|
|
679
689
|
bads = await adq.filter(ad__pair_side__is_sell=False)
|
|
680
690
|
# остаток каждой монеты (asset.free) у акторов персон этого юзера, по бирже и монете # noqa: RUF003
|
|
681
691
|
coin_balances: dict[int, dict[int, int]] = {}
|
|
@@ -1292,6 +1302,24 @@ class MyAd(Model): # Road
|
|
|
1292
1302
|
"ad__pair_side__pair__coin", "ad__pair_side__pair__cur", "ad__maker__ex"
|
|
1293
1303
|
)
|
|
1294
1304
|
|
|
1305
|
+
@classmethod
|
|
1306
|
+
async def unshared_hot_ad_ids(cls, hex_ex_ids: list[int] = SHARE_HEX_EX_IDS) -> list[int]:
|
|
1307
|
+
"""ad_id активных hot-объяв share-hex-бирж без MyAd.hex, чей мейкер-агент ОНЛАЙН (listen-бит,
|
|
1308
|
+
`status & 2` → статусы listen|race_listen). Их надо было зашарить (агент слушает), но hex нет —
|
|
1309
|
+
для старт-алерта. Объява без hex у НЕактивного агента (off/race, бит 2 снят) — норма (он не шарит),
|
|
1310
|
+
не включаем. Гонка (бит 1) для шеринга не нужна, поэтому условие `& 2`, а не `>=3` (hot_mads_query)."""
|
|
1311
|
+
return (
|
|
1312
|
+
await cls.filter(
|
|
1313
|
+
hex__isnull=True,
|
|
1314
|
+
ad__status=AdStatus.active,
|
|
1315
|
+
ad__maker__ex_id__in=hex_ex_ids,
|
|
1316
|
+
credexs__cred__ovr_pm_id=0,
|
|
1317
|
+
ad__maker__agent__status__in=[AgentStatus.listen, AgentStatus.race_listen], # listen-бит (& 2)
|
|
1318
|
+
)
|
|
1319
|
+
.distinct()
|
|
1320
|
+
.values_list("ad_id", flat=True)
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1295
1323
|
@classmethod
|
|
1296
1324
|
async def upsert(
|
|
1297
1325
|
cls,
|
|
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
|