Merge branch 'develop' into feat/short
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import talib.abstract as ta
|
||||
from pandas import DataFrame
|
||||
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.strategy import IStrategy
|
||||
|
||||
|
||||
@@ -48,6 +51,9 @@ class StrategyTestV2(IStrategy):
|
||||
'sell': 'gtc',
|
||||
}
|
||||
|
||||
# By default this strategy does not use Position Adjustments
|
||||
position_adjustment_enable = False
|
||||
|
||||
def informative_pairs(self):
|
||||
"""
|
||||
Define additional, informative pair/interval combinations to be cached from the exchange.
|
||||
@@ -154,3 +160,12 @@ class StrategyTestV2(IStrategy):
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
||||
|
||||
def adjust_trade_position(self, trade: Trade, current_time: datetime, current_rate: float,
|
||||
current_profit: float, min_stake: float, max_stake: float, **kwargs):
|
||||
|
||||
if current_profit < -0.0075:
|
||||
orders = trade.select_filled_orders('buy')
|
||||
return round(orders[0].cost, 0)
|
||||
|
||||
return None
|
||||
|
@@ -6,6 +6,7 @@ import talib.abstract as ta
|
||||
from pandas import DataFrame
|
||||
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.strategy import (BooleanParameter, DecimalParameter, IntParameter, IStrategy,
|
||||
RealParameter)
|
||||
|
||||
@@ -178,3 +179,12 @@ class StrategyTestV3(IStrategy):
|
||||
# Bot-logic must make sure it's an allowed leverage and eventually adjust accordingly.
|
||||
|
||||
return 3.0
|
||||
|
||||
def adjust_trade_position(self, trade: Trade, current_time: datetime, current_rate: float,
|
||||
current_profit: float, min_stake: float, max_stake: float, **kwargs):
|
||||
|
||||
if current_profit < -0.0075:
|
||||
orders = trade.select_filled_orders('buy')
|
||||
return round(orders[0].cost, 0)
|
||||
|
||||
return None
|
||||
|
@@ -38,6 +38,9 @@ def test_returns_latest_signal(ohlcv_history):
|
||||
mocked_history['exit_long'] = 0
|
||||
mocked_history['enter_short'] = 0
|
||||
mocked_history['exit_short'] = 0
|
||||
# Set tags in lines that don't matter to test nan in the sell line
|
||||
mocked_history.loc[0, 'enter_tag'] = 'wrong_line'
|
||||
mocked_history.loc[0, 'exit_tag'] = 'wrong_line'
|
||||
mocked_history.loc[1, 'exit_long'] = 1
|
||||
|
||||
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
|
||||
|
Reference in New Issue
Block a user