|
|
|
|
@ -1183,7 +1183,7 @@ def test_calc_profit(
|
|
|
|
|
assert pytest.approx(val) == profit_res.profit_abs
|
|
|
|
|
|
|
|
|
|
assert pytest.approx(profit_res.total_profit) == round(profit, 8)
|
|
|
|
|
# assert pytest.approx(profit_res.total_profit_ratio) == round(profit_ratio, 8)
|
|
|
|
|
assert pytest.approx(profit_res.total_profit_ratio) == round(profit_ratio, 8)
|
|
|
|
|
|
|
|
|
|
assert pytest.approx(trade.calc_profit(rate=close_rate)) == round(profit, 8)
|
|
|
|
|
assert pytest.approx(trade.calc_profit_ratio(rate=close_rate)) == round(profit_ratio, 8)
|
|
|
|
|
@ -1193,7 +1193,7 @@ def test_calc_profit(
|
|
|
|
|
assert pytest.approx(profit_res2.profit_ratio) == round(profit_ratio, 8)
|
|
|
|
|
|
|
|
|
|
assert pytest.approx(profit_res2.total_profit) == round(profit, 8)
|
|
|
|
|
# assert pytest.approx(profit_res2.total_profit_ratio) == round(profit_ratio, 8)
|
|
|
|
|
assert pytest.approx(profit_res2.total_profit_ratio) == round(profit_ratio, 8)
|
|
|
|
|
|
|
|
|
|
assert pytest.approx(trade.calc_profit(close_rate, trade.amount, trade.open_rate)) == round(
|
|
|
|
|
profit, 8
|
|
|
|
|
|