temp commit message
This commit is contained in:
parent
232d10f300
commit
8e83cb4d64
@ -92,7 +92,7 @@ class Binance(Exchange):
|
|||||||
except ccxt.BaseError as e:
|
except ccxt.BaseError as e:
|
||||||
raise OperationalException(e) from e
|
raise OperationalException(e) from e
|
||||||
|
|
||||||
def _get_funding_rate(self, pair: str, when: datetime) -> Optional[float]:
|
def _calculate_funding_rate(self, pair: str, premium_index: float) -> Optional[float]:
|
||||||
"""
|
"""
|
||||||
Get's the funding_rate for a pair at a specific date and time in the past
|
Get's the funding_rate for a pair at a specific date and time in the past
|
||||||
"""
|
"""
|
||||||
@ -101,9 +101,10 @@ class Binance(Exchange):
|
|||||||
|
|
||||||
def _get_funding_fee(
|
def _get_funding_fee(
|
||||||
self,
|
self,
|
||||||
|
pair: str,
|
||||||
contract_size: float,
|
contract_size: float,
|
||||||
mark_price: float,
|
mark_price: float,
|
||||||
funding_rate: Optional[float],
|
premium_index: Optional[float],
|
||||||
) -> float:
|
) -> float:
|
||||||
"""
|
"""
|
||||||
Calculates a single funding fee
|
Calculates a single funding fee
|
||||||
@ -113,8 +114,8 @@ class Binance(Exchange):
|
|||||||
- interest rate: 0.03% daily, BNBUSDT, LINKUSDT, and LTCUSDT are 0%
|
- interest rate: 0.03% daily, BNBUSDT, LINKUSDT, and LTCUSDT are 0%
|
||||||
- premium: varies by price difference between the perpetual contract and mark price
|
- premium: varies by price difference between the perpetual contract and mark price
|
||||||
"""
|
"""
|
||||||
if funding_rate is None:
|
if premium_index is None:
|
||||||
raise OperationalException("Funding rate cannot be None for Binance._get_funding_fee")
|
raise OperationalException("Funding rate cannot be None for Binance._get_funding_fee")
|
||||||
nominal_value = mark_price * contract_size
|
nominal_value = mark_price * contract_size
|
||||||
adjustment = nominal_value * funding_rate
|
adjustment = nominal_value * _calculate_funding_rate(pair, premium_index)
|
||||||
return adjustment
|
return adjustment
|
||||||
|
@ -1555,14 +1555,6 @@ class Exchange:
|
|||||||
except ccxt.BaseError as e:
|
except ccxt.BaseError as e:
|
||||||
raise OperationalException(e) from e
|
raise OperationalException(e) from e
|
||||||
|
|
||||||
def _get_mark_price(self, pair: str, when: datetime):
|
|
||||||
"""
|
|
||||||
Get's the value of the underlying asset for a futures contract
|
|
||||||
at a specific date and time in the past
|
|
||||||
"""
|
|
||||||
# TODO-lev: implement
|
|
||||||
raise OperationalException(f"get_mark_price has not been implemented for {self.name}")
|
|
||||||
|
|
||||||
def _get_funding_rate(self, pair: str, when: datetime):
|
def _get_funding_rate(self, pair: str, when: datetime):
|
||||||
"""
|
"""
|
||||||
Get's the funding_rate for a pair at a specific date and time in the past
|
Get's the funding_rate for a pair at a specific date and time in the past
|
||||||
|
Loading…
Reference in New Issue
Block a user