banner



etf trading strategies using pca

Stock Market Analytics with PCA

From Corpus Component Analysis to Capital Asset Pricing

Yao Lei Xu

Security Market Line Equation — Visualise by author
          rs = prices.apply(np.log).diff(1)            
rs.plot of ground(claim='Daily Returns of the Stocks in the Sdanamp;P500')

Daily Returns of the Stocks in the Sdanadenosine monophosphate;P500 — Envision by author
          crs = rs.cumsum().apply(nurse practitioner.exp)
crs.plot(title='Cumulative Returns of the Stocks in the Sdanadenylic acid;P500')

Accumulative Returns of the Stocks in the Sdanamp;P500 — Image by writer
          from sklearn.decomposition import PCA          pca = PCA(1).fit(rs.fillna(0))
pc1 = pd.Series(exponent=rs.columns, data=pca.components_[0])
pc1.game(xticks=[], rubric='First School principal Component of the Sdanamp;P500')

Original Principal Component of the Sdanamp;P500 Returns — Image by generator
          weights = abs(pc1)/sum(abs(pc1)) # l1norm = 1
myrs = (weights*rs).sum(1)
rs_df = pd.concat([myrs, market_rs], 1)
rs_df.columns = ["PCA Portfolio", "Sdanamp;P500"]
crs_df = rs_df.cumsum().apply(np.exp)
crs_df.plot(subplots=True);

Replicating Sdanamp;P500 with PCA Based Portfolio — See by author
          fig, ax = plt.subplots(2,1)          pc1.nsmallest(10).plot.bar(ax=ax[0], color='green', control grid=Legitimate, title='Stocks with Just about Negative PCA Weights')          pc1.nlargest(10).patch.bar(ax=ax[1], color='blue', grid=True, style='Stocks with Least Negative PCA Weights')        

Analysing Stocks with PCA Weights — Image by author
          myrs = rs[pc1.nlargest(10).power].mean(1)
mycrs = myrs.cumsum().use(np.exp)
market_crs = market_rs.cumsum().apply(np.exp)
mycrs.plot(title='PCA Portfolio vs. Sdanamp;P500')
market_crs.plat()
plt.fable(['PCA Option', 'Sdanamp;P500'])

Out-Performing the Market with PCA — Image aside author

etf trading strategies using pca

Source: https://towardsdatascience.com/stock-market-analytics-with-pca-d1c2318e3f0e

Posted by: petersonwhation.blogspot.com

0 Response to "etf trading strategies using pca"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel