Update merge to "left" to avoid creating non-existing mark candles

This commit is contained in:
Matthias
2024-02-29 07:31:22 +01:00
parent e988995d71
commit cdfeae9f90
2 changed files with 9 additions and 3 deletions

View File

@@ -4314,8 +4314,8 @@ def test_combine_funding_and_mark(
assert len(df) == 1
# Empty funding rates
funding_rates = DataFrame([], columns=['date', 'open'])
df = exchange.combine_funding_and_mark(funding_rates, mark_rates, futures_funding_rate)
funding_rates2 = DataFrame([], columns=['date', 'open'])
df = exchange.combine_funding_and_mark(funding_rates2, mark_rates, futures_funding_rate)
if futures_funding_rate is not None:
assert len(df) == 3
assert df.iloc[0]['open_fund'] == futures_funding_rate
@@ -4324,6 +4324,12 @@ def test_combine_funding_and_mark(
else:
assert len(df) == 0
# Empty mark candles
mark_candles = DataFrame([], columns=['date', 'open'])
df = exchange.combine_funding_and_mark(funding_rates, mark_candles, futures_funding_rate)
assert len(df) == 0
@pytest.mark.parametrize('exchange,rate_start,rate_end,d1,d2,amount,expected_fees', [
('binance', 0, 2, "2021-09-01 01:00:00", "2021-09-01 04:00:00", 30.0, 0.0),