xync-schema 0.6.63__tar.gz → 0.6.66__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_schema-0.6.63/xync_schema.egg-info → xync_schema-0.6.66}/PKG-INFO +1 -1
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema/models.py +28 -11
- {xync_schema-0.6.63 → xync_schema-0.6.66/xync_schema.egg-info}/PKG-INFO +1 -1
- {xync_schema-0.6.63 → xync_schema-0.6.66}/.env.sample +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/.gitignore +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/.pre-commit-config.yaml +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/README.md +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/makefile +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/pyproject.toml +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/setup.cfg +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/tests/__init__.py +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/tests/test_db.py +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema/__init__.py +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema/enums.py +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema/pydantic.py +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema.egg-info/SOURCES.txt +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema.egg-info/dependency_links.txt +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema.egg-info/requires.txt +0 -0
- {xync_schema-0.6.63 → xync_schema-0.6.66}/xync_schema.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from datetime import datetime
|
|
2
3
|
from tortoise import fields
|
|
3
4
|
from tortoise.queryset import QuerySet
|
|
@@ -82,8 +83,6 @@ class Ex(Model):
|
|
|
82
83
|
include = "name", "logo"
|
|
83
84
|
|
|
84
85
|
def client(self):
|
|
85
|
-
import sys
|
|
86
|
-
|
|
87
86
|
module_name = f"xync_client.{self.name}.ex"
|
|
88
87
|
__import__(module_name)
|
|
89
88
|
client = sys.modules[module_name].ExClient
|
|
@@ -94,7 +93,6 @@ class Curex(BaseModel):
|
|
|
94
93
|
cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
|
|
95
94
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
96
95
|
exid: str = fields.CharField(31)
|
|
97
|
-
p2p: bool = fields.BooleanField(default=True)
|
|
98
96
|
# countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
|
|
99
97
|
# "models.Country", through="curexcountry", backward_key="curexs"
|
|
100
98
|
# )
|
|
@@ -215,8 +213,6 @@ class Agent(Model):
|
|
|
215
213
|
computed = ["balance"]
|
|
216
214
|
|
|
217
215
|
def client(self):
|
|
218
|
-
import sys
|
|
219
|
-
|
|
220
216
|
module_name = f"xync_client.{self.ex.name}.agent"
|
|
221
217
|
__import__(module_name)
|
|
222
218
|
client = sys.modules[module_name].AgentClient
|
|
@@ -231,8 +227,6 @@ class Agent(Model):
|
|
|
231
227
|
# return client(self)
|
|
232
228
|
|
|
233
229
|
def asset_client(self):
|
|
234
|
-
import sys
|
|
235
|
-
|
|
236
230
|
module_name = f"xync_client.{self.ex.name}.asset"
|
|
237
231
|
__import__(module_name)
|
|
238
232
|
client = sys.modules[module_name].AssetClient
|
|
@@ -270,6 +264,11 @@ class Ad(Model, TsTrait):
|
|
|
270
264
|
class Meta:
|
|
271
265
|
table_description = "P2P Advertisements"
|
|
272
266
|
|
|
267
|
+
def epyd(self):
|
|
268
|
+
module_name = f"xync_client.{self.ex.name}.pyd"
|
|
269
|
+
__import__(module_name)
|
|
270
|
+
return sys.modules[module_name].AdEpyd
|
|
271
|
+
|
|
273
272
|
|
|
274
273
|
class Pm(Model):
|
|
275
274
|
name: str = fields.CharField(63, unique=True)
|
|
@@ -293,6 +292,11 @@ class Pm(Model):
|
|
|
293
292
|
# backward_relations = True
|
|
294
293
|
# include = "id", "name", "logo", "pmexs__sbp"
|
|
295
294
|
|
|
295
|
+
# def epyd(self):
|
|
296
|
+
# module_name = f"xync_client.{self.ex.name}.pyd"
|
|
297
|
+
# __import__(module_name)
|
|
298
|
+
# return sys.modules[module_name].PmEpyd
|
|
299
|
+
|
|
296
300
|
|
|
297
301
|
class Pmcur(Model): # for fiat with no exs tie
|
|
298
302
|
pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
|
|
@@ -319,7 +323,8 @@ class Pmex(BaseModel): # existence pm in ex with no cur tie
|
|
|
319
323
|
ex_id: int
|
|
320
324
|
exid: str = fields.CharField(63)
|
|
321
325
|
name: str = fields.CharField(63)
|
|
322
|
-
|
|
326
|
+
|
|
327
|
+
banks: fields.BackwardFKRelation["PmexBank"]
|
|
323
328
|
|
|
324
329
|
class Meta:
|
|
325
330
|
unique_together = (("ex_id", "exid"),)
|
|
@@ -371,7 +376,11 @@ class Fiat(Model):
|
|
|
371
376
|
backward_relations = False
|
|
372
377
|
include = "id", "pmcur", "detail", "name", "amount"
|
|
373
378
|
|
|
374
|
-
|
|
379
|
+
@staticmethod
|
|
380
|
+
def epyd(ex: Ex):
|
|
381
|
+
module_name = f"xync_client.{ex.name}.pyd"
|
|
382
|
+
__import__(module_name)
|
|
383
|
+
return sys.modules[module_name].FiatEpyd
|
|
375
384
|
|
|
376
385
|
|
|
377
386
|
class Fiatex(BaseModel): # existence pm in ex with no cur tie
|
|
@@ -424,6 +433,11 @@ class Asset(Model):
|
|
|
424
433
|
class PydanticMeta(Model.PydanticMeta):
|
|
425
434
|
max_recursion: int = 2 # default: 3
|
|
426
435
|
|
|
436
|
+
def epyd(self):
|
|
437
|
+
module_name = f"xync_client.{self.agent.ex.name}.pyd"
|
|
438
|
+
__import__(module_name)
|
|
439
|
+
return sys.modules[module_name].AssetEpyd
|
|
440
|
+
|
|
427
441
|
|
|
428
442
|
class Order(Model):
|
|
429
443
|
id: int = fields.BigIntField(True)
|
|
@@ -450,8 +464,6 @@ class Order(Model):
|
|
|
450
464
|
return f"{self.fiat.pmcur.pm.name}/{self.fiat_id}:{self.amount:.3g} {self.status.name}"
|
|
451
465
|
|
|
452
466
|
async def client(self):
|
|
453
|
-
import sys
|
|
454
|
-
|
|
455
467
|
if isinstance(self.ad, QuerySet):
|
|
456
468
|
# noinspection PyTypeChecker
|
|
457
469
|
self.ad: Ad = await self.ad.prefetch_related("agent__ex")
|
|
@@ -464,6 +476,11 @@ class Order(Model):
|
|
|
464
476
|
client = sys.modules[f"xync_client.{self.ad.agent.ex.name}.order"].Client
|
|
465
477
|
return client(self)
|
|
466
478
|
|
|
479
|
+
# def epyd(self): # todo: for who?
|
|
480
|
+
# module_name = f"xync_client.{self.ex.name}.pyd"
|
|
481
|
+
# __import__(module_name)
|
|
482
|
+
# return sys.modules[module_name].OrderEpyd
|
|
483
|
+
|
|
467
484
|
class Meta:
|
|
468
485
|
table_description = "P2P Orders"
|
|
469
486
|
|
|
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
|