Exemplo n.º 1
0
    def getData(self, tickers) :
        settings = Settings()
        dp = TimeSeries(settings).get_agg_ETF_data(tickers)
        dp = dp.fillna(method='pad', axis=0)
        dp = dp.fillna(method='bfill', axis=0)
        dp = dp.dropna()

        dp = dp.reindex_axis(['open', 'high', 'low', 'close', 'volume', 'price'], axis=2)
        return dp
Exemplo n.º 2
0
           #'GOOG/NYSE_VNQ', # Vanguard MSCI US Reits
           'GOOG/NYSE_IYR', # iShares U.S. Real Estate ETF
           'GOOG/NYSE_RWX', # SPDR DJ Wilshire Intl Real Estate ETF

           'GOOG/NYSEARCA_TLT',  # 20 Years Treasury ETF
           'GOOG/NYSEARCA_TLH',  # 15-20 Years Treasury

           'GOOG/AMEX_GSG', # GSCI Commodity-Indexed Trust Fund
           'GOOG/NYSEARCA_GLD'  # SPDR Gold ETF

          ]

settings = Settings()
dp = TimeSeries(settings).get_agg_data(tickers)
dp = dp.fillna(method='pad', axis=0)
dp = dp.fillna(method='bfill', axis=0)
dp = dp[:,:,:]
dp[:, :,'price'].plot(figsize=[20,10])
df_rets = dp[:,:,'price'].pct_change().dropna()










Exemplo n.º 3
0
    sector_tickers = [
        'GOOG/NYSEARCA_XLB', 'GOOG/NYSEARCA_XLE', 'GOOG/NYSEARCA_XLF',
        'GOOG/NYSEARCA_XLI', 'GOOG/NYSEARCA_XLK', 'GOOG/NYSEARCA_XLP',
        'GOOG/NYSEARCA_XLU', 'GOOG/NYSEARCA_XLV', 'GOOG/NYSEARCA_XLY'
    ]

    bm_tickers = [
        'GOOG/NYSE_SPY',
        'GOOG/NYSEARCA_TLT',
        'GOOG/NYSEARCA_GLD'  #gold
    ]

    settings = Settings()
    dp = TimeSeries(settings).get_agg_data(sector_tickers + bm_tickers)
    dp = dp.fillna(method='pad', axis=0)
    dp = dp.fillna(method='bfill', axis=0)
    dp = dp[:, '2000-01-01'::, :]
    dp = dp.dropna()

    rets = pd.DataFrame()
    rets[1] = Momentum_Sector_Rotation(dp).run_trading().portfolio_value
    #rets[1] = Portfolio1(dp).run_trading().portfolio_value
    #rets[2] = Portfolio2(dp).run_trading().portfolio_value
    # rets[3] = Portfolio3(dp).run_trading().portfolio_value
    # rets[4] = Portfolio4(dp).run_trading().portfolio_value
    # rets[5] = Portfolio5(dp).run_trading().portfolio_value
    #
    # rets[6] = Portfolio6(dp).run_trading().portfolio_value
    # rets[7] = Momentum(dp).run_trading().portfolio_vlaue
    rets.plot(figsize=[20, 12])