mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
removed a few todos
This commit is contained in:
parent
08b738a5d9
commit
9a220f6cfe
|
@ -28,8 +28,6 @@ Regular trading mode (low risk)
|
||||||
|
|
||||||
### Leverage trading modes
|
### Leverage trading modes
|
||||||
|
|
||||||
# TODO-lev: include a resource to help calculate stoplosses that are above the liquidation price
|
|
||||||
|
|
||||||
With leverage, a trader borrows capital from the exchange. The capital must be repayed fully to the exchange(potentially with interest), and the trader keeps any profits, or pays any losses, from any trades made using the borrowed capital.
|
With leverage, a trader borrows capital from the exchange. The capital must be repayed fully to the exchange(potentially with interest), and the trader keeps any profits, or pays any losses, from any trades made using the borrowed capital.
|
||||||
|
|
||||||
Because the capital must always be repayed, exchanges will **liquidate** a trade (forcefully sell the traders assets) made using borrowed capital when the total value of assets in a leverage account drops to a certain point(a point where the total value of losses is less than the value of the collateral that the trader actually owns in the leverage account), in order to ensure that the trader has enough capital to pay back the borrowed assets to the exchange. The exchange will also charge a **liquidation fee**, adding to the traders losses. For this reason, **DO NOT TRADE WITH LEVERAGE IF YOU DON'T KNOW EXACTLY WHAT YOUR DOING. LEVERAGE TRADING IS HIGH RISK, AND CAN RESULT IN THE VALUE OF YOUR ASSETS DROPPING TO 0 VERY QUICKLY, WITH NO CHANCE OF INCREASING IN VALUE AGAIN**
|
Because the capital must always be repayed, exchanges will **liquidate** a trade (forcefully sell the traders assets) made using borrowed capital when the total value of assets in a leverage account drops to a certain point(a point where the total value of losses is less than the value of the collateral that the trader actually owns in the leverage account), in order to ensure that the trader has enough capital to pay back the borrowed assets to the exchange. The exchange will also charge a **liquidation fee**, adding to the traders losses. For this reason, **DO NOT TRADE WITH LEVERAGE IF YOU DON'T KNOW EXACTLY WHAT YOUR DOING. LEVERAGE TRADING IS HIGH RISK, AND CAN RESULT IN THE VALUE OF YOUR ASSETS DROPPING TO 0 VERY QUICKLY, WITH NO CHANCE OF INCREASING IN VALUE AGAIN**
|
||||||
|
|
|
@ -36,8 +36,7 @@ class MaxDrawdown(IProtection):
|
||||||
"""
|
"""
|
||||||
LockReason to use
|
LockReason to use
|
||||||
"""
|
"""
|
||||||
# TODO-lev: < for shorts?
|
return (f'{drawdown} passed {self._max_allowed_drawdown} in {self.lookback_period_str}, '
|
||||||
return (f'{drawdown} > {self._max_allowed_drawdown} in {self.lookback_period_str}, '
|
|
||||||
f'locking for {self.stop_duration_str}.')
|
f'locking for {self.stop_duration_str}.')
|
||||||
|
|
||||||
def _max_drawdown(self, date_now: datetime) -> ProtectionReturn:
|
def _max_drawdown(self, date_now: datetime) -> ProtectionReturn:
|
||||||
|
|
|
@ -685,7 +685,7 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker)
|
||||||
inf_pairs = MagicMock(return_value=[
|
inf_pairs = MagicMock(return_value=[
|
||||||
("BTC/ETH", '1m', CandleType.SPOT),
|
("BTC/ETH", '1m', CandleType.SPOT),
|
||||||
("ETH/USDT", "1h", CandleType.SPOT)
|
("ETH/USDT", "1h", CandleType.SPOT)
|
||||||
])
|
])
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.strategy.interface.IStrategy',
|
'freqtrade.strategy.interface.IStrategy',
|
||||||
get_exit_signal=MagicMock(return_value=(False, False)),
|
get_exit_signal=MagicMock(return_value=(False, False)),
|
||||||
|
@ -710,8 +710,8 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker)
|
||||||
'spot',
|
'spot',
|
||||||
# TODO-lev: Enable other modes
|
# TODO-lev: Enable other modes
|
||||||
# 'margin', 'futures'
|
# 'margin', 'futures'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize("is_short", [False, True])
|
@pytest.mark.parametrize("is_short", [False, True])
|
||||||
def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
||||||
limit_order_open, is_short, trading_mode) -> None:
|
limit_order_open, is_short, trading_mode) -> None:
|
||||||
|
@ -2090,9 +2090,8 @@ def test_handle_trade_roi(default_conf_usdt, ticker_usdt, limit_order_open, fee,
|
||||||
# we might just want to check if we are in a sell condition without
|
# we might just want to check if we are in a sell condition without
|
||||||
# executing
|
# executing
|
||||||
# if ROI is reached we must sell
|
# if ROI is reached we must sell
|
||||||
# TODO-lev: Change the next line for shorts
|
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
patch_get_signal(freqtrade, enter_long=False, exit_long=True)
|
patch_get_signal(freqtrade, enter_long=False, exit_long=not is_short, exit_short=is_short)
|
||||||
assert freqtrade.handle_trade(trade)
|
assert freqtrade.handle_trade(trade)
|
||||||
assert log_has("ETH/USDT - Required profit reached. sell_type=SellType.ROI",
|
assert log_has("ETH/USDT - Required profit reached. sell_type=SellType.ROI",
|
||||||
caplog)
|
caplog)
|
||||||
|
@ -4928,4 +4927,4 @@ def test_update_funding_fees(
|
||||||
assert trade.funding_fees == pytest.approx(sum(
|
assert trade.funding_fees == pytest.approx(sum(
|
||||||
trade.amount *
|
trade.amount *
|
||||||
mark_prices[trade.pair].iloc[0:2]['open'] * funding_rates[trade.pair].iloc[0:2]['open']
|
mark_prices[trade.pair].iloc[0:2]['open'] * funding_rates[trade.pair].iloc[0:2]['open']
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user