gateio, ftx and binance all use same funding fee formula

This commit is contained in:
Sam Germain
2021-10-09 12:49:00 -06:00
parent badc0fa445
commit ef8b617eb2
6 changed files with 14 additions and 90 deletions

View File

@@ -1649,17 +1649,19 @@ class Exchange:
self,
pair: str,
contract_size: float,
funding_rate: float,
mark_price: float,
funding_rate: Optional[float]
) -> float:
"""
Calculates a single funding fee
:param contract_size: The amount/quanity
:param mark_price: The price of the asset that the contract is based off of
:param funding_rate: the interest rate and the premium
- interest rate:
- premium: varies by price difference between the perpetual contract and mark price
"""
raise OperationalException(f"Funding fee has not been implemented for {self.name}")
nominal_value = mark_price * contract_size
return nominal_value * funding_rate
@retrier
def _set_leverage(