comments, formatting

This commit is contained in:
Sam Germain 2021-09-08 00:19:21 -06:00
parent e13b0414d8
commit f8248f3771
6 changed files with 7 additions and 6 deletions

View File

@ -3,7 +3,7 @@ from enum import Enum
class SignalType(Enum): class SignalType(Enum):
""" """
Enum to distinguish between buy and sell signals Enum to distinguish between enter and exit signals
""" """
ENTER_LONG = "enter_long" ENTER_LONG = "enter_long"
EXIT_LONG = "exit_long" EXIT_LONG = "exit_long"

View File

@ -371,7 +371,7 @@ class Backtesting:
trade, sell_row[OPEN_IDX], sell_candle_time, # type: ignore trade, sell_row[OPEN_IDX], sell_candle_time, # type: ignore
enter=enter, exit_=exit_, enter=enter, exit_=exit_,
low=sell_row[LOW_IDX], high=sell_row[HIGH_IDX] low=sell_row[LOW_IDX], high=sell_row[HIGH_IDX]
) )
if sell.sell_flag: if sell.sell_flag:
trade.close_date = sell_candle_time trade.close_date = sell_candle_time
@ -403,7 +403,7 @@ class Backtesting:
detail_data = detail_data.loc[ detail_data = detail_data.loc[
(detail_data['date'] >= sell_candle_time) & (detail_data['date'] >= sell_candle_time) &
(detail_data['date'] < sell_candle_end) (detail_data['date'] < sell_candle_end)
] ]
if len(detail_data) == 0: if len(detail_data) == 0:
# Fall back to "regular" data if no detail data was found for this candle # Fall back to "regular" data if no detail data was found for this candle
return self._get_sell_trade_entry_for_candle(trade, sell_row) return self._get_sell_trade_entry_for_candle(trade, sell_row)

View File

@ -548,7 +548,7 @@ class LocalTrade():
if self.is_open: if self.is_open:
payment = "BUY" if self.is_short else "SELL" payment = "BUY" if self.is_short else "SELL"
# TODO-lev: On shorts, you buy a little bit more than the amount (amount + interest) # TODO-lev: On shorts, you buy a little bit more than the amount (amount + interest)
# This wll only print the original amount # TODO-lev: This wll only print the original amount
logger.info(f'{order_type.upper()}_{payment} has been fulfilled for {self}.') logger.info(f'{order_type.upper()}_{payment} has been fulfilled for {self}.')
# TODO-lev: Double check this # TODO-lev: Double check this
self.close(safe_value_fallback(order, 'average', 'price')) self.close(safe_value_fallback(order, 'average', 'price'))

View File

@ -127,7 +127,7 @@ class PairListManager():
:return: pairlist - whitelisted pairs :return: pairlist - whitelisted pairs
""" """
try: try:
# TODO-lev: filter for pairlists that are able to trade at the desired leverage
whitelist = expand_pairlist(pairlist, self._exchange.get_markets().keys(), keep_invalid) whitelist = expand_pairlist(pairlist, self._exchange.get_markets().keys(), keep_invalid)
except ValueError as err: except ValueError as err:
logger.error(f"Pair whitelist contains an invalid Wildcard: {err}") logger.error(f"Pair whitelist contains an invalid Wildcard: {err}")

View File

@ -36,6 +36,7 @@ class RPCException(Exception):
raise RPCException('*Status:* `no active trade`') raise RPCException('*Status:* `no active trade`')
""" """
# TODO-lev: Add new configuration options introduced with leveraged/short trading
def __init__(self, message: str) -> None: def __init__(self, message: str) -> None:
super().__init__(self) super().__init__(self)

View File

@ -90,7 +90,7 @@ def test_enter_exit_side(fee):
@pytest.mark.usefixtures("init_persistence") @pytest.mark.usefixtures("init_persistence")
def test__set_stop_loss_isolated_liq(fee): def test_set_stop_loss_isolated_liq(fee):
trade = Trade( trade = Trade(
id=2, id=2,
pair='ADA/USDT', pair='ADA/USDT',