Learn Algo Trading with Python | Codes | Youtube Series

Hi @CBrid

For issues related to chart variable, or error: AttributeError: ‘NoneType’ object has no attribute ‘iloc’

Explanation of error:
This means in line no 15, the value of the chart was not received from the api
and now when on line no 16 we try to make rsi on it… it gives us error that on None type data … it cannot subscribe to close column

Solution:

you need to check if the data is correctly received,
chart dataframe should Not be None
if this is not the case so continue and restart the loop, from the last stock

code to be added



while True:
	for stock_name in watchlist:
		print(stock_name)

		chart = tsl.get_intraday_data(stock_name, 'NSE', 1)

		if chart is None:
			continue

		chart['rsi'] = talib.RSI(chart['close'], timeperiod=14) #pandas

		bc   = chart.iloc[-2] #pandas  breakout candle
		ic   = chart.iloc[-3] #pandas  inside candle
		ba_c = chart.iloc[-4] #pandas  base candle


Try it and… also let me know if any confusion

1 Like