Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🥚ignore_instrument setting #237

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion findmyorder/default_settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mapping = [
{ id = "BTC", alt = "WBTC" },
{ id = "ETH", alt = "WETH" },
]

ignore_instrument = "US500 USTEC DOGE"


[testing]
Expand Down
3 changes: 3 additions & 0 deletions findmyorder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ async def get_order(
print(settings.instrument_mapping)
if settings.instrument_mapping:
await self.replace_instrument(order)
if order["instrument"] in settings.ignore_instrument:
""" ignoring instrument"""
return
return order
return None

Expand Down
12 changes: 12 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"timestamp": datetime.now()
}

@pytest.fixture
def ignore_order():
"""return valid order"""
return "buy US500"

@pytest.fixture
def crypto_order():
Expand Down Expand Up @@ -173,6 +177,14 @@
assert int(result["quantity"]) == 1
assert type(result["timestamp"] is datetime)


@pytest.mark.asyncio
async def test_ignoteorder(fmo, ignore_order):
"""ignore order Testing"""
result = await fmo.get_order(ignore_order)
assert result is None
Dismissed Show dismissed Hide dismissed


@pytest.mark.asyncio
async def test_mapping_order(
fmo,
Expand Down