jealous / stockstats

Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.
Other
1.29k stars 299 forks source link

Invalid number of return arguments after parsing column name: 'mdi' : stockstats 0.6.0 #162

Closed laurentvv closed 1 year ago

laurentvv commented 1 year ago

My script don't work after upgrade to stockstats 0.6.0

` import yfinance as yf import pandas as pd from stockstats import StockDataFrame

ticker = "O" start = "2022-01-01" end = "2023-06-19"

df = yf.download(ticker, start, end) stock_df = StockDataFrame.retype(df)

stock_df = stock_df[ [ "open", "high", "low", "close", "adj close", "volume", "rsi", "macd", "stochrsi", "vwma", "close_200_ema", "close_100_ema", "close_30_ema", "close_10_ema", "vr", "wr", "supertrend", "dma", "pdi", "mdi", "chop", "mfi", ] ]

print(stock_df)

`

raise UserWarning("Invalid number of return arguments " UserWarning: Invalid number of return arguments after parsing column name: 'mdi'

Downgrade to stockstats-0.5.4 : it's working.

jealous commented 1 year ago

Please replace mdi with ndi. n stands for negative.

laurentvv commented 1 year ago

Does it correspond to the same value as mdi or do I have to regenerate all my values using ndi ?

jealous commented 1 year ago

Yes, it's the same.

laurentvv commented 1 year ago

I tested for yesterday's quote, I do not have the same value. stockstats-0.5.4 - mdi : 21,9476930314154 stockstats 0.6.0 - ndi : 22,8012709491946

jealous commented 1 year ago

Sorry, you are right. I just checked the test file's change. The value are different.

ndi is calculated from ndm (Negative directional movement). I used to smooth it with ema. But I searched some documents: https://www.investopedia.com/terms/d/dmi.asp It says I should use smoothed moving average. So I change the function from ema to smma.

laurentvv commented 1 year ago

I redid my column with the new ndi values