removed excess decimals in test_binance

This commit is contained in:
Sam Germain 2022-01-22 20:24:41 -06:00
parent 0c13e387fe
commit 5cf54bee4d

View File

@ -176,21 +176,21 @@ def test_get_max_leverage_binance(default_conf, mocker, pair, nominal_value, max
'BNB/BUSD': [[0.0, 0.025, 0.0], 'BNB/BUSD': [[0.0, 0.025, 0.0],
[100000.0, 0.05, 2500.0], [100000.0, 0.05, 2500.0],
[500000.0, 0.1, 27500.0], [500000.0, 0.1, 27500.0],
[1000000.0, 0.15, 77499.99999999999], [1000000.0, 0.15, 77500.0],
[2000000.0, 0.25, 277500.0], [2000000.0, 0.25, 277500.0],
[5000000.0, 0.5, 1527500.0]], [5000000.0, 0.5, 1527500.0]],
'BNB/USDT': [[0.0, 0.0065, 0.0], 'BNB/USDT': [[0.0, 0.0065, 0.0],
[10000.0, 0.01, 35.00000000000001], [10000.0, 0.01, 35.0],
[50000.0, 0.02, 535.0], [50000.0, 0.02, 535.0],
[250000.0, 0.05, 8035.000000000001], [250000.0, 0.05, 8035.0],
[1000000.0, 0.1, 58035.0], [1000000.0, 0.1, 58035.0],
[2000000.0, 0.125, 108034.99999999999], [2000000.0, 0.125, 108035.0],
[5000000.0, 0.15, 233034.99999999994], [5000000.0, 0.15, 233035.0],
[10000000.0, 0.25, 1233035.0]], [10000000.0, 0.25, 1233035.0]],
'BTC/USDT': [[0.0, 0.004, 0.0], 'BTC/USDT': [[0.0, 0.004, 0.0],
[50000.0, 0.005, 50.0], [50000.0, 0.005, 50.0],
[250000.0, 0.01, 1300.0], [250000.0, 0.01, 1300.0],
[1000000.0, 0.025, 16300.000000000002], [1000000.0, 0.025, 16300.0],
[5000000.0, 0.05, 141300.0], [5000000.0, 0.05, 141300.0],
[20000000.0, 0.1, 1141300.0], [20000000.0, 0.1, 1141300.0],
[50000000.0, 0.125, 2391300.0], [50000000.0, 0.125, 2391300.0],
@ -257,7 +257,7 @@ def test_fill_leverage_brackets_binance(default_conf, mocker):
[5000.0, 0.025, 75.0], [5000.0, 0.025, 75.0],
[25000.0, 0.05, 700.0], [25000.0, 0.05, 700.0],
[100000.0, 0.1, 5700.0], [100000.0, 0.1, 5700.0],
[250000.0, 0.125, 11949.999999999998], [250000.0, 0.125, 11949.999999999998],
[1000000.0, 0.5, 386950.0]] [1000000.0, 0.5, 386950.0]]
} }
@ -398,7 +398,7 @@ def test__ccxt_config(default_conf, mocker, trading_mode, collateral, config):
("BNB/USDT", 100.0, 0.0065, 0), ("BNB/USDT", 100.0, 0.0065, 0),
("BTC/USDT", 170.30, 0.004, 0), ("BTC/USDT", 170.30, 0.004, 0),
("BNB/BUSD", 999999.9, 0.1, 27500.0), ("BNB/BUSD", 999999.9, 0.1, 27500.0),
("BNB/USDT", 5000000.0, 0.15, 233034.99999999994), ("BNB/USDT", 5000000.0, 0.15, 233035.0),
("BTC/USDT", 300000000.1, 0.5, 99891300.0), ("BTC/USDT", 300000000.1, 0.5, 99891300.0),
]) ])
def test_get_maintenance_ratio_and_amt_binance( def test_get_maintenance_ratio_and_amt_binance(
@ -414,21 +414,21 @@ def test_get_maintenance_ratio_and_amt_binance(
'BNB/BUSD': [[0.0, 0.025, 0.0], 'BNB/BUSD': [[0.0, 0.025, 0.0],
[100000.0, 0.05, 2500.0], [100000.0, 0.05, 2500.0],
[500000.0, 0.1, 27500.0], [500000.0, 0.1, 27500.0],
[1000000.0, 0.15, 77499.99999999999], [1000000.0, 0.15, 77500.0],
[2000000.0, 0.25, 277500.0], [2000000.0, 0.25, 277500.0],
[5000000.0, 0.5, 1527500.0]], [5000000.0, 0.5, 1527500.0]],
'BNB/USDT': [[0.0, 0.0065, 0.0], 'BNB/USDT': [[0.0, 0.0065, 0.0],
[10000.0, 0.01, 35.00000000000001], [10000.0, 0.01, 35.0],
[50000.0, 0.02, 535.0], [50000.0, 0.02, 535.0],
[250000.0, 0.05, 8035.000000000001], [250000.0, 0.05, 8035.0],
[1000000.0, 0.1, 58035.0], [1000000.0, 0.1, 58035.0],
[2000000.0, 0.125, 108034.99999999999], [2000000.0, 0.125, 108035.0],
[5000000.0, 0.15, 233034.99999999994], [5000000.0, 0.15, 233035.0],
[10000000.0, 0.25, 1233035.0]], [10000000.0, 0.25, 1233035.0]],
'BTC/USDT': [[0.0, 0.004, 0.0], 'BTC/USDT': [[0.0, 0.004, 0.0],
[50000.0, 0.005, 50.0], [50000.0, 0.005, 50.0],
[250000.0, 0.01, 1300.0], [250000.0, 0.01, 1300.0],
[1000000.0, 0.025, 16300.000000000002], [1000000.0, 0.025, 16300.0],
[5000000.0, 0.05, 141300.0], [5000000.0, 0.05, 141300.0],
[20000000.0, 0.1, 1141300.0], [20000000.0, 0.1, 1141300.0],
[50000000.0, 0.125, 2391300.0], [50000000.0, 0.125, 2391300.0],
@ -437,4 +437,5 @@ def test_get_maintenance_ratio_and_amt_binance(
[300000000.0, 0.5, 99891300.0] [300000000.0, 0.5, 99891300.0]
] ]
} }
assert exchange.get_maintenance_ratio_and_amt(pair, nominal_value) == (mm_ratio, amt) (result_ratio, result_amt) = exchange.get_maintenance_ratio_and_amt(pair, nominal_value)
assert (round(result_ratio, 8), round(result_amt, 8)) == (mm_ratio, amt)