Added TODOs to test files
This commit is contained in:
parent
53a6ce881c
commit
0733d69cda
@ -30,7 +30,7 @@ class Binance(Exchange):
|
||||
Returns True if adjustment is necessary.
|
||||
:param side: "buy" or "sell"
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
return order['type'] == 'stop_loss_limit' and stop_loss > float(order['info']['stopPrice'])
|
||||
|
||||
@retrier(retries=0)
|
||||
@ -42,7 +42,7 @@ class Binance(Exchange):
|
||||
It may work with a limited number of other exchanges, but this has not been tested yet.
|
||||
:param side: "buy" or "sell"
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
# Limit price threshold: As limit price should always be below stop-price
|
||||
limit_price_pct = order_types.get('stoploss_on_exchange_limit_ratio', 0.99)
|
||||
rate = stop_price * limit_price_pct
|
||||
|
@ -527,7 +527,7 @@ class Exchange:
|
||||
|
||||
def get_min_pair_stake_amount(self, pair: str, price: float, stoploss: float,
|
||||
leverage: Optional[float] = 1.0) -> Optional[float]:
|
||||
# TODO-mg: Using leverage makes the min stake amount lower (on binance at least)
|
||||
# TODO-lev: Using leverage makes the min stake amount lower (on binance at least)
|
||||
try:
|
||||
market = self.markets[pair]
|
||||
except KeyError:
|
||||
@ -1517,7 +1517,7 @@ class Exchange:
|
||||
until=until, from_id=from_id))
|
||||
|
||||
def get_interest_rate(self, pair: str, open_rate: float, is_short: bool) -> float:
|
||||
# TODO-mg: implement
|
||||
# TODO-lev: implement
|
||||
return 0.0005
|
||||
|
||||
def set_leverage(self, pair, leverage):
|
||||
|
@ -36,7 +36,7 @@ class Ftx(Exchange):
|
||||
Verify stop_loss against stoploss-order value (limit or price)
|
||||
Returns True if adjustment is necessary.
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
return order['type'] == 'stop' and stop_loss > float(order['price'])
|
||||
|
||||
@retrier(retries=0)
|
||||
@ -48,7 +48,7 @@ class Ftx(Exchange):
|
||||
|
||||
Limit orders are defined by having orderPrice set, otherwise a market order is used.
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
|
||||
limit_price_pct = order_types.get('stoploss_on_exchange_limit_ratio', 0.99)
|
||||
limit_rate = stop_price * limit_price_pct
|
||||
|
@ -72,7 +72,7 @@ class Kraken(Exchange):
|
||||
Verify stop_loss against stoploss-order value (limit or price)
|
||||
Returns True if adjustment is necessary.
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
return (order['type'] in ('stop-loss', 'stop-loss-limit')
|
||||
and stop_loss > float(order['price']))
|
||||
|
||||
@ -83,7 +83,7 @@ class Kraken(Exchange):
|
||||
Creates a stoploss market order.
|
||||
Stoploss market orders is the only stoploss type supported by kraken.
|
||||
"""
|
||||
# TODO-mg: Short support
|
||||
# TODO-lev: Short support
|
||||
params = self._params.copy()
|
||||
|
||||
if order_types.get('stoploss', 'market') == 'limit':
|
||||
|
@ -109,6 +109,8 @@ def test_init_ccxt_kwargs(default_conf, mocker, caplog):
|
||||
assert log_has("Applying additional ccxt config: {'TestKWARG': 11, 'TestKWARG44': 11}", caplog)
|
||||
assert log_has(asynclogmsg, caplog)
|
||||
|
||||
# TODO-lev: Test with options
|
||||
|
||||
|
||||
def test_destroy(default_conf, mocker, caplog):
|
||||
caplog.set_level(logging.DEBUG)
|
||||
@ -300,6 +302,7 @@ def test_price_get_one_pip(default_conf, mocker, price, precision_mode, precisio
|
||||
|
||||
def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
|
||||
|
||||
# TODO-lev: Test with leverage
|
||||
exchange = get_patched_exchange(mocker, default_conf, id="binance")
|
||||
stoploss = -0.05
|
||||
markets = {'ETH/BTC': {'symbol': 'ETH/BTC'}}
|
||||
@ -418,6 +421,7 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
|
||||
|
||||
|
||||
def test_get_min_pair_stake_amount_real_data(mocker, default_conf) -> None:
|
||||
# TODO-lev: Test with leverage
|
||||
exchange = get_patched_exchange(mocker, default_conf, id="binance")
|
||||
stoploss = -0.05
|
||||
markets = {'ETH/BTC': {'symbol': 'ETH/BTC'}}
|
||||
@ -438,6 +442,11 @@ def test_get_min_pair_stake_amount_real_data(mocker, default_conf) -> None:
|
||||
)
|
||||
|
||||
|
||||
def apply_leverage_to_stake_amount():
|
||||
# TODO-lev
|
||||
return
|
||||
|
||||
|
||||
def test_set_sandbox(default_conf, mocker):
|
||||
"""
|
||||
Test working scenario
|
||||
@ -2882,3 +2891,18 @@ def test_calculate_fee_rate(mocker, default_conf, order, expected) -> None:
|
||||
])
|
||||
def test_calculate_backoff(retrycount, max_retries, expected):
|
||||
assert calculate_backoff(retrycount, max_retries) == expected
|
||||
|
||||
|
||||
def test_get_max_leverage():
|
||||
# TODO-lev
|
||||
return
|
||||
|
||||
|
||||
def test_get_interest_rate():
|
||||
# TODO-lev
|
||||
return
|
||||
|
||||
|
||||
def test_set_leverage():
|
||||
# TODO-lev
|
||||
return
|
||||
|
@ -13,6 +13,8 @@ from .test_exchange import ccxt_exceptionhandlers
|
||||
|
||||
STOPLOSS_ORDERTYPE = 'stop'
|
||||
|
||||
# TODO-lev: All these stoploss tests with shorts
|
||||
|
||||
|
||||
def test_stoploss_order_ftx(default_conf, mocker):
|
||||
api_mock = MagicMock()
|
||||
|
@ -164,6 +164,8 @@ def test_get_balances_prod(default_conf, mocker):
|
||||
ccxt_exceptionhandlers(mocker, default_conf, api_mock, "kraken",
|
||||
"get_balances", "fetch_balance")
|
||||
|
||||
# TODO-lev: All these stoploss tests with shorts
|
||||
|
||||
|
||||
@pytest.mark.parametrize('ordertype', ['market', 'limit'])
|
||||
def test_stoploss_order_kraken(default_conf, mocker, ordertype):
|
||||
|
Loading…
Reference in New Issue
Block a user