Closed balioglum closed 2 years ago
@balioglum,
Thank you! That's much more useful.
Sounds like a potential rounding issue.
Have you tried scaling the price, apply ta, and descale like:
import pandas as pd
import pandas_ta as ta
import yfinance as yf
scale = 1000 # Or whatever works best
_df = yf.download(tickers='SHIB-USD', start="2022-01-01", end="2022-03-30")
df = scale * _df.copy()
df.ta.fisher(append=True)
df /= scale
df.tail(5)
Unfortunately I do not have a time frame to address this, but I'll take another look at it when I get to converting it to numpy/numba. If you have a solution and would like to contribute, that would be great! 😎
Kind Regards, KJ
Thank you Kevin.
@balioglum
Did you try the scaling code I posted in the last comment?
Hi Kevin,
Scaling and descaling seems to be working. I've been using python-binance api and need to scale/descale only high, low and close values only.
klines = client.get_historical_klines("SHIBUSDT", Client.KLINE_INTERVAL_1DAY, "1 Jan, 2022")
data_df = pd.DataFrame(klines, columns=['timestamp', 'open', 'high', 'low', 'close',
'volume', 'close_time', 'quote_av', 'trades', 'tb_base_av', 'tb_quote_av', 'ignore'])
scale = 10000
data_df['high'] = data_df['high'].astype(float) * scale
data_df['low'] = data_df['low'].astype(float) * scale
data_df['close'] = data_df['close'].astype(float) * scale
data_df.ta.fisher(append=True)
data_df['close'] /= scale
data_df['high'] /= scale
data_df['low'] /= scale
Thanks again for your help. I've learned the /=
operator by the way as a bonus!
Hi @balioglum,
Scaling and descaling seems to be working.
Excellent!
... need to scale/descale only high, low and close values only.
True. Also you can consolidate the code a bit:
scale = 10000
ohlc = ['open', 'high', 'low', 'close']
data_df = # ohlcv et al
df = scale * data_df[ohlc].astype(float)
df.ta.fisher(append=True)
df /= scale
# then rejoin the DataFrames data_df, df
Thanks again for your help. I've learned the
/=
operator by the way as a bonus!
You're welcome! 😎
Which version are you running? The lastest version is on Github. Pip is for major releases.
Do you have TA Lib also installed in your environment?
Did you upgrade? Did the upgrade resolve the issue?
Upgrade did not resolve.
Describe the bug Fisher Transform does not produce correct results for cryptos which have multiple zeros after the decimal point. Some of these are:
['HOTUSDT','SHIBUSDT','XECUSDT','IOTXUSDT','JSTUSDT','WINUSDT','TROYUSDT','SUNUSDT','FUNUSDT','DENTUSDT','AKROUSDT','SPELLUSDT','SCUSDT','MFTUSDT','SKLUSDT','STPTUSDT','CKBUSDT']
To Reproduce
Expected behavior For some cryptocoins listed in Binance, pandas-ta Fisher transform indicator does not produce correct results. The common characteristic of these coins are that they have little multiple zeros after decimal point of their prices. For example, the close price of SHIBUST as of now is : 0.00002548
Thanks.