Example #1
0
def test_sample_evaluations_with_moving_average(sample_data):
    sample_line = "moving_average(high, 5) > close"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
    assert result.any()
Example #2
0
def test_evaluation_with_and(sample_data):
    sample_line = "(year == 2019) & (year == 2019)"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
    assert result.all()
Example #3
0
def test_sample_evaluations_with_functions(sample_data):
    sample_line = "highest(high, 5) == 0"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
    assert ~result.any()
Example #4
0
def test_sample_line_evaluations_with_mul(sample_data):
    sample_line = "high * 0 == 0"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
    assert result.all()
Example #5
0
def test_sample_line_evaluations_equality_when_same_shift(sample_data):
    sample_line = "high[5] == high[5]"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
    assert result.iloc[5:].all()
Example #6
0
def test_sample_line_evaluations_with_shift(sample_data):
    sample_line = "high > open[5]"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)
Example #7
0
def test_sample_line_evaluations(sample_data):
    sample_line = "close > open"
    result = evaluate_line(sample_data, sample_line)
    assert isinstance(result, pd.Series)