Is there a function to check the current open trades? If there is a current ongoing trade, then I would like to either skip opening a new trade, or cancel the trade and open a new one.

I also couldn't find a function to cancel ongoing trades at market price. So far I can only find stop or profit target, which are not what I am looking for.