Added trading mode and collateral to constants.py

This commit is contained in:
Sam Germain 2021-10-18 01:15:44 -06:00
parent faaa3ae9b1
commit 57d7009fd9
2 changed files with 20 additions and 16 deletions

View File

@ -39,6 +39,8 @@ DEFAULT_DATAFRAME_COLUMNS = ['date', 'open', 'high', 'low', 'close', 'volume']
# Don't modify sequence of DEFAULT_TRADES_COLUMNS
# it has wide consequences for stored trades files
DEFAULT_TRADES_COLUMNS = ['timestamp', 'id', 'type', 'side', 'price', 'amount', 'cost']
TRADING_MODES = ['spot', 'margin', 'futures']
COLLATERAL_TYPES = ['cross', 'isolated']
LAST_BT_RESULT_FN = '.last_result.json'
FTHYPT_FILEVERSION = 'fthypt_fileversion'
@ -146,6 +148,8 @@ CONF_SCHEMA = {
'sell_profit_offset': {'type': 'number'},
'ignore_roi_if_buy_signal': {'type': 'boolean'},
'ignore_buying_expired_candle_after': {'type': 'number'},
'trading_mode': {'type': 'string', 'enum': TRADING_MODES},
'collateral_type': {'type': 'string', 'enum': COLLATERAL_TYPES},
'bot_name': {'type': 'string'},
'unfilledtimeout': {
'type': 'object',
@ -193,7 +197,7 @@ CONF_SCHEMA = {
'required': ['price_side']
},
'custom_price_max_distance_ratio': {
'type': 'number', 'minimum': 0.0
'type': 'number', 'minimum': 0.0
},
'order_types': {
'type': 'object',

View File

@ -11,7 +11,7 @@ import arrow
import pytest
from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT
from freqtrade.enums import RPCMessageType, RunMode, SellType, SignalDirection, State, TradingMode
from freqtrade.enums import RPCMessageType, RunMode, SellType, SignalDirection, State
from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError,
InvalidOrderException, OperationalException, PricingError,
TemporaryError)
@ -3564,7 +3564,7 @@ def test_ignore_roi_if_buy_signal(default_conf_usdt, limit_order, limit_order_op
@ pytest.mark.parametrize("is_short,val1,val2", [
(False, 1.5, 1.1),
(True, 0.5, 0.9)
])
])
def test_trailing_stop_loss(default_conf_usdt, limit_order_open,
is_short, val1, val2, fee, caplog, mocker) -> None:
patch_RPCManager(mocker)
@ -4668,19 +4668,19 @@ def test_leverage_prep():
@pytest.mark.parametrize('trading_mode,calls,t1,t2', [
(TradingMode.SPOT, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
(TradingMode.MARGIN, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
(TradingMode.FUTURES, 31, "2021-09-01 00:00:02", "2021-09-01 08:00:01"),
(TradingMode.FUTURES, 32, "2021-09-01 00:00:00", "2021-09-01 08:00:01"),
(TradingMode.FUTURES, 32, "2021-09-01 00:00:02", "2021-09-01 08:00:02"),
(TradingMode.FUTURES, 33, "2021-09-01 00:00:00", "2021-09-01 08:00:02"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:02"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:03"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:04"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:05"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:06"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:07"),
(TradingMode.FUTURES, 33, "2021-08-31 23:59:58", "2021-09-01 08:00:07"),
('spot', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
('margin', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
('futures', 31, "2021-09-01 00:00:02", "2021-09-01 08:00:01"),
('futures', 32, "2021-09-01 00:00:00", "2021-09-01 08:00:01"),
('futures', 32, "2021-09-01 00:00:02", "2021-09-01 08:00:02"),
('futures', 33, "2021-09-01 00:00:00", "2021-09-01 08:00:02"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:02"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:03"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:04"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:05"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:06"),
('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:07"),
('futures', 33, "2021-08-31 23:59:58", "2021-09-01 08:00:07"),
])
def test_update_funding_fees(mocker, default_conf, trading_mode, calls, time_machine,
t1, t2):