Skip to content

Commit

Permalink
fixing model conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 16, 2024
1 parent 342724a commit 5ebf738
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
30 changes: 8 additions & 22 deletions mantis/simulation/routers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# This is global unique ID for token(asset) or exchange(pool)
TId = TypeVar("TId", int, str)
TNetworkId = TypeVar("TNetworkId", int, str)
TAmount = TypeVar("TAmount", int, float, dec)
TAmount = TypeVar("TAmount", int, float, dec, str)

MINIMAL_FEE_PER_MILLION_DEFAULT = 100
"""
Expand Down Expand Up @@ -329,30 +329,16 @@ class Input(
in_asset_id: TId = Field(example="158456325028528675187087900673")
out_asset_id: TId = Field(example="158456325028528675187087900674")
# tendered amount DELTA
in_asset_amount: TAmount = Field(
example="1000000000000",
title='Password',
type = 'string',
json_schema_extra={
'title': 'Password',
'description': 'Password of the user',
'examples': ['123456']
}
)
# expected received amount LAMBDA
out_asset_amount: TAmount = Field(
example="10",
type='string',
json_schema_extra={
'title': 'Password',
'description': 'Password of the user',
'examples': ['123456'],
}
)
in_asset_amount: TAmount = Field(example="10000000")
out_asset_amount: TAmount = Field(example="100")
"""
expected received amount LAMBDA
"""

# if max is True, user wants to spent all in to get at least out
# if max is False, user wants to get exact out, but spent as small as possible in
# please fail if bool is False for now
max: bool = Field(example=True)
max: bool = Field(example=True, default=True)


class Trade(Generic[TId, TAmount]):
Expand Down
9 changes: 8 additions & 1 deletion mantis/simulation/routers/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path

from simulation.routers.data import (
Input,
new_data,
new_pair,
new_transfer,
Expand All @@ -15,7 +16,13 @@ def _test_all_data_from_csv():
assert read_dummy_data(TEST_DATA_DIR)


def _test_token_price_in_usd():
def test_big_numbers_api():
"""_summary_
Ensures that amounts are strings on the wire but big integers in memory
"""
input : Input[str, str] = Input(in_asset_id="1", out_asset_id="2", in_asset_amount="100", out_asset_amount="100")

def test_token_price_in_usd():
pica_usd = new_pair(
1,
1,
Expand Down

0 comments on commit 5ebf738

Please sign in to comment.