test_get_liquidation_price/test_get_maintenance_ratio_and_amt_binance/fill_leverage_brackets/test_validate_trading_mode_and_collateral TODO comments

This commit is contained in:
Sam Germain
2022-01-14 06:58:32 -06:00
parent c2f9201512
commit 1f1ac8ce9d
4 changed files with 87 additions and 74 deletions

View File

@@ -708,10 +708,10 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker)
@pytest.mark.parametrize("is_short,trading_mode,exchange_name,margin_mode,liq_price", [
(False, 'spot', 'binance', '', None),
(True, 'spot', 'binance', '', None),
(False, 'spot', 'gateio', '', None),
(True, 'spot', 'gateio', '', None),
(False, 'spot', 'binance', None, None),
(True, 'spot', 'binance', None, None),
(False, 'spot', 'gateio', None, None),
(True, 'spot', 'gateio', None, None),
(True, 'futures', 'binance', 'isolated', 13.217821782178218),
(False, 'futures', 'binance', 'isolated', 6.717171717171718),
(True, 'futures', 'gateio', 'isolated', 13.198706526760379),
@@ -745,7 +745,8 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
order = limit_order[enter_side(is_short)]
default_conf_usdt['trading_mode'] = trading_mode
leverage = 1.0 if trading_mode == 'spot' else 5.0
default_conf_usdt['collateral'] = margin_mode
if margin_mode:
default_conf_usdt['collateral'] = margin_mode
patch_RPCManager(mocker)
patch_exchange(mocker)
freqtrade = FreqtradeBot(default_conf_usdt)
@@ -4832,16 +4833,16 @@ def test_update_funding_fees(
nominal_value = mark_price * size
funding_fee = nominal_value * funding_rate
size = 123
"LTC/BTC"
"LTC/USDT"
time: 0, mark: 3.3, fundRate: 0.00032583, nominal_value: 405.9, fundFee: 0.132254397
time: 8, mark: 3.2, fundRate: 0.00024472, nominal_value: 393.6, fundFee: 0.096321792
"ETH/BTC"
"ETH/USDT"
time: 0, mark: 2.4, fundRate: 0.0001, nominal_value: 295.2, fundFee: 0.02952
time: 8, mark: 2.5, fundRate: 0.0001, nominal_value: 307.5, fundFee: 0.03075
"ETC/BTC"
"ETC/USDT"
time: 0, mark: 4.3, fundRate: 0.00031077, nominal_value: 528.9, fundFee: 0.164366253
time: 8, mark: 4.1, fundRate: 0.00022655, nominal_value: 504.3, fundFee: 0.114249165
"XRP/BTC"
"XRP/USDT"
time: 0, mark: 1.2, fundRate: 0.00049426, nominal_value: 147.6, fundFee: 0.072952776
time: 8, mark: 1.2, fundRate: 0.00032715, nominal_value: 147.6, fundFee: 0.04828734
"""
@@ -4865,19 +4866,19 @@ def test_update_funding_fees(
# 16:00 entry is actually never used
# But should be kept in the test to ensure we're filtering correctly.
funding_rates = {
"LTC/BTC":
"LTC/USDT":
DataFrame([
[date_midnight, 0.00032583, 0, 0, 0, 0],
[date_eight, 0.00024472, 0, 0, 0, 0],
[date_sixteen, 0.00024472, 0, 0, 0, 0],
], columns=columns),
"ETH/BTC":
"ETH/USDT":
DataFrame([
[date_midnight, 0.0001, 0, 0, 0, 0],
[date_eight, 0.0001, 0, 0, 0, 0],
[date_sixteen, 0.0001, 0, 0, 0, 0],
], columns=columns),
"XRP/BTC":
"XRP/USDT":
DataFrame([
[date_midnight, 0.00049426, 0, 0, 0, 0],
[date_eight, 0.00032715, 0, 0, 0, 0],
@@ -4886,19 +4887,19 @@ def test_update_funding_fees(
}
mark_prices = {
"LTC/BTC":
"LTC/USDT":
DataFrame([
[date_midnight, 3.3, 0, 0, 0, 0],
[date_eight, 3.2, 0, 0, 0, 0],
[date_sixteen, 3.2, 0, 0, 0, 0],
], columns=columns),
"ETH/BTC":
"ETH/USDT":
DataFrame([
[date_midnight, 2.4, 0, 0, 0, 0],
[date_eight, 2.5, 0, 0, 0, 0],
[date_sixteen, 2.5, 0, 0, 0, 0],
], columns=columns),
"XRP/BTC":
"XRP/USDT":
DataFrame([
[date_midnight, 1.2, 0, 0, 0, 0],
[date_eight, 1.2, 0, 0, 0, 0],
@@ -4935,9 +4936,9 @@ def test_update_funding_fees(
freqtrade = get_patched_freqtradebot(mocker, default_conf)
# initial funding fees,
freqtrade.execute_entry('ETH/BTC', 123, is_short=is_short)
freqtrade.execute_entry('LTC/BTC', 2.0, is_short=is_short)
freqtrade.execute_entry('XRP/BTC', 123, is_short=is_short)
freqtrade.execute_entry('ETH/USDT', 123, is_short=is_short)
freqtrade.execute_entry('LTC/USDT', 2.0, is_short=is_short)
freqtrade.execute_entry('XRP/USDT', 123, is_short=is_short)
multipl = 1 if is_short else -1
trades = Trade.get_open_trades()
assert len(trades) == 3