Fetch and cancel all GTT orders

Can you please share the example code to fetch all the FNO GTT orders and cancel them.
Background : I want to cancel all open orders by 3:15pm first and exit all positions.