197a7f917dfc540b59f6f1b5c397c89c05436eb9,tests/test_backtest.py,,test_Results_helper_functions_fi,#,164

Before Change


    // algo to set the weights
    //  it will only run when runMonthlyAlgo returns true
    //  which only happens on the first of every month
    weights = pd.Series([0.6, 0.4], index=rdf.columns)
    weighSpecifiedAlgo = bt.algos.WeighSpecified(**weights)

    // algo to rebalance the current weights to weights set by weighSpecified
    //  will only run when weighSpecifiedAlgo returns true

After Change


        progress_bar=False,
        additional_data = {"mydata":pdf}
    )
    bidoffer = 1.
    backtest2 = bt.Backtest(
        strat,
        pdf,
        initial_capital = 0,
        integer_positions=False,
        progress_bar=False,
        additional_data = {"mydata":pdf, 
                           "bidoffer": pd.DataFrame( bidoffer, pdf.index, pdf.columns )}
    )
    random.seed(1234)
    res = bt.run(backtest)
    random.seed(1234)
    res2 = bt.run(backtest2)

    assert(type(res.get_security_weights()) is pd.DataFrame)

    assert (type(res.get_transactions()) is pd.DataFrame)
    assert len(res.get_transactions()) > 0

    assert (type(res.get_weights()) is pd.DataFrame)

    // Make sure the insertion of the first row applies to additional data as well
    assert backtest.data.index.equals( backtest.additional_data["mydata"].index )

    // Check that bid/offer is accounted for
    transactions = res.get_transactions()        
    transactions["price"] = transactions["price"] + 0.5 * bidoffer
    assert (res2.get_transactions().price - res2.get_transactions().price).abs().sum() == 0
        
        
def test_30_min_data():
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: pmorissette/bt
Commit Name: 197a7f917dfc540b59f6f1b5c397c89c05436eb9
Time: 2020-11-05
Author: pascal.i.tomecek@jpmorgan.com
File Name: tests/test_backtest.py
Class Name:
Method Name: test_Results_helper_functions_fi


Project Name: galeone/dynamic-training-bench
Commit Name: 50914556832ada0004e55f004eed2b44f448cac6
Time: 2016-10-25
Author: nessuno@nerdz.eu
File Name: train_fixed_dropout.py
Class Name:
Method Name: train


Project Name: tensorflow/tensorboard
Commit Name: 17ba11f67dae7b1fba8d7fb6de65472d328847ff
Time: 2016-04-01
Author: danmane@gmail.com
File Name: scripts/generate_testdata.py
Class Name:
Method Name: WriteImageSeries