xync-schema 0.6.73.dev6__tar.gz → 0.6.73.dev7__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.73.dev6/xync_schema.egg-info → xync_schema-0.6.73.dev7}/PKG-INFO +1 -1
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/tests/test_db.py +3 -3
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema/models.py +38 -19
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema/types.py +18 -29
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7/xync_schema.egg-info}/PKG-INFO +1 -1
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/.env.sample +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/.gitignore +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/.pre-commit-config.yaml +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/README.md +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/makefile +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/pyproject.toml +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/setup.cfg +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/tests/__init__.py +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema/__init__.py +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema/enums.py +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema.egg-info/SOURCES.txt +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema.egg-info/dependency_links.txt +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema.egg-info/requires.txt +0 -0
- {xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema.egg-info/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ from tortoise.backends.asyncpg import AsyncpgDBClient
|
|
|
7
7
|
from x_model import init_db
|
|
8
8
|
|
|
9
9
|
from xync_schema import models
|
|
10
|
-
from xync_schema.models import
|
|
10
|
+
from xync_schema.models import Ex
|
|
11
11
|
|
|
12
12
|
load_dotenv()
|
|
13
13
|
|
|
@@ -25,5 +25,5 @@ async def test_init_db(dbc):
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
async def test_models(dbc):
|
|
28
|
-
c = await
|
|
29
|
-
assert isinstance(c,
|
|
28
|
+
c = await Ex.first()
|
|
29
|
+
assert isinstance(c, Ex), "No exs"
|
|
@@ -8,7 +8,17 @@ from tortoise.signals import pre_save
|
|
|
8
8
|
from x_auth.models import Model, UserTg
|
|
9
9
|
from x_model.models import TsTrait, DatetimeSecField
|
|
10
10
|
|
|
11
|
-
from xync_schema.enums import
|
|
11
|
+
from xync_schema.enums import (
|
|
12
|
+
ExType,
|
|
13
|
+
AdStatus,
|
|
14
|
+
AssetType,
|
|
15
|
+
OrderStatus,
|
|
16
|
+
ExAction,
|
|
17
|
+
ExStatus,
|
|
18
|
+
PersonStatus,
|
|
19
|
+
UserStatus,
|
|
20
|
+
PmType,
|
|
21
|
+
)
|
|
12
22
|
|
|
13
23
|
|
|
14
24
|
class Country(Model):
|
|
@@ -24,6 +34,7 @@ class Country(Model):
|
|
|
24
34
|
class Cur(Model):
|
|
25
35
|
id = fields.SmallIntField(True)
|
|
26
36
|
ticker: str = fields.CharField(3, unique=True)
|
|
37
|
+
scale: int = fields.SmallIntField(default=0)
|
|
27
38
|
rate: float | None = fields.FloatField(default=0, null=True)
|
|
28
39
|
|
|
29
40
|
pms: fields.ManyToManyRelation["Pm"] = fields.ManyToManyField("models.Pm", through="pmcur")
|
|
@@ -40,6 +51,7 @@ class Cur(Model):
|
|
|
40
51
|
class Coin(Model):
|
|
41
52
|
id: int = fields.SmallIntField(True)
|
|
42
53
|
ticker: str = fields.CharField(15, unique=True)
|
|
54
|
+
scale: int = fields.SmallIntField(default=0)
|
|
43
55
|
rate: float | None = fields.FloatField(default=0)
|
|
44
56
|
is_fiat: bool = fields.BooleanField(default=False)
|
|
45
57
|
exs: fields.ManyToManyRelation["Ex"] = fields.ManyToManyField("models.Ex", through="coinex")
|
|
@@ -160,7 +172,7 @@ class Direction(Model):
|
|
|
160
172
|
|
|
161
173
|
class Person(Model, TsTrait):
|
|
162
174
|
status: PersonStatus = fields.IntEnumField(PersonStatus, default=PersonStatus.DEFAULT)
|
|
163
|
-
name: str | None = fields.CharField(127)
|
|
175
|
+
name: str | None = fields.CharField(127, null=True)
|
|
164
176
|
|
|
165
177
|
user: fields.BackwardOneToOneRelation["User"]
|
|
166
178
|
creds: fields.BackwardFKRelation["Cred"]
|
|
@@ -274,10 +286,10 @@ class Agent(Model, TsTrait):
|
|
|
274
286
|
client = sys.modules[module_name].AssetClient
|
|
275
287
|
return client(self)
|
|
276
288
|
|
|
277
|
-
class PydanticMeta(Model.PydanticMeta):
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
289
|
+
# class PydanticMeta(Model.PydanticMeta):
|
|
290
|
+
# max_recursion = 3
|
|
291
|
+
# include = "id", "actor__ex", "auth", "updated_at"
|
|
292
|
+
# computed = ["balance"]
|
|
281
293
|
|
|
282
294
|
|
|
283
295
|
# class Adpm(Model):
|
|
@@ -337,15 +349,17 @@ class Ad(Model, TsTrait):
|
|
|
337
349
|
|
|
338
350
|
|
|
339
351
|
class Pm(Model):
|
|
340
|
-
name: str = fields.CharField(63
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
country: fields.ForeignKeyRelation[Country] = fields.ForeignKeyField(
|
|
344
|
-
|
|
345
|
-
)
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
352
|
+
# name: str = fields.CharField(63) # mv to pmex cause it diffs on each ex
|
|
353
|
+
norm: str | None = fields.CharField(63)
|
|
354
|
+
acronym: str | None = fields.CharField(7, unique=True, null=True)
|
|
355
|
+
country: fields.ForeignKeyRelation[Country] = fields.ForeignKeyField("models.Country", "pms", null=True)
|
|
356
|
+
alias: str | None = fields.CharField(63, null=True)
|
|
357
|
+
extra: str | None = fields.CharField(63, null=True)
|
|
358
|
+
ok: bool = fields.BooleanField(default=True)
|
|
359
|
+
bank: bool = fields.BooleanField(null=True)
|
|
360
|
+
|
|
361
|
+
type_: PmType | None = fields.IntEnumField(PmType, null=True)
|
|
362
|
+
logo: str | None = fields.CharField(119, null=True)
|
|
349
363
|
|
|
350
364
|
ads: fields.ManyToManyRelation[Ad]
|
|
351
365
|
curs: fields.ManyToManyRelation[Cur]
|
|
@@ -356,6 +370,7 @@ class Pm(Model):
|
|
|
356
370
|
|
|
357
371
|
class Meta:
|
|
358
372
|
table_description = "Payment methods"
|
|
373
|
+
unique_together = (("norm", "country"), ("alias", "country"))
|
|
359
374
|
|
|
360
375
|
# class PydanticMeta(Model.PydanticMeta):
|
|
361
376
|
# max_recursion = 3
|
|
@@ -387,17 +402,21 @@ class Pmcur(Model): # for fiat with no exs tie
|
|
|
387
402
|
|
|
388
403
|
|
|
389
404
|
class Pmex(BaseModel): # existence pm in ex with no cur tie
|
|
390
|
-
pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm", "pmexs")
|
|
391
|
-
pm_id: int
|
|
392
405
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "pmexs")
|
|
393
406
|
ex_id: int
|
|
407
|
+
pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm", "pmexs")
|
|
408
|
+
pm_id: int
|
|
394
409
|
exid: str = fields.CharField(63)
|
|
395
410
|
name: str = fields.CharField(63)
|
|
411
|
+
name_: str = fields.CharField(63, null=True)
|
|
396
412
|
|
|
397
413
|
banks: fields.BackwardFKRelation["PmexBank"]
|
|
398
414
|
|
|
399
415
|
class Meta:
|
|
400
|
-
unique_together = (
|
|
416
|
+
unique_together = (
|
|
417
|
+
("ex", "exid"),
|
|
418
|
+
("ex", "name_"),
|
|
419
|
+
) # , ("ex", "pm"), ("ex", "name") # todo: tmp removed for HTX duplicates
|
|
401
420
|
|
|
402
421
|
|
|
403
422
|
class PmexBank(BaseModel): # banks for SBP
|
|
@@ -462,7 +481,7 @@ class Fiat(Model):
|
|
|
462
481
|
cred: fields.OneToOneRelation[Cred] = fields.OneToOneField("models.Cred", "fiat")
|
|
463
482
|
cred_id: int
|
|
464
483
|
amount: float | None = fields.FloatField(default=0)
|
|
465
|
-
target: float
|
|
484
|
+
target: float = fields.FloatField(default=0)
|
|
466
485
|
|
|
467
486
|
class Meta:
|
|
468
487
|
table_description = "Currency balances"
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
|
+
from x_model.types import New, Upd
|
|
4
5
|
|
|
5
6
|
from xync_schema.enums import AdStatus, OrderStatus, PmType
|
|
6
7
|
from xync_schema import models
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
class
|
|
10
|
+
class UnitEx(BaseModel):
|
|
10
11
|
exid: int | str
|
|
11
12
|
ticker: str
|
|
12
|
-
|
|
13
|
+
scale: int
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class
|
|
16
|
-
p2p: bool =
|
|
16
|
+
class CoinEx(UnitEx):
|
|
17
|
+
p2p: bool = None
|
|
17
18
|
minimum: float | None = None
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class
|
|
21
|
+
class CurEx(UnitEx):
|
|
21
22
|
rounding_scale: int | None = None
|
|
22
23
|
minimum: int | None = None
|
|
23
24
|
|
|
@@ -28,12 +29,18 @@ class PmexBank(BaseModel):
|
|
|
28
29
|
name: str
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
class
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
class PmIn(New):
|
|
33
|
+
norm: str
|
|
34
|
+
acronym: str | None = None
|
|
35
|
+
alias: str | None = None
|
|
36
|
+
extra: str | None = None
|
|
37
|
+
bank: bool | None = None
|
|
38
|
+
country_id: int | None = None
|
|
35
39
|
type_: PmType | None = None
|
|
36
40
|
logo: str | None = None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class PmOut(PmIn, Upd):
|
|
37
44
|
banks: list[PmexBank] | None = None
|
|
38
45
|
|
|
39
46
|
|
|
@@ -43,24 +50,6 @@ class Pm(BaseModel):
|
|
|
43
50
|
# cur_id: int
|
|
44
51
|
|
|
45
52
|
|
|
46
|
-
class FFiat(BaseModel):
|
|
47
|
-
detail: str
|
|
48
|
-
name: str | None = None
|
|
49
|
-
amount: float = 0
|
|
50
|
-
target: int | None = None
|
|
51
|
-
banks: list[str] = []
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class FiatNew(FFiat):
|
|
55
|
-
cur_id: int
|
|
56
|
-
pm_id: int
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class FiatUpd(FFiat):
|
|
60
|
-
id: int
|
|
61
|
-
exid: int
|
|
62
|
-
|
|
63
|
-
|
|
64
53
|
class CredIn(BaseModel):
|
|
65
54
|
id: int | None = None
|
|
66
55
|
exid: int
|
|
@@ -124,7 +113,7 @@ class BaseAdIn(BaseAd):
|
|
|
124
113
|
|
|
125
114
|
|
|
126
115
|
class AdBuyIn(BaseAdIn):
|
|
127
|
-
pms_: list[Pm]
|
|
116
|
+
pms_: list[models.Pm]
|
|
128
117
|
|
|
129
118
|
|
|
130
119
|
class AdSaleIn(BaseAdIn):
|
|
@@ -140,7 +129,7 @@ class Order(BaseModel):
|
|
|
140
129
|
amount: float
|
|
141
130
|
status: str
|
|
142
131
|
actions: dict | None = {}
|
|
143
|
-
cred: models.Cred.
|
|
132
|
+
cred: models.Cred.out_type()
|
|
144
133
|
is_sell: bool
|
|
145
134
|
actor: int | None = None
|
|
146
135
|
created_at: datetime
|
|
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
|
{xync_schema-0.6.73.dev6 → xync_schema-0.6.73.dev7}/xync_schema.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|