for params in read_parameters_input_file.itertuples():
timings = params.Time
timing = timings
base_price = params.Base_price
stop_loss_pr = params.Stop_loss
def run_code(timing, base_price, stop_loss_pr):
ltp_data = kite_connection()
b120(timing, ltp_data, base_price, stop_loss_pr)
schedule.every().day.at(timings).do(run_code(timing, base_price, stop_loss_pr))
while True:
schedule.run_pending()
time.sleep(1)
In run_code function there I'm calling two functions, that's why in run-code arguments have values, which is using in b120 function. I have this code and when I'm running my code I get an error - the first argument must be callable. I don't know what am I doing wrong here. Please help me.
CodePudding user response:
schedule needs to create a partial and thus needs a "bare" function. However the module does enable you to pass arguments to the function as per the documentation. So you should be able to do this;
schedule.every().day.at(timings).do(run_code, timing=timing, base_price=base_price, stop_loss_pr=stop_loss_pr))

