Merge branch 'enums' into feat/short

This commit is contained in:
Sam Germain 2021-08-06 19:30:31 -06:00
commit 9988c293b5
10 changed files with 50 additions and 0 deletions

View File

@ -1,8 +1,11 @@
# flake8: noqa: F401
from freqtrade.enums.backteststate import BacktestState
from freqtrade.enums.collateral import Collateral
from freqtrade.enums.exchangename import ExchangeName
from freqtrade.enums.interestmode import InterestMode
from freqtrade.enums.rpcmessagetype import RPCMessageType
from freqtrade.enums.runmode import NON_UTIL_MODES, OPTIMIZE_MODES, TRADING_MODES, RunMode
from freqtrade.enums.selltype import SellType
from freqtrade.enums.signaltype import SignalTagType, SignalType
from freqtrade.enums.state import State
from freqtrade.enums.tradingmode import TradingMode

View File

@ -0,0 +1,11 @@
from enum import Enum
class Collateral(Enum):
"""
Enum to distinguish between
cross margin/futures collateral and
isolated margin/futures collateral
"""
CROSS = "cross"
ISOLATED = "isolated"

View File

@ -0,0 +1,10 @@
from enum import Enum
class ExchangeName(Enum):
"""All the exchanges supported by freqtrade that support leverage"""
BINANCE = "Binance"
KRAKEN = "Kraken"
FTX = "FTX"
OTHER = None

View File

@ -7,6 +7,8 @@ class SignalType(Enum):
"""
BUY = "buy"
SELL = "sell"
SHORT = "short"
EXIT_SHORT = "exit_short"
class SignalTagType(Enum):

View File

@ -0,0 +1,11 @@
from enum import Enum
class TradingMode(Enum):
"""
Enum to distinguish between
spot, margin, futures or any other trading method
"""
SPOT = "spot"
MARGIN = "margin"
FUTURES = "futures"

View File

@ -4,6 +4,7 @@ from typing import Dict
import ccxt
from freqtrade.enums import ExchangeName
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
OperationalException, TemporaryError)
from freqtrade.exchange import Exchange
@ -15,6 +16,8 @@ logger = logging.getLogger(__name__)
class Binance(Exchange):
exchange_name: ExchangeName = ExchangeName.BINANCE
_ft_has: Dict = {
"stoploss_on_exchange": True,
"order_time_in_force": ['gtc', 'fok', 'ioc'],

View File

@ -21,6 +21,7 @@ from pandas import DataFrame
from freqtrade.constants import DEFAULT_AMOUNT_RESERVE_PERCENT, ListPairsWithTimeframes
from freqtrade.data.converter import ohlcv_to_dataframe, trades_dict_to_list
from freqtrade.enums import ExchangeName
from freqtrade.exceptions import (DDosProtection, ExchangeError, InsufficientFundsError,
InvalidOrderException, OperationalException, PricingError,
RetryableOrderError, TemporaryError)
@ -69,6 +70,8 @@ class Exchange:
}
_ft_has: Dict = {}
exchange_name: ExchangeName = ExchangeName.BINANCE
def __init__(self, config: Dict[str, Any], validate: bool = True) -> None:
"""
Initializes this module with the given config,

View File

@ -4,6 +4,7 @@ from typing import Any, Dict
import ccxt
from freqtrade.enums import ExchangeName
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
OperationalException, TemporaryError)
from freqtrade.exchange import Exchange
@ -16,6 +17,8 @@ logger = logging.getLogger(__name__)
class Ftx(Exchange):
exchange_name: ExchangeName = ExchangeName.FTX
_ft_has: Dict = {
"stoploss_on_exchange": True,
"ohlcv_candle_limit": 1500,

View File

@ -4,6 +4,7 @@ from typing import Any, Dict
import ccxt
from freqtrade.enums import ExchangeName
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
OperationalException, TemporaryError)
from freqtrade.exchange import Exchange
@ -15,6 +16,8 @@ logger = logging.getLogger(__name__)
class Kraken(Exchange):
exchange_name: ExchangeName = ExchangeName.KRAKEN
_params: Dict = {"trading_agreement": "agree"}
_ft_has: Dict = {
"stoploss_on_exchange": True,

View File

@ -0,0 +1 @@
# flake8: noqa: F401