Fix docstring indents
This commit is contained in:
parent
bfca9e7c09
commit
d5438ed0a8
@ -3,9 +3,9 @@ from enum import Enum
|
||||
|
||||
class Collateral(Enum):
|
||||
"""
|
||||
Enum to distinguish between
|
||||
cross margin/futures collateral and
|
||||
isolated margin/futures collateral
|
||||
Enum to distinguish between
|
||||
cross margin/futures collateral and
|
||||
isolated margin/futures collateral
|
||||
"""
|
||||
CROSS = "cross"
|
||||
ISOLATED = "isolated"
|
||||
|
@ -3,8 +3,8 @@ from enum import Enum
|
||||
|
||||
class TradingMode(Enum):
|
||||
"""
|
||||
Enum to distinguish between
|
||||
spot, margin, futures or any other trading method
|
||||
Enum to distinguish between
|
||||
spot, margin, futures or any other trading method
|
||||
"""
|
||||
SPOT = "spot"
|
||||
MARGIN = "margin"
|
||||
|
@ -139,8 +139,8 @@ class Binance(Exchange):
|
||||
@retrier
|
||||
def fill_leverage_brackets(self):
|
||||
"""
|
||||
Assigns property _leverage_brackets to a dictionary of information about the leverage
|
||||
allowed on each pair
|
||||
Assigns property _leverage_brackets to a dictionary of information about the leverage
|
||||
allowed on each pair
|
||||
"""
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
try:
|
||||
@ -174,9 +174,9 @@ class Binance(Exchange):
|
||||
|
||||
def get_max_leverage(self, pair: Optional[str], nominal_value: Optional[float]) -> float:
|
||||
"""
|
||||
Returns the maximum leverage that a pair can be traded at
|
||||
:param pair: The base/quote currency pair being traded
|
||||
:nominal_value: The total value of the trade in quote currency (collateral + debt)
|
||||
Returns the maximum leverage that a pair can be traded at
|
||||
:param pair: The base/quote currency pair being traded
|
||||
:nominal_value: The total value of the trade in quote currency (collateral + debt)
|
||||
"""
|
||||
pair_brackets = self._leverage_brackets[pair]
|
||||
max_lev = 1.0
|
||||
@ -193,8 +193,8 @@ class Binance(Exchange):
|
||||
trading_mode: Optional[TradingMode] = None
|
||||
):
|
||||
"""
|
||||
Set's the leverage before making a trade, in order to not
|
||||
have the same leverage on every trade
|
||||
Set's the leverage before making a trade, in order to not
|
||||
have the same leverage on every trade
|
||||
"""
|
||||
trading_mode = trading_mode or self.trading_mode
|
||||
|
||||
|
@ -515,10 +515,10 @@ class Exchange:
|
||||
collateral: Optional[Collateral] # Only None when trading_mode = TradingMode.SPOT
|
||||
):
|
||||
"""
|
||||
Checks if freqtrade can perform trades using the configured
|
||||
trading mode(Margin, Futures) and Collateral(Cross, Isolated)
|
||||
Throws OperationalException:
|
||||
If the trading_mode/collateral type are not supported by freqtrade on this exchange
|
||||
Checks if freqtrade can perform trades using the configured
|
||||
trading mode(Margin, Futures) and Collateral(Cross, Isolated)
|
||||
Throws OperationalException:
|
||||
If the trading_mode/collateral type are not supported by freqtrade on this exchange
|
||||
"""
|
||||
if trading_mode != TradingMode.SPOT and (
|
||||
(trading_mode, collateral) not in self._supported_trading_mode_collateral_pairs
|
||||
@ -1607,10 +1607,10 @@ class Exchange:
|
||||
@retrier
|
||||
def get_funding_fees_from_exchange(self, pair: str, since: Union[datetime, int]) -> float:
|
||||
"""
|
||||
Returns the sum of all funding fees that were exchanged for a pair within a timeframe
|
||||
:param pair: (e.g. ADA/USDT)
|
||||
:param since: The earliest time of consideration for calculating funding fees,
|
||||
in unix time or as a datetime
|
||||
Returns the sum of all funding fees that were exchanged for a pair within a timeframe
|
||||
:param pair: (e.g. ADA/USDT)
|
||||
:param since: The earliest time of consideration for calculating funding fees,
|
||||
in unix time or as a datetime
|
||||
"""
|
||||
# TODO-lev: Add dry-run handling for this.
|
||||
|
||||
@ -1637,17 +1637,17 @@ class Exchange:
|
||||
|
||||
def fill_leverage_brackets(self):
|
||||
"""
|
||||
Assigns property _leverage_brackets to a dictionary of information about the leverage
|
||||
allowed on each pair
|
||||
Not used if the exchange has a static max leverage value for the account or each pair
|
||||
Assigns property _leverage_brackets to a dictionary of information about the leverage
|
||||
allowed on each pair
|
||||
Not used if the exchange has a static max leverage value for the account or each pair
|
||||
"""
|
||||
return
|
||||
|
||||
def get_max_leverage(self, pair: Optional[str], nominal_value: Optional[float]) -> float:
|
||||
"""
|
||||
Returns the maximum leverage that a pair can be traded at
|
||||
:param pair: The base/quote currency pair being traded
|
||||
:nominal_value: The total value of the trade in quote currency (collateral + debt)
|
||||
Returns the maximum leverage that a pair can be traded at
|
||||
:param pair: The base/quote currency pair being traded
|
||||
:param nominal_value: The total value of the trade in quote currency (collateral + debt)
|
||||
"""
|
||||
market = self.markets[pair]
|
||||
if (
|
||||
@ -1667,8 +1667,8 @@ class Exchange:
|
||||
trading_mode: Optional[TradingMode] = None
|
||||
):
|
||||
"""
|
||||
Set's the leverage before making a trade, in order to not
|
||||
have the same leverage on every trade
|
||||
Set's the leverage before making a trade, in order to not
|
||||
have the same leverage on every trade
|
||||
"""
|
||||
if self._config['dry_run'] or not self.exchange_has("setLeverage"):
|
||||
# Some exchanges only support one collateral type
|
||||
@ -1686,10 +1686,10 @@ class Exchange:
|
||||
|
||||
@retrier
|
||||
def set_margin_mode(self, pair: str, collateral: Collateral, params: dict = {}):
|
||||
'''
|
||||
Set's the margin mode on the exchange to cross or isolated for a specific pair
|
||||
:param symbol: base/quote currency pair (e.g. "ADA/USDT")
|
||||
'''
|
||||
"""
|
||||
Set's the margin mode on the exchange to cross or isolated for a specific pair
|
||||
:param symbol: base/quote currency pair (e.g. "ADA/USDT")
|
||||
"""
|
||||
if self._config['dry_run'] or not self.exchange_has("setMarginMode"):
|
||||
# Some exchanges only support one collateral type
|
||||
return
|
||||
|
@ -146,8 +146,8 @@ class Kraken(Exchange):
|
||||
trading_mode: Optional[TradingMode] = None
|
||||
):
|
||||
"""
|
||||
Kraken set's the leverage as an option in the order object, so we need to
|
||||
add it to params
|
||||
Kraken set's the leverage as an option in the order object, so we need to
|
||||
add it to params
|
||||
"""
|
||||
return
|
||||
|
||||
|
@ -16,18 +16,18 @@ def interest(
|
||||
hours: Decimal
|
||||
) -> Decimal:
|
||||
"""
|
||||
Equation to calculate interest on margin trades
|
||||
Equation to calculate interest on margin trades
|
||||
|
||||
:param exchange_name: The exchanged being trading on
|
||||
:param borrowed: The amount of currency being borrowed
|
||||
:param rate: The rate of interest (i.e daily interest rate)
|
||||
:param hours: The time in hours that the currency has been borrowed for
|
||||
:param exchange_name: The exchanged being trading on
|
||||
:param borrowed: The amount of currency being borrowed
|
||||
:param rate: The rate of interest (i.e daily interest rate)
|
||||
:param hours: The time in hours that the currency has been borrowed for
|
||||
|
||||
Raises:
|
||||
OperationalException: Raised if freqtrade does
|
||||
not support margin trading for this exchange
|
||||
Raises:
|
||||
OperationalException: Raised if freqtrade does
|
||||
not support margin trading for this exchange
|
||||
|
||||
Returns: The amount of interest owed (currency matches borrowed)
|
||||
Returns: The amount of interest owed (currency matches borrowed)
|
||||
"""
|
||||
exchange_name = exchange_name.lower()
|
||||
if exchange_name == "binance":
|
||||
|
@ -30,13 +30,13 @@ _SQL_DOCS_URL = 'http://docs.sqlalchemy.org/en/latest/core/engines.html#database
|
||||
|
||||
def init_db(db_url: str, clean_open_orders: bool = False) -> None:
|
||||
"""
|
||||
Initializes this module with the given config,
|
||||
registers all known command handlers
|
||||
and starts polling for message updates
|
||||
:param db_url: Database to use
|
||||
:param clean_open_orders: Remove open orders from the database.
|
||||
Useful for dry-run or if all orders have been reset on the exchange.
|
||||
:return: None
|
||||
Initializes this module with the given config,
|
||||
registers all known command handlers
|
||||
and starts polling for message updates
|
||||
:param db_url: Database to use
|
||||
:param clean_open_orders: Remove open orders from the database.
|
||||
Useful for dry-run or if all orders have been reset on the exchange.
|
||||
:return: None
|
||||
"""
|
||||
kwargs = {}
|
||||
|
||||
@ -329,8 +329,8 @@ class LocalTrade():
|
||||
|
||||
def _set_stop_loss(self, stop_loss: float, percent: float):
|
||||
"""
|
||||
Method you should use to set self.stop_loss.
|
||||
Assures stop_loss is not passed the liquidation price
|
||||
Method you should use to set self.stop_loss.
|
||||
Assures stop_loss is not passed the liquidation price
|
||||
"""
|
||||
if self.isolated_liq is not None:
|
||||
if self.is_short:
|
||||
@ -352,8 +352,8 @@ class LocalTrade():
|
||||
|
||||
def set_isolated_liq(self, isolated_liq: float):
|
||||
"""
|
||||
Method you should use to set self.liquidation price.
|
||||
Assures stop_loss is not passed the liquidation price
|
||||
Method you should use to set self.liquidation price.
|
||||
Assures stop_loss is not passed the liquidation price
|
||||
"""
|
||||
if self.stop_loss is not None:
|
||||
if self.is_short:
|
||||
|
Loading…
Reference in New Issue
Block a user