Ejemplo n.º 1
0
def test_bah(S):
    """ Fees for BAH should be equal to 1 * fee. """
    FEE = 0.01
    result = algos.BAH().run(S)
    wealth_no_fees = result.total_wealth
    result.fee = FEE
    wealth_with_fees = result.total_wealth

    assert abs(wealth_no_fees * (1 - FEE) - wealth_with_fees) < EPS
Ejemplo n.º 2
0
    def AlgResult(self, ag):

        if ag == 'OLMAR':
            algo = algos.OLMAR(window=5, eps=10)
        if ag == 'CRP':
            algo = algos.CRP()
        if ag == 'BAH':
            algo = algos.BAH()
        if ag == 'Anticor':
            algo = algos.Anticor(window=5)
        if ag == 'CORN':
            algo = algos.CORN(window=5)
        if ag == 'BCRP':
            algo = algos.BCRP()
        if ag == 'CWMR':
            algo = algos.CWMR(eps=10)
        if ag == 'PAMR':
            algo = algos.PAMR(eps=10)
        if ag == 'RMR':
            algo = algos.RMR(window=5, eps=10)
        if ag == 'UP':
            algo = algos.UP()
        if ag == 'WMAMR':
            algo = algos.WMAMR(window=5)
        if ag == 'ONS':
            algo = algos.ONS()
        if ag == 'Kelly':
            algo = algos.Kelly(window=5)
        if ag == 'EG':
            algo = algos.EG()
        if ag == 'BNN':
            algo = algos.BNN()
        if ag == 'BestSoFar':
            algo = algos.BestSoFar()
        if ag == 'BestMarkowitz':
            algo = algos.BestMarkowitz()

        result = algo.run(self.data)
        return result
Ejemplo n.º 3
0
# plot normalized prices of the test set
#ax2 = (test / test.iloc[0,:]).plot()
#(test_b / test_b.iloc[0,:]).plot(ax=ax2)
(test / test.iloc[0, :]).plot()

# # Comparing the Algorithms

# We want to train on market data from a number of years, and test out of sample for a duration smaller than the train set. To get started we accept the default parameters for the respective algorithms and we essentially are just looking at two independent time periods.  In the future we will want to optimize the paramaters on the train set.

# In[ ]:

#list all the algos
olps_algos = [
    algos.Anticor(),
    algos.BAH(),
    algos.BCRP(),
    algos.BNN(),
    algos.CORN(),
    algos.CRP(
        b=swensen_allocation),  # Non Uniform CRP (the Swensen allocation)
    algos.CWMR(),
    algos.EG(),
    algos.Kelly(),
    algos.OLMAR(),
    algos.ONS(),
    algos.PAMR(),
    algos.RMR(),
    algos.UP()
]