Closed nichmetsa closed 4 years ago
Hi @nichmetsa, I just ran those lines in a jupyter notebook, and the plot looks ok on my end.
Looking at the plot you copied here, I don't think it is inverted. It looks like something went wrong with the dates there. The lines (with buy/sell signals) on the left are where they should be (according to the x-axis), but it looks like the lines of the moving averages are displaced to the right by 2000 years.
Unfortunately I cannot say more than this, as I can't reproduce it.
When running this code, that was extracted from the examples of the documentation, the plot seems to be inverted and since i simply copied/pasted the code i really dont know what would go wrong. ``#%% from finquant.portfolio import build_portfolio names = ['GOOG', 'AMZN', 'MCD', 'DIS'] pf = build_portfolio(names=names, data_api="yfinance") from finquant.moving_average import compute_ma, ema
get stock data for Disney
dis = pf.get_stock("DIS").data.copy(deep=True) spans = [10, 50, 100, 150]
computing and visualising a band of moving averages
ma = compute_ma(dis, ema, spans, plot=True) print(ma.tail())`![plot](https://user-images.githubusercontent.com/66751518/88179023-a4321280-cc01-11ea-8690-23b4275e5f8c.png)
`