fmilthaler / FinQuant

A program for financial portfolio management, analysis and optimisation.
MIT License
1.38k stars 190 forks source link

Inverted Axis when plotting #61

Closed nichmetsa closed 4 years ago

nichmetsa commented 4 years ago

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

`

fmilthaler commented 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.