xync-schema 0.6.84.dev4__py3-none-any.whl → 0.6.86__py3-none-any.whl

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_schema/enums.py CHANGED
@@ -56,7 +56,7 @@ class DepType(IntEnum):
56
56
  lend = 4
57
57
 
58
58
 
59
- class AssetType(IntEnum):
59
+ class AddrExType(IntEnum):
60
60
  spot = 1
61
61
  earn = 2
62
62
  found = 3
xync_schema/models.py CHANGED
@@ -10,7 +10,6 @@ from x_model.models import TsTrait, DatetimeSecField
10
10
  from xync_schema.enums import (
11
11
  ExType,
12
12
  AdStatus,
13
- AssetType,
14
13
  OrderStatus,
15
14
  ExAction,
16
15
  ExStatus,
@@ -18,6 +17,7 @@ from xync_schema.enums import (
18
17
  UserStatus,
19
18
  PmType,
20
19
  FileType,
20
+ AddrExType,
21
21
  )
22
22
 
23
23
 
@@ -327,8 +327,10 @@ class Ad(Model, TsTrait):
327
327
  maker_id: int
328
328
  pay_req: fields.ForeignKeyNullableRelation["PayReq"] = fields.ForeignKeyField("models.PayReq", "ads", null=True)
329
329
 
330
- pms: fields.ManyToManyRelation["Pm"] = fields.ManyToManyField("models.Pm", through="adpm") # only root pms
331
- creds: fields.ManyToManyRelation["Cred"] = fields.ManyToManyField("models.Cred", through="adcred")
330
+ pmexs: fields.ManyToManyRelation["Pmex"] = fields.ManyToManyField("models.Pmex", "adpmex", related_name="ads")
331
+ credexs: fields.ManyToManyRelation["CredEx"] = fields.ManyToManyField(
332
+ "models.CredEx", through="adcredex", related_name="ads"
333
+ )
332
334
  orders: fields.ReverseRelation["Order"]
333
335
 
334
336
  _icon = "ad"
@@ -362,7 +364,6 @@ class Pm(Model):
362
364
 
363
365
  typ: PmType | None = fields.IntEnumField(PmType, null=True)
364
366
 
365
- ads: fields.ManyToManyRelation[Ad]
366
367
  curs: fields.ManyToManyRelation[Cur]
367
368
  exs: fields.ManyToManyRelation[Ex] = fields.ManyToManyField("models.Ex", "pmex") # no need. use pmexs[.exid]
368
369
  orders: fields.ReverseRelation["Order"]
@@ -395,7 +396,7 @@ class Pmcur(Model): # for fiat with no exs tie
395
396
 
396
397
  class Meta:
397
398
  table_description = "Payment methods - Currencies"
398
- # unique_together = ("pm_id", "cur_id"),
399
+ unique_together = (("pm_id", "cur_id"),)
399
400
 
400
401
  class PydanticMeta(Model.PydanticMeta):
401
402
  max_recursion: int = 2 # default: 3
@@ -412,6 +413,7 @@ class Pmex(BaseModel): # existence pm in ex with no cur tie
412
413
  exid: str = fields.CharField(63)
413
414
  name: str = fields.CharField(63)
414
415
 
416
+ ads: fields.ManyToManyRelation[Ad]
415
417
  banks: fields.BackwardFKRelation["PmexBank"]
416
418
 
417
419
  class Meta:
@@ -452,7 +454,6 @@ class Cred(Model):
452
454
  banks: fields.ManyToManyRelation[PmexBank] = fields.ManyToManyField("models.PmexBank", related_name="creds")
453
455
 
454
456
  fiat: fields.BackwardOneToOneRelation["Fiat"]
455
- ads: fields.ManyToManyRelation[Ad]
456
457
  credexs: fields.BackwardFKRelation["CredEx"]
457
458
  orders: fields.BackwardFKRelation["Order"]
458
459
 
@@ -470,6 +471,8 @@ class CredEx(Model):
470
471
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "credexs")
471
472
  ex_id: int
472
473
 
474
+ ads: fields.ManyToManyRelation[Ad]
475
+
473
476
  _name = {"exid"}
474
477
 
475
478
  class Meta:
@@ -518,27 +521,38 @@ class Limit(Model):
518
521
  table_description = "Currency accounts balance"
519
522
 
520
523
 
521
- class Asset(Model):
522
- coin: fields.ForeignKeyRelation[Coin] = fields.ForeignKeyField("models.Coin", related_name="assets")
524
+ class Addr(Model):
525
+ coin: fields.ForeignKeyRelation[Coin] = fields.ForeignKeyField("models.Coin", related_name="addrs")
523
526
  coin_id: int
527
+ actor: fields.ForeignKeyRelation[Actor] = fields.ForeignKeyField("models.Actor", "addrs")
528
+ actor_id: int
529
+
530
+ pay_reqs: fields.ReverseRelation["PayReq"]
531
+
532
+ _name = {"coin__ticker", "free"}
533
+
534
+ class Meta:
535
+ table_description = "Coin address on cex"
536
+ unique_together = (("coin_id", "actor_id"),)
537
+
538
+
539
+ class Asset(Model):
540
+ addr: fields.ForeignKeyRelation[Addr] = fields.ForeignKeyField("models.Addr", related_name="addrs")
541
+ addr_id: int
524
542
  agent: fields.ForeignKeyRelation[Agent] = fields.ForeignKeyField("models.Agent", "assets")
525
543
  agent_id: int
526
- type_: AssetType = fields.IntEnumField(AssetType, default=AssetType.found)
544
+
545
+ typ: AddrExType = fields.IntEnumField(AddrExType, default=AddrExType.found)
527
546
  free: float = fields.FloatField()
528
547
  freeze: float | None = fields.FloatField(default=0)
529
548
  lock: float | None = fields.FloatField(default=0)
530
549
  target: float | None = fields.FloatField(default=0, null=True)
531
550
 
532
- pay_reqs: fields.ReverseRelation["PayReq"]
533
-
534
- _name = {"coin__ticker", "free"}
551
+ _name = {"asset__coin__ticker", "free"}
535
552
 
536
553
  class Meta:
537
554
  table_description = "Coin balance"
538
- unique_together = (("coin_id", "agent_id", "type_"),)
539
-
540
- class PydanticMeta(Model.PydanticMeta):
541
- max_recursion: int = 2 # default: 3
555
+ unique_together = (("addr_id", "agent_id", "typ"),)
542
556
 
543
557
  def epyd(self):
544
558
  module_name = f"xync_client.{self.agent.ex.name}.pyd"
xync_schema/types.py CHANGED
@@ -41,6 +41,7 @@ class BaseAd(BaseModel):
41
41
 
42
42
  class BaseAdIn(BaseAd):
43
43
  min_fiat: float
44
+ amount: float
44
45
  max_fiat: float
45
46
  direction_id: int
46
47
  detail: str | None = None
@@ -54,11 +55,11 @@ class BaseAdIn(BaseAd):
54
55
 
55
56
 
56
57
  class AdBuyIn(BaseAdIn):
57
- pms_: list[models.Pm]
58
+ pmexs_: list[models.Pmex]
58
59
 
59
60
 
60
61
  class AdSaleIn(BaseAdIn):
61
- creds_: list[models.Cred]
62
+ credexs_: list[models.CredEx]
62
63
 
63
64
 
64
65
  class OrderIn(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.6.84.dev4
3
+ Version: 0.6.86
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -0,0 +1,8 @@
1
+ xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ xync_schema/enums.py,sha256=MM5s20GpI8gsPlPS9nYFtkyrPheTvlcDYESwjnZ4Hmg,12698
3
+ xync_schema/models.py,sha256=5NGFmvOYL7lw1veM7gnOPx9skgMYgQfDq8iyDiJEC4o,29153
4
+ xync_schema/types.py,sha256=sYWjJMcwv7mjm38FnWyxWhT6Z4bGpt92BTVZrqyZ0Ic,1675
5
+ xync_schema-0.6.86.dist-info/METADATA,sha256=WTefTMM7hLjp6NGBKDPg480f3Xy6Mw5gSRm_kgBy7jE,4055
6
+ xync_schema-0.6.86.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
+ xync_schema-0.6.86.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
+ xync_schema-0.6.86.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- xync_schema/enums.py,sha256=4ZNpPKY54SY34nz1APsg7wKzCIvpYWhG4sKsZ1uEmVU,12697
3
- xync_schema/models.py,sha256=Zg_k9OgXrnv04OF5pCS6IiKjiBj0Ht9e8MaFlVWlLVw,28778
4
- xync_schema/types.py,sha256=P9rcmrH4_mcRsXy6jh009A_XP6BpjtO5a04_2Pz2j6w,1649
5
- xync_schema-0.6.84.dev4.dist-info/METADATA,sha256=hL62yxK5RKtIFbDlYt5KmC_D4O96q-OxPe3pkJBf1b0,4060
6
- xync_schema-0.6.84.dev4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
- xync_schema-0.6.84.dev4.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
- xync_schema-0.6.84.dev4.dist-info/RECORD,,