@abhishek.anand @krispy have you tried to specify which asset should be sold / closed? In the code i see:

self.buy() instead self.buy(data=d) self.close() instead self.close(data=d)

Let me know if works better.