xync-schema 0.6.61__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.61/xync_schema.egg-info → xync_schema-0.6.66}/PKG-INFO +1 -1
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema/models.py +55 -14
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema/pydantic.py +1 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66/xync_schema.egg-info}/PKG-INFO +1 -1
- {xync_schema-0.6.61 → xync_schema-0.6.66}/.env.sample +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/.gitignore +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/.pre-commit-config.yaml +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/README.md +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/makefile +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/pyproject.toml +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/setup.cfg +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/tests/__init__.py +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/tests/test_db.py +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema/__init__.py +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema/enums.py +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema.egg-info/SOURCES.txt +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema.egg-info/dependency_links.txt +0 -0
- {xync_schema-0.6.61 → xync_schema-0.6.66}/xync_schema.egg-info/requires.txt +0 -0
- {xync_schema-0.6.61 → 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
|
# )
|
|
@@ -107,6 +105,8 @@ class Curex(BaseModel):
|
|
|
107
105
|
class Coinex(BaseModel):
|
|
108
106
|
coin: fields.ForeignKeyRelation[Coin] = fields.ForeignKeyField("models.Coin")
|
|
109
107
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
108
|
+
minimum: float = fields.FloatField(null=True)
|
|
109
|
+
|
|
110
110
|
exid: str = fields.CharField(31)
|
|
111
111
|
p2p: bool = fields.BooleanField(default=True)
|
|
112
112
|
|
|
@@ -213,16 +213,20 @@ class Agent(Model):
|
|
|
213
213
|
computed = ["balance"]
|
|
214
214
|
|
|
215
215
|
def client(self):
|
|
216
|
-
import sys
|
|
217
|
-
|
|
218
216
|
module_name = f"xync_client.{self.ex.name}.agent"
|
|
219
217
|
__import__(module_name)
|
|
220
218
|
client = sys.modules[module_name].AgentClient
|
|
221
219
|
return client(self)
|
|
222
220
|
|
|
223
|
-
def
|
|
224
|
-
|
|
221
|
+
# def in_client(self) -> "BaseInAgentClient":
|
|
222
|
+
# import sys
|
|
223
|
+
#
|
|
224
|
+
# module_name = f"xync_client.{self.ex.name}.inAgent"
|
|
225
|
+
# __import__(module_name)
|
|
226
|
+
# client = sys.modules[module_name].InAgentClient
|
|
227
|
+
# return client(self)
|
|
225
228
|
|
|
229
|
+
def asset_client(self):
|
|
226
230
|
module_name = f"xync_client.{self.ex.name}.asset"
|
|
227
231
|
__import__(module_name)
|
|
228
232
|
client = sys.modules[module_name].AssetClient
|
|
@@ -249,6 +253,7 @@ class Ad(Model, TsTrait):
|
|
|
249
253
|
detail: str | None = fields.CharField(4095, null=True)
|
|
250
254
|
autoMsg: str | None = fields.CharField(255, null=True)
|
|
251
255
|
agent: fields.ForeignKeyRelation[Agent] = fields.ForeignKeyField("models.Agent", "ads")
|
|
256
|
+
agent_id: int
|
|
252
257
|
status: AdStatus = fields.IntEnumField(AdStatus)
|
|
253
258
|
|
|
254
259
|
orders: fields.ReverseRelation["Order"]
|
|
@@ -259,6 +264,11 @@ class Ad(Model, TsTrait):
|
|
|
259
264
|
class Meta:
|
|
260
265
|
table_description = "P2P Advertisements"
|
|
261
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
|
+
|
|
262
272
|
|
|
263
273
|
class Pm(Model):
|
|
264
274
|
name: str = fields.CharField(63, unique=True)
|
|
@@ -277,8 +287,15 @@ class Pm(Model):
|
|
|
277
287
|
class Meta:
|
|
278
288
|
table_description = "Payment methods"
|
|
279
289
|
|
|
280
|
-
class PydanticMeta(Model.PydanticMeta):
|
|
281
|
-
|
|
290
|
+
# class PydanticMeta(Model.PydanticMeta):
|
|
291
|
+
# max_recursion = 3
|
|
292
|
+
# backward_relations = True
|
|
293
|
+
# include = "id", "name", "logo", "pmexs__sbp"
|
|
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
|
|
282
299
|
|
|
283
300
|
|
|
284
301
|
class Pmcur(Model): # for fiat with no exs tie
|
|
@@ -287,7 +304,7 @@ class Pmcur(Model): # for fiat with no exs tie
|
|
|
287
304
|
cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
|
|
288
305
|
cur_id: int
|
|
289
306
|
|
|
290
|
-
fiats: fields.
|
|
307
|
+
fiats: fields.BackwardFKRelation["Fiat"]
|
|
291
308
|
exs: fields.ManyToManyRelation[Ex]
|
|
292
309
|
|
|
293
310
|
class Meta:
|
|
@@ -307,10 +324,22 @@ class Pmex(BaseModel): # existence pm in ex with no cur tie
|
|
|
307
324
|
exid: str = fields.CharField(63)
|
|
308
325
|
name: str = fields.CharField(63)
|
|
309
326
|
|
|
327
|
+
banks: fields.BackwardFKRelation["PmexBank"]
|
|
328
|
+
|
|
310
329
|
class Meta:
|
|
311
330
|
unique_together = (("ex_id", "exid"),)
|
|
312
331
|
|
|
313
332
|
|
|
333
|
+
class PmexBank(BaseModel): # banks for SBP
|
|
334
|
+
pmex: fields.ForeignKeyRelation[Pmex] = fields.ForeignKeyField("models.Pmex", "banks")
|
|
335
|
+
pmex_id: int
|
|
336
|
+
exid: str = fields.CharField(63)
|
|
337
|
+
name: str = fields.CharField(63)
|
|
338
|
+
|
|
339
|
+
class Meta:
|
|
340
|
+
unique_together = (("pmex", "exid"),)
|
|
341
|
+
|
|
342
|
+
|
|
314
343
|
class Pmcurex(BaseModel): # existence pm in ex for exact cur, with "blocked" flag
|
|
315
344
|
pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
|
|
316
345
|
pmcur_id: int
|
|
@@ -347,7 +376,11 @@ class Fiat(Model):
|
|
|
347
376
|
backward_relations = False
|
|
348
377
|
include = "id", "pmcur", "detail", "name", "amount"
|
|
349
378
|
|
|
350
|
-
|
|
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
|
|
351
384
|
|
|
352
385
|
|
|
353
386
|
class Fiatex(BaseModel): # existence pm in ex with no cur tie
|
|
@@ -385,7 +418,7 @@ class Asset(Model):
|
|
|
385
418
|
coin_id: int
|
|
386
419
|
agent: fields.ForeignKeyRelation[Agent] = fields.ForeignKeyField("models.Agent", "assets")
|
|
387
420
|
agent_id: int
|
|
388
|
-
type_: AssetType = fields.IntEnumField(AssetType)
|
|
421
|
+
type_: AssetType = fields.IntEnumField(AssetType, default=AssetType.found)
|
|
389
422
|
free: float = fields.FloatField()
|
|
390
423
|
freeze: float | None = fields.FloatField(default=0)
|
|
391
424
|
lock: float | None = fields.FloatField(default=0)
|
|
@@ -400,6 +433,11 @@ class Asset(Model):
|
|
|
400
433
|
class PydanticMeta(Model.PydanticMeta):
|
|
401
434
|
max_recursion: int = 2 # default: 3
|
|
402
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
|
+
|
|
403
441
|
|
|
404
442
|
class Order(Model):
|
|
405
443
|
id: int = fields.BigIntField(True)
|
|
@@ -426,8 +464,6 @@ class Order(Model):
|
|
|
426
464
|
return f"{self.fiat.pmcur.pm.name}/{self.fiat_id}:{self.amount:.3g} {self.status.name}"
|
|
427
465
|
|
|
428
466
|
async def client(self):
|
|
429
|
-
import sys
|
|
430
|
-
|
|
431
467
|
if isinstance(self.ad, QuerySet):
|
|
432
468
|
# noinspection PyTypeChecker
|
|
433
469
|
self.ad: Ad = await self.ad.prefetch_related("agent__ex")
|
|
@@ -440,6 +476,11 @@ class Order(Model):
|
|
|
440
476
|
client = sys.modules[f"xync_client.{self.ad.agent.ex.name}.order"].Client
|
|
441
477
|
return client(self)
|
|
442
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
|
+
|
|
443
484
|
class Meta:
|
|
444
485
|
table_description = "P2P Orders"
|
|
445
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
|