OpenBBTerminal icon indicating copy to clipboard operation
OpenBBTerminal copied to clipboard

[IMPROVE] Regplot of 2 Stocks

Open alice-comfy opened this issue 8 months ago • 2 comments

What's the feature that should be improved? Regplot (through seaborn) of the daily % change (or any period) of 2 given stocks. Example I have below is PDD & kweb, this is implemented on Bloomberg & some other pro platforms & is extremely trivial to implement given OpenBB's stack.

I'm thinking this should go under stocks.qa?

My current toy implemntation works like so. index['kweb'] = kweb['Close'] (both DFs obtained from openbb.stocks.load). index['pdd'] = pdd['Close'] chg = index.copy() for col in chg.columns: chg[col] = chg[col].pct_change(1)

sb.regplot(x=chg['pdd'], y=chg['kweb'])

Describe how you would like the feature improved Produces a plot like so of PDD & KWEB image

Possibly describe the ideal way to improve this Can turn price series into % change series by using df.pct_change(1), may be some value in letting the 1 be replacable.

I am reading through the contribution guide as we speak in terms of implementing this. Can write the code myself. Would appreciate any input in terms of inputs (such as number of days, startdate) that might be useful to this function.

alice-comfy avatar Oct 16 '23 21:10 alice-comfy