backtesting confirm_trade_entry should pass correct amount, not stake-amount
closes #7423
This commit is contained in:
parent
8a236c3c4f
commit
e5368f5a14
@ -812,14 +812,6 @@ class Backtesting:
|
|||||||
return trade
|
return trade
|
||||||
time_in_force = self.strategy.order_time_in_force['entry']
|
time_in_force = self.strategy.order_time_in_force['entry']
|
||||||
|
|
||||||
if not pos_adjust:
|
|
||||||
# Confirm trade entry:
|
|
||||||
if not strategy_safe_wrapper(self.strategy.confirm_trade_entry, default_retval=True)(
|
|
||||||
pair=pair, order_type=order_type, amount=stake_amount, rate=propose_rate,
|
|
||||||
time_in_force=time_in_force, current_time=current_time,
|
|
||||||
entry_tag=entry_tag, side=direction):
|
|
||||||
return trade
|
|
||||||
|
|
||||||
if stake_amount and (not min_stake_amount or stake_amount > min_stake_amount):
|
if stake_amount and (not min_stake_amount or stake_amount > min_stake_amount):
|
||||||
self.order_id_counter += 1
|
self.order_id_counter += 1
|
||||||
base_currency = self.exchange.get_pair_base_currency(pair)
|
base_currency = self.exchange.get_pair_base_currency(pair)
|
||||||
@ -834,6 +826,15 @@ class Backtesting:
|
|||||||
# Backcalculate actual stake amount.
|
# Backcalculate actual stake amount.
|
||||||
stake_amount = amount * propose_rate / leverage
|
stake_amount = amount * propose_rate / leverage
|
||||||
|
|
||||||
|
if not pos_adjust:
|
||||||
|
# Confirm trade entry:
|
||||||
|
if not strategy_safe_wrapper(
|
||||||
|
self.strategy.confirm_trade_entry, default_retval=True)(
|
||||||
|
pair=pair, order_type=order_type, amount=amount, rate=propose_rate,
|
||||||
|
time_in_force=time_in_force, current_time=current_time,
|
||||||
|
entry_tag=entry_tag, side=direction):
|
||||||
|
return trade
|
||||||
|
|
||||||
is_short = (direction == 'short')
|
is_short = (direction == 'short')
|
||||||
# Necessary for Margin trading. Disabled until support is enabled.
|
# Necessary for Margin trading. Disabled until support is enabled.
|
||||||
# interest_rate = self.exchange.get_interest_rate()
|
# interest_rate = self.exchange.get_interest_rate()
|
||||||
|
Loading…
Reference in New Issue
Block a user