We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f77786e commit c386893Copy full SHA for c386893
backtesting/test/_test.py
@@ -278,9 +278,16 @@ def test_compute_stats(self):
278
'Win Rate [%]': 46.96969696969697,
279
'Worst Trade [%]': -18.39887353835481,
280
})
281
+
282
+ def almost_equal(a, b):
283
+ try:
284
+ return np.isclose(a, b, rtol=1.e-8)
285
+ except TypeError:
286
+ return a == b
287
288
diff = {key: print(key) or value
289
for key, value in stats.filter(regex='^[^_]').items()
- if value != expected[key]}
290
+ if not almost_equal(value, expected[key])}
291
self.assertDictEqual(diff, {})
292
293
self.assertSequenceEqual(
0 commit comments