Miscellaneous funding fee changes. Abandoning for a new method of tracking funding fee

This commit is contained in:
Sam Germain
2021-08-25 12:59:25 -06:00
parent b7891485b3
commit 194bb24a55
4 changed files with 71 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
""" Binance exchange subclass """
import logging
from typing import Dict
from typing import Dict, Optional
import ccxt
@@ -89,3 +89,17 @@ class Binance(Exchange):
f'Could not place sell order due to {e.__class__.__name__}. Message: {e}') from e
except ccxt.BaseError as e:
raise OperationalException(e) from e
# https://www.binance.com/en/support/faq/360033525031
def get_funding_fee(
self,
contract_size: float,
mark_price: float,
rate: Optional[float],
# index_price: float,
# interest_rate: float
):
assert isinstance(rate, float)
nominal_value = mark_price * contract_size
adjustment = nominal_value * rate
return adjustment