Wrote dummy tests for exchange.get_interest_rate
This commit is contained in:
parent
607e403eb2
commit
8264cc546d
@ -1554,9 +1554,9 @@ class Exchange:
|
|||||||
self._async_get_trade_history(pair=pair, since=since,
|
self._async_get_trade_history(pair=pair, since=since,
|
||||||
until=until, from_id=from_id))
|
until=until, from_id=from_id))
|
||||||
|
|
||||||
def get_interest_rate(self, pair: str, open_rate: float, is_short: bool) -> float:
|
def get_interest_rate(self, pair: str, maker_or_taker: str, is_short: bool) -> float:
|
||||||
# TODO-lev: implement
|
# TODO-lev: implement
|
||||||
return 0.0005
|
return (0.0005, 0.0005)
|
||||||
|
|
||||||
def fill_leverage_brackets(self):
|
def fill_leverage_brackets(self):
|
||||||
"""
|
"""
|
||||||
|
@ -2998,9 +2998,37 @@ def test_fill_leverage_brackets():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def test_get_interest_rate():
|
# TODO-lev: These tests don't test anything real, they need to be replaced with real values once
|
||||||
# TODO-lev
|
# get_interest_rates is written
|
||||||
return
|
@pytest.mark.parametrize('exchange_name,pair,maker_or_taker,is_short,borrow_rate,interest_rate', [
|
||||||
|
('binance', "ADA/USDT", "maker", True, 0.0005, 0.0005),
|
||||||
|
('binance', "ADA/USDT", "maker", False, 0.0005, 0.0005),
|
||||||
|
('binance', "ADA/USDT", "taker", True, 0.0005, 0.0005),
|
||||||
|
('binance', "ADA/USDT", "taker", False, 0.0005, 0.0005),
|
||||||
|
# Kraken
|
||||||
|
('kraken', "ADA/USDT", "maker", True, 0.0005, 0.0005),
|
||||||
|
('kraken', "ADA/USDT", "maker", False, 0.0005, 0.0005),
|
||||||
|
('kraken', "ADA/USDT", "taker", True, 0.0005, 0.0005),
|
||||||
|
('kraken', "ADA/USDT", "taker", False, 0.0005, 0.0005),
|
||||||
|
# FTX
|
||||||
|
('ftx', "ADA/USDT", "maker", True, 0.0005, 0.0005),
|
||||||
|
('ftx', "ADA/USDT", "maker", False, 0.0005, 0.0005),
|
||||||
|
('ftx', "ADA/USDT", "taker", True, 0.0005, 0.0005),
|
||||||
|
('ftx', "ADA/USDT", "taker", False, 0.0005, 0.0005),
|
||||||
|
])
|
||||||
|
def test_get_interest_rate(
|
||||||
|
default_conf,
|
||||||
|
mocker,
|
||||||
|
exchange_name,
|
||||||
|
pair,
|
||||||
|
maker_or_taker,
|
||||||
|
is_short,
|
||||||
|
borrow_rate,
|
||||||
|
interest_rate
|
||||||
|
):
|
||||||
|
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
||||||
|
assert exchange.get_interest_rate(
|
||||||
|
pair, maker_or_taker, is_short) == (borrow_rate, interest_rate)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("collateral", [
|
@pytest.mark.parametrize("collateral", [
|
||||||
|
Loading…
Reference in New Issue
Block a user