Ejemplo n.º 1
0
def test_regression():
    """Check regression"""
    simulated_market_data = simulated_market_data_4_years_gen()
    simulated_market_data["signal"] = simulated_market_data["close"].shift(-1)
    price_prediction_from_signal = PricePredictionFromSignalRegression()
    out = price_prediction_from_signal.fit_transform(simulated_market_data)
    assert isinstance(out, pd.DataFrame)
Ejemplo n.º 2
0
def test_pipeline_signal_to_position():
    """Checks we can use a signal in conjunction with a rule to calculate a position."""
    signal_to_positions = make_pipeline(
        scikit_signal_factory(normalised_close,), PricePredictionFromSignalRegression(), PositionsFromPricePrediction()
    )
    df = signal_to_positions.fit_transform(simulated_market_data_4_years_gen())
    assert isinstance(df, pd.DataFrame)
Ejemplo n.º 3
0
def test_readme_example_four():
    """Get price prediction and positions from an external signal transformer"""
    adapted_aroon = ta_adaptor(AroonIndicator, "aroon_down", window=1)
    pipeline = make_pipeline(
        scikit_signal_factory(adapted_aroon), PricePredictionFromSignalRegression(), PositionsFromPricePrediction()
    )
    pipeline.fit_transform(simulated_market_data_4_years_gen())
Ejemplo n.º 4
0
def test_readme_example_three():
    """Get price prediction and positions from a signal transformer"""
    pipeline = make_pipeline(
        scikit_signal_factory(normalised_close), PricePredictionFromSignalRegression(), PositionsFromPricePrediction()
    )

    pipeline.fit_transform(simulated_market_data_4_years_gen())