Fix typo, add test for validate_order_tif
This commit is contained in:
parent
e15f2ef11a
commit
9b22d5cab1
@ -272,7 +272,7 @@ class Exchange(object):
|
|||||||
if any(v not in self._ft_has["order_time_in_force"]
|
if any(v not in self._ft_has["order_time_in_force"]
|
||||||
for k, v in order_time_in_force.items()):
|
for k, v in order_time_in_force.items()):
|
||||||
raise OperationalException(
|
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:
|
def exchange_has(self, endpoint: str) -> bool:
|
||||||
"""
|
"""
|
||||||
|
@ -139,6 +139,28 @@ def test_exchange_resolver(default_conf, mocker, caplog):
|
|||||||
caplog.record_tuples)
|
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):
|
def test_symbol_amount_prec(default_conf, mocker):
|
||||||
'''
|
'''
|
||||||
Test rounds down to 4 Decimal places
|
Test rounds down to 4 Decimal places
|
||||||
|
Loading…
Reference in New Issue
Block a user