Added trading mode and collateral to constants.py
This commit is contained in:
parent
faaa3ae9b1
commit
57d7009fd9
@ -39,6 +39,8 @@ DEFAULT_DATAFRAME_COLUMNS = ['date', 'open', 'high', 'low', 'close', 'volume']
|
|||||||
# Don't modify sequence of DEFAULT_TRADES_COLUMNS
|
# Don't modify sequence of DEFAULT_TRADES_COLUMNS
|
||||||
# it has wide consequences for stored trades files
|
# it has wide consequences for stored trades files
|
||||||
DEFAULT_TRADES_COLUMNS = ['timestamp', 'id', 'type', 'side', 'price', 'amount', 'cost']
|
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'
|
LAST_BT_RESULT_FN = '.last_result.json'
|
||||||
FTHYPT_FILEVERSION = 'fthypt_fileversion'
|
FTHYPT_FILEVERSION = 'fthypt_fileversion'
|
||||||
@ -146,6 +148,8 @@ CONF_SCHEMA = {
|
|||||||
'sell_profit_offset': {'type': 'number'},
|
'sell_profit_offset': {'type': 'number'},
|
||||||
'ignore_roi_if_buy_signal': {'type': 'boolean'},
|
'ignore_roi_if_buy_signal': {'type': 'boolean'},
|
||||||
'ignore_buying_expired_candle_after': {'type': 'number'},
|
'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'},
|
'bot_name': {'type': 'string'},
|
||||||
'unfilledtimeout': {
|
'unfilledtimeout': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
@ -193,7 +197,7 @@ CONF_SCHEMA = {
|
|||||||
'required': ['price_side']
|
'required': ['price_side']
|
||||||
},
|
},
|
||||||
'custom_price_max_distance_ratio': {
|
'custom_price_max_distance_ratio': {
|
||||||
'type': 'number', 'minimum': 0.0
|
'type': 'number', 'minimum': 0.0
|
||||||
},
|
},
|
||||||
'order_types': {
|
'order_types': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
@ -11,7 +11,7 @@ import arrow
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT
|
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,
|
from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError,
|
||||||
InvalidOrderException, OperationalException, PricingError,
|
InvalidOrderException, OperationalException, PricingError,
|
||||||
TemporaryError)
|
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", [
|
@ pytest.mark.parametrize("is_short,val1,val2", [
|
||||||
(False, 1.5, 1.1),
|
(False, 1.5, 1.1),
|
||||||
(True, 0.5, 0.9)
|
(True, 0.5, 0.9)
|
||||||
])
|
])
|
||||||
def test_trailing_stop_loss(default_conf_usdt, limit_order_open,
|
def test_trailing_stop_loss(default_conf_usdt, limit_order_open,
|
||||||
is_short, val1, val2, fee, caplog, mocker) -> None:
|
is_short, val1, val2, fee, caplog, mocker) -> None:
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
@ -4668,19 +4668,19 @@ def test_leverage_prep():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('trading_mode,calls,t1,t2', [
|
@pytest.mark.parametrize('trading_mode,calls,t1,t2', [
|
||||||
(TradingMode.SPOT, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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"),
|
('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,
|
def test_update_funding_fees(mocker, default_conf, trading_mode, calls, time_machine,
|
||||||
t1, t2):
|
t1, t2):
|
||||||
|
Loading…
Reference in New Issue
Block a user