Added funding fee calculation methods to exchange classes

This commit is contained in:
Sam Germain
2021-09-08 19:31:04 -06:00
parent cdefd15b28
commit 36b8c87fb6
3 changed files with 58 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
""" FTX exchange subclass """
import logging
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional
import ccxt
from datetime import time
@@ -153,3 +153,21 @@ class Ftx(Exchange):
if order['type'] == 'stop':
return safe_value_fallback2(order, order, 'id_stop', 'id')
return order['id']
def _get_funding_fee(
self,
contract_size: float,
mark_price: float,
funding_rate: Optional[float],
# index_price: float,
# interest_rate: float)
):
"""
Calculates a single funding fee
Always paid in USD on FTX # TODO: How do we account for this
:param contract_size: The amount/quanity
:param mark_price: The price of the asset that the contract is based off of
:param funding_rate: Must be None on ftx
"""
(contract_size * mark_price) / 24
return