11"""Kraken exchange subclass"""
22
33import logging
4- from datetime import datetime
54from typing import Any
65
76import ccxt
8- from pandas import DataFrame
97
108from freqtrade .constants import BuySell
119from freqtrade .enums import MarginMode , TradingMode
@@ -40,7 +38,6 @@ class Kraken(Exchange):
4038 _supported_trading_mode_margin_pairs : list [tuple [TradingMode , MarginMode ]] = [
4139 (TradingMode .SPOT , MarginMode .NONE ),
4240 # (TradingMode.MARGIN, MarginMode.CROSS),
43- # (TradingMode.FUTURES, MarginMode.CROSS)
4441 ]
4542
4643 def market_is_tradable (self , market : dict [str , Any ]) -> bool :
@@ -114,18 +111,6 @@ def get_balances(self, params: dict | None = None) -> CcxtBalances:
114111 except ccxt .BaseError as e :
115112 raise OperationalException (e ) from e
116113
117- def _set_leverage (
118- self ,
119- leverage : float ,
120- pair : str | None = None ,
121- accept_fail : bool = False ,
122- ):
123- """
124- Kraken set's the leverage as an option in the order object, so we need to
125- add it to params
126- """
127- return
128-
129114 def _get_params (
130115 self ,
131116 side : BuySell ,
@@ -148,41 +133,6 @@ def _get_params(
148133 params ["postOnly" ] = True
149134 return params
150135
151- def calculate_funding_fees (
152- self ,
153- df : DataFrame ,
154- amount : float ,
155- is_short : bool ,
156- open_date : datetime ,
157- close_date : datetime ,
158- time_in_ratio : float | None = None ,
159- ) -> float :
160- """
161- # ! This method will always error when run by Freqtrade because time_in_ratio is never
162- # ! passed to _get_funding_fee. For kraken futures to work in dry run and backtesting
163- # ! functionality must be added that passes the parameter time_in_ratio to
164- # ! _get_funding_fee when using Kraken
165- calculates the sum of all funding fees that occurred for a pair during a futures trade
166- :param df: Dataframe containing combined funding and mark rates
167- as `open_fund` and `open_mark`.
168- :param amount: The quantity of the trade
169- :param is_short: trade direction
170- :param open_date: The date and time that the trade started
171- :param close_date: The date and time that the trade ended
172- :param time_in_ratio: Not used by most exchange classes
173- """
174- if not time_in_ratio :
175- raise OperationalException (
176- f"time_in_ratio is required for { self .name } ._get_funding_fee"
177- )
178- fees : float = 0
179-
180- if not df .empty :
181- df = df [(df ["date" ] >= open_date ) & (df ["date" ] <= close_date )]
182- fees = sum (df ["open_fund" ] * df ["open_mark" ] * amount * time_in_ratio )
183-
184- return fees if is_short else - fees
185-
186136 def _get_trade_pagination_next_value (self , trades : list [dict ]):
187137 """
188138 Extract pagination id for the next "from_id" value
0 commit comments