Wright code for signal generator based on this signal generator code: def getminutedata(symbol, interval, lookback):
frame = pd.DataFrame(client.get_historical_klines(symbol, interval, lookback+‘min ago UTC’))
frame = frame.iloc[:60,:6]
frame.columns = [‘Time’,‘Open’,‘High’,‘Low’,‘Close’,‘Volume’]
frame = frame.set_index(‘Time’)
today = dt.date.today()
frame.index = pd.to_datetime(frame.index, unit=‘ms’).tz_localize(‘UTC’).tz_convert(‘Etc/GMT+3’).strftime(f"{today} %H:%M:%S")
frame = frame.astype(float)
return frame

df = getminutedata(‘BTCUSDT’, ‘1m’, ‘44640’)

def signal_generator(df):
open = df.Open.iloc[-1]
close = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]

#Bearish pattern
if (open>close and
previous_open<previous_close and
close<previous_open and
open>=previous_close):
return ‘sell’

#Bullish pattern
elif (open<close and
previous_open>previous_close and
close>previous_open and
open<=previous_close):
return ‘buy’

#No clear pattern
else:
return ‘’
signal = [“” for i in range(len(df))] # initialize signal as a list of empty strings
for i in range(1, len(df)):
df_temp = df[i-1:i+1]
signal[i] = signal_generator(df_temp)
df[“signal”] = signal