From b8a527e4a08ad0f5e0c7bfd52e0ec49113644883 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 5 Feb 2023 10:46:24 +0100 Subject: [PATCH] Add gateio price type field --- freqtrade/exchange/gateio.py | 8 +++++++- tests/exchange/test_exchange.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/freqtrade/exchange/gateio.py b/freqtrade/exchange/gateio.py index de178af02..cc7e47cca 100644 --- a/freqtrade/exchange/gateio.py +++ b/freqtrade/exchange/gateio.py @@ -4,7 +4,7 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Tuple from freqtrade.constants import BuySell -from freqtrade.enums import MarginMode, TradingMode +from freqtrade.enums import MarginMode, PriceType, TradingMode from freqtrade.exceptions import OperationalException from freqtrade.exchange import Exchange from freqtrade.misc import safe_value_fallback2 @@ -34,6 +34,12 @@ class Gateio(Exchange): "needs_trading_fees": True, "fee_cost_in_contracts": False, # Set explicitly to false for clarity "order_props_in_contracts": ['amount', 'filled', 'remaining'], + "stop_price_type_field": "price_type", + "stop_price_type_value_mapping": { + PriceType.LAST: 0, + PriceType.MARK: 1, + PriceType.INDEX: 2, + }, } _supported_trading_mode_margin_pairs: List[Tuple[TradingMode, MarginMode]] = [ diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 6b28b33b6..dfa807b95 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -1070,6 +1070,9 @@ def test_validate_ordertypes(default_conf, mocker): # ('okx', 'last', True), # ('okx', 'mark', True), # ('okx', 'index', True), + ('gate', 'last', True), + ('gate', 'mark', True), + ('gate', 'index', True), ]) def test_validate_ordertypes_stop_advanced(default_conf, mocker, exchange_name, stopadv, expected):