Add leverage to dry-run liquidation price calculation
This commit is contained in:
parent
a7b030fff9
commit
34e7433844
@ -150,6 +150,7 @@ class Binance(Exchange):
|
|||||||
is_short: bool,
|
is_short: bool,
|
||||||
amount: float,
|
amount: float,
|
||||||
stake_amount: float,
|
stake_amount: float,
|
||||||
|
leverage: float,
|
||||||
wallet_balance: float, # Or margin balance
|
wallet_balance: float, # Or margin balance
|
||||||
mm_ex_1: float = 0.0, # (Binance) Cross only
|
mm_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
@ -159,11 +160,12 @@ class Binance(Exchange):
|
|||||||
MARGIN: https://www.binance.com/en/support/faq/f6b010588e55413aa58b7d63ee0125ed
|
MARGIN: https://www.binance.com/en/support/faq/f6b010588e55413aa58b7d63ee0125ed
|
||||||
PERPETUAL: https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93
|
PERPETUAL: https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93
|
||||||
|
|
||||||
:param exchange_name:
|
:param pair: Pair to calculate liquidation price for
|
||||||
:param open_rate: Entry price of position
|
:param open_rate: Entry price of position
|
||||||
:param is_short: True if the trade is a short, false otherwise
|
:param is_short: True if the trade is a short, false otherwise
|
||||||
:param amount: Absolute value of position size incl. leverage (in base currency)
|
:param amount: Absolute value of position size incl. leverage (in base currency)
|
||||||
:param stake_amount: Stake amount - Collateral in settle currency.
|
:param stake_amount: Stake amount - Collateral in settle currency.
|
||||||
|
:param leverage: Leverage used for this position.
|
||||||
:param trading_mode: SPOT, MARGIN, FUTURES, etc.
|
:param trading_mode: SPOT, MARGIN, FUTURES, etc.
|
||||||
:param margin_mode: Either ISOLATED or CROSS
|
:param margin_mode: Either ISOLATED or CROSS
|
||||||
:param wallet_balance: Amount of margin_mode in the wallet being used to trade
|
:param wallet_balance: Amount of margin_mode in the wallet being used to trade
|
||||||
|
@ -2687,6 +2687,7 @@ class Exchange:
|
|||||||
is_short: bool,
|
is_short: bool,
|
||||||
amount: float, # Absolute value of position size
|
amount: float, # Absolute value of position size
|
||||||
stake_amount: float,
|
stake_amount: float,
|
||||||
|
leverage: float,
|
||||||
wallet_balance: float,
|
wallet_balance: float,
|
||||||
mm_ex_1: float = 0.0, # (Binance) Cross only
|
mm_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
@ -2708,6 +2709,7 @@ class Exchange:
|
|||||||
open_rate=open_rate,
|
open_rate=open_rate,
|
||||||
is_short=is_short,
|
is_short=is_short,
|
||||||
amount=amount,
|
amount=amount,
|
||||||
|
leverage=leverage,
|
||||||
stake_amount=stake_amount,
|
stake_amount=stake_amount,
|
||||||
wallet_balance=wallet_balance,
|
wallet_balance=wallet_balance,
|
||||||
mm_ex_1=mm_ex_1,
|
mm_ex_1=mm_ex_1,
|
||||||
@ -2737,6 +2739,7 @@ class Exchange:
|
|||||||
is_short: bool,
|
is_short: bool,
|
||||||
amount: float,
|
amount: float,
|
||||||
stake_amount: float,
|
stake_amount: float,
|
||||||
|
leverage: float,
|
||||||
wallet_balance: float, # Or margin balance
|
wallet_balance: float, # Or margin balance
|
||||||
mm_ex_1: float = 0.0, # (Binance) Cross only
|
mm_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
@ -2758,6 +2761,7 @@ class Exchange:
|
|||||||
:param is_short: True if the trade is a short, false otherwise
|
:param is_short: True if the trade is a short, false otherwise
|
||||||
:param amount: Absolute value of position size incl. leverage (in base currency)
|
:param amount: Absolute value of position size incl. leverage (in base currency)
|
||||||
:param stake_amount: Stake amount - Collateral in settle currency.
|
:param stake_amount: Stake amount - Collateral in settle currency.
|
||||||
|
:param leverage: Leverage used for this position.
|
||||||
:param trading_mode: SPOT, MARGIN, FUTURES, etc.
|
:param trading_mode: SPOT, MARGIN, FUTURES, etc.
|
||||||
:param margin_mode: Either ISOLATED or CROSS
|
:param margin_mode: Either ISOLATED or CROSS
|
||||||
:param wallet_balance: Amount of margin_mode in the wallet being used to trade
|
:param wallet_balance: Amount of margin_mode in the wallet being used to trade
|
||||||
|
@ -1789,6 +1789,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
is_short=trade.is_short,
|
is_short=trade.is_short,
|
||||||
amount=trade.amount,
|
amount=trade.amount,
|
||||||
stake_amount=trade.stake_amount,
|
stake_amount=trade.stake_amount,
|
||||||
|
leverage=trade.leverage,
|
||||||
wallet_balance=trade.stake_amount,
|
wallet_balance=trade.stake_amount,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -863,6 +863,7 @@ class Backtesting:
|
|||||||
open_rate=propose_rate,
|
open_rate=propose_rate,
|
||||||
amount=amount,
|
amount=amount,
|
||||||
stake_amount=trade.stake_amount,
|
stake_amount=trade.stake_amount,
|
||||||
|
leverage=trade.leverage,
|
||||||
wallet_balance=trade.stake_amount,
|
wallet_balance=trade.stake_amount,
|
||||||
is_short=is_short,
|
is_short=is_short,
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user