def test_limit_price_sigmoid(self): """ Test successful execution of 'limit_price_sigmoid' function. """ t_pos_sig, pos_sig, f_sig, w_sig, max_pos_sig = 124, 112, 165.50, 8.44, 150 sum_inv_price_sig = sum([ inv_price_sigmoid(f_sig, w_sig, j / float(max_pos_sig)) for j in range(abs(pos_sig + np.sign(t_pos_sig - pos_sig)), abs(t_pos_sig + 1)) ]) limit_p_sig = (1 / abs(t_pos_sig - pos_sig)) * sum_inv_price_sig self.assertAlmostEqual( limit_p_sig, limit_price_sigmoid(t_pos_sig, pos_sig, f_sig, w_sig, max_pos_sig), 7)
def test_limit_price_sigmoid_return_nan(self): """ Tests for the successful return of np.nan in the case that the target position is the same as the current position. """ self.assertTrue(np.isnan(limit_price_sigmoid(1, 1, 123, 21, 234)))