xync-db 0.5.5.dev26__tar.gz → 0.5.5.dev31__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 (40) hide show
  1. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/PKG-INFO +1 -1
  2. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/a_actor_seed.py +1 -1
  3. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/c_net_seed.py +1 -1
  4. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/models/__init__.py +5 -4
  5. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/.gitignore +0 -0
  6. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/README.md +0 -0
  7. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/pyproject.toml +0 -0
  8. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/__init__.py +0 -0
  9. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/config.py +0 -0
  10. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/enums.py +0 -0
  11. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/exceptions.py +0 -0
  12. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/graph.py +0 -0
  13. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/i18n.py +0 -0
  14. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/login_store.py +0 -0
  15. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/logo.png +0 -0
  16. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/CLAUDE.md +0 -0
  17. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/__init__.py +0 -0
  18. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/0001_initial.py +0 -0
  19. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/0002_triggers.py +0 -0
  20. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/0003_seed.py +0 -0
  21. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/__init__.py +0 -0
  22. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/__init__.py +0 -0
  23. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/a_bin_seed.py +0 -0
  24. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/a_country_seed.py +0 -0
  25. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
  26. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
  27. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/countries.json +0 -0
  28. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/ranges.csv +0 -0
  29. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
  30. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/models/CLAUDE.md +0 -0
  31. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/py.typed +0 -0
  32. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/shared.py +0 -0
  33. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/__init__.py +0 -0
  34. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/__init__.py +0 -0
  35. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/actor.py +0 -0
  36. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/ad.py +0 -0
  37. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/common.py +0 -0
  38. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/cred.py +0 -0
  39. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/order.py +0 -0
  40. {xync_db-0.5.5.dev26 → xync_db-0.5.5.dev31}/src/xync_db/typs/db/pm.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: xync-db
3
- Version: 0.5.5.dev26
3
+ Version: 0.5.5.dev31
4
4
  Summary: Xync DB schema: Tortoise ORM models, enums, pydantic DTOs.
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: LicenseRef-EULA
@@ -266,7 +266,7 @@ async def actor_seed(db: BaseDBAsyncClient) -> str:
266
266
  btc, _ = await Coin.update_or_create(dict(scale=8), id=2, ticker="BTC")
267
267
  eth, _ = await Coin.update_or_create(dict(scale=8), id=3, ticker="ETH")
268
268
  usdc, _ = await Coin.update_or_create(dict(scale=4), id=4, ticker="USDC")
269
- ton, _ = await Coin.update_or_create(dict(scale=4), id=5, ticker="TON")
269
+ gram, _ = await Coin.update_or_create(dict(scale=4), id=5, ticker="GRAM")
270
270
  sol, _ = await Coin.update_or_create(dict(scale=8), id=6, ticker="SOL")
271
271
  bnb, _ = await Coin.update_or_create(dict(scale=8), id=7, ticker="BNB")
272
272
  xrp, _ = await Coin.update_or_create(dict(scale=8), id=8, ticker="XRP")
@@ -7,7 +7,7 @@ from xync_db.models import Coin, Net
7
7
  NETS: list[tuple[int, str, str]] = [
8
8
  (0, "xync", "XYNC"),
9
9
  (1, "eth", "ETH"),
10
- (2, "ton", "TON"),
10
+ (2, "gram", "GRAM"),
11
11
  (3, "trx", "TRX"),
12
12
  (4, "bsc", "BNB"),
13
13
  (5, "arbitrum", "ARB"),
@@ -179,7 +179,7 @@ class Net(Model):
179
179
 
180
180
  class CoinNet(Model):
181
181
  """В каких сетях живёт кастодиальная монета и по какому контракту (web3.md → GET /public/coin-nets).
182
- contract=None → монета нативна для сети (ETH в eth, TON в ton…). decimals — on-chain decimals токена
182
+ contract=None → монета нативна для сети (ETH в eth, GRAM в ton…). decimals — on-chain decimals токена
183
183
  в ЭТОЙ сети (у USDT 6 в trx/eth, 9 в ton), не путать с кастодиальным Coin.scale."""
184
184
 
185
185
  coin: ForeignKeyRelation[Coin] = ForeignKeyField("models.Coin", "coin_nets", on_update=CASCADE)
@@ -903,7 +903,7 @@ class User(TgUser, TsTrait):
903
903
  # остаток каждой монеты (asset.free) у акторов персон этого юзера, по бирже и монете # noqa: RUF003
904
904
  coin_balances: dict[int, dict[int, int]] = {}
905
905
  for ex_id, coin_id, total in (
906
- await Asset.filter(addr__actor__person__user_id=self.id)
906
+ await Asset.filter(addr__actor__person__user_id=self.id, typ=AddrExType.found) # P2P-счёт
907
907
  .group_by("addr__actor__ex_id", "addr__coin_id")
908
908
  .annotate(total=Sum("free"))
909
909
  .values_list("addr__actor__ex_id", "addr__coin_id", "total")
@@ -1181,7 +1181,7 @@ class Agent(Model, TsTrait):
1181
1181
  status: AgentStatus = IntEnumField(AgentStatus, db_default=AgentStatus.off)
1182
1182
  same_dir_ad: int = SmallIntField(db_default=0)
1183
1183
  # индивидуальный прокси агента: если задан, ВСЕ сессии его клиентов (Agent/Order/InAgent —
1184
- # aiohttp, pybit/bybit_p2p, приватный WS) ходят на биржу с этого IP, чтобы запросы одного
1184
+ # aiohttp, pybit, приватный WS) ходят на биржу с этого IP, чтобы запросы одного
1185
1185
  # пользователя биржи всегда шли с одного его IP. Пусто → общий прокси-фолбэк (settings.prx).
1186
1186
  proxy: ForeignKeyNullableRelation[Proxy] = ForeignKeyField("models.Proxy", "agents", null=True, on_update=CASCADE)
1187
1187
  proxy_id: str | None
@@ -1213,7 +1213,8 @@ class Agent(Model, TsTrait):
1213
1213
 
1214
1214
  async def coins_balance(self, coin_id: int | None = None, to_float: bool = True):
1215
1215
  # Asset больше не висит на agent — идём через актора (agent 1:1 actor): Asset → addr → actor.
1216
- assets = await Asset.filter(addr__actor_id=self.actor_id).prefetch_related("addr")
1216
+ # только P2P-счёт (found; у Bybit это FUND): UNIFIED (spot) под объявы не продать
1217
+ assets = await Asset.filter(addr__actor_id=self.actor_id, typ=AddrExType.found).prefetch_related("addr")
1217
1218
  dct = {a.addr.coin_id: a.free for a in assets if a.free}
1218
1219
  if not to_float:
1219
1220
  return dct[coin_id] if coin_id else dct
File without changes
File without changes