Skip to content

Commit

Permalink
Fix typo, add test for validate_order_tif
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Mar 27, 2019
1 parent e15f2ef commit 9b22d5c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion freqtrade/exchange/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def validate_order_time_in_force(self, order_time_in_force: Dict) -> None:
if any(v not in self._ft_has["order_time_in_force"]
for k, v in order_time_in_force.items()):
raise OperationalException(
f'Time in force policies are not supporetd for {self.name} yet.')
f'Time in force policies are not supported for {self.name} yet.')

def exchange_has(self, endpoint: str) -> bool:
"""
Expand Down
22 changes: 22 additions & 0 deletions freqtrade/tests/exchange/test_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,28 @@ def test_exchange_resolver(default_conf, mocker, caplog):
caplog.record_tuples)


def test_validate_order_time_in_force(default_conf, mocker, caplog):
caplog.set_level(logging.INFO)
# explicitly test bittrex, exchanges implementing other policies need seperate tests
ex = get_patched_exchange(mocker, default_conf, id="bittrex")
tif = {
"buy": "gtc",
"sell": "gtc",
}

ex.validate_order_time_in_force(tif)
tif2 = {
"buy": "fok",
"sell": "ioc",
}
with pytest.raises(OperationalException, match=r"Time in force.*not supported for .*"):
ex.validate_order_time_in_force(tif2)

# Patch to see if this will pass if the values are in the ft dict
ex._ft_has.update({"order_time_in_force": ["gtc", "fok", "ioc"]})
ex.validate_order_time_in_force(tif2)


def test_symbol_amount_prec(default_conf, mocker):
'''
Test rounds down to 4 Decimal places
Expand Down

0 comments on commit 9b22d5c

Please sign in to comment.